diff --git a/ChangeLog b/ChangeLog index d16c39fec..17b0697c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-23 Don Allingham + * src/Editors/_EditUrl.py: add jump button + * src/DisplayTabs/_WebEmbedList.py: add jump button + * src/DisplayTabs/_EmbeddedList.py: add jump button + * src/DisplayTabs/_BackRefList.py: add jump button + * src/DisplayTabs/_ButtonTab.py: add jump button + * src/glade/gramps.glade: add jump button + 2007-06-23 Brian Matherly * src/Filters/Rules/Person/__init__.py: * src/Filters/Rules/Person/Makefile.am: diff --git a/src/DisplayTabs/_BackRefList.py b/src/DisplayTabs/_BackRefList.py index 2f3f98aa3..76a86926b 100644 --- a/src/DisplayTabs/_BackRefList.py +++ b/src/DisplayTabs/_BackRefList.py @@ -80,7 +80,7 @@ class BackRefList(EmbeddedList): def is_empty(self): return self.model.count == 0 - def create_buttons(self, share=False, move=False): + def create_buttons(self, share=False, move=False, jump=False): ''' Creates a button box consisting of one button: Edit. This button box is then appended hbox (self). diff --git a/src/DisplayTabs/_ButtonTab.py b/src/DisplayTabs/_ButtonTab.py index 7912960a7..cbec7def7 100644 --- a/src/DisplayTabs/_ButtonTab.py +++ b/src/DisplayTabs/_ButtonTab.py @@ -60,12 +60,13 @@ class ButtonTab(GrampsTab): 'del' : _('Remove'), 'edit' : _('Edit'), 'share' : _('Share'), + 'jump' : _('Jump To'), 'up' : _('Move Up'), 'down' : _('Move Down'), } def __init__(self, dbstate, uistate, track, name, share_button=False, - move_buttons=False): + move_buttons=False, jump_button=False): """ Similar to the base class, except after Build @param dbstate: The database state. Contains a reference to @@ -88,9 +89,9 @@ class ButtonTab(GrampsTab): """ GrampsTab.__init__(self,dbstate, uistate, track, name) self.tooltips = gtk.Tooltips() - self.create_buttons(share_button, move_buttons) + self.create_buttons(share_button, move_buttons, jump_button) - def create_buttons(self, share_button=False, move_buttons=False): + def create_buttons(self, share_button, move_buttons, jump_button): """ Creates a button box consisting of three buttons, one for Add, one for Edit, and one for Delete. This button box is then appended @@ -125,10 +126,18 @@ class ButtonTab(GrampsTab): self.del_btn.set_sensitive(False) if share_button: self.share_btn.set_sensitive(False) + if jump_button: + self.jump_btn.set_sensitive(False) if move_buttons: self.up_btn.set_sensitive(False) self.down_btn.set_sensitive(False) + if jump_button: + self.jump_btn = SimpleButton(gtk.STOCK_JUMP_TO, self.jump_button_clicked) + self.tooltips.set_tip(self.jump_btn, self._MSG['jump']) + else: + self.jump_btn = None + vbox = gtk.VBox() vbox.set_spacing(6) vbox.pack_start(self.add_btn, False) @@ -139,6 +148,8 @@ class ButtonTab(GrampsTab): if move_buttons: vbox.pack_start(self.up_btn, False) vbox.pack_start(self.down_btn, False) + if jump_button: + vbox.pack_start(self.jump_btn, False) vbox.show_all() self.pack_start(vbox, False) @@ -162,11 +173,18 @@ class ButtonTab(GrampsTab): def share_button_clicked(self, obj): """ - Function called with the Add button is clicked. This function + Function called with the Share button is clicked. This function should be overridden by the derived class. """ print "Uncaught Share clicked" + def jump_button_clicked(self, obj): + """ + Function called with the Jump button is clicked. This function + should be overridden by the derived class. + """ + print "Uncaught Jump clicked" + def del_button_clicked(self, obj): """ Function called with the Delete button is clicked. This function @@ -206,6 +224,8 @@ class ButtonTab(GrampsTab): # and 0 can be returned if self.get_selected() != None: self.edit_btn.set_sensitive(True) + if self.jump_btn: + self.jump_btn.set_sensitive(True) if not self.dbstate.db.readonly: self.del_btn.set_sensitive(True) # note: up and down cannot be set unsensitive after clicked @@ -215,6 +235,8 @@ class ButtonTab(GrampsTab): # self.down_btn.set_sensitive(True) else: self.edit_btn.set_sensitive(False) + if self.jump_btn: + self.jump_btn.set_sensitive(False) if not self.dbstate.db.readonly: self.del_btn.set_sensitive(False) # note: up and down cannot be set unsensitive after clicked diff --git a/src/DisplayTabs/_EmbeddedList.py b/src/DisplayTabs/_EmbeddedList.py index 0dc5e86df..5f69c289e 100644 --- a/src/DisplayTabs/_EmbeddedList.py +++ b/src/DisplayTabs/_EmbeddedList.py @@ -60,12 +60,12 @@ class EmbeddedList(ButtonTab): _DND_EXTRA = None def __init__(self, dbstate, uistate, track, name, build_model, - share=False, move=False): + share=False, move=False, jump=False): """ Creates a new list, using the passed build_model to populate the list. """ - ButtonTab.__init__(self, dbstate, uistate, track, name, share, move) + ButtonTab.__init__(self, dbstate, uistate, track, name, share, move, jump) self.changed = False diff --git a/src/DisplayTabs/_WebEmbedList.py b/src/DisplayTabs/_WebEmbedList.py index 8efb7b64d..b9fea490b 100644 --- a/src/DisplayTabs/_WebEmbedList.py +++ b/src/DisplayTabs/_WebEmbedList.py @@ -26,6 +26,7 @@ # #------------------------------------------------------------------------- from gettext import gettext as _ +import gtk #------------------------------------------------------------------------- # @@ -57,7 +58,7 @@ class WebEmbedList(EmbeddedList): def __init__(self, dbstate, uistate, track, data): self.data = data EmbeddedList.__init__(self, dbstate, uistate, track, - _('Internet'), WebModel) + _('Internet'), WebModel, jump=True) def get_icon_name(self): return 'gramps-url' @@ -95,3 +96,18 @@ class WebEmbedList(EmbeddedList): def edit_callback(self, url): self.rebuild() + + def get_popup_menu_items(self): + return [ + (True, True, gtk.STOCK_ADD, self.add_button_clicked), + (False, True, gtk.STOCK_EDIT, self.edit_button_clicked), + (True, True, gtk.STOCK_REMOVE, self.del_button_clicked), + (True, True, gtk.STOCK_JUMP_TO, self.jump_button_clicked), + ] + + def jump_button_clicked(self, obj): + import GrampsDisplay + + url = self.get_selected() + if url.get_path(): + GrampsDisplay.url(url.get_path()) diff --git a/src/Editors/_EditUrl.py b/src/Editors/_EditUrl.py index a9bed25bc..88d31be26 100644 --- a/src/Editors/_EditUrl.py +++ b/src/Editors/_EditUrl.py @@ -61,17 +61,24 @@ class EditUrl(EditSecondary): url, callback) def _local_init(self): - self.top = gtk.glade.XML(const.gladeFile, "url_edit","gramps") + self.top = gtk.glade.XML(const.gladeFile, "url_edit", "gramps") + self.jump = self.top.get_widget('jump') self.set_window(self.top.get_widget("url_edit"), self.top.get_widget("title"), _('Internet Address Editor')) def _connect_signals(self): + self.jump.connect('clicked', self.jump_to) self.define_cancel_button(self.top.get_widget('button125')) - self.define_ok_button(self.top.get_widget('button124'),self.save) - self.define_help_button(self.top.get_widget('button130'),'gramps-edit_complete') + self.define_ok_button(self.top.get_widget('button124'), self.save) + self.define_help_button(self.top.get_widget('button130'), 'gramps-edit_complete') + def jump_to(self, obj): + if self.obj.get_path(): + import GrampsDisplay + GrampsDisplay.url(self.obj.get_path()) + def _setup_fields(self): self.des = MonitoredEntry( self.top.get_widget("url_des"), diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index a0f552b29..2f67c5034 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -8159,6 +8159,23 @@ + + + True + False + True + True + + + 1 + 2 + 0 + 1 + fill + + + + True @@ -8174,7 +8191,7 @@ 1 - 3 + 2 1 2 3 @@ -8182,6 +8199,25 @@ + + + True + True + gtk-jump-to + True + GTK_RELIEF_NORMAL + True + + + 2 + 3 + 1 + 2 + fill + + + + True @@ -8196,29 +8232,12 @@ 1 - 2 + 3 2 3 - - - - True - False - True - True - - - 1 - 2 - 0 - 1 - fill - - - 0