From 447f9ea7f897ba3db7d6eaf8e7b48824ab543a60 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 2 Apr 2006 04:15:11 +0000 Subject: [PATCH] dbstate.active fixes svn: r6255 --- gramps2/ChangeLog | 11 +++++++ gramps2/autogen.sh | 2 +- gramps2/src/DisplayState.py | 5 +-- gramps2/src/Exporter.py | 2 +- gramps2/src/GrampsDb/_GrampsDbBase.py | 1 + gramps2/src/ManagedWindow.py | 6 +++- gramps2/src/PageView.py | 3 +- gramps2/src/PluginUtils/_ReportUtils.py | 4 +-- gramps2/src/RelLib/_DateBase.py | 42 ------------------------- gramps2/src/ViewManager.py | 4 +-- 10 files changed, 27 insertions(+), 53 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 5ad44ea80..4b5523909 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,14 @@ +2006-04-01 Don Allingham + * src/ViewManager.py: dbstate.active fixes + * src/GrampsDb/_GrampsDbBase.py: dbstate.active fixes + * src/Exporter.py: dbstate.active fixes + * src/RelLib/_DateBase.py: remove unused stuff + * src/DisplayState.py: Remove managed window + * src/PluginUtils/_ReportUtils.py: fix check + * src/PageView.py: dbstate.active fixes + * src/ManagedWindow.py: add assertions + * autogen.sh: require automake 1.9 + 2006-04-01 Brian Matherly * src/PluginUtils/_ReportUtils.py: remove use of deprecated functions * src/plugins/NavWebPage.py: various fixes - should work now diff --git a/gramps2/autogen.sh b/gramps2/autogen.sh index aa422e09b..d7956d13f 100755 --- a/gramps2/autogen.sh +++ b/gramps2/autogen.sh @@ -18,4 +18,4 @@ which gnome-autogen.sh || { echo "You need to install gnome-common package." exit 1 } -REQUIRED_AUTOMAKE_VERSION=1.6 USE_GNOME2_MACROS=1 . gnome-autogen.sh +REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh diff --git a/gramps2/src/DisplayState.py b/gramps2/src/DisplayState.py index 6f56865b2..ae239cf15 100644 --- a/gramps2/src/DisplayState.py +++ b/gramps2/src/DisplayState.py @@ -301,8 +301,9 @@ class DisplayState(GrampsDb.GrampsDBCallback): self.status.push(self.status_id,"") else: if Config.get_statusbar() <= 1: - pname = NameDisplay.displayer.display(self.dbstate.active) - name = "[%s] %s" % (self.dbstate.active.get_gramps_id(),pname) + person = self.dbstate.get_active_person() + pname = NameDisplay.displayer.display(person) + name = "[%s] %s" % (person.get_gramps_id(),pname) else: name = "" #self.display_relationship() self.status.push(self.status_id,name) diff --git a/gramps2/src/Exporter.py b/gramps2/src/Exporter.py index 9ee3c2d5a..82ff4db29 100644 --- a/gramps2/src/Exporter.py +++ b/gramps2/src/Exporter.py @@ -85,7 +85,7 @@ class Exporter: self.uistate = uistate self.callback = self.uistate.pulse_progressbar if self.dbstate.active: - self.person = self.dbstate.active + self.person = self.dbstate.get_active_person() else: self.person = self.dbstate.db.find_initial_person() diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index 9fc383b33..c62b49ff4 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -2048,6 +2048,7 @@ class DbState(GrampsDBCallback): self.change_active_person(self.db.get_person_from_handle(handle)) def get_active_person(self): + self.active = self.db.get_person_from_handle(self.active.handle) return self.active def change_database(self,db): diff --git a/gramps2/src/ManagedWindow.py b/gramps2/src/ManagedWindow.py index 56d7828df..f933bdab2 100644 --- a/gramps2/src/ManagedWindow.py +++ b/gramps2/src/ManagedWindow.py @@ -278,7 +278,6 @@ class ManagedWindow: ... """ - window_key = self.build_window_key(obj) menu_label,submenu_label = self.build_menu_names(obj) @@ -312,6 +311,9 @@ class ManagedWindow: # On the top level: we use gramps top window self.parent_window = self.uistate.window + def set_window(self, window): + self.window = window + def build_menu_names(self,obj): return ('Undefined Menu','Undefined Submenu') @@ -319,6 +321,7 @@ class ManagedWindow: return id(self) def show(self): + assert(self.window) self.window.set_transient_for(self.parent_window) self.window.show() @@ -334,4 +337,5 @@ class ManagedWindow: """ Present window (unroll/unminimize/bring to top). """ + assert(self.window) self.window.present() diff --git a/gramps2/src/PageView.py b/gramps2/src/PageView.py index b7540b987..bb8b484b6 100644 --- a/gramps2/src/PageView.py +++ b/gramps2/src/PageView.py @@ -279,9 +279,8 @@ class PersonNavView(PageView): if not hobj.at_end(): try: handle = hobj.forward() - self.dbstate.active = self.dbstate.db.get_person_from_handle(handle) - self.uistate.modify_statusbar() self.dbstate.change_active_handle(handle) + self.uistate.modify_statusbar() hobj.mhistory.append(hobj.history[hobj.index]) #self.redraw_histmenu() self.fwd_action.set_sensitive(not hobj.at_end()) diff --git a/gramps2/src/PluginUtils/_ReportUtils.py b/gramps2/src/PluginUtils/_ReportUtils.py index 1f43b3902..e9b69b7af 100644 --- a/gramps2/src/PluginUtils/_ReportUtils.py +++ b/gramps2/src/PluginUtils/_ReportUtils.py @@ -1320,8 +1320,8 @@ def get_birth_death_strings(database,person,empty_date="",empty_place=""): birth_ref = person.get_birth_ref() if birth_ref and birth_ref.ref: - if birth_ref: - birth = database.get_event_from_handle(birth_ref.ref) + birth = database.get_event_from_handle(birth_ref.ref) + if birth: bdate = DateHandler.get_date(birth) bplace_handle = birth.get_place_handle() if bplace_handle: diff --git a/gramps2/src/RelLib/_DateBase.py b/gramps2/src/RelLib/_DateBase.py index f49b58120..b10cfe342 100644 --- a/gramps2/src/RelLib/_DateBase.py +++ b/gramps2/src/RelLib/_DateBase.py @@ -66,48 +66,6 @@ class DateBase: else: self.date = Date().unserialize(data) -# def set_date(self, date) : -# """ -# Sets the date of the DateBase instance. - -# The date is parsed into a L{Date} instance. - -# @param date: String representation of a date. The locale specific -# L{DateParser} is used to parse the string into a GRAMPS L{Date} -# object. -# @type date: str -# """ -# self.date = DateHandler.parser.parse(date) - -# def get_date(self) : -# """ -# Returns a string representation of the date of the DateBase instance. - -# This representation is based off the default date display format -# determined by the locale's L{DateDisplay} instance. - -# @return: Returns a string representing the DateBase date -# @rtype: str -# """ -# if self.date: -# return DateHandler.displayer.display(self.date) -# return u"" - -# def get_quote_date(self) : -# """ -# Returns a string representation of the date of the DateBase instance. - -# This representation is based off the default date display format -# determined by the locale's L{DateDisplay} instance. The date is -# enclosed in quotes if the L{Date} is not a valid date. - -# @return: Returns a string representing the DateBase date -# @rtype: str -# """ -# if self.date: -# return DateHandler.displayer.quote_display(self.date) -# return u"" - def get_date_object(self): """ Returns the L{Date} object associated with the DateBase. diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index ea45dbfea..7149b7f24 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -1113,11 +1113,11 @@ def add_gedcom_filter(chooser): chooser.add_filter(mime_filter) def make_report_callback(lst,dbstate): - return lambda x: Report.report(dbstate.db,dbstate.active, + return lambda x: Report.report(dbstate.db,dbstate.get_active_person(), lst[0],lst[1],lst[2],lst[3],lst[4]) def make_tool_callback(lst,dbstate): - return lambda x: Tool.gui_tool(dbstate.db,dbstate.active, + return lambda x: Tool.gui_tool(dbstate.db,dbstate.get_active_person(), lst[0],lst[1],lst[2],lst[3],lst[4], dbstate.db.request_rebuild,None)