def _on_select_sleep(self, *args): if self.sleep_timer is not None: gobject.source_remove(self.sleep_timer) try: index = hildonize.touch_selector( self.win, "Sleeptimer", self._sleepSelection, self._sleepSelectionIndex if 0 <= self._sleepSelectionIndex else 0, ) except RuntimeError: _moduleLogger.exception("Handling as if user cancelled") hildonize.show_information_banner(self.win, "Sleep timer canceled") index = 0 self._sleepSelectionIndex = index sleepName = self._sleepSelection[index] time_out = int(sleepName) if 0 < time_out: timeout_add_seconds(time_out * 60, self.sleep) if hildonize.IS_FREMANTLE_SUPPORTED: self.sleeptime_button.set_text("Sleeptimer", sleepName) else: self._sleepMenuItem.get_child().set_text("Sleeptimer: %s" % (sleepName,))
def _on_category_selector_clicked(self, *args): currenntIndex = unit_data.UNIT_CATEGORIES.index(self._selectedCategoryName) newIndex = hildonize.touch_selector( self._mainWindow, "Categories", unit_data.UNIT_CATEGORIES, currenntIndex, ) selectedCategoryName = unit_data.UNIT_CATEGORIES[newIndex] self._categorySelectionButton.get_child().set_markup("<big>%s</big>" % selectedCategoryName) self._switch_category(selectedCategoryName)
def _on_select_chapter(self, *args): if not self._chapterSelection: return index = hildonize.touch_selector( self.win, "Chapter", (self.__format_name(chapterPath) for chapterPath in self._chapterSelection), self._chapterSelectionIndex if 0 <= self._chapterSelectionIndex else 0, ) self._chapterSelectionIndex = index chapterName = self._chapterSelection[index] self.controller.set_chapter(chapterName) self.set_button_text("Play", "Start playing the audiobook") # reset button
def _on_category_selector_clicked(self, *args): try: currenntIndex = unit_data.UNIT_CATEGORIES.index(self._selectedCategoryName) newIndex = hildonize.touch_selector( self._mainWindow, "Categories", unit_data.UNIT_CATEGORIES, currenntIndex, ) selectedCategoryName = unit_data.UNIT_CATEGORIES[newIndex] self._categorySelectionButton.set_label(selectedCategoryName) self._categoryView.set_cursor(newIndex, self._categoryColumn, False) self._categoryView.grab_focus() except Exception: _moduleLogger.exception("_on_category_selector_clicked")
def _on_kb_plugin_selection_button(self, *args): pluginNames = [plugin["pluginName"] for plugin in self.__activeKeyboards] oldIndex = pluginNames.index(self.__pluginButton.get_label()) newIndex = hildonize.touch_selector(self._window, "Keyboards", pluginNames, oldIndex) self._set_plugin_kb(newIndex)