diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Wizcommon.pm | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/common/Wizcommon.pm b/common/Wizcommon.pm index edbbbf3f..4cf9eadf 100644 --- a/common/Wizcommon.pm +++ b/common/Wizcommon.pm @@ -27,7 +27,7 @@ use MDK::Common; use MDK::Wizard::IFCFG; our @ISA = qw(Exporter); -our @EXPORT = qw(check_started run_command_and_log test_host_domain); +our @EXPORT = qw(check_started run_command_and_log test_host_domain wizard_progress_bar); my $net; @@ -63,6 +63,41 @@ sub test_host_domain { } +sub wizard_progress_bar { + use lib qw(/usr/lib/libDrakX); + use ugtk2 qw(:wrappers); + my ($command, $descr) = @_; + my ($value, $timer); + my $my_win = ugtk2->new(""); + my $window1 = $my_win->{window}; + gtkadd($window1, + gtkpack(Gtk2::VBox->new(0,0), + gtkpack_(Gtk2::VBox->new(0, 3), + 0, my $text = Gtk2::Label->new($descr), + 0, my $text2 = Gtk2::Label->new(), + 0, Gtk2::HSeparator->new, + 0, my $pbar = Gtk2::ProgressBar->new, + ), + ), + ); + $window1->realize; + $pbar->set_pulse_step(0.1); + + open(TMP, "$command 2>&1 |"); + while ($value = <TMP>) { + $timer = Glib::Timeout->add(10, sub {}); + $pbar->pulse; + $text2->set_text($value); + gtkflush(); + next; + $my_win->main; + $window1->show_all; + undef $value; + } + close TMP; + $my_win->destroy; +} + my $timeout; sub gtktext_get_log { |