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 __SyncPageWithStack(self, page):
     """
     Sync the selection mechanism with the current stack page. Simply viewing 
     the previous or next page is not enough, if we look at a different
     song, the selection mechanism should kick in and show it
     """
     if page[0] == PAGE_SONG:
         viewmgr.signalSetSong(page[1])
     elif page[0] == PAGE_HOMEPAGE:
         viewmgr.signalSetSong(None)
     else:
         self.__OnRenderCurrPage()   # default   
 def __OnItemSelected(self, event):
     """ Select the song """
     song = viewmgr.Get()._list.find_id(event.GetData())
     viewmgr.signalSetSong(song)