diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index e435917d2..0631456d2 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,6 @@ 2006-05-12 Don Allingham + * src/GrampsCfg.py: fix color dialog buttons + * src/Filters/Rules/Person/_HasEvent.py: handle EventType * src/DataViews/_PersonView.py: set up new filter fields * src/Filters/Rules/Person/_RegExpIdOf.py: added * src/Filters/Rules/Person/__init__.py: added new files diff --git a/gramps2/src/DataViews/_PersonView.py b/gramps2/src/DataViews/_PersonView.py index 38f1bba61..ca0246786 100644 --- a/gramps2/src/DataViews/_PersonView.py +++ b/gramps2/src/DataViews/_PersonView.py @@ -224,12 +224,15 @@ class PersonView(PageView.PersonNavView): self.filter_id = gtk.Entry() self.filter_birth = gtk.Entry() self.filter_death = gtk.Entry() - self.filter_event = gtk.Entry() - self.filter_event.set_sensitive(False) + self.filter_event = RelLib.Event() + self.filter_event.set_type((RelLib.EventType.CUSTOM,'')) + etype = gtk.ComboBoxEntry() + + self.event_menu = GrampsWidgets.MonitoredDataType( + etype, + self.filter_event.set_type, + self.filter_event.get_type) - self.filter_source = gtk.Entry() - self.filter_source.set_sensitive(False) - self.filter_note = gtk.Entry() self.filter_gender = gtk.combo_box_new_text() for i in [ _('any'), _('male'), _('female'), _('unknown') ]: @@ -276,27 +279,20 @@ class PersonView(PageView.PersonNavView): table.attach(self.filter_death, 2, 3, 5, 6, xoptions=gtk.FILL, yoptions=0) - table.attach(GrampsWidgets.BasicLabel(_('Event')), + table.attach(GrampsWidgets.BasicLabel(_('Has Event')), 1, 2, 6, 7, xoptions=gtk.FILL, yoptions=0) - table.attach(self.filter_event, 2, 3, 6, 7, - xoptions=gtk.FILL, yoptions=0) - - table.attach(GrampsWidgets.BasicLabel(_('Source')), - 1, 2, 7, 8, xoptions=gtk.FILL, yoptions=0) - - table.attach(self.filter_source, 2, 3, 7, 8, - xoptions=gtk.FILL, yoptions=0) + table.attach(etype, 2, 3, 6, 7, xoptions=gtk.FILL, yoptions=0) table.attach(GrampsWidgets.BasicLabel(_('Note')), - 1, 2, 8, 9, xoptions=gtk.FILL, yoptions=0) + 1, 2, 7, 8, xoptions=gtk.FILL, yoptions=0) - table.attach(self.filter_note, 2, 3, 8, 9, + table.attach(self.filter_note, 2, 3, 7, 8, xoptions=gtk.FILL, yoptions=0) - table.attach(self.filter_regex, 2, 3, 9, 10, xoptions=gtk.FILL, + table.attach(self.filter_regex, 2, 3, 8, 9, xoptions=gtk.FILL, yoptions=0) - table.attach(self.apply_btn, 2, 3, 10, 11, xoptions=0, + table.attach(self.apply_btn, 2, 3, 9, 10, xoptions=0, yoptions=0) return table @@ -306,14 +302,14 @@ class PersonView(PageView.PersonNavView): gid = self.filter_id.get_text().strip() birth = self.filter_birth.get_text().strip() death = self.filter_death.get_text().strip() - event = self.filter_event.get_text().strip() source = self.filter_source.get_text().strip() note = self.filter_note.get_text().strip() gender = self.filter_gender.get_active() regex = self.filter_regex.get_active() if not name and not gid and not birth and not death \ - and not event and not source and not note and not gender > 0: + and not str(self.filter_event.get_type()) and \ + not source and not note and not gender > 0: self.generic_filter = None else: self.generic_filter = GenericFilter() @@ -336,6 +332,12 @@ class PersonView(PageView.PersonNavView): self.generic_filter.add_rule(IsFemale([])) else: self.generic_filter.add_rule(HasUnknownGender([])) + + etype = self.filter_event.get_type() + if str(etype): + rule = HasEvent([etype, '', '', '']) + self.generic_filter.add_rule(rule) + if birth: rule = HasBirth([birth,'','']) self.generic_filter.add_rule(rule) diff --git a/gramps2/src/Filters/Rules/Person/_HasEvent.py b/gramps2/src/Filters/Rules/Person/_HasEvent.py index 97d2cb9ca..9aa279594 100644 --- a/gramps2/src/Filters/Rules/Person/_HasEvent.py +++ b/gramps2/src/Filters/Rules/Person/_HasEvent.py @@ -67,7 +67,7 @@ class HasEvent(Rule): for event_ref in person.get_event_ref_list(): if not event_ref: continue - event = db.get_event_from_handle(event_handle) + event = db.get_event_from_handle(event_ref.ref) val = True if self.etype and event.get_type() != self.etype: val = False diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index c832fbca1..970965d26 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -82,7 +82,6 @@ def get_researcher(): owner.set(n,a,c,s,ct,p,ph,e) return owner - #------------------------------------------------------------------------- # # @@ -156,21 +155,24 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): table.set_border_width(12) table.set_col_spacings(6) table.set_row_spacings(6) - self.add_checkbox(table, _('Warn when adding parents to a child'), - 0, Config.FAMILY_WARN) + self.add_checkbox( + table, _('Warn when adding parents to a child'), + 0, Config.FAMILY_WARN) - self.add_checkbox(table, _('Suppress warning when cancelling with changed data'), - 1, Config.DONT_ASK) + self.add_checkbox( + table, _('Suppress warning when cancelling with changed data'), + 1, Config.DONT_ASK) - self.add_checkbox(table, _('Show plugin status dialog on plugin load error'), - 2, Config.POP_PLUGIN_STATUS) + self.add_checkbox( + table, _('Show plugin status dialog on plugin load error'), + 2, Config.POP_PLUGIN_STATUS) return table def add_color_panel(self): table = gtk.Table(3,8) table.set_border_width(12) - table.set_col_spacings(6) + table.set_col_spacings(12) table.set_row_spacings(6) self.add_color(table, _("Complete"), 0, Config.COMPLETE_COLOR) @@ -261,8 +263,9 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): entry = gtk.Entry() entry.set_text(Config.get(constant)) entry.connect('changed', self.update_entry, constant) - table.attach(lwidget, 0, 1, index, index+1, yoptions=0) - table.attach(entry, 1, 3, index, index+1, yoptions=0) + table.attach(lwidget, 0, 1, index, index+1, yoptions=0, + xoptions=gtk.FILL) + table.attach(entry, 1, 2, index, index+1, yoptions=0) def add_color(self, table, label, index, constant): lwidget = BasicLabel("%s: " % label) @@ -270,8 +273,11 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): color = gtk.gdk.color_parse(hexval) entry = gtk.ColorButton(color=color) entry.connect('color-set', self.update_color, constant) - table.attach(lwidget, 0, 1, index, index+1, yoptions=0) - table.attach(entry, 1, 3, index, index+1, yoptions=0) + table.attach(lwidget, 0, 1, index, index+1, yoptions=0, + xoptions=gtk.FILL) + table.attach(entry, 1, 2, index, index+1, yoptions=0, xoptions=0) + table.attach(BasicLabel(hexval), 2, 3, index, index+1, + yoptions=0) def update_entry(self, obj, constant): Config.set(constant, unicode(obj.get_text()))