Exemple #1
0
    def icon_change(self, state):
        """
        Depending on the specific state of the program
        the play button's icon will vary
        """
        icons = MyIcons()
        if state == "play":
            icon = icons.icon("pause")
            tray = QIcon(":/application/app.png")
        elif state == "pause":            
            icon = icons.icon("play")
            tray = QIcon(":/application/paused.png")

        self.ui.play_bttn.setIcon(icon)
        self.ui.tray_icon.setIcon(tray)
Exemple #2
0
 def __create_tray_menu(self):
     """
     The tray menu contains shortcuts to features
     in the main UI
     """
     icons = MyIcons()
     quit_action = QAction(icons.icon("quit"), "&Quit", self.ui)
     self.ui.play_action = QAction(icons.icon("play"), "&Play", self.ui)
     next_action = QAction(icons.icon("next"), "&Next", self.ui)
     prev_action = QAction(icons.icon("back"), "&Previous", self.ui)
     stop_action = QAction(icons.icon("stop"), "&Stop", self.ui)
     
     self.ui.play_action.setCheckable(True)
     self.ui.view_action = QAction("&Visible", self.ui)
     self.ui.view_action.setCheckable(True)
     self.ui.view_action.setChecked(True)
     tray_menu = QMenu(self.ui)
     tray_menu.addAction(QIcon(":/application/app.png"), "Gereqi")
     tray_menu.addSeparator()
     tray_menu.addAction(prev_action)
     tray_menu.addAction(self.ui.play_action)
     tray_menu.addAction(stop_action)
     tray_menu.addAction(next_action)
     tray_menu.addSeparator()
     tray_menu.addAction(self.ui.view_action)
     tray_menu.addAction(quit_action)
     self.ui.tray_icon = QSystemTrayIcon(self.ui)
     self.ui.tray_icon.setIcon(QIcon(":/application/paused.png"))
     self.ui.tray_icon.setContextMenu(tray_menu)
     self.ui.tray_icon.setToolTip("Stopped")    
     
     self.ui.play_action.toggled.connect(self.ui.play_bttn.setChecked)
     self.ui.view_action.toggled.connect(self.ui.minimise_to_tray)
     self.ui.tray_icon.activated.connect(self.ui.tray_event)
     next_action.triggered.connect(self.ui.next_bttn.click)
     prev_action.triggered.connect(self.ui.prev_bttn.click)
     stop_action.triggered.connect(self.ui.stop_bttn.click)
     quit_action.triggered.connect(self.ui.shutdown)     
Exemple #3
0
 def __setup_misc(self):
     """
     Extra __init__ things to add to the UI
     """
     icons = MyIcons()
     self.ui.stat_lbl = QLabel("Finished")
     self.ui.stat_prog = QProgressBar()
     
     self.ui.stat_prog.setRange(0, 100)
     self.ui.stat_prog.setValue(100)
     self.ui.stat_prog.setMaximumSize(QSize(100, 18))
     
     
     self.ui.stat_bttn = QToolButton()
     self.ui.stat_bttn.setIcon(icons.icon("quit"))
     self.ui.stat_bttn.setAutoRaise(True)
     self.ui.stat_bttn.setEnabled(False)
     
     self.ui.play_type_bttn = QToolButton()  
     self.ui.play_type_bttn.setCheckable(True)
     self.ui.play_type_bttn.setAutoRaise(True)
     self.ui.play_type_bttn.setIcon(QIcon(":/application/normal.png"))
     
     self.ui.statusBar.addPermanentWidget(self.ui.stat_lbl)
     self.ui.statusBar.addPermanentWidget(self.ui.stat_prog)
     self.ui.statusBar.addPermanentWidget(self.ui.stat_bttn)
     self.ui.statusBar.addPermanentWidget(self.ui.play_type_bttn)
   
     # Disables the webView link-clicks as we want to manually handle them
     self.ui.info_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
     self.ui.wiki_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
     self.ui.info_view.setRenderHint(QPainter.HighQualityAntialiasing)
     
     self.ui.progress_sldr = Phonon.SeekSlider(self.ui)
     self.ui.progress_sldr.setIconVisible(False)
     self.ui.progressLayout.insertWidget(0, self.ui.progress_sldr)