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)
|
ans.append(n)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
def has_action(self, name):
|
||||||
|
for a in self._data:
|
||||||
|
if a.name == name:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class AllModel(BaseModel):
|
class AllModel(BaseModel):
|
||||||
|
|
||||||
@ -291,13 +297,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
def commit(self):
|
def commit(self):
|
||||||
# Ensure preferences are showing in either the toolbar or
|
# Ensure preferences are showing in either the toolbar or
|
||||||
# the menubar.
|
# the menubar.
|
||||||
pref_in_toolbar = lm_in_toolbar = False
|
pref_in_toolbar = self.models['toolbar'][1].has_action('Preferences')
|
||||||
cm = self.models['toolbar']
|
lm_in_toolbar = self.models['toolbar-device'][1].has_action('Location Manager')
|
||||||
for x in cm[1]._data:
|
|
||||||
if x.name == 'Preferences':
|
|
||||||
pref_in_toolbar = True
|
|
||||||
if x.name == 'Location Manager':
|
|
||||||
lm_in_toolbar = True
|
|
||||||
if not pref_in_toolbar:
|
if not pref_in_toolbar:
|
||||||
self.models['menubar'][1].add(['Preferences'])
|
self.models['menubar'][1].add(['Preferences'])
|
||||||
if not lm_in_toolbar:
|
if not lm_in_toolbar:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user