From 7dfc3016a5e0882be883bd92dbcf398485d0273f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 25 Sep 2001 23:51:11 +0000 Subject: [PATCH] Export progress window svn: r430 --- gramps/src/plugins/WriteGedcom.py | 39 +++- gramps/src/plugins/gedcomexport.glade | 278 ++++++++++++++++++++++++++ 2 files changed, 314 insertions(+), 3 deletions(-) diff --git a/gramps/src/plugins/WriteGedcom.py b/gramps/src/plugins/WriteGedcom.py index 1325bb407..c3437f4bb 100644 --- a/gramps/src/plugins/WriteGedcom.py +++ b/gramps/src/plugins/WriteGedcom.py @@ -482,7 +482,7 @@ def write_person(g,person): # # #------------------------------------------------------------------------- -def exportData(database, filename): +def exportData(database, filename, pbar, fbar, sbar): g = open(filename,"w") @@ -520,9 +520,18 @@ def exportData(database, filename): g.write("1 PHON " + cnvtxt(owner.getPhone()) + "\n") people_list.sort(sortById) + nump = float(len(people_list)) + index = 0.0 for person in people_list: write_person(g,person) - + index = index + 1 + pbar.set_value((100*index)/nump) + while(events_pending()): + mainiteration() + pbar.set_value(100.0) + + nump = float(len(family_list)) + index = 0.0 for family in family_list: g.write("0 @F%s@ FAM\n" % family.getId()) person = family.getFather() @@ -555,7 +564,14 @@ def exportData(database, filename): for person in family.getChildList(): g.write("1 CHIL @I%s@\n" % person.getId()) + index = index + 1 + fbar.set_value((100*index)/nump) + while(events_pending()): + mainiteration() + fbar.set_value(100.0) + nump = float(len(source_list)) + index = 0.0 for source in source_list: g.write("0 @S%s@ SOUR\n" % source.getId()) if source.getTitle() != "": @@ -570,6 +586,11 @@ def exportData(database, filename): g.write("1 CALN %s\n" % cnvtxt(source.getCallNumber())) if source.getNote() != "": write_long_text(g,"NOTE",1,source.getNote()) + index = index + 1 + sbar.set_value((100*index)/nump) + while(events_pending()): + mainiteration() + sbar.set_value(100.0) g.write("0 TRLR\n") @@ -650,8 +671,20 @@ def on_ok_clicked(obj): name = topDialog.get_widget("filename").get_text() filter() - exportData(db,name) utils.destroy_passed_object(obj) + + base = os.path.dirname(__file__) + glade_file = base + os.sep + "gedcomexport.glade" + progress = GladeXML(glade_file,"exportprogress") + progress.signal_autoconnect({"on_close_clicked":utils.destroy_passed_object}) + fbar = progress.get_widget("fbar") + pbar = progress.get_widget("pbar") + sbar = progress.get_widget("sbar") + closebtn = progress.get_widget("close") + closebtn.connect("clicked",utils.destroy_passed_object) + closebtn.set_sensitive(0) + exportData(db,name,pbar,fbar,sbar) + closebtn.set_sensitive(1) #------------------------------------------------------------------------- # diff --git a/gramps/src/plugins/gedcomexport.glade b/gramps/src/plugins/gedcomexport.glade index 9c1469355..512951bbc 100644 --- a/gramps/src/plugins/gedcomexport.glade +++ b/gramps/src/plugins/gedcomexport.glade @@ -279,4 +279,282 @@ + + GnomeDialog + exportprogress + Export GEDCOM file + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox2 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + close + True + True + + clicked + on_close_clicked + exportprogress + Tue, 25 Sep 2001 23:46:20 GMT + + GNOME_STOCK_BUTTON_CLOSE + + + + + GtkVBox + vbox4 + False + 0 + + 0 + True + True + + + + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkHSeparator + hseparator2 + + 5 + False + True + + + + + GtkTable + table1 + 3 + 2 + False + 0 + 0 + + 0 + True + True + + + + GtkLabel + label4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 2 + 3 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 5 + 5 + False + False + False + False + True + False + + + + + GtkProgressBar + pbar + 0 + 0 + 100 + GTK_PROGRESS_CONTINUOUS + GTK_PROGRESS_LEFT_TO_RIGHT + False + False + %P %% + 0.5 + 0.5 + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + + + + GtkProgressBar + fbar + 0 + 0 + 100 + GTK_PROGRESS_CONTINUOUS + GTK_PROGRESS_LEFT_TO_RIGHT + False + False + %P %% + 0.5 + 0.5 + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + GtkProgressBar + sbar + 0 + 0 + 100 + GTK_PROGRESS_CONTINUOUS + GTK_PROGRESS_LEFT_TO_RIGHT + False + False + %P %% + 0.5 + 0.5 + + 1 + 2 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + + + +