예제 #1
0
    def onDelete(self, win, event):
        """ Use our own quit sequence, that will itself destroy the window """
        import modules

        win.hide()
        modules.postQuitMsg()

        return True
예제 #2
0
    def onPopupMenu(self, statusIcon, button, time):
        """ The user asks for the popup menu """
        if self.popupMenu is None:
            wTree              = loadGladeFile('StatusIconMenu.ui')
            self.menuPlay      = wTree.get_object('item-play')
            self.menuStop      = wTree.get_object('item-stop')
            self.menuNext      = wTree.get_object('item-next')
            self.popupMenu     = wTree.get_object('menu-popup')
            self.menuPause     = wTree.get_object('item-pause')
            self.menuPrevious  = wTree.get_object('item-previous')
            self.menuSeparator = wTree.get_object('item-separator')
            # Connect handlers
            wTree.get_object('item-quit').connect('activate', lambda btn: modules.postQuitMsg())
            wTree.get_object('item-preferences').connect('activate', lambda btn: modules.showPreferences())
            self.menuPlay.connect('activate',     lambda btn: modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE))
            self.menuStop.connect('activate',     lambda btn: modules.postMsg(consts.MSG_CMD_STOP))
            self.menuNext.connect('activate',     lambda btn: modules.postMsg(consts.MSG_CMD_NEXT))
            self.menuPrevious.connect('activate', lambda btn: modules.postMsg(consts.MSG_CMD_PREVIOUS))
            self.menuPause.connect('activate',    lambda btn: modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE))
            self.popupMenu.show_all()

        # Enable only relevant menu entries
        self.menuStop.set_sensitive(self.isPlaying)
        self.menuNext.set_sensitive(self.isPlaying and self.trackHasNext)
        self.menuPause.set_sensitive(self.isPlaying and not self.isPaused)
        self.menuPrevious.set_sensitive(self.isPlaying and self.trackHasPrev)
        self.menuPlay.set_sensitive((not (self.isPlaying or self.emptyTracklist)) or self.isPaused)

        self.popupMenu.popup(None, None, gtk.status_icon_position_menu, button, time, statusIcon)
 def onInterrupt(window):
     """ Handler for interrupt signals e.g., Ctrl-C """
     window.hide()
     modules.postQuitMsg()
예제 #4
0
파일: pogo.py 프로젝트: johanson/pogo
 def onDelete(win, event):
     """ Use our own quit sequence, that will itself destroy the window """
     win.hide()
     modules.postQuitMsg()
     return True
예제 #5
0
 def Quit(self):
     """ Makes the media player exit """
     modules.postQuitMsg()
예제 #6
0
파일: DBus.py 프로젝트: csryan/pogo
 def Quit(self):
     """ Makes the media player exit """
     modules.postQuitMsg()