def __init__(self, component_manager): ReviewWidget.__init__(self, component_manager) self._main_widget = self.main_widget() self._review_controller = self.review_controller() self.renderer = self.component_manager.get_current('renderer') self.tts = None self.sndtext = None self.is_sound_card = False # create widgets self.page, self.question_container, self.answer_container, \ self.question_text, self.answer_text, self.grades_table, \ grades, buttons, self.tags_label = widgets.create_review_ui( \ self._main_widget.switcher) self.tts_button, self.edit_button, self.del_button = \ buttons[1], buttons[2], buttons[3] self.tts_available = tts.is_available() self.tts_button.set_sensitive(False) # connect signals self.question_text.connect('button-press-event', \ self.preview_sound_in_review_cb) self.answer_text.connect('button-press-event', self.get_answer_cb) for grade_button in grades: grade_button.connect('clicked', self.grade_cb) buttons[0].connect('clicked', self.statistics_card_cb) buttons[1].connect('clicked', self.speak_cb) buttons[2].connect('clicked', self.edit_card_cb) buttons[3].connect('clicked', self.delete_card_cb) buttons[4].connect('clicked', self.review_to_main_menu_cb)
def __init__(self, component_manager): ReviewWidget.__init__(self, component_manager) self.w_tree = self.main_widget().w_tree self.get_widget = get_widget = self.w_tree.get_widget self.w_tree.signal_autoconnect(dict([(sig, getattr(self, sig + "_cb")) \ for sig in ['review_to_main_menu', 'get_answer', 'grade', 'speak', \ 'delete_card', 'edit_card', 'preview_sound_in_review','add_card']])) self.next_is_image_card = False #Image card indicator self.sndtext = None self.tts = None self.renderer = self.component_manager.get_current('renderer') # Widgets as attributes self.edit_button = get_widget("review_toolbar_edit_card_button") self.del_button = get_widget("review_toolbar_delete_card_button") self.question_container = get_widget("question_container") self.answer_container = get_widget("answer_container") self.container_width = get_widget("question_text"). \ window.get_geometry()[2] self.question_text = get_widget("question_text") self.answer_text = get_widget("answer_text") self.sound_container = get_widget("review_mode_snd_container") self.sound_button = get_widget("review_mode_snd_button") self.grades_table = get_widget("grades_table") self.tts_button = get_widget("review_toolbar_tts_button") self.tts_available = tts.is_available() self.tts_button.set_sensitive(self.tts_available)