def _category_translate(self, catname): """ helper that will look into the categories we got from the parser and returns the translated name if it find it, otherwise it resorts to plain gettext """ # look into parsed categories that use .directory translation for cat in self.all_categories: if cat.untranslated_name == catname: return cat.name # try normal translation first translated_catname = _(catname) if translated_catname == catname: # if no normal translation is found, try to find a escaped # translation (LP: #872760) translated_catname = _(GObject.markup_escape_text(catname)) # the parent expect the string unescaped translated_catname = unescape(translated_catname) return translated_catname
def navigate_to(self): """ navigate to the view that corresponds to this NavigationItem """ global in_replay_history_mode in_replay_history_mode = True available_pane = self.available_pane available_pane.apps_category = self.apps_category available_pane.apps_subcategory = self.apps_subcategory available_pane.apps_search_term = self.apps_search_term available_pane.searchentry.set_text(self.apps_search_term) available_pane.searchentry.set_position(-1) available_pane.app_details.show_app(self.current_app) nav_bar = self.available_pane.navigation_bar nav_bar.remove_all(do_callback=False) for part in self.parts[1:]: nav_bar.add_with_id(unescape(part.label), part.callback, part.get_name(), do_callback=False, animate=False) gobject.idle_add(self._update_available_pane_cb, nav_bar) in_replay_history_mode = False