def __add_bindings(self): # file_save_ctrl self.fsc = control.FileChooserCtrl(self) self.Bind(wx.EVT_BUTTON, self.fsc.load_file, self.file_open_button) self.Bind(wx.EVT_BUTTON, self.fsc.save_file, self.save_button) # record_button_ctrl self.rbc = control.RecordCtrl() self.Bind(wx.EVT_TOGGLEBUTTON, self.rbc.action, self.record_button) # play_button_ctrl self.pbc = control.PlayCtrl() self.Bind(wx.EVT_TOGGLEBUTTON, self.pbc.action, self.play_button) # Handle the event returned after a playback has completed self.Bind(self.pbc.EVT_THREAD_END, self.on_thread_end) # compile_button_ctrl self.Bind(wx.EVT_BUTTON, control.CompileCtrl.compile, self.compile_button) # help_button_ctrl self.Bind(wx.EVT_BUTTON, control.HelpCtrl.action, self.help_button) # settings_button_ctrl self.Bind(wx.EVT_BUTTON, self.on_settings_click, self.settings_button) self.sc = control.SettingsCtrl(self) self.Bind(wx.EVT_CLOSE, self.on_close_dialog) # Handle keyboard shortcuts self.panel.Bind(wx.EVT_KEY_UP, self.on_key_press) self.panel.SetFocus()
def settings_popup(self): """Build the popup menu.""" menu = wx.Menu() # Replay fast ps = menu.Append(wx.ID_ANY, self.settings_text[0]) self.Bind(wx.EVT_MENU, control.SettingsCtrl.playback_speed, ps) ps.Enable(False) # Infinite Playback cp = menu.AppendCheckItem(wx.ID_ANY, self.settings_text[1]) status = settings.CONFIG.getboolean('DEFAULT', 'Infinite Playback') cp.Check(status) self.Bind(wx.EVT_MENU, control.SettingsCtrl.infinite_playback, cp) # Repeat count self.Bind(wx.EVT_MENU, control.SettingsCtrl.repeat_count, menu.Append(wx.ID_ANY, self.settings_text[2])) menu.AppendSeparator() # Recording hotkey self.Bind(wx.EVT_MENU, control.SettingsCtrl.recording_hotkey, menu.Append(wx.ID_ANY, self.settings_text[3])) # Playback hotkey self.Bind(wx.EVT_MENU, control.SettingsCtrl.playback_hotkey, menu.Append(wx.ID_ANY, self.settings_text[4])) menu.AppendSeparator() # Always on top aot = menu.AppendCheckItem(wx.ID_ANY, self.settings_text[5]) status = settings.CONFIG.getboolean('DEFAULT', 'Always On Top') aot.Check(status) sc = control.SettingsCtrl(self) self.Bind(wx.EVT_MENU, sc.always_on_top, aot) # Language submenu = wx.Menu() # Workaround for users of the previous version current_lang = "en" try: current_lang = settings.CONFIG.get('DEFAULT', 'Language') except: pass for language in os.listdir(os.path.join(self.path, "lang")): lang_item = submenu.AppendRadioItem(wx.ID_ANY, language) self.Bind(wx.EVT_MENU, sc.language, lang_item) if language == current_lang: lang_item.Check(True) menu.AppendSubMenu(submenu, self.settings_text[6]) # About self.Bind(wx.EVT_MENU, self.on_about, menu.Append(wx.ID_ABOUT, self.settings_text[7])) # Exit self.Bind(wx.EVT_MENU, self.on_close_dialog, menu.Append(wx.ID_ANY, self.settings_text[8])) return menu
def settings_popup(self): menu = wx.Menu() # Replay fast ps = menu.Append(wx.ID_ANY, SETTINGS_TEXT[0]) self.Bind(wx.EVT_MENU, control.SettingsCtrl.playback_speed, ps) ps.Enable(False) # Infinite Playback cp = menu.AppendCheckItem(wx.ID_ANY, SETTINGS_TEXT[1]) status = utils.CONFIG.getboolean('DEFAULT', 'Infinite Playback') cp.Check(status) self.Bind(wx.EVT_MENU, control.SettingsCtrl.infinite_playback, cp) # Repeat count self.Bind(wx.EVT_MENU, control.SettingsCtrl.repeat_count, menu.Append(wx.ID_ANY, SETTINGS_TEXT[2])) menu.AppendSeparator() # Recording hotkey self.Bind(wx.EVT_MENU, control.SettingsCtrl.recording_hotkey, menu.Append(wx.ID_ANY, SETTINGS_TEXT[3])) # Playback hotkey self.Bind(wx.EVT_MENU, control.SettingsCtrl.playback_hotkey, menu.Append(wx.ID_ANY, SETTINGS_TEXT[4])) menu.AppendSeparator() # Always on top aot = menu.AppendCheckItem(wx.ID_ANY, SETTINGS_TEXT[5]) status = utils.CONFIG.getboolean('DEFAULT', 'Always On Top') aot.Check(status) sc = control.SettingsCtrl(self) self.Bind(wx.EVT_MENU, sc.always_on_top, aot) # ABout self.Bind(wx.EVT_MENU, self.on_about, menu.Append(wx.ID_ABOUT, SETTINGS_TEXT[6])) # Exit self.Bind(wx.EVT_MENU, self.on_close_dialog, menu.Append(wx.ID_ANY, SETTINGS_TEXT[7])) return menu