From 428d4210960f545ea3051392aa8de2cfe651339e Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 15 Dec 2005 23:48:06 +0000 Subject: [PATCH] * src/ViewManger.py: progress bar added back in * src/ReadXML.py: handle markers svn: r5560 --- gramps2/ChangeLog | 2 ++ gramps2/src/ReadXML.py | 26 +++++++++++++++++--------- gramps2/src/ViewManager.py | 22 +++++++++++++++++++--- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index bc446d8e8..abe8262c6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,5 +1,7 @@ 2005-12-15 Don Allingham * src/DisplayState.py: Window management completed + * src/ViewManger.py: progress bar added back in + * src/ReadXML.py: handle markers 2005-12-15 Alex Roitman * src/GrampsBSDDB.py: go back to a single load function; diff --git a/gramps2/src/ReadXML.py b/gramps2/src/ReadXML.py index 8ef3b7c28..9a3da0431 100644 --- a/gramps2/src/ReadXML.py +++ b/gramps2/src/ReadXML.py @@ -281,7 +281,7 @@ class GrampsParser: self.callback = callback self.count = 0 - self.increment = 500 + self.increment = 100 self.event = None self.name = None self.tempDefault = None @@ -732,6 +732,7 @@ class GrampsParser: def start_person(self,attrs): if self.callback != None and self.count % self.increment == 0: self.callback(True) + self.count += 1 new_id = self.map_gid(attrs['id']) try: self.person = self.db.find_person_from_handle( @@ -740,10 +741,12 @@ class GrampsParser: except KeyError: self.person = self.find_person_by_gramps_id(new_id) - try: - self.person.set_complete_flag(int(attrs['complete'])) - except KeyError: - self.person.set_complete_flag(0) + if attrs.has_key('complete'): + try: + if int(attrs['complete']): + self.person.set_marker((RelLib.PrimaryObject.MARKER_COMPLETE, "")) + except KeyError: + pass def start_people(self,attrs): if attrs.has_key('home'): @@ -815,10 +818,12 @@ class GrampsParser: else: self.family.set_relationship((ftype,"")) - if attrs.has_key("complete"): - self.family.set_complete_flag(int(attrs['complete'])) - else: - self.family.set_complete_flag(0) + if attrs.has_key('complete'): + try: + if int(attrs['complete']): + self.family.set_marker((RelLib.PrimaryObject.MARKER_COMPLETE, "")) + except KeyError: + pass def start_childof(self,attrs): try: @@ -922,6 +927,9 @@ class GrampsParser: self.person.add_source_reference(self.source_ref) def start_source(self,attrs): + if self.callback != None and self.count % self.increment == 0: + self.callback(True) + self.count += 1 handle = self.map_sid(attrs["id"]) try: self.source = self.db.find_source_from_handle( diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index 4ab83b5c1..5b82fe742 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -175,9 +175,11 @@ class ViewManager: self.bbox = gtk.VBox() self.ebox.add(self.bbox) hbox.pack_start(self.ebox,False) + hbox.show_all() self.notebook = gtk.Notebook() self.notebook.set_show_tabs(False) + self.notebook.show() self.build_ui_manager() hbox.pack_start(self.notebook,True) @@ -186,7 +188,16 @@ class ViewManager: vbox.pack_start(self.menubar, False) vbox.pack_start(self.toolbar, False) vbox.add(hbox) - vbox.pack_end(self.statusbar,False) + self.progress = gtk.ProgressBar() + self.progress.set_size_request(100,-1) + self.progress.hide() + self.statusbar.show() + hbox2 = gtk.HBox() + hbox2.pack_start(self.progress,False) + hbox2.pack_end(self.statusbar,True) + hbox2.show() + vbox.pack_end(hbox2,False) + vbox.show() self.notebook.connect('switch-page',self.change_page) self.uistate = DisplayState.DisplayState(self.window, self.statusbar, @@ -194,7 +205,7 @@ class ViewManager: person_nav = Navigation.PersonNavigation(self.uistate) self.navigation_type[PageView.NAVIGATION_PERSON] = (person_nav,None) - self.window.show_all() + self.window.show() def init_interface(self): self.create_pages() @@ -708,6 +719,9 @@ class ViewManager: import ScratchPad ScratchPad.ScratchPadWindow(self.state, self) + def pulse_progressbar(self,value): + self.progress.pulse() + def import_data(self,obj): choose = gtk.FileChooserDialog(_('GRAMPS: Import database'), self.uistate.window, @@ -773,7 +787,9 @@ class ViewManager: elif filetype == const.app_gramps_xml: choose.destroy() import ReadXML - ReadXML.importData(self.state.db,filename) + self.progress.show() + ReadXML.importData(self.state.db,filename,self.pulse_progressbar) + self.progress.hide() return True elif filetype == const.app_gedcom: choose.destroy()