From 0db70dfc4c691bfc097027d6dbf05c94d83f0f77 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 18 Aug 2002 22:36:43 +0000 Subject: [PATCH] Provide progress bar svn: r1119 --- gramps/src/plugins/ReadNative.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/gramps/src/plugins/ReadNative.py b/gramps/src/plugins/ReadNative.py index 7e6b44ef6..820ecb14e 100644 --- a/gramps/src/plugins/ReadNative.py +++ b/gramps/src/plugins/ReadNative.py @@ -28,14 +28,6 @@ import const _ = intl.gettext -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- -def progress(val): - pass - #------------------------------------------------------------------------- # # @@ -60,6 +52,17 @@ class ReadNative: self.top.cancel_button.connect_object('clicked', Utils.destroy_passed_object,self.top) self.top.show() + def show_display(self): + self.window = gtk.GtkWindow(title=_("Import from GRAMPS")) + vbox = gtk.GtkVBox() + self.window.add(vbox) + label = gtk.GtkLabel(_("Import from GRAMPS")) + vbox.add(label) + adj = gtk.GtkAdjustment(lower=0,upper=100) + self.progress_bar = gtk.GtkProgressBar(adj) + vbox.add(self.progress_bar) + self.window.show_all() + def on_ok_clicked(self,obj): name = self.top.get_filename() @@ -68,13 +71,20 @@ class ReadNative: name = "%s/%s" % (name,const.xmlFile) Utils.destroy_passed_object(self.top) + self.show_display() try: - importData(self.db,name,progress) + importData(self.db,name,self.progress) except: import DisplayTrace DisplayTrace.DisplayTrace() + self.window.destroy() self.callback(1) + def progress(self,val): + self.progress_bar.set_value(val*100.0) + while gtk.events_pending(): + gtk.mainiteration() + #------------------------------------------------------------------------ # #