From b073854468ca5e53470fe3f71f84c909535c72a9 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 11 May 2006 23:05:12 +0000 Subject: [PATCH] fix marker type, search bar tuple problem svn: r6622 --- ChangeLog | 6 ++++++ src/DataViews/_PersonView.py | 5 +++-- src/GrampsWidgets.py | 9 +++++---- src/PageView.py | 8 +++++--- src/RelLib/_MarkerType.py | 28 ++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd753abfb..674f7ba6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-11 Don Allingham + * src/PageView.py: fix search tuple + * src/GrampsWidgets.py: handle Marker type properly + * src/DataViews/_PersonView.py: fix cache problem + * src/RelLib/_MarkerType.py: handle NONE/CUSTOM conflict + 2006-05-11 Alex Roitman * src/UndoHistory.py: Paint all rows in a selected block; Require exploicit button click on any action. diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index ace759aee..920215af3 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -462,8 +462,9 @@ class PersonView(PageView.PersonNavView): def edit(self,obj): if self.dbstate.active: try: - EditPerson(self.dbstate, self.uistate, [], - self.dbstate.active) + handle = self.dbstate.active.handle + person = self.dbstate.db.get_person_from_handle(handle) + EditPerson(self.dbstate, self.uistate, [], person) except Errors.WindowActiveError: pass diff --git a/src/GrampsWidgets.py b/src/GrampsWidgets.py index 57a5d71d6..29ae268bd 100644 --- a/src/GrampsWidgets.py +++ b/src/GrampsWidgets.py @@ -370,11 +370,12 @@ class MonitoredDataType: default, additional=custom_values) - value = self.sel.get_values() - self.set_val(self.fix_value(value)) - - if val.is_custom(): + if get_val().is_custom(): + self.obj.set_active(get_val().get_custom()) obj.child.set_text(str(val)) + else: + active = int(get_val()) + self.obj.set_active(active) self.obj.set_sensitive(not readonly) self.obj.connect('changed', self.on_change) diff --git a/src/PageView.py b/src/PageView.py index 2b17e4b05..c830d3b3e 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -51,6 +51,8 @@ import const NAVIGATION_NONE = -1 NAVIGATION_PERSON = 0 +EMPTY_SEARCH = (0, '', False) + #---------------------------------------------------------------- # # PageView @@ -570,7 +572,7 @@ class ListView(BookMarkView): handle = self.first_selected() if Config.get(Config.FILTER): - search = (0, '', False) + search = EMPTY_SEARCH else: search = self.search_bar.get_value() @@ -610,7 +612,7 @@ class ListView(BookMarkView): if self.active: if Config.get(Config.FILTER): - search = (0, '') + search = EMPTY_SEARCH else: search = self.search_bar.get_value() @@ -631,7 +633,7 @@ class ListView(BookMarkView): db.connect(sig, self.signal_map[sig]) if Config.get(Config.FILTER): - search = (0, '') + search = EMPTY_SEARCH else: search = self.search_bar.get_value() diff --git a/src/RelLib/_MarkerType.py b/src/RelLib/_MarkerType.py index 3b0b585e1..716c061d7 100644 --- a/src/RelLib/_MarkerType.py +++ b/src/RelLib/_MarkerType.py @@ -46,3 +46,31 @@ class MarkerType(GrampsType): def __init__(self, value=None): GrampsType.__init__(self, value) + + def set(self, value): + if isinstance(value,self.__class__): + if value.val == self.CUSTOM and value.string == '': + self.val = self.NONE + self.string = '' + else: + self.val = value.val + self.string = value.string + elif type(value) == tuple: + if value[0] == self.CUSTOM and value[1] == '': + self.value = self.NONE + self.string = '' + else: + self.val = value[0] + self.string = value[1] + elif type(value) == int: + self.val = value + self.string = '' + elif type(value) == str: + self.val = self._S2IMAP.get(value,self._CUSTOM) + if self.val == self._CUSTOM: + self.string = value + else: + self.string = '' + else: + self.val = self._DEFAULT + self.string = ''