def handle_button_action(self, name, sender): BUTTON_PREFIX = 'button_' INFO_PREFIX = 'info_' if name == 'button_start_speech': speech.say(sample_text.get_sample_text(), 'de', 1.0 * self.conf.rechtschreibung.speech_speed / 100.0) elif name == 'button_stop_speech': speech.stop() elif name == 'button_load_mode': self.load_mode_start(LOAD_MODE_RULESET) elif name == 'button_load_reference_mode': self.load_mode_start(LOAD_MODE_REFERENCE) elif name == 'button_save_mode': self.save_mode_start() elif name == 'button_open_app_control_view': self.open_app_control_view() elif name == 'button_open_top_navigation_view': self.open_top_navigation_view() elif name == 'button_open_statistics_view': self.open_statistics_view() elif name == 'button_close_top_navigation_view': self.close_top_navigation_view() elif name == 'button_icon_rechtschreibung': self.button_icon_rechtschreibung() elif name.startswith(BUTTON_PREFIX): view_name = name[len(BUTTON_PREFIX):] child_view = self.find_subview_by_name(view_name) if child_view != None: view = self.find_subview_by_name(NAME_NAVIGATION_VIEW) view.push_view(child_view) return 1 else: logger.warning("cannot find subview '%s" % view_name) elif name.startswith(INFO_PREFIX): info_name = name[len(INFO_PREFIX):] rule_info = self.rule_doc_manager.get_rule_info_by_attr_name(info_name) if rule_info: self.info_popup.present(rule_info, close_label=words.schlieszen(c=rulesets.C_BOS)) else: logger.error("cannot find info text for %s" % info_name) else: super(MainViewController, self).handle_button_action(name, sender)
def load_mode_start(self, load_mode_type): self.load_mode_type = load_mode_type self.selectModeVC.select( mode_manager.get_available_modes(), cancel_label=words.abbrechen(c=rulesets.C_BOS), close_label=words.schlieszen(c=rulesets.C_BOS), title = 'Regelsatz laden' if load_mode_type == LOAD_MODE_RULESET else 'Referenz laden')