mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
2697f4d0ec
commit
360bc4df7c
@ -80,6 +80,12 @@ class BaseModel(QAbstractListModel):
|
||||
ans.append(n)
|
||||
return ans
|
||||
|
||||
def has_action(self, name):
|
||||
for a in self._data:
|
||||
if a.name == name:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class AllModel(BaseModel):
|
||||
|
||||
@ -291,13 +297,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
def commit(self):
|
||||
# Ensure preferences are showing in either the toolbar or
|
||||
# the menubar.
|
||||
pref_in_toolbar = lm_in_toolbar = False
|
||||
cm = self.models['toolbar']
|
||||
for x in cm[1]._data:
|
||||
if x.name == 'Preferences':
|
||||
pref_in_toolbar = True
|
||||
if x.name == 'Location Manager':
|
||||
lm_in_toolbar = True
|
||||
pref_in_toolbar = self.models['toolbar'][1].has_action('Preferences')
|
||||
lm_in_toolbar = self.models['toolbar-device'][1].has_action('Location Manager')
|
||||
if not pref_in_toolbar:
|
||||
self.models['menubar'][1].add(['Preferences'])
|
||||
if not lm_in_toolbar:
|
||||
|
Loading…
x
Reference in New Issue
Block a user