def _setup_ui(self): '''add the widgets that will display the information of the extension category and the selected extension and widgets to display the extensions''' self.add_text(tr('Categories'), 0, 0, True) self.add_text(tr('Selected'), 0, 1, True) self.add_text('', 0, 2, True) self.add_text(tr('Name'), 0, 3, True) self.add_text(tr('Description'), 0, 4, True) self.add_text(tr('Author'), 0, 5, True) self.add_text(tr('Website'), 0, 6, True) self.add_label(self.name_info, 1, 3, True) self.add_label(self.description_info, 1, 4, True) self.add_label(self.author_info, 1, 5, True) self.add_label(self.website_info, 1, 6, True) self.add_button(tr('Redraw main screen'), 1, 7, self._on_redraw_main_screen) self.attach(self.categories_cmb, 1, 2, 0, 1) self.attach(self.extensions_cmb, 1, 2, 1, 2) categories = extension.get_multiextension_categories() for item in categories: log.info('category item: %s' % item) self.categories_cmb.addItem(item) self.categories_cmb.setCurrentIndex(0) self._on_category_changed(self.categories_cmb) self.categories_cmb.currentIndexChanged.connect( lambda text: self._on_category_changed(self.categories_cmb)) self.extensions_cmb.currentIndexChanged.connect( lambda text: self._on_extension_changed(self.extensions_cmb))
def _setup_ui(self): """add the widgets that will display the information of the extension category and the selected extension and widgets to display the extensions""" self.add_text(tr("Categories"), 0, 0, True) self.add_text(tr("Selected"), 0, 1, True) self.add_text("", 0, 2, True) self.add_text(tr("Name"), 0, 3, True) self.add_text(tr("Description"), 0, 4, True) self.add_text(tr("Author"), 0, 5, True) self.add_text(tr("Website"), 0, 6, True) self.add_label(self.name_info, 1, 3, True) self.add_label(self.description_info, 1, 4, True) self.add_label(self.author_info, 1, 5, True) self.add_label(self.website_info, 1, 6, True) self.add_button(tr("Redraw main screen"), 1, 7, self._on_redraw_main_screen) self.attach(self.categories_cmb, 1, 2, 0, 1) self.attach(self.extensions_cmb, 1, 2, 1, 2) categories = extension.get_multiextension_categories() for item in categories: log.info("category item: %s" % item) self.categories_cmb.addItem(item) self.categories_cmb.setCurrentIndex(0) self._on_category_changed(self.categories_cmb) self.categories_cmb.currentIndexChanged.connect(lambda text: self._on_category_changed(self.categories_cmb)) self.extensions_cmb.currentIndexChanged.connect(lambda text: self._on_extension_changed(self.extensions_cmb))
def on_update(self): '''called when changed to this page''' # empty categories combo model = self.categories_cmb.model().clear() # fill it again with available categories # this is done because a plugin may have changed them categories = extension.get_multiextension_categories() for item in categories: self.categories_cmb.addItems([item]) self.categories_cmb.setCurrentIndex(0)
def _add_categories_and_extensions_combos(self): """add the widgets to display the extensions""" categories = extension.get_multiextension_categories() for item in categories: self.categories.append_text(item) self.categories.connect("changed", self._on_category_changed) self.ext_id = self.extensions.connect("changed", self._on_extension_changed) self.attach(self.categories, 1, 2, 0, 1, yoptions=0) self.attach(self.extensions, 1, 2, 1, 2, yoptions=0) self.categories.set_active(0)
def on_update(self): '''called when changed to this page''' # empty categories combo model = self.categories.get_model() self.categories.set_model(None) model.clear() # fill it again with available categories # this is done because a plugin may have changed them categories = extension.get_multiextension_categories() for item in categories: model.append([item]) self.categories.set_model(model) self.categories.set_active(0)