Disable OSX specific menu items, added in 'Gramps' menu
This commit is contained in:
parent
97b15322d4
commit
15db2dd603
@ -97,10 +97,12 @@ UIDEFAULT = (
|
|||||||
<attribute name="label" translatable="yes">'''
|
<attribute name="label" translatable="yes">'''
|
||||||
'''_Abandon Changes and Quit</attribute>
|
'''_Abandon Changes and Quit</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<placeholder groups='OSX' id='osxquit'>
|
||||||
<attribute name="action">win.Quit</attribute>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
<attribute name="action">app.quit</attribute>
|
||||||
</item>
|
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||||
|
</item>
|
||||||
|
</placeholder>
|
||||||
</section>
|
</section>
|
||||||
</submenu>
|
</submenu>
|
||||||
<submenu id='m2' groups='RW'>
|
<submenu id='m2' groups='RW'>
|
||||||
@ -173,11 +175,13 @@ UIDEFAULT = (
|
|||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<placeholder groups='OSX' id='osxpref'>
|
||||||
<attribute name="action">win.Preferences</attribute>
|
<item>
|
||||||
<attribute name="label" translatable="yes">'''
|
<attribute name="action">app.preferences</attribute>
|
||||||
|
<attribute name="label" translatable="yes">'''
|
||||||
'''_Preferences...</attribute>
|
'''_Preferences...</attribute>
|
||||||
</item>
|
</item>
|
||||||
|
</placeholder>
|
||||||
<placeholder id='otheredit'>
|
<placeholder id='otheredit'>
|
||||||
</placeholder>
|
</placeholder>
|
||||||
</section>
|
</section>
|
||||||
@ -288,9 +292,9 @@ UIDEFAULT = (
|
|||||||
'''_Extra Reports/Tools</attribute>
|
'''_Extra Reports/Tools</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section groups='OSX'>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="action">win.About</attribute>
|
<attribute name="action">app.about</attribute>
|
||||||
<attribute name="label" translatable="yes">_About</attribute>
|
<attribute name="label" translatable="yes">_About</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
@ -710,6 +714,7 @@ def startgramps(errors, argparser):
|
|||||||
|
|
||||||
# we do the following import here to avoid the Gtk require version warning
|
# we do the following import here to avoid the Gtk require version warning
|
||||||
from .uimanager import UIManager
|
from .uimanager import UIManager
|
||||||
|
from gramps.gen.constfunc import is_quartz
|
||||||
|
|
||||||
|
|
||||||
class GrampsApplication(Gtk.Application):
|
class GrampsApplication(Gtk.Application):
|
||||||
@ -723,6 +728,8 @@ class GrampsApplication(Gtk.Application):
|
|||||||
def do_startup(self):
|
def do_startup(self):
|
||||||
Gtk.Application.do_startup(self)
|
Gtk.Application.do_startup(self)
|
||||||
self.uimanager = UIManager(self, UIDEFAULT)
|
self.uimanager = UIManager(self, UIDEFAULT)
|
||||||
|
if not is_quartz():
|
||||||
|
self.uimanager.show_groups = ['OSX']
|
||||||
self.uimanager.update_menu(init=True)
|
self.uimanager.update_menu(init=True)
|
||||||
|
|
||||||
if os.path.exists(os.path.join(DATA_DIR, "gramps.accel")):
|
if os.path.exists(os.path.join(DATA_DIR, "gramps.accel")):
|
||||||
|
@ -135,7 +135,7 @@ class UIManager():
|
|||||||
self.builder = None
|
self.builder = None
|
||||||
self.toolbar = None
|
self.toolbar = None
|
||||||
self.action_groups = [] # current list of action groups
|
self.action_groups = [] # current list of action groups
|
||||||
self.show_groups = ['RW', 'RO'] # groups to show at the moment
|
self.show_groups = [] # groups to show at the moment
|
||||||
self.accel_dict = {} # used to store accel overrides from file
|
self.accel_dict = {} # used to store accel overrides from file
|
||||||
|
|
||||||
def update_menu(self, init=False):
|
def update_menu(self, init=False):
|
||||||
|
@ -108,17 +108,6 @@ from .managedwindow import ManagedWindow
|
|||||||
# Constants
|
# Constants
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# if is_quartz():
|
|
||||||
# try:
|
|
||||||
# import gi
|
|
||||||
# gi.require_version('GtkosxApplication', '1.0')
|
|
||||||
# from gi.repository import GtkosxApplication as QuartzApp
|
|
||||||
# _GTKOSXAPPLICATION = True
|
|
||||||
# except:
|
|
||||||
# print("Failed to import gtk_osxapplication")
|
|
||||||
# _GTKOSXAPPLICATION = False
|
|
||||||
# else:
|
|
||||||
# _GTKOSXAPPLICATION = False
|
|
||||||
|
|
||||||
_UNSUPPORTED = ("Unsupported", _("Unsupported"))
|
_UNSUPPORTED = ("Unsupported", _("Unsupported"))
|
||||||
|
|
||||||
@ -169,9 +158,6 @@ class ViewManager(CLIManager):
|
|||||||
the view categories are accessible in the sidebar.
|
the view categories are accessible in the sidebar.
|
||||||
"""
|
"""
|
||||||
CLIManager.__init__(self, dbstate, setloader=False, user=user)
|
CLIManager.__init__(self, dbstate, setloader=False, user=user)
|
||||||
# if _GTKOSXAPPLICATION:
|
|
||||||
# self.macapp = QuartzApp.Application()
|
|
||||||
# self.macapp.set_use_quartz_accelerators(False)
|
|
||||||
|
|
||||||
self.view_category_order = view_category_order
|
self.view_category_order = view_category_order
|
||||||
self.app = app
|
self.app = app
|
||||||
@ -203,8 +189,6 @@ class ViewManager(CLIManager):
|
|||||||
uistate=self.uistate,
|
uistate=self.uistate,
|
||||||
dbstate=self.dbstate)
|
dbstate=self.dbstate)
|
||||||
self.__connect_signals()
|
self.__connect_signals()
|
||||||
# if _GTKOSXAPPLICATION:
|
|
||||||
# self.macapp.ready()
|
|
||||||
|
|
||||||
self.do_reg_plugins(self.dbstate, self.uistate)
|
self.do_reg_plugins(self.dbstate, self.uistate)
|
||||||
#plugins loaded now set relationship class
|
#plugins loaded now set relationship class
|
||||||
@ -352,31 +336,34 @@ class ViewManager(CLIManager):
|
|||||||
"""
|
"""
|
||||||
self.window.connect('delete-event', self.quit)
|
self.window.connect('delete-event', self.quit)
|
||||||
self.notebook.connect('switch-page', self.view_changed)
|
self.notebook.connect('switch-page', self.view_changed)
|
||||||
# if _GTKOSXAPPLICATION:
|
|
||||||
# self.macapp.connect('NSApplicationWillTerminate', self.quit)
|
|
||||||
|
|
||||||
def __init_lists(self):
|
def __init_lists(self):
|
||||||
"""
|
"""
|
||||||
Initialize the actions lists for the UIManager
|
Initialize the actions lists for the UIManager
|
||||||
"""
|
"""
|
||||||
|
self._app_actionlist = [
|
||||||
|
('quit', self.quit, "<PRIMARY>q"),
|
||||||
|
('preferences', self.preferences_activate),
|
||||||
|
('about', self.display_about_box), ]
|
||||||
|
|
||||||
self._file_action_list = [
|
self._file_action_list = [
|
||||||
#('FileMenu', None, _('_Family Trees')),
|
#('FileMenu', None, _('_Family Trees')),
|
||||||
('Open', self.__open_activate, "<PRIMARY>o"),
|
('Open', self.__open_activate, "<PRIMARY>o"),
|
||||||
#('OpenRecent'_("Open an existing database")),
|
#('OpenRecent'_("Open an existing database")),
|
||||||
('Quit', self.quit, "<PRIMARY>q"),
|
#('quit', self.quit, "<PRIMARY>q"),
|
||||||
#('ViewMenu', None, _('_View')),
|
#('ViewMenu', None, _('_View')),
|
||||||
('Navigator', self.navigator_toggle, "<PRIMARY>m",
|
('Navigator', self.navigator_toggle, "<PRIMARY>m",
|
||||||
self.show_navigator),
|
self.show_navigator),
|
||||||
('Toolbar', self.toolbar_toggle, '', self.show_toolbar),
|
('Toolbar', self.toolbar_toggle, '', self.show_toolbar),
|
||||||
('Fullscreen', self.fullscreen_toggle, "F11", self.fullscreen),
|
('Fullscreen', self.fullscreen_toggle, "F11", self.fullscreen),
|
||||||
#('EditMenu', None, _('_Edit')),
|
#('EditMenu', None, _('_Edit')),
|
||||||
('Preferences', self.preferences_activate),
|
#('preferences', self.preferences_activate),
|
||||||
#('HelpMenu', None, _('_Help')),
|
#('HelpMenu', None, _('_Help')),
|
||||||
('HomePage', home_page_activate),
|
('HomePage', home_page_activate),
|
||||||
('MailingLists', mailing_lists_activate),
|
('MailingLists', mailing_lists_activate),
|
||||||
('ReportBug', report_bug_activate),
|
('ReportBug', report_bug_activate),
|
||||||
('ExtraPlugins', extra_plugins_activate),
|
('ExtraPlugins', extra_plugins_activate),
|
||||||
('About', self.display_about_box),
|
#('about', self.display_about_box),
|
||||||
('PluginStatus', self.__plugin_status),
|
('PluginStatus', self.__plugin_status),
|
||||||
('FAQ', faq_activate),
|
('FAQ', faq_activate),
|
||||||
('KeyBindings', key_bindings),
|
('KeyBindings', key_bindings),
|
||||||
@ -653,20 +640,8 @@ class ViewManager(CLIManager):
|
|||||||
'Undo', self._undo_action_list, sensitive=False)
|
'Undo', self._undo_action_list, sensitive=False)
|
||||||
self.redoactions = self.__init_action_group(
|
self.redoactions = self.__init_action_group(
|
||||||
'Redo', self._redo_action_list, sensitive=False)
|
'Redo', self._redo_action_list, sensitive=False)
|
||||||
|
self.appactions = ActionGroup('AppActions', self._app_actionlist, 'app')
|
||||||
# def __attach_menubar(self, vbox):
|
self.uimanager.insert_action_group(self.appactions, gio_group=self.app)
|
||||||
# """
|
|
||||||
# Attach the menubar
|
|
||||||
# """
|
|
||||||
# vbox.pack_start(self.menubar, False, True, 0)
|
|
||||||
# if _GTKOSXAPPLICATION:
|
|
||||||
# self.menubar.hide()
|
|
||||||
# quit_item = self.uimanager.get_widget("Quit")
|
|
||||||
# about_item = self.uimanager.get_widget("About")
|
|
||||||
# prefs_item = self.uimanager.get_widget("Preferences")
|
|
||||||
# self.macapp.set_menu_bar(self.menubar)
|
|
||||||
# self.macapp.insert_app_menu_item(about_item, 0)
|
|
||||||
# self.macapp.insert_app_menu_item(prefs_item, 1)
|
|
||||||
|
|
||||||
def preferences_activate(self, *obj):
|
def preferences_activate(self, *obj):
|
||||||
"""
|
"""
|
||||||
@ -864,8 +839,6 @@ class ViewManager(CLIManager):
|
|||||||
Gtk.main_iteration()
|
Gtk.main_iteration()
|
||||||
|
|
||||||
self.uimanager.update_menu()
|
self.uimanager.update_menu()
|
||||||
# if _GTKOSXAPPLICATION:
|
|
||||||
# self.macapp.sync_menubar()
|
|
||||||
|
|
||||||
while Gtk.events_pending():
|
while Gtk.events_pending():
|
||||||
Gtk.main_iteration()
|
Gtk.main_iteration()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user