summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-07-04 08:13:09 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-07-04 08:13:09 +0000
commit590cf32515eca733c2ae6224ff4e6df9caedc70a (patch)
tree9faf82dce16d95f70bfd8eb98151dcf56f93d35b
parent14d5e54eb23b873696ed775d61e9970796fd54c9 (diff)
downloaddrakwizard-590cf32515eca733c2ae6224ff4e6df9caedc70a.tar
drakwizard-590cf32515eca733c2ae6224ff4e6df9caedc70a.tar.gz
drakwizard-590cf32515eca733c2ae6224ff4e6df9caedc70a.tar.bz2
drakwizard-590cf32515eca733c2ae6224ff4e6df9caedc70a.tar.xz
drakwizard-590cf32515eca733c2ae6224ff4e6df9caedc70a.zip
add a progress bar fonction
-rw-r--r--common/Wizcommon.pm37
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 {