Ejemplo n.º 1
0
    def update_menu(self):
        menu_items = []
        if Player.is_paused():
            pixbuf_group = self.get_pixbuf_group("play")
            status_label = _("Play")
        else:
            pixbuf_group = self.get_pixbuf_group("pause")
            status_label = _("Pause")
        menu_items.append((pixbuf_group, status_label, Player.playpause))
        menu_items.append((self.get_pixbuf_group("previous"), _("Previous"), Player.previous))
        menu_items.append((self.get_pixbuf_group("next"), _("Next"), Player.next))
        menu_items.append(None)
        menu_items.append((self.get_pixbuf_group("volume"), _("Volume"), self.get_volume_menu()))
        menu_items.append(None)

        if config.getboolean("lyrics", "status"):
            menu_items.append((None, _("Close Lyrics"), lambda: Dispatcher.close_lyrics()))
            menu_items.append((None, _("Search Lyrics"), lambda: Dispatcher.emit("search-lyrics")))
        else:
            menu_items.append((None, _("Show Lyrics"), lambda: Dispatcher.show_lyrics()))

        if config.getboolean("lyrics", "locked"):
            menu_items.append((self.get_pixbuf_group("unlock"), _("Unlock Lyrics"), lambda: Dispatcher.unlock_lyrics()))
        else:
            menu_items.append((self.get_pixbuf_group("lock"), _("Lock Lyrics"), lambda: Dispatcher.lock_lyrics()))

        menu_items.append(None)
        menu_items.append((self.get_pixbuf_group("setting"), _("Preferences"), lambda: Dispatcher.show_setting()))
        menu_items.append((self.get_pixbuf_group("close"), _("Quit"), lambda: Dispatcher.quit()))
        if self.menu is not None:
            del self.menu
        self.menu = Menu(menu_items, True)
Ejemplo n.º 2
0
 def _setup_menu(self):
     self._main_menu = gtk.Menu()
     self.add_menu_item("%s/%s" % (_("显示"), _("隐藏")), lambda obj: self.instance.toggle_visible())
     self.add_separator_item()
     self.add_menu_item("%s/%s" % (_("Play"), _("Pause")), lambda obj: Dispatcher.quit())
     self.add_menu_item(_("Previous"), lambda obj: Player.previous())
     self.add_menu_item(_("Next"), lambda obj: Player.next())
     self.add_separator_item()
     self.add_menu_item(_("Show Lyrics"), lambda obj: Dispatcher.show_lyrics())
     self.add_menu_item(_("Unlock Lyrics"), lambda obj: Dispatcher.unlock_lyrics())
     self.add_separator_item()        
     self.add_menu_item(_("Preferences"), lambda obj: Dispatcher.show_setting())
     self.add_menu_item(_("Quit"), lambda obj: Dispatcher.quit())
     self._main_menu.show_all()
Ejemplo n.º 3
0
    def update_menu(self):
        menu_items = []
        if Player.is_paused():
            pixbuf_group = self.get_pixbuf_group("play")
            status_label = _("Play")
        else:
            pixbuf_group = self.get_pixbuf_group("pause")
            status_label = _("Pause")
        menu_items.append((pixbuf_group, status_label, Player.playpause))
        menu_items.append((self.get_pixbuf_group("previous"), _("Previous"),
                           Player.previous))
        menu_items.append(
            (self.get_pixbuf_group("next"), _("Next"), Player.next))
        menu_items.append(None)
        menu_items.append((self.get_pixbuf_group("volume"), _("Volume"),
                           self.get_volume_menu()))
        menu_items.append(None)

        if config.getboolean("lyrics", "status"):
            menu_items.append(
                (None, _("Close Lyrics"), lambda: Dispatcher.close_lyrics()))
            menu_items.append((None, _("Search Lyrics"),
                               lambda: Dispatcher.emit("search-lyrics")))
        else:
            menu_items.append(
                (None, _("Show Lyrics"), lambda: Dispatcher.show_lyrics()))

        if config.getboolean("lyrics", "locked"):
            menu_items.append(
                (self.get_pixbuf_group("unlock"), _("Unlock Lyrics"),
                 lambda: Dispatcher.unlock_lyrics()))
        else:
            menu_items.append((self.get_pixbuf_group("lock"), _("Lock Lyrics"),
                               lambda: Dispatcher.lock_lyrics()))

        menu_items.append(None)
        menu_items.append((self.get_pixbuf_group("setting"), _("Preferences"),
                           lambda: Dispatcher.show_setting()))
        menu_items.append((self.get_pixbuf_group("close"), _("Quit"),
                           lambda: Dispatcher.quit()))
        if self.menu is not None:
            del self.menu
        self.menu = Menu(menu_items, True)
Ejemplo n.º 4
0
 def _setup_menu(self):
     self._main_menu = gtk.Menu()
     self.add_menu_item("%s/%s" % (_("显示"), _("隐藏")),
                        lambda obj: self.instance.toggle_visible())
     self.add_separator_item()
     self.add_menu_item("%s/%s" % (_("Play"), _("Pause")),
                        lambda obj: Dispatcher.quit())
     self.add_menu_item(_("Previous"), lambda obj: Player.previous())
     self.add_menu_item(_("Next"), lambda obj: Player.next())
     self.add_separator_item()
     self.add_menu_item(_("Show Lyrics"),
                        lambda obj: Dispatcher.show_lyrics())
     self.add_menu_item(_("Unlock Lyrics"),
                        lambda obj: Dispatcher.unlock_lyrics())
     self.add_separator_item()
     self.add_menu_item(_("Preferences"),
                        lambda obj: Dispatcher.show_setting())
     self.add_menu_item(_("Quit"), lambda obj: Dispatcher.quit())
     self._main_menu.show_all()
Ejemplo n.º 5
0
 def get_lyrics_menu_items(self):
     if config.getboolean("lyrics", "status"):
         return (None, _("Hide Lyrics"), lambda: Dispatcher.close_lyrics())
     else:
         return (None, _("Show Lyrics"), lambda: Dispatcher.show_lyrics())
Ejemplo n.º 6
0
def change_lyrics_status():        
    if config.getboolean("lyrics", "status"):
        Dispatcher.close_lyrics()
    else:    
        Dispatcher.show_lyrics()
Ejemplo n.º 7
0
def change_lyrics_status():
    if config.getboolean("lyrics", "status"):
        Dispatcher.close_lyrics()
    else:
        Dispatcher.show_lyrics()
Ejemplo n.º 8
0
 def change_lyrics_status(self, widget):    
     if self.signal_auto:
         if widget.get_active():
             Dispatcher.show_lyrics()
         else:    
             Dispatcher.close_lyrics()
Ejemplo n.º 9
0
 def change_lyrics_status(self, widget):    
     if self.signal_auto:
         if widget.get_active():
             Dispatcher.show_lyrics()
         else:    
             Dispatcher.close_lyrics()
Ejemplo n.º 10
0
 def get_lyrics_menu_items(self):    
     if config.getboolean("lyrics", "status"):
         return (None, _("Hide Lyrics"), lambda : Dispatcher.close_lyrics())
     else:    
         return (None, _("Show Lyrics"), lambda : Dispatcher.show_lyrics())