diff --git a/gramps/src/EditPerson.glade b/gramps/src/EditPerson.glade index 6b2ae486e..0669e0e78 100644 --- a/gramps/src/EditPerson.glade +++ b/gramps/src/EditPerson.glade @@ -1957,14 +1957,19 @@ True select_row - on_name_list_select_row - Mon, 18 Dec 2000 22:29:26 GMT + on_name_select_row + Sun, 07 Apr 2002 04:37:52 GMT button_press_event on_name_button_press Sun, 04 Nov 2001 15:40:59 GMT + + unselect_row + on_name_unselect_row + Sun, 07 Apr 2002 04:37:40 GMT + 3 350,100,50 GTK_SELECTION_SINGLE @@ -2046,6 +2051,7 @@ GtkButton aka_update + False Modify the selected name True True @@ -2062,6 +2068,7 @@ GtkButton aka_delete + False Delete selected name True True @@ -2628,6 +2635,11 @@ on_event_button_press Sun, 04 Nov 2001 15:29:48 GMT + + unselect_row + on_event_unselect_row + Sun, 07 Apr 2002 04:54:47 GMT + 5 115,110,150,100,50 GTK_SELECTION_SINGLE @@ -2734,7 +2746,8 @@ GtkButton - button59 + event_edit_btn + False Update the selected event with the above data True True @@ -2750,7 +2763,8 @@ GtkButton - button60 + event_delete_btn + False Delete the selected event True True @@ -3074,14 +3088,19 @@ True select_row - on_attr_list_select_row - Tue, 01 May 2001 17:24:40 GMT + on_attr_select_row + Sun, 07 Apr 2002 05:07:05 GMT button_press_event on_attr_button_press Sun, 04 Nov 2001 15:42:49 GMT + + unselect_row + on_attr_unselect_row + Sun, 07 Apr 2002 05:07:26 GMT + 3 200,250,50 GTK_SELECTION_SINGLE @@ -3162,7 +3181,8 @@ GtkButton - button89 + attr_edit_btn + False Update the selected attribute with the above data True True @@ -3178,7 +3198,8 @@ GtkButton - button90 + attr_delete_btn + False Delete the selected attribute True True @@ -3892,14 +3913,19 @@ True select_row - on_address_list_select_row - Wed, 23 May 2001 18:42:16 GMT + on_addr_select_row + Sun, 07 Apr 2002 05:27:50 GMT button_press_event on_addr_button_press Sun, 04 Nov 2001 15:53:05 GMT + + unselect_row + on_addr_unselect_row + Sun, 07 Apr 2002 05:27:58 GMT + 3 150,350,50 GTK_SELECTION_SINGLE @@ -3980,7 +4006,8 @@ GtkButton - button93 + addr_edit_btn + False Update the selected address with the above data True True @@ -3996,7 +4023,8 @@ GtkButton - button94 + addr_delete_btn + False Delete the selected address True True @@ -4500,14 +4528,19 @@ True select_row - on_web_list_select_row - Tue, 24 Apr 2001 14:12:50 GMT + on_web_select_row + Sun, 07 Apr 2002 18:44:25 GMT button_press_event on_web_button_press Sun, 04 Nov 2001 15:44:20 GMT + + unselect_row + on_web_unselect_row + Sun, 07 Apr 2002 18:44:42 GMT + 2 273,80 GTK_SELECTION_SINGLE @@ -4576,6 +4609,7 @@ GtkButton update_url + False Modify selected reference True True @@ -4592,6 +4626,7 @@ GtkButton delete_url + False Delete selected reference True True diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 56586ce5d..b30549ded 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -92,6 +92,22 @@ class EditPerson: self.top = libglade.GladeXML(const.editPersonFile, "editPerson") gwidget = self.top.get_widget("photolist") self.gallery = ImageSelect.Gallery(person, self.path, gwidget, self.db) + + self.name_update_btn = self.top.get_widget('aka_update') + self.name_delete_btn = self.top.get_widget('aka_delete') + + self.web_update_btn = self.top.get_widget('update_url') + self.web_delete_btn = self.top.get_widget('delete_url') + + self.event_edit_btn = self.top.get_widget('event_edit_btn') + self.event_delete_btn = self.top.get_widget('event_delete_btn') + + self.attr_edit_btn = self.top.get_widget('attr_edit_btn') + self.attr_delete_btn = self.top.get_widget('attr_delete_btn') + + self.addr_edit_btn = self.top.get_widget('addr_edit_btn') + self.addr_delete_btn = self.top.get_widget('addr_delete_btn') + self.top.signal_autoconnect({ "destroy_passed_object" : self.on_cancel_edit, "on_up_clicked" : self.on_up_clicked, @@ -103,12 +119,14 @@ class EditPerson: "on_addr_button_press" : self.addr_double_click, "on_web_button_press" : self.url_double_click, "on_addphoto_clicked" : self.gallery.on_add_photo_clicked, - "on_address_list_select_row": self.on_addr_list_select_row, + "on_addr_select_row" : self.on_addr_select_row, + "on_addr_unselect_row" : self.on_addr_unselect_row, "on_aka_delete_clicked" : self.on_aka_delete_clicked, "on_aka_update_clicked" : self.on_aka_update_clicked, "on_apply_person_clicked" : self.on_apply_person_clicked, "on_attr_button_press" : self.attr_double_click, - "on_attr_list_select_row" : self.on_attr_list_select_row, + "on_attr_select_row" : self.on_attr_select_row, + "on_attr_unselect_row" : self.on_attr_unselect_row, "on_edit_birth_clicked" : self.on_edit_birth_clicked, "on_edit_death_clicked" : self.on_edit_death_clicked, "on_delete_address_clicked" : self.on_delete_addr_clicked, @@ -122,9 +140,11 @@ class EditPerson: "on_event_button_press" : self.event_double_click, "on_event_delete_clicked" : self.on_event_delete_clicked, "on_event_select_row" : self.on_event_select_row, + "on_event_unselect_row" : self.on_event_unselect_row, "on_event_update_clicked" : self.on_event_update_clicked, "on_name_button_press" : self.aka_double_click, - "on_name_list_select_row" : self.on_name_list_select_row, + "on_name_select_row" : self.on_name_select_row, + "on_name_unselect_row" : self.on_name_unselect_row, "on_name_note_clicked" : self.on_name_note_clicked, "on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked, "on_ldsendow_note_clicked" : self.on_ldsendow_note_clicked, @@ -139,7 +159,8 @@ class EditPerson: "on_update_attr_clicked" : self.on_update_attr_clicked, "on_update_url_clicked" : self.on_update_url_clicked, "on_web_go_clicked" : self.on_web_go_clicked, - "on_web_list_select_row" : self.on_web_list_select_row, + "on_web_select_row" : self.on_web_select_row, + "on_web_unselect_row" : self.on_web_unselect_row, }) self.window = self.get_widget("editPerson") @@ -225,7 +246,8 @@ class EditPerson: self.window.editable_enters(self.dplace); self.autoplace = AutoComp.AutoCombo(self.bpcombo,self.pmap.keys()) - self.autodeath = AutoComp.AutoCombo(self.dpcombo,self.pmap.keys(),self.autoplace) + self.autodeath = AutoComp.AutoCombo(self.dpcombo,self.pmap.keys(), + self.autoplace) self.comp = AutoComp.AutoCombo(self.sncombo,const.surnames) self.gid.set_text(person.getId()) @@ -283,25 +305,33 @@ class EditPerson: self.notes_field.insert_defaults(person.getNote()) self.notes_field.set_word_wrap(1) - self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY) + self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, + pycode_tgts,ACTION_COPY) self.event_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY) self.event_list.connect('drag_data_get', self.ev_drag_data_get) - self.event_list.connect('drag_data_received', self.ev_drag_data_received) + self.event_list.connect('drag_data_received', + self.ev_drag_data_received) - self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY) + self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, + pycode_tgts,ACTION_COPY) self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY) self.web_list.connect('drag_data_get', self.url_drag_data_get) - self.web_list.connect('drag_data_received', self.url_drag_data_received) + self.web_list.connect('drag_data_received', + self.url_drag_data_received) - self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY) + self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts, + ACTION_COPY) self.attr_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY) self.attr_list.connect('drag_data_get', self.at_drag_data_get) - self.attr_list.connect('drag_data_received', self.at_drag_data_received) + self.attr_list.connect('drag_data_received', + self.at_drag_data_received) - self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY) + self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, + pycode_tgts,ACTION_COPY) self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY) self.addr_list.connect('drag_data_get', self.ad_drag_data_get) - self.addr_list.connect('drag_data_received', self.ad_drag_data_received) + self.addr_list.connect('drag_data_received', + self.ad_drag_data_received) self.redraw_event_list() self.redraw_attr_list() @@ -951,6 +981,8 @@ class EditPerson: self.callback) def on_event_select_row(self,obj,row,b,c): + self.event_edit_btn.set_sensitive(1) + self.event_delete_btn.set_sensitive(1) event = obj.get_row_data(row) self.event_date_field.set_text(event.getDate()) self.event_place_field.set_text(event.getPlaceName()) @@ -959,9 +991,20 @@ class EditPerson: self.event_descr_field.set_text(event.getDescription()) self.event_details_field.set_text(Utils.get_detail_text(event)) - def on_addr_list_select_row(self,obj,row,b,c): + def on_event_unselect_row(self,obj,a,b,c): + enable = len(obj.selection) > 0 + self.event_edit_btn.set_sensitive(enable) + self.event_delete_btn.set_sensitive(enable) + def on_addr_unselect_row(self,obj,row,b,c): + enable = len(obj.selection) > 0 + self.addr_edit_btn.set_sensitive(enable) + self.addr_delete_btn.set_sensitive(enable) + + def on_addr_select_row(self,obj,row,b,c): a = obj.get_row_data(row) + self.addr_edit_btn.set_sensitive(1) + self.addr_delete_btn.set_sensitive(1) label = "%s %s %s" % (a.getCity(),a.getState(),a.getCountry()) self.addr_label.set_label(label) @@ -973,8 +1016,9 @@ class EditPerson: self.addr_postal.set_text(a.getPostal()) self.addr_details_field.set_text(Utils.get_detail_text(a)) - def on_name_list_select_row(self,obj,row,b,c): - + def on_name_select_row(self,obj,row,b,c): + self.name_update_btn.set_sensitive(1) + self.name_delete_btn.set_sensitive(1) name = obj.get_row_data(row) self.name_frame.set_label(name.getName()) self.alt_given_field.set_text(name.getFirstName()) @@ -984,8 +1028,14 @@ class EditPerson: self.name_type_field.set_text(name.getType()) self.name_details_field.set_text(Utils.get_detail_text(name)) - def on_web_list_select_row(self,obj,row,b,c): + def on_name_unselect_row(self,obj,a,b,c): + enable = len(obj.selection) > 0 + self.name_update_btn.set_sensitive(enable) + self.name_delete_btn.set_sensitive(enable) + def on_web_select_row(self,obj,row,b,c): + self.web_update_btn.set_sensitive(1) + self.web_delete_btn.set_sensitive(1) url = obj.get_row_data(row) if url == None: self.web_url.set_text("") @@ -997,13 +1047,24 @@ class EditPerson: self.web_go.set_sensitive(1) self.web_description.set_text(url.get_description()) - def on_attr_list_select_row(self,obj,row,b,c): + def on_web_unselect_row(self,obj,row,b,c): + enable = len(obj.selection) > 0 + self.web_update_btn.set_sensitive(enable) + self.web_delete_btn.set_sensitive(enable) + def on_attr_select_row(self,obj,row,b,c): + self.attr_edit_btn.set_sensitive(1) + self.attr_delete_btn.set_sensitive(1) attr = obj.get_row_data(row) self.attr_type.set_label(const.display_pattr(attr.getType())) self.attr_value.set_text(attr.getValue()) self.attr_details_field.set_text(Utils.get_detail_text(attr)) + def on_attr_unselect_row(self,obj,row,b,c): + enable = len(obj.selection) > 0 + self.attr_edit_btn.set_sensitive(enable) + self.attr_delete_btn.set_sensitive(enable) + def aka_double_click(self,obj,event): if event.button == 1 and event.type == _2BUTTON_PRESS: self.on_aka_update_clicked(obj) diff --git a/gramps/src/GenericFilter.py b/gramps/src/GenericFilter.py index 92dae4f2d..caa2ae5a2 100644 --- a/gramps/src/GenericFilter.py +++ b/gramps/src/GenericFilter.py @@ -505,11 +505,19 @@ class GenericFilter: self.flist = source.flist[:] self.name = source.name self.comment = source.comment + self.logical_or = source.logical_or else: self.flist = [] - self.name = 'NoName' + self.name = '' self.comment = '' + self.logical_or = 0 + def set_logical_or(self,val): + self.logical_or = val + + def get_logical_or(self): + return self.logical_or + def get_name(self): return self.name @@ -533,12 +541,19 @@ class GenericFilter: def apply(self,list): result = [] - for p in list: - for rule in self.flist: - if rule.apply(p) == 0: - break - else: - result.append(p) + if self.logical_or: + for p in list: + for rule in self.flist: + if rule.apply(p): + result.append(p) + break + else: + for p in list: + for rule in self.flist: + if rule.apply(p) == 0: + break + else: + result.append(p) return result #------------------------------------------------------------------------- @@ -607,6 +622,8 @@ class GenericFilterList: f.write('\n') for i in self.filter_list: f.write(' 1: arg = sys.argv[1] else: diff --git a/gramps/src/intl.py b/gramps/src/intl.py index 4dada6e71..2902b235a 100644 --- a/gramps/src/intl.py +++ b/gramps/src/intl.py @@ -36,6 +36,8 @@ try: elif ver == "2.2": from intl22 import * else: + print 'Internationalization library could be loaded' + def gettext(s): return s diff --git a/gramps/src/plugins.glade b/gramps/src/plugins.glade index 18d043e7d..2a1edc32e 100644 --- a/gramps/src/plugins.glade +++ b/gramps/src/plugins.glade @@ -110,23 +110,54 @@ - GtkTree - tree - 5 - 250 - 300 - GTK_SELECTION_SINGLE - GTK_TREE_VIEW_ITEM - True + GtkScrolledWindow + scrolledwindow1 + 200 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS False - True + False + + + GtkCTree + tree + 250 + 300 + True + + tree_select_row + on_tree_select_row + Mon, 08 Apr 2002 00:44:55 GMT + + 1 + 80 + GTK_SELECTION_SINGLE + False + GTK_SHADOW_IN + + + GtkLabel + CTree:title + label63 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + GtkVBox vbox36 + 300 False 0 diff --git a/gramps/src/plugins/FilterEditor.py b/gramps/src/plugins/FilterEditor.py index 2ed481ce0..1987fab33 100644 --- a/gramps/src/plugins/FilterEditor.py +++ b/gramps/src/plugins/FilterEditor.py @@ -52,30 +52,49 @@ class FilterEditor: self.editor = libglade.GladeXML(const.filterFile,'filter_list') self.editor_top = self.editor.get_widget('filter_list') self.filter_list = self.editor.get_widget('filters') - self.draw_filters() + self.edit = self.editor.get_widget('edit') + self.delete = self.editor.get_widget('delete') + self.test = self.editor.get_widget('test') + self.editor.signal_autoconnect({ 'on_add_clicked' : self.add_new_filter, 'on_edit_clicked' : self.edit_filter, + 'on_filters_select_row' : self.filter_select_row, + 'on_filters_unselect_row' : self.filter_unselect_row, 'on_test_clicked' : self.test_clicked, 'on_close_clicked' : self.close_filter_editor, 'on_delete_clicked' : self.delete_filter, }) + self.draw_filters() + def filter_select_row(self,obj,a,b,c): + self.edit.set_sensitive(1) + self.delete.set_sensitive(1) + self.test.set_sensitive(1) + + def filter_unselect_row(self,obj,a,b,c): + enable = (len(obj.selection) > 0) + self.edit.set_sensitive(enable) + self.delete.set_sensitive(enable) + self.test.set_sensitive(enable) + def close_filter_editor(self,obj): self.filterdb.save() self.editor_top.destroy() def draw_filters(self): row = 0 + self.filter_list.freeze() self.filter_list.clear() for f in self.filterdb.get_filters(): self.filter_list.append([f.get_name(),f.get_comment()]) self.filter_list.set_row_data(row,f) row = row + 1 + self.filter_list.sort() + self.filter_list.thaw() def add_new_filter(self,obj): filter = GenericFilter.GenericFilter() - filter.set_name('NoName') self.filter_editor(filter) def edit_filter(self,obj): @@ -107,19 +126,41 @@ class FilterEditor: self.top = self.glade.get_widget('define_filter') self.rule_list = self.glade.get_widget('rule_list') self.fname = self.glade.get_widget('filter_name') + self.logor = self.glade.get_widget('logical_or') self.comment = self.glade.get_widget('comment') + self.ok = self.glade.get_widget('ok') + self.edit_btn = self.glade.get_widget('edit') + self.del_btn = self.glade.get_widget('delete') self.glade.signal_autoconnect({ 'on_ok_clicked' : self.on_ok_clicked, 'on_cancel_clicked' : self.on_cancel_clicked, + 'on_rule_select_row' : self.select_row, + 'on_rule_unselect_row' : self.unselect_row, + 'on_filter_name_changed' : self.filter_name_changed, 'on_delete_clicked' : self.on_delete_clicked, 'on_add_clicked' : self.on_add_clicked, 'on_edit_clicked' : self.on_edit_clicked, 'on_cancel_clicked' : self.on_cancel_clicked, }) - self.fname.set_text(self.filter.get_name()) + self.logor.set_active(self.filter.get_logical_or()) + if self.filter.get_name(): + self.fname.set_text(self.filter.get_name()) self.comment.set_text(self.filter.get_comment()) self.draw_rules() + def filter_name_changed(self,obj): + name = self.fname.get_text() + self.ok.set_sensitive(len(name) != 0) + + def select_row(self,obj,a,b,c): + self.edit_btn.set_sensitive(1) + self.del_btn.set_sensitive(1) + + def unselect_row(self,obj,a,b,c): + enable = (len(obj.selection) == 1) + self.edit_btn.set_sensitive(enable) + self.del_btn.set_sensitive(enable) + def draw_rules(self): self.rule_list.clear() row = 0 @@ -141,6 +182,7 @@ class FilterEditor: if n == f.get_name(): self.filterdb.get_filters().remove(f) break + self.filter.set_logical_or(self.logor.get_active()) self.filterdb.add(self.filter) self.draw_filters() self.top.destroy() @@ -172,7 +214,9 @@ class FilterEditor: self.name2page = {} map = {} list = [] - for name in GenericFilter.tasks.keys(): + keylist = GenericFilter.tasks.keys() + keylist.sort() + for name in keylist: cname = GenericFilter.tasks[name] arglist = cname.labels vallist = [] @@ -191,12 +235,14 @@ class FilterEditor: list.append(c) map[name] = c for v in arglist: - l = gtk.GtkLabel(_(v)) + v1 = _(v) + l = gtk.GtkLabel(v1) l.set_alignment(1,0.5) l.show() - if _name2list.has_key(_(v)): + if _name2list.has_key(v1): t = gtk.GtkCombo() - t.set_popdown_strings(_name2list[_(v)]) + _name2list[v1].sort() + t.set_popdown_strings(_name2list[v1]) t.set_value_in_list(1,0) t.entry.set_editable(0) tlist.append(t.entry) diff --git a/gramps/src/rule.glade b/gramps/src/rule.glade index 3319b3709..d4f1ca152 100644 --- a/gramps/src/rule.glade +++ b/gramps/src/rule.glade @@ -57,6 +57,7 @@ GtkButton ok + False True True @@ -122,7 +123,7 @@ GtkTable table1 - 2 + 4 2 False 0 @@ -189,6 +190,11 @@ GtkEntry filter_name True + + changed + on_filter_name_changed + Sun, 07 Apr 2002 19:28:31 GMT + True True 0 @@ -232,6 +238,54 @@ False + + + GtkRadioButton + logical_and + True + + True + True + logic + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkRadioButton + logical_or + True + + False + True + logic + + 1 + 2 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + @@ -253,6 +307,16 @@ 450 200 True + + select_row + on_rule_select_row + Sun, 07 Apr 2002 19:29:31 GMT + + + unselect_row + on_rule_unselect_row + Sun, 07 Apr 2002 19:30:23 GMT + 2 147,80 GTK_SELECTION_SINGLE @@ -319,6 +383,7 @@ GtkButton edit + False True True @@ -333,6 +398,7 @@ GtkButton delete + False True True @@ -636,6 +702,16 @@ 450 150 True + + select_row + on_filters_select_row + Sun, 07 Apr 2002 22:15:34 GMT + + + unselect_row + on_filters_unselect_row + Sun, 07 Apr 2002 22:15:44 GMT + 2 117,80 GTK_SELECTION_SINGLE @@ -688,6 +764,7 @@ GtkButton button3 + Add a new filter True True @@ -701,7 +778,9 @@ GtkButton - button4 + edit + False + Edit the selected filter True True @@ -715,7 +794,9 @@ GtkButton - button5 + delete + False + Delete the selected filter True True @@ -729,7 +810,9 @@ GtkButton - button7 + test + False + Display people matching the filter True True