mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the dict a map of panel enum items since we cant guarantee that translated names are unique
This commit is contained in:
parent
64a31a1efb
commit
d3803affa0
@ -74,17 +74,12 @@ class LayoutActions(InterfaceAction):
|
|||||||
for name in self.gui.button_order:
|
for name in self.gui.button_order:
|
||||||
self.set_visible(Panel(name), show=True)
|
self.set_visible(Panel(name), show=True)
|
||||||
|
|
||||||
def button_names(self):
|
def panel_titles(self):
|
||||||
'''
|
'''
|
||||||
Return a dictionary of translated panel names to its Panel enum. This
|
Return a dictionary of Panel Enum items to translated human readable title.
|
||||||
simplifies building dialogs, for example combo boxes of all the panel
|
Simplifies building dialogs, for example combo boxes of all the panel
|
||||||
names or check boxes for each panel. You can also use the dict
|
names or check boxes for each panel.
|
||||||
to find the translated names of particular panels, easier after
|
|
||||||
inverting it with dict(map(reversed, instance.button_names().items()))
|
|
||||||
|
|
||||||
:return: {panel_name: Panel_enum_value, ...}
|
:return: {Panel_enum_value: human readable title, ...}
|
||||||
'''
|
'''
|
||||||
names = {}
|
return {p: self._button_from_enum(p).label for p in Panel}
|
||||||
for p in Panel:
|
|
||||||
names[self._button_from_enum(p).label] = p
|
|
||||||
return names
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user