def __OnLinkClicked(self, event): tag = event.GetLinkInfo().GetHref() if linkfile.is_valid_external_link(tag): linkfile.execute_uri(tag) # check if we need to select a song elif tag.startswith('#song:'): song_nr = tag[6:] if song_nr: song = viewmgr.Get()._list.find_id(int(song_nr)) if song: viewmgr.signalSetSong(song) # check for execution of a link elif tag.startswith('#link:'): link_nr = tag[6:] if link_nr: link = linkmgt.Get().links.find_id(int(link_nr)) if link: linkfile.executelink(link) # check for execution of a tab elif tag.startswith('#tab:'): tab_nr = tag[5:] if tab_nr: song = viewmgr.Get()._selectedSong if song: tab = song.tabs.find_id(int(tab_nr)) if tab: # push the tab on the stack, and refresh the view self.stack.Push((PAGE_SONG_TAB, song, tab)) # check for execution of a command elif tag.startswith('#cmd:'): cmd = tag[5:] commands = { "status_practicing": lambda : self.__DoSetSongStatus(songs.SS_STARTED), "status_postponed": lambda : self.__DoSetSongStatus(songs.SS_POSTPONED), "status_completed": lambda : self.__DoSetSongStatus(songs.SS_COMPLETED), "edit_info": self.__DoShowEditInfo, "edit_lyrics": self.__DoShowEditLyrics, "enter_comment": self.__DoEnterComment, "edit_progress": self.__DoShowEditProgress, "show_lyrics": self.__DoShowLyrics, "show_info": self.__DoShowInfo, "reset_filter": lambda : viewmgr.signalResetFilter() } try: exec_func = commands[cmd] exec_func() except KeyError: wx.MessageBox("Command '%s' not implemented!" % (cmd,), 'Error', wx.ICON_ERROR | wx.OK)
def __OnTestFile(self, event): """ Handler of the test file button to execute the filename """ if self._currLink: linkfile.executelink(self._currLink)
def __OnExecuteLink(self, event): l = linkmgt.Get().links.find_id(event.GetData()) linkfile.executelink(l)