Fix #743701 (Untranslated texts)

This commit is contained in:
Kovid Goyal 2011-03-27 20:00:02 -06:00
parent 6e80c5f200
commit cec36461bd

View File

@ -71,11 +71,11 @@ class Category(QWidget): # {{{
plugin_activated = pyqtSignal(object) plugin_activated = pyqtSignal(object)
def __init__(self, name, plugins, parent=None): def __init__(self, name, plugins, gui_name, parent=None):
QWidget.__init__(self, parent) QWidget.__init__(self, parent)
self._layout = QVBoxLayout() self._layout = QVBoxLayout()
self.setLayout(self._layout) self.setLayout(self._layout)
self.label = QLabel(name) self.label = QLabel(gui_name)
self.sep = QFrame(self) self.sep = QFrame(self)
self.bf = QFont() self.bf = QFont()
self.bf.setBold(True) self.bf.setBold(True)
@ -118,12 +118,17 @@ class Browser(QScrollArea): # {{{
QScrollArea.__init__(self, parent) QScrollArea.__init__(self, parent)
self.setWidgetResizable(True) self.setWidgetResizable(True)
category_map = {} category_map, category_names = {}, {}
for plugin in preferences_plugins(): for plugin in preferences_plugins():
if plugin.category not in category_map: if plugin.category not in category_map:
category_map[plugin.category] = plugin.category_order category_map[plugin.category] = plugin.category_order
if category_map[plugin.category] < plugin.category_order: if category_map[plugin.category] < plugin.category_order:
category_map[plugin.category] = plugin.category_order category_map[plugin.category] = plugin.category_order
if plugin.category not in category_names:
category_names[plugin.category] = (plugin.gui_category if
plugin.gui_category else plugin.category)
self.category_names = category_names
categories = list(category_map.keys()) categories = list(category_map.keys())
categories.sort(cmp=lambda x, y: cmp(category_map[x], category_map[y])) categories.sort(cmp=lambda x, y: cmp(category_map[x], category_map[y]))
@ -145,7 +150,7 @@ class Browser(QScrollArea): # {{{
self.setWidget(self.container) self.setWidget(self.container)
for name, plugins in self.category_map.items(): for name, plugins in self.category_map.items():
w = Category(name, plugins, self) w = Category(name, plugins, self.category_names[name], parent=self)
self.widgets.append(w) self.widgets.append(w)
self._layout.addWidget(w) self._layout.addWidget(w)
w.plugin_activated.connect(self.show_plugin.emit) w.plugin_activated.connect(self.show_plugin.emit)