def onDelete(self, win, event): """ Use our own quit sequence, that will itself destroy the window """ import modules win.hide() modules.postQuitMsg() return True
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()
def onDelete(win, event): """ Use our own quit sequence, that will itself destroy the window """ win.hide() modules.postQuitMsg() return True
def Quit(self): """ Makes the media player exit """ modules.postQuitMsg()