From a0c320d2fc589082c7efdffc4f40d9d5328e5f0f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 17 May 2006 04:35:03 +0000 Subject: [PATCH] * src/Editors/_EditEvent.py: start of SelectPlace integration * src/glade/gramps.glade: start of SelectPlace integration * src/GrampsWidgets.py: start of SelectPlace integration svn: r6686 --- gramps2/ChangeLog | 3 + gramps2/src/Editors/_EditEvent.py | 17 +- gramps2/src/GrampsWidgets.py | 60 +++--- gramps2/src/glade/gramps.glade | 328 ++++++++++++++++++------------ gramps2/src/gramps_main.py | 13 -- 5 files changed, 249 insertions(+), 172 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index fad037490..6d3f3a5d7 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2006-05-16 Don Allingham + * src/Editors/_EditEvent.py: start of SelectPlace integration + * src/glade/gramps.glade: start of SelectPlace integration + * src/GrampsWidgets.py: start of SelectPlace integration * src/DisplayTabs/_WebEmbedList.py: icon fixes * src/images/stock_insert-url.png: added * src/images/person.png: added diff --git a/gramps2/src/Editors/_EditEvent.py b/gramps2/src/Editors/_EditEvent.py index 4e5194d89..9a9b227ae 100644 --- a/gramps2/src/Editors/_EditEvent.py +++ b/gramps2/src/Editors/_EditEvent.py @@ -93,6 +93,10 @@ class EditEvent(EditPrimary): self.top.get_widget('title'), _('Event Editor')) + self.place = self.top.get_widget('place') + self.share_btn = self.top.get_widget('select_place') + self.add_del_btn = self.top.get_widget('add_del_place') + def _connect_signals(self): self.top.get_widget('button111').connect('clicked',self.close) self.top.get_widget('button126').connect('clicked',self.help_clicked) @@ -106,11 +110,16 @@ class EditEvent(EditPrimary): self.dbstate.db.get_family_event_types() def _setup_fields(self): + + # place, select_place, add_del_place + self.place_field = PlaceEntry( - self.top.get_widget("eventPlace"), - self.obj.get_place_handle(), - self.dbstate.get_place_completion(), - self.db.readonly) + self.db, + self.top.get_widget("place"), + self.obj.set_place_handle, + self.obj.get_place_handle, + self.add_del_btn, + self.share_btn) self.cause_monitor = MonitoredEntry( self.top.get_widget("eventCause"), diff --git a/gramps2/src/GrampsWidgets.py b/gramps2/src/GrampsWidgets.py index 8425a7fb8..6eefd871d 100644 --- a/gramps2/src/GrampsWidgets.py +++ b/gramps2/src/GrampsWidgets.py @@ -471,41 +471,47 @@ class MonitoredDate: class PlaceEntry: - def __init__(self, obj, handle, place_map, read_only=False): + def __init__(self, db, obj, set_val, get_val, add_del, share): + self.obj = obj - self.handle = handle - self.places = place_map + self.add_del = add_del + self.share = share + self.db = db + self.get_val = get_val + self.set_val = set_val - if handle: - name = place_map[handle] + if get_val(): + self.set_button(True) + p = self.db.get_place_from_handle(self.get_val()) + name = "%s [%s]" % (p.get_title(),p.gramps_id) else: name = u"" + self.set_button(False) - if read_only: - self.obj.set_editable(False) + if db.readonly: + self.add_del.set_sensitive(False) + self.share.set_sensitive(False) else: - self.obj.set_editable(True) + self.add_del.set_sensitive(True) + self.share.set_sensitive(True) - store = gtk.ListStore(str) - foo = [ (locale.strxfrm(self.places[v]), v) \ - for v in self.places.keys()] - foo.sort() - for val in foo: - store.append(row=[self.places[val[1]]]) - completion = gtk.EntryCompletion() - completion.set_text_column(0) - completion.set_model(store) - obj.set_completion(completion) - obj.set_text(name) - def get_place_info(self): - text = unicode(self.obj.get_text().strip()) - if text: - for key in self.places.keys(): - if text == self.places[key]: - return (False, key) - return (True, text) + def set_button(self, use_add): + for i in self.add_del.get_children(): + self.add_del.remove(i) + + image = gtk.Image() + if use_add: + image.set_from_stock(gtk.STOCK_REMOVE,gtk.ICON_SIZE_BUTTON) + self.share.hide() else: - return (False, u"") + image.set_from_stock(gtk.STOCK_ADD,gtk.ICON_SIZE_BUTTON) + self.share.show() + image.show() + self.add_del.add(image) + + + + diff --git a/gramps2/src/glade/gramps.glade b/gramps2/src/glade/gramps.glade index 2ae972929..2f6211f49 100644 --- a/gramps2/src/glade/gramps.glade +++ b/gramps2/src/glade/gramps.glade @@ -8461,7 +8461,7 @@ Text Beside Icons 12 True 4 - 6 + 5 False 6 12 @@ -8494,35 +8494,6 @@ Text Beside Icons - - - True - _Place: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 3 - eventPlace - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - True @@ -8545,34 +8516,13 @@ Text Beside Icons 0 1 - 3 - 4 + 2 + 3 fill - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 3 - 4 - - - - True @@ -8582,7 +8532,7 @@ Text Beside Icons 1 - 3 + 2 0 1 fill @@ -8610,8 +8560,8 @@ Text Beside Icons 0 - 3 - 4 + 2 + 3 0 1 fill @@ -8619,27 +8569,6 @@ Text Beside Icons - - - True - True - True - True - 0 - - True - * - False - - - 4 - 5 - 0 - 1 - - - - True @@ -8658,8 +8587,8 @@ Text Beside Icons - 5 - 6 + 4 + 5 0 1 fill @@ -8696,48 +8625,6 @@ Text Beside Icons - - - True - True - True - True - 0 - - True - * - False - - - 1 - 6 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 6 - 2 - 3 - - - - True @@ -8760,10 +8647,10 @@ Text Beside Icons - 5 - 6 - 3 - 4 + 4 + 5 + 2 + 3 fill @@ -8787,12 +8674,33 @@ Text Beside Icons False 0 + + 2 + 3 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + 3 4 - 3 - 4 - fill + 0 + 1 @@ -8809,14 +8717,178 @@ Text Beside Icons False + + 3 + 4 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 4 + 1 + 2 + + + + + + + True + _Place: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 3 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + GTK_RELIEF_NONE + True + + + + True + 0.5 + 0.5 + 0 + 0 + + + 4 5 3 4 + fill + + + + True + False + 0 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + True + True + GTK_RELIEF_NONE + True + + + + True + 4 + gtk-index + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + 1 + 4 + 3 + 4 + fill + fill + + 0 diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 5cf190ae8..5f7ca35fc 100644 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -194,16 +194,6 @@ class Gramps: self.statusbar_key_update) Config.client.notify_add("/apps/gramps/interface/toolbar", self.toolbar_key_update) -# Config.client.notify_add("/apps/gramps/interface/toolbar-on", -# self.toolbar_on_key_update) -# Config.client.notify_add("/apps/gramps/interface/filter", -# self.filter_key_update) -# Config.client.notify_add("/apps/gramps/interface/view", -# self.sidebar_key_update) -# Config.client.notify_add("/apps/gramps/preferences/name-format", -# self.familyview_key_update) -# Config.client.notify_add("/apps/gramps/preferences/date-format", -# self.date_format_key_update) if Config.get(Config.USE_TIPS): TipOfDay.TipOfDay(self.vm.uistate) @@ -254,6 +244,3 @@ class Gramps: else: self.vm.toolbar.set_style(the_style) -# def toolbar_on_key_update(self,client,cnxn_id,entry,data): -# is_on = COnfig.get_toolbar_on() -# self.enable_toolbar(is_on)