Example #1
0
 def __init__(self, parent=None):
     super().__init__()
     QSystemTrayIcon.__init__(self, parent)
     self.setIcon(QIcon('lightbulb.png'))
     self.setToolTip('Tray - Lights')
     self.menu = QMenu()
     self.initUI()
Example #2
0
    def __init__(self,
                 parent=None,
                 app_name="EnigmaCurry.com",
                 app_url="https://www.enigmacurry.com"):
        # Fix the app so Ctrl-C works : https://stackoverflow.com/a/1357015/56560
        signal.signal(signal.SIGINT, signal.SIG_DFL)
        notify_init(os.path.basename(__file__), 'glib')

        self._app_name = app_name
        self._app_url = app_url
        self._q_app = QApplication([])
        self._q_app.setQuitOnLastWindowClosed(False)

        QSystemTrayIcon.__init__(self, parent)
        self.setIcon(QIcon(pyinstaller_resource_path("icon.png")))
        self.show()
        self.activated.connect(self.onTrayIconActivated)

        menu = QMenu()
        open_action = QAction(QIcon("SP_ComputerIcon"), "Open App", menu)
        open_action.triggered.connect(self.open)
        menu.addAction(open_action)
        quit_action = QAction(QIcon("application-exit"), "&Exit", menu)
        quit_action.triggered.connect(self.quit)
        menu.addAction(quit_action)
        self.setContextMenu(menu)

        self._notifications = []
        self.notify("title", "hello")
Example #3
0
    def __init__(self, config, service, app, lang):
        self.lang = lang
        global _
        _ = self.lang.gettext

        QSystemTrayIcon.__init__(self)
        self.config = config
        self.service = service
        self.service.start()
        self.app = app
        self.setIcon(QIcon(autobrightness.ICON))
        self.setContextMenu(QMenu())

        settingsAction = self.contextMenu().addAction(_("Settings"))
        settingsAction.setObjectName("settings")
        settingsAction.triggered.connect(self.configWindow)

        logAction = self.contextMenu().addAction(_("Daemon logs"))
        logAction.setObjectName("logs")
        logAction.triggered.connect(self.logWindow)

        aboutAction = self.contextMenu().addAction(_("About"))
        aboutAction.setObjectName("about")
        aboutAction.triggered.connect(self.aboutWindow)

        quitAction = self.contextMenu().addAction(_("Quit"))
        quitAction.triggered.connect(self.quit)

        if not config.configFileExists():
            self.configWindow()
Example #4
0
    def __init__(self, mode, parent=None):
        self.parent = parent

        self.NVIDIA_ICON = QIcon.fromTheme(
            'nvidia', QIcon(os.path.join(ICON_PATH, 'nvidia.png')))
        self.INTEL_ICON = QIcon.fromTheme(
            'intel', QIcon(os.path.join(ICON_PATH, 'intel.png')))

        QSystemTrayIcon.__init__(
            self, self.NVIDIA_ICON if mode == NVIDIA else self.INTEL_ICON,
            self.parent)
        menu = QMenu(self.parent)

        self.setVisible(True)

        # Nvidia menu item bound to self.switch('nvidia')
        nvidia_action = menu.addAction(
            self.NVIDIA_ICON,
            "Switch to nvidia" if mode == INTEL else "Reload nvidia")
        nvidia_action.triggered.connect(partial(self.switch, NVIDIA))

        # Intel menu item bound to self.switch('intel')
        intel_action = menu.addAction(
            self.INTEL_ICON,
            "Switch to intel" if mode == NVIDIA else "Reload intel")
        intel_action.triggered.connect(partial(self.switch, INTEL))

        # Provide an easy menu item to close the "app"
        exit_action = menu.addAction("Exit")
        exit_action.triggered.connect(self.exit)

        # Set the menu and proper tooltip
        self.setContextMenu(menu)
        self.setToolTip('optimus-manager ({mode})'.format(mode=mode))
Example #5
0
    def __init__(self, icon, parent=None):
        """Constructor."""
        QSystemTrayIcon.__init__(self, icon, parent)

        self.config = Config()
        self.menu = None
        self._load_menu()
Example #6
0
    def __init__(self, parent=None):
        icon = QIcon(get_asset('icons/hdd-o.png'))
        QSystemTrayIcon.__init__(self, icon, parent)
        self.app = parent
        menu = QMenu()

        self.status = menu.addAction(self.app.scheduler.next_job)
        self.status.setEnabled(False)

        self.profile_menu = menu.addMenu('Backup Now')
        for profile in BackupProfileModel.select():
            new_item = self.profile_menu.addAction(profile.name)
            new_item.setData(profile.id)
            new_item.triggered.connect(lambda profile_id=profile.id: self.app.
                                       create_backup_action(profile_id))

        self.cancel_action = menu.addAction("Cancel Backup")
        self.cancel_action.triggered.connect(
            self.app.backup_cancelled_event.emit)
        self.cancel_action.setVisible(False)

        settings_action = menu.addAction("Settings")
        settings_action.triggered.connect(self.app.open_main_window_action)

        menu.addSeparator()

        exit_action = menu.addAction("Exit")
        exit_action.triggered.connect(self.app.quit)

        self.activated.connect(self.on_user_click)

        self.setContextMenu(menu)
        self.setVisible(True)
        self.show()
Example #7
0
    def __init__(self, parent, show, titles, settingsdir):
        QSystemTrayIcon.__init__(self, QIcon(":/icons/main.png"), parent)
        self.left_menu = LeftClickMenu()
        self.markers = ChapterMarkFile(show, titles, settingsdir)
        log.debug(self.markers)
        # left click
        self.activated.connect(self.left_click)

        # Right Click
        menu = QMenu(parent=None)
        self.setContextMenu(menu)

        settingAction = menu.addAction(QIcon(":/icons/save.png"),"save")
        settingAction.triggered.connect(self.save)

        settingAction = menu.addAction("---")

        settingAction = menu.addAction(QIcon(":/icons/main.png"), "Reset and Restart")
        settingAction.triggered.connect(self.reset)

        settingAction = menu.addAction(QIcon(":/icons/exit.png"),"exit")
        settingAction.triggered.connect(self.exit)

        manager = KeyBoardManager(self)
        manager.uSignal.connect(self.start_chaptermarks)
        manager.jSignal.connect(self.next_chapter)
        manager.start()
Example #8
0
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent)

        # set tray icon
        self.setIcon(QtGui.QIcon(self.configuration.main_window.icon_path))

        # double click event
        self.activated.connect(self.on_activated)

        # add right click menu
        menu = QMenu(parent)

        pause_action = menu.addAction(button_text_pause)
        pause_action.triggered.connect(self.on_pause_triggered)

        resume_action = menu.addAction(button_text_resume)
        resume_action.triggered.connect(self.on_resume_triggered)

        stop_all_action = menu.addAction(button_text_stop)
        stop_all_action.triggered.connect(self.on_stop_triggered)

        menu.addSeparator()

        show_action = menu.addAction(button_text_show)
        show_action.triggered.connect(self.show_triggered)

        exit_action = menu.addAction(button_text_exit)
        exit_action.triggered.connect(self.on_exit_triggered)

        self.setContextMenu(menu)
        self.show()
Example #9
0
 def __init__(self, icon, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     menu = QMenu(parent)
     exitAction = QAction('Exit', self)
     exitMenu = menu.addAction(exitAction)
     exitAction.triggered.connect(parent.close)
     self.setContextMenu(menu)
    def __init__(self, manager: Manager, icon, parent=None, testing=False) -> None:
        QSystemTrayIcon.__init__(self, icon, parent)
        self.setToolTip("ActivityWatch" + (" (testing)" if testing else ""))

        self.manager = manager
        self.testing = testing

        self._build_rootmenu()
    def __init__(self, icon, parent=None):

        QSystemTrayIcon.__init__(self, icon, parent)
        menu = QMenu(parent)
        exitAction = menu.addAction("Exit")
        self.setContextMenu(menu)

        menu.triggered.connect(self.exit)
 def __init__(self, icon, logger, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     DatabaseMonitor.__init__(self)
     menu = QMenu(parent)
     menu.setStyleSheet("* { background-color: black; color: #FFFFFF; } QMenu::item::selected {background-color: blue;}");
     self.menu_settings(menu)
     self.logger = logger
     self.update_icon()
Example #13
0
 def __init__(self, icon, app, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     self.app = app
     self.menu = QtWidgets.QMenu(None)
     # self.menu.aboutToShow.connect(self.app.thread.force_update)
     self.activated.connect(self.app.thread.force_update)
     self.setContextMenu(self.menu)
     self.build_menu()
Example #14
0
	def __init__(self, icon, parent=None):
		QSystemTrayIcon.__init__(self, icon, parent)
		self.parent = parent
		
		self.timer = QtCore.QTimer(self)
		self.timer.timeout.connect(self.update)
		self.timer.setSingleShot(True)
		
		self.update()
Example #15
0
    def __init__(self, icon, window, parent=None):
        QSystemTrayIcon.__init__(self, icon, parent)
        self.menu = QMenu(parent)
        self.window = window
        self.resolve = RemoteResolve(self.window)

        self.create_menu()

        self.setContextMenu(self.menu)
Example #16
0
 def __init__(self, app):
     self.icon = QIcon(resource_filename(__name__, "res/logo_small.png"))
     QSystemTrayIcon.__init__(self, self.icon, app)
     self.setToolTip("Your Vintel-Information-Service! :)")
     self.lastNotifications = {}
     self.setContextMenu(TrayContextMenu(self))
     self.showAlarm = True
     self.showRequest = True
     self.alarmDistance = 0
Example #17
0
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self)

        self.parent = parent

        self.signals = SignalManager(self)
        self.logger = Loggers(self.__class__.__name__)
        self.settings = Settings(SETTING_FILEPTH['app'], ST_FORMAT['ini'],
                                 self)
Example #18
0
 def __init__(self, state, parent=None):
     QSystemTrayIcon.__init__(self, QIcon('icon.png'), parent)
     menu = QMenu(parent)
     self.calibrate_action = menu.addAction("센서 조정")
     self.logout_action = menu.addAction("로그아웃")
     self.exit_action = menu.addAction("종료")
     self.setContextMenu(menu)
     menu.triggered.connect(self.action)
     self.login_changed(state.is_logged_in())
     state.loginChanged.connect(self.login_changed)
Example #19
0
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent)
        self.setIcon(QIcon.fromTheme("document-save"))

        self.right_menu = RightClickMenu()
        self.setContextMenu(self.right_menu)

        self.left_menu = LeftClickMenu()

        self.activated.connect(self.click_trap)
Example #20
0
 def __init__(self, icon, com, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     menu = QMenu(parent)
     showAction = menu.addAction("Mostrar")
     showAction.triggered.connect(self.show_action)
     exitAction = menu.addAction("Fechar")
     exitAction.triggered.connect(self.close_event)
     self.activated.connect(self.tray_activated)
     self.setContextMenu(menu)
     self.com = com
     self.show()
Example #21
0
 def __init__(self, icon, com, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     menu = QMenu(parent)
     showAction = menu.addAction("Mostrar")
     showAction.triggered.connect(self.show_action)
     exitAction = menu.addAction("Fechar")
     exitAction.triggered.connect(self.close_event)
     self.activated.connect(self.tray_activated)
     self.setContextMenu(menu)
     self.com = com
     self.show()
Example #22
0
 def __init__(self, icon, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     self.menu = QMenu(parent)
     self.hosts_menu = QMenu(self.menu)
     self.hosts_menu.setIcon(QIcon(get_image_path('host')))
     self.services_menu = QMenu(self.menu)
     self.services_menu.setIcon(QIcon(get_image_path('service')))
     self.qaction_factory = QActionFactory()
     self.alignak_status = None
     self.app_about = None
     self.synthesis = None
Example #23
0
    def __init__(self, parent=None):
        self.__is_inhibited = False
        self.__inhibited_icon = QIcon(":/checked.img")
        self.__non_inhibited_icon = QIcon(":/not_checked.img")

        QSystemTrayIcon.__init__(self, parent=None)
        self.setIcon(self.__non_inhibited_icon)
        right_menu = RightClicked(self.quit)
        self.setContextMenu(right_menu)
        self.setToolTip("Inhibit me ...")
        self.activated.connect(self.onActivation)
        self.inhibit = Inhibitation()
    def __init__(self,
                 manager: Manager,
                 icon,
                 parent=None,
                 testing=False) -> None:
        QSystemTrayIcon.__init__(self, icon, parent)
        self.setToolTip("ActivityWatch" + (" (testing)" if testing else ""))

        self.manager = manager
        self.testing = testing

        self._build_rootmenu()
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent=None)

        # Initial state
        self.set_disabled()

        # Right Click
        right_menu = RightClicked()
        self.setContextMenu(right_menu)

        # left click
        self.activated.connect(self.toggle)
Example #26
0
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent)
        self.app = parent
        set_tray_icon(self)
        menu = QMenu()

        # Workaround to get `activated` signal on Unity: https://stackoverflow.com/a/43683895/3983708
        menu.aboutToShow.connect(self.on_user_click)

        self.setContextMenu(menu)
        self.setVisible(True)
        self.show()
Example #27
0
 def __init__(self, icon, parent=None):
     global Settings
     global Locales
     global Translations
     QSystemTrayIcon.__init__(self, icon, parent)
     self.setToolTip(Translations["Menu::Title"])
     self.activated.connect(self.onTrayActivated)
     self.MyParent = parent
     self.Actions = {}
     # Configure Menu
     self.Menu = QMenu(parent)
     self.PrepareMenu(self.Menu)
Example #28
0
 def __init__(self, icon, parent=None):
       QSystemTrayIcon.__init__(self, icon, parent)
       self.tray_icon = QSystemTrayIcon(self)
       menu = QMenu(parent)
       quit_action = QAction("Exit", self)
       menu.addAction(quit_action)
       quit_action.triggered.connect(qApp.quit)
       tray_menu = QMenu()
       self.iconLabel = QLabel("TEST")
       tray_menu.addAction(quit_action)
       self.setContextMenu(tray_menu)
       self.show()
Example #29
0
    def __init__(self, icon, parent):
        QSystemTrayIcon.__init__(self, icon, parent)

        self.setToolTip('Check out my tray icon')

        menu = QMenu()
        exitAction = menu.addAction('Exit')
        exitAction.triggered.connect(parent.quit)

        TimeStamp().start()

        self.setContextMenu(menu)
Example #30
0
    def __init__(self):
        QSystemTrayIcon.__init__(self)

        self.setIcon(QtGui.QIcon("icons/devdungeon32x32.png"))

        exit_action = QAction("Exit", self)
        exit_action.triggered.connect(self.exit_app)

        tray_menu = QMenu()
        tray_menu.addAction(exit_action)
        self.setContextMenu(tray_menu)  # Set right-click menu
        self.show()
        self.notify('Now running...')
Example #31
0
    def __init__(self, icon, controller_launcher, model_launcher):
        QSystemTrayIcon.__init__(self, icon)
        ViewElement.__init__(self, controller_launcher, model_launcher)

        self.menu = QMenu()
        self.menu.addAction("Quit", self.controller_launcher.quit)

        self.setContextMenu(self.menu)

        self.activated.connect(self.on_activated)

        self.setToolTip('Validol')

        self.show()
Example #32
0
    def __init__(self, app_context, parent=None):
        QSystemTrayIcon.__init__(self, parent)
        self.app_context = app_context
        self.enabled_icon = QIcon(app_context.get_resource("icon_enabled.png"))
        self.disabled_icon = QIcon(
            app_context.get_resource("icon_disabled.png"))
        self.cadmus_lib_path = ""

        self.disable_suppression_menu = QAction("Disable Noise Suppression")
        self.enable_suppression_menu = QMenu("Enable Noise Suppression")
        self.exit_menu = QAction("Exit")

        self.gui_setup()
        self.drop_cadmus_binary()
Example #33
0
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent)
        icon_path = os.path.join(os.path.abspath(""), "src", "ui", "images",
                                 "main_icon.png")
        icon = QIcon()
        from PyQt5.QtCore import QSize
        icon.addFile(icon_path, QSize(1600, 1600))
        self.setIcon(icon)

        self.right_menu = RightClickMenu()
        self.setContextMenu(self.right_menu)

        self.left_menu = LeftClickMenu()

        self.activated.connect(self.click_trap)
Example #34
0
    def __init__(
        self,
        manager: Manager,
        icon: QIcon,
        parent: Optional[QWidget] = None,
        testing: bool = False,
    ) -> None:
        QSystemTrayIcon.__init__(self, icon, parent)
        self._parent = parent  # QSystemTrayIcon also tries to save parent info but it screws up the type info
        self.setToolTip("ActivityWatch" + (" (testing)" if testing else ""))

        self.manager = manager
        self.testing = testing

        self._build_rootmenu()
Example #35
0
	def __init__(self, icon,parent=None):
		QSystemTrayIcon.__init__(self,icon, parent)
		menu = QMenu(parent)

		showAction = menu.addAction("Show Moodly")
		showAction.triggered.connect(self.trigger.emit)

		exitAction = menu.addAction("Exit")
		exitAction.triggered.connect(self.qtrigger.emit)

		self.updateAction = menu.addAction("Update Now")
		self.updateAction.triggered.connect(self.uptrigger.emit)
		self.updateAction.setEnabled(False)

		self.activated.connect(self.activateIcon)
		self.setContextMenu(menu)
Example #36
0
 def __init__(self, parent=None):
     """
     Initialize the system tray icon.
     """
     QSystemTrayIcon.__init__(self, parent)
     self.initUI()
Example #37
0
 def __init__(self, parent=None):
     QSystemTrayIcon.__init__(self, self.get_trayicon(), parent)
     self.activated.connect(self.on_activated) 
     
     self.menu_is_visible = False
Example #38
0
    def __init__(self, activateCallback, parent=None):
        if app.devicePixelRatio() == 2:
            icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.svg')
            iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.svg')
        else:
            icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.png')
            iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.png')
        QSystemTrayIcon.__init__(self, icon, parent)
        menu = QMenu(parent)
        if globals.appIsPaused:
            menu.addAction('Aether is paused.').setDisabled(True)
        else:
            menu.addAction('Aether is connected.').setDisabled(True)
        globalStatusMenuItem = menu.actions()[0]

        menu.addSeparator() # 1
        if globals.appIsPaused:
            menu.addAction('Resume')
        else:
            menu.addAction('Pause')
        togglePauseMenuItem = menu.actions()[2]
        def togglePause():
            if globals.appIsPaused:
                globals.appIsPaused = False
                togglePauseMenuItem.setText('Pause')
                globalStatusMenuItem.setText('Aether is connected.')
            else:
                globals.appIsPaused = True
                togglePauseMenuItem.setText('Resume')
                globalStatusMenuItem.setText('Aether is paused.')
        togglePauseMenuItem.triggered.connect(togglePause)

        if not globals.appStartedAtBoot:
            menu.addAction('Show Aether')
        else:
            menu.addAction('Hide Aether')
        global toggleVisibilityMenuItem
        toggleVisibilityMenuItem = menu.actions()[3]
        def toggleVisibility():
            if parent.isHidden():
                parent.show()
                toggleVisibilityMenuItem.setText('Hide Aether')

            else:
                parent.close()
                toggleVisibilityMenuItem.setText('Show Aether')
        toggleVisibilityMenuItem.triggered.connect(toggleVisibility)

        menu.addAction('Email the developer')
        emailDevMenuItem = menu.actions()[4]
        def emailDev():
            mailInitialiser = \
                QUrl('mailto:[email protected]'
                     '?subject=Feedback for Aether'
                     '&body=<i><br><br>Hello there! Thanks for taking time to give feedback, I really appreciate it. '
                     'If you are having problems, please right click on Aether.app on your Applications folder, '
                     'click Show Package Contents, go to Contents/MacOS/Logs and attach the network.log file there to '
                     'this email. <br><br>'
                     'You can delete this text before sending.'
                     '<br><br>You can find my PGP key here:</i> '
                     'http://pgp.mit.edu:11371/pks/lookup?search=Burak+Nehbit')
            QtGui.QDesktopServices.openUrl(mailInitialiser)
        emailDevMenuItem.triggered.connect(emailDev)

        menu.addSeparator() # 5

        menu.addAction('Quit')
        quitAppMenuItem = menu.actions()[6]
        # This is below reactor.run to allow access from other places outside main.
        def quitApp():
            # This is buggy...
            if parent.reactor.threadpool is not None:
                parent.reactor.threadpool.stop()
            parent.close()
            parent.reactor.stop()
            app.quit()
            sys.exit()
        quitAppMenuItem.triggered.connect(quitApp)

        self.setContextMenu(menu)
        self.setIcon(icon)
        self.activated.connect(lambda r: activateCallback(self, r))
        def changeIconToActiveState():
            self.setIcon(iconActive)
        def changeIconToPassiveState():
            self.setIcon(icon)
        menu.aboutToShow.connect(changeIconToActiveState)
        menu.aboutToHide.connect(changeIconToPassiveState)
Example #39
0
    def __init__(self, basedir, app, parent=None):
        self.basedir = basedir
        if globals.PLATFORM == 'OSX':
            if app.devicePixelRatio() == 2:
                self.icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.svg')
                self.iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.svg')
                self.iconHighlight =  QtGui.QIcon(self.basedir+'Assets/aether-blue-tray.svg')
            else:
                self.icon = QtGui.QIcon(basedir+'Assets/aether-black-tray.png')
                self.iconActive = QtGui.QIcon(basedir+'Assets/aether-white-tray.png')
                self.iconHighlight =  QtGui.QIcon(self.basedir+'Assets/aether-blue-tray.png')
        elif globals.PLATFORM == 'LNX':
            self.icon = QtGui.QIcon(basedir+'Assets/aether-white-tray.png')
            self.iconActive = self.icon
            self.iconHighlight = self.icon
        elif globals.PLATFORM == 'WIN':
            self.icon = QtGui.QIcon(basedir+'Assets/aether-black-tray-win.svg')
            self.iconActive = self.icon
            self.iconHighlight = self.icon
        else:
            pass

        QSystemTrayIcon.__init__(self, self.icon, parent)

        self.menu = QMenu(parent)
        if globals.appIsPaused:
            self.menu.addAction('Aether is paused.').setDisabled(True)
        else:
            self.menu.addAction('Aether is connected.').setDisabled(True)
        globalStatusMenuItem = self.menu.actions()[0]

        self.menu.addSeparator() # 1
        self.menu.addAction('You have no replies.').setDisabled(True)
        self.messagesMenuItem = self.menu.actions()[2]
        def goToMessages():
            self.messagesMenuItem.setText('You have no replies.')
            self.messagesMenuItem.setDisabled(True)
            if parent.isHidden():
                parent.show()
                parent.raise_()
            jsString = \
            ("firstFrameScope = angular.element(document.getElementById('first-frame-contents')).scope();"
             "firstFrameScope.repliesButtonClick();"
             "firstFrameScope.$apply();"
            )
            self.webView.JSContext(jsString)
            # reach out to jscontext and
            # Here, I need to call qtwebkit and tell it to open messages.
        self.messagesMenuItem.triggered.connect(goToMessages)
        self.menu.addSeparator() # 3
        if globals.appIsPaused:
            self.menu.addAction('Resume')
        else:
            self.menu.addAction('Pause')
        self.togglePauseMenuItem = self.menu.actions()[4]
        def togglePause():
            if globals.appIsPaused:
                globals.appIsPaused = False
                self.togglePauseMenuItem.setText('Pause')
                globalStatusMenuItem.setText('Aether is connected.')
            else:
                globals.appIsPaused = True
                self.togglePauseMenuItem.setText('Resume')
                self.globalStatusMenuItem.setText('Aether is paused.')
        self.togglePauseMenuItem.triggered.connect(togglePause)

        if not globals.appStartedAtBoot:
            self.menu.addAction('Show Aether')
        else:
            self.menu.addAction('Hide Aether')
        self.toggleVisibilityMenuItem = self.menu.actions()[5]
        def toggleVisibility():
            if parent.isHidden():
                parent.show()
                parent.raise_()
                # if globals.PLATFORM == 'OSX':
                #     globals.raiseAndFocusApp() #FIXME BEFORE RELEASE
                self.toggleVisibilityMenuItem.setText('Hide Aether')

            else:
                parent.hide()
                parent.lower()
                self.toggleVisibilityMenuItem.setText('Show Aether')
        self.toggleVisibilityMenuItem.triggered.connect(toggleVisibility)

        self.menu.addAction('Email the developer')
        self.emailDevMenuItem = self.menu.actions()[6]
        def emailDev():
            mailInitialiser = \
                QUrl('mailto:[email protected]'
                     '?subject=Feedback for Aether'
                     '&body=<i><br><br>Hello there! Thanks for taking time to give feedback, I really appreciate it. '
                     'If you are having problems, please right click on Aether.app on your Applications folder, '
                     'click Show Package Contents, go to Contents/MacOS/Logs and attach the network.log file there to '
                     'this email. <br><br>'
                     'You can delete this text before sending.'
                     '<br><br>You can find my PGP key here:</i> '
                     'http://pgp.mit.edu:11371/pks/lookup?search=Burak+Nehbit')
            QtGui.QDesktopServices.openUrl(mailInitialiser)
        self.emailDevMenuItem.triggered.connect(emailDev)

        self.menu.addSeparator() # 5

        self.menu.addAction('Quit')
        self.quitAppMenuItem = self.menu.actions()[8]
        # This is below reactor.run to allow access from other places outside main.
        def quitApp():
            # This is buggy...
            # if parent.reactor.threadpool is not None:
            #     parent.reactor.threadpool.stop()
            # parent.close()
            print('firing kill app on prot instance')
            self.protInstance.killApp()
            # def finishExit():
            #     parent.reactor.stop()
            #     app.quit()
            #     sys.exit()
            # d.addCallback(finishExit)
        self.quitAppMenuItem.triggered.connect(quitApp)

        self.setContextMenu(self.menu)
        self.setIcon(self.icon)

        def changeIconToActiveState():
            self.setIcon(self.iconActive)
        def changeIconToPassiveState():
            self.setIcon(self.icon)
        self.menu.aboutToShow.connect(changeIconToActiveState)
        self.menu.aboutToHide.connect(changeIconToPassiveState)
        if globals.PLATFORM == 'WIN':
            def showOnLeftClick(reason):
                if reason == self.Trigger:
                    toggleVisibility() # I hate that Python doesn't have anonymous functions.
            self.activated.connect(showOnLeftClick)
Example #40
0
    def __init__(self, basedir, app, parent=None):
        if PLATFORM == 'OSX':
            if app.devicePixelRatio() == 2:
                self.icon = QtGui.QIcon(BASEDIR+'Assets/aether-black-tray.svg')
                self.iconActive = QtGui.QIcon(BASEDIR+'Assets/aether-white-tray.svg')
                self.iconHighlight =  QtGui.QIcon(BASEDIR+'Assets/aether-blue-tray.svg')
            else:
                self.icon = QtGui.QIcon(BASEDIR+'Assets/aether-black-tray.png')
                self.iconActive = QtGui.QIcon(BASEDIR+'Assets/aether-white-tray.png')
                self.iconHighlight =  QtGui.QIcon(BASEDIR+'Assets/aether-blue-tray.png')
        elif PLATFORM == 'WIN':
            self.icon = QtGui.QIcon(BASEDIR+'Assets/aether-white-tray-win.svg')
            self.iconActive = self.icon
            self.iconHighlight = QtGui.QIcon(BASEDIR+'Assets/aether-green-tray-win.svg')
        else:
            pass

        QSystemTrayIcon.__init__(self, self.icon, parent)

        self.menu = QMenu(parent)
        if globals.appIsPaused:
            self.menu.addAction('Paused').setDisabled(True)
        else:
            self.menu.addAction('Online').setDisabled(True)
        self.globalStatusMenuItem = self.menu.actions()[0]

        self.menu.addSeparator() # 1
        self.menu.addAction('You have no replies.').setDisabled(True)
        self.messagesMenuItem = self.menu.actions()[2]
        def goToMessages():
            self.messagesMenuItem.setText('You have no replies.')
            self.messagesMenuItem.setDisabled(True)
            parent.show()
            parent.raise_()
            jsString = \
            ("firstFrameScope = angular.element(document.getElementById('first-frame-contents')).scope();"
             "firstFrameScope.repliesButtonClick();"
             "firstFrameScope.$apply();"
            )
            self.webView.JSContext(jsString)
            # reach out to jscontext and
            # Here, I need to call qtwebkit and tell it to open messages.
        self.messagesMenuItem.triggered.connect(goToMessages)
        self.menu.addSeparator() # 3
        if globals.appIsPaused:
            self.menu.addAction('Resume')
        else:
            self.menu.addAction('Pause')
        self.togglePauseMenuItem = self.menu.actions()[4]
        def togglePause():
            if globals.appIsPaused:
                globals.appIsPaused = False
                self.togglePauseMenuItem.setText('Pause')
                self.globalStatusMenuItem.setText('Online')
            else:
                globals.appIsPaused = True
                self.togglePauseMenuItem.setText('Resume')
                self.globalStatusMenuItem.setText('Paused')
        self.togglePauseMenuItem.triggered.connect(togglePause)
        self.menu.addAction('Show Aether')
        self.toggleVisibilityMenuItem = self.menu.actions()[5]
        def makeVisible():
            parent.show()
            parent.raise_()
            if PLATFORM == 'OSX':
                globals.raiseAndFocusApp()

        self.toggleVisibilityMenuItem.triggered.connect(makeVisible)

        self.menu.addAction('Email the developer')
        self.emailDevMenuItem = self.menu.actions()[6]
        def emailDev():
            mailInitialiser = \
                QUrl('mailto:[email protected]'
                     '?subject=Feedback for Aether'
                     '&body=Hello there! Thanks for taking time to give feedback, I really appreciate it. '
                     'If you are having problems, please follow the directions at www.getaether.net/sending_logs, '
                     'and send me the produced logs. Thanks! You can delete this text before sending. '
                     'You can find my PGP key here: pgp.mit.edu:11371/pks/lookup?search=Burak+Nehbit')
            QtGui.QDesktopServices.openUrl(mailInitialiser)
        self.emailDevMenuItem.triggered.connect(emailDev)

        self.menu.addSeparator() # 5

        self.menu.addAction('Settings')
        self.settingsMenuItem = self.menu.actions()[8]
        def goToSettings():
            self.settingsMenuItem.setText('Settings')
            self.settingsMenuItem.setDisabled(False)
            if parent.isHidden():
                parent.show()
                parent.raise_()
            jsString = \
            ("firstFrameScope = angular.element(document.getElementById('first-frame-contents')).scope();"
             "firstFrameScope.settingsButtonClick();"
             "firstFrameScope.$apply();"
            )
            self.webView.JSContext(jsString)
        self.settingsMenuItem.triggered.connect(goToSettings)

        self.menu.addSeparator() # 6

        self.menu.addAction('Quit Aether')
        self.quitAppMenuItem = self.menu.actions()[10]
        # This is below reactor.run to allow access from other places outside main.
        def quitApp():
            # This is buggy...
            if parent.reactor.threadpool is not None:
                parent.reactor.threadpool.stop()
            parent.close()
            parent.reactor.stop()
            app.quit()
            sys.exit()

            # self.protInstance.killApp()
            # def finishExit():
            #     parent.reactor.stop()
            #     app.quit()
            #     sys.exit()
            # d.addCallback(finishExit)
        self.quitAppMenuItem.triggered.connect(quitApp)



        self.setContextMenu(self.menu)
        self.setIcon(self.icon)

        def changeIconToActiveState():
            self.setIcon(self.iconActive)
        def changeIconToPassiveState():
            self.setIcon(self.icon)
        self.menu.aboutToShow.connect(changeIconToActiveState)
        self.menu.aboutToHide.connect(changeIconToPassiveState)
        if PLATFORM == 'WIN':
            def showOnLeftClick(reason):
                if reason == self.Trigger:
                    makeVisible() # I hate that Python doesn't have anonymous functions.
            self.activated.connect(showOnLeftClick)
Example #41
0
 def __init__(self, icon, parent=None):
     QSystemTrayIcon.__init__(self, icon, parent)
     self.activated.connect(self.on_activated) 
Example #42
0
	def __init__(self,  parent=None):
		QSystemTrayIcon.__init__(self, QIcon(os.path.join(get_image_file_path(),"ball_green.png")), parent)
		menu = QMenu(parent)
		self.exitAction = menu.addAction("Exit")
		self.exitAction.triggered.connect(self.callback_exit)
		self.setContextMenu(menu)