5108: Fix bug in context menu when no database is connected
svn: r18066
This commit is contained in:
parent
623f59d5ad
commit
03919314c5
@ -39,15 +39,6 @@ import os
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
gtk.rc_parse_string("""
|
||||
style "tab-button-style" {
|
||||
GtkWidget::focus-padding = 0
|
||||
GtkWidget::focus-line-width = 0
|
||||
xthickness = 0
|
||||
ythickness = 0
|
||||
}
|
||||
widget "*.tab-button" style "tab-button-style"
|
||||
""")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -319,7 +310,7 @@ class GrampsBar(gtk.Notebook):
|
||||
|
||||
def __create_tab_label(self, gramplet):
|
||||
"""
|
||||
Create a tab label consisting of a label and a close button.
|
||||
Create a tab label.
|
||||
"""
|
||||
label = gtk.Label()
|
||||
if hasattr(gramplet.pui, "has_data"):
|
||||
@ -412,18 +403,19 @@ class GrampsBar(gtk.Notebook):
|
||||
Called when a button is pressed in the tabs section of the GrampsBar.
|
||||
"""
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
uiman = self.uistate.uimanager
|
||||
ag_menu = uiman.get_widget('/GrampsBarPopup/AddGramplet')
|
||||
menu = gtk.Menu()
|
||||
|
||||
ag_menu = gtk.MenuItem(_('Add a gramplet'))
|
||||
nav_type = self.pageview.navigation_type()
|
||||
skip = self.all_gramplets()
|
||||
gramplet_list = GET_GRAMPLET_LIST(nav_type, skip)
|
||||
gramplet_list.sort()
|
||||
self.__create_submenu(ag_menu, gramplet_list, self.__add_clicked)
|
||||
ag_menu.show()
|
||||
menu.append(ag_menu)
|
||||
|
||||
rg_menu = uiman.get_widget('/GrampsBarPopup/RemoveGramplet')
|
||||
if self.empty:
|
||||
rg_menu.hide()
|
||||
else:
|
||||
if not self.empty:
|
||||
rg_menu = gtk.MenuItem(_('Remove a gramplet'))
|
||||
gramplet_list = [(gramplet.title, gramplet.gname)
|
||||
for gramplet in self.get_children() +
|
||||
self.detached_gramplets]
|
||||
@ -431,11 +423,11 @@ class GrampsBar(gtk.Notebook):
|
||||
self.__create_submenu(rg_menu, gramplet_list,
|
||||
self.__remove_clicked)
|
||||
rg_menu.show()
|
||||
menu.append(rg_menu)
|
||||
|
||||
menu.popup(None, None, None, 1, event.time)
|
||||
return True
|
||||
|
||||
menu = uiman.get_widget('/GrampsBarPopup')
|
||||
if menu:
|
||||
menu.popup(None, None, None, 1, event.time)
|
||||
return True
|
||||
return False
|
||||
|
||||
def __create_submenu(self, main_menu, gramplet_list, callback_func):
|
||||
|
@ -111,10 +111,6 @@ class PageView(DbGUIElement):
|
||||
</placeholder>
|
||||
</menu>
|
||||
</menubar>
|
||||
<popup name="GrampsBarPopup">
|
||||
<menuitem action="AddGramplet"/>
|
||||
<menuitem action="RemoveGramplet"/>
|
||||
</popup>
|
||||
</ui>'''
|
||||
self.dirty = True
|
||||
self.active = False
|
||||
@ -413,9 +409,6 @@ class PageView(DbGUIElement):
|
||||
self._add_toggle_action('Bottombar', None, _('_Bottombar'),
|
||||
"<shift><control>B", None, self.__bottombar_toggled,
|
||||
self.bottombar.get_property('visible'))
|
||||
self._add_action("AddGramplet", gtk.STOCK_ADD, _("Add a gramplet"))
|
||||
self._add_action("RemoveGramplet", gtk.STOCK_REMOVE,
|
||||
_("Remove a gramplet"))
|
||||
|
||||
def __build_action_group(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user