2007-06-23 Don Allingham <don@gramps-project.org>

* 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



svn: r8643
This commit is contained in:
Don Allingham 2007-06-23 23:34:40 +00:00
parent 7d85cfd7bc
commit 4c34914b6f
7 changed files with 102 additions and 30 deletions

View File

@ -1,3 +1,11 @@
2007-06-23 Don Allingham <don@gramps-project.org>
* 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 <brian@gramps-project.org>
* src/Filters/Rules/Person/__init__.py:
* src/Filters/Rules/Person/Makefile.am:

View File

@ -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).

View File

@ -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

View File

@ -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

View File

@ -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())

View File

@ -61,16 +61,23 @@ 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(

View File

@ -8159,6 +8159,23 @@
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="type">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="has_frame">True</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="url_addr">
<property name="visible">True</property>
@ -8174,7 +8191,7 @@
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_padding">3</property>
@ -8182,6 +8199,25 @@
</packing>
</child>
<child>
<widget class="GtkButton" id="jump">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-jump-to</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="url_des">
<property name="visible">True</property>
@ -8196,29 +8232,12 @@
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="type">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="has_frame">True</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>