mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression that broke customizing toolbars on non English calibre installs
This commit is contained in:
parent
b715e71fce
commit
231e8aeca3
@ -17,10 +17,10 @@ from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||
|
||||
class FakeAction(object):
|
||||
|
||||
def __init__(self, name, icon, tooltip=None,
|
||||
def __init__(self, name, gui_name, icon, tooltip=None,
|
||||
dont_add_to=frozenset([]), dont_remove_from=frozenset([])):
|
||||
self.name = name
|
||||
self.action_spec = (name, icon, tooltip, None)
|
||||
self.action_spec = (gui_name, icon, tooltip, None)
|
||||
self.dont_remove_from = dont_remove_from
|
||||
self.dont_add_to = dont_add_to
|
||||
|
||||
@ -28,17 +28,18 @@ class BaseModel(QAbstractListModel):
|
||||
|
||||
def name_to_action(self, name, gui):
|
||||
if name == 'Donate':
|
||||
return FakeAction(_('Donate'), 'donate.png',
|
||||
return FakeAction('Donate', _('Donate'), 'donate.png',
|
||||
dont_add_to=frozenset(['context-menu',
|
||||
'context-menu-device']))
|
||||
if name == 'Location Manager':
|
||||
return FakeAction(_('Location Manager'), None,
|
||||
return FakeAction('Location Manager', _('Location Manager'), 'reader.png',
|
||||
_('Switch between library and device views'),
|
||||
dont_add_to=frozenset(['menubar', 'toolbar',
|
||||
'toolbar-child', 'context-menu',
|
||||
'context-menu-device']))
|
||||
if name is None:
|
||||
return FakeAction('--- '+_('Separator')+' ---', None,
|
||||
return FakeAction('--- '+('Separator')+' ---',
|
||||
'--- '+_('Separator')+' ---', None,
|
||||
dont_add_to=frozenset(['menubar', 'menubar-device']))
|
||||
try:
|
||||
return gui.iactions[name]
|
||||
@ -314,7 +315,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
if not pref_in_toolbar and not pref_in_menubar:
|
||||
self.models['menubar'][1].add(['Preferences'])
|
||||
if not lm_in_toolbar and not lm_in_menubar:
|
||||
self.models['menubar-device'][1].add(['Location Manager'])
|
||||
m = self.models['toolbar-device'][1]
|
||||
m.add(['Location Manager'])
|
||||
m.move(m.index(m.rowCount(None)-1), 5-m.rowCount(None))
|
||||
|
||||
# Save data.
|
||||
for am, cm in self.models.values():
|
||||
|
Loading…
x
Reference in New Issue
Block a user