Beispiel #1
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()
Beispiel #2
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)
Beispiel #3
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()
Beispiel #4
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)
Beispiel #5
0
 def Quit(self):
     Dispatcher.quit()
     return "Successful command "