Esempio n. 1
0
def start_tray(background_function, shutdown_function):
    """Add an tray icon and is blocking the program. Must be called from the main thread."""
    global tray

    def background_wrapper(icon_):
        background_function()

    def _stop():
        """
        Stops synchronization. Tray keeps open
        """
        shutdown_function()

    def _close():
        """
        Stops synchronization and stops the tray.
        """
        shutdown_function()
        stop_tray()

    image = PIL.Image.open(c_paths.normalize_path(c_paths.ASSETS, "Logo.png"))
    menu = pystray.Menu(pystray.MenuItem("Open", _open_gui),
                        pystray.MenuItem("Stop", _stop),
                        pystray.MenuItem("Close", _close))
    tray = pystray.Icon("OpenDrive", image, "OpenDrive", menu)
    tray.icon = image
    tray.visible = True
    tray.run(background_wrapper)
Esempio n. 2
0
def init_icon():
    icon = pystray.Icon('Status')
    icon.menu = Menu(
        MenuItem('Available', lambda: ButtonClickAvail(User)),
        MenuItem('Webex', lambda: ButtonClickWebex(User)),
        MenuItem('Logs/ESRS', lambda: ButtonClickLogs(User)),
        MenuItem('No Bandwidth', lambda: ButtonClickNoBW(User)),
        MenuItem('Away', lambda: ButtonClickAway(User)),
        MenuItem('In Call', lambda: ButtonClickIncall(User)),
        MenuItem('Out of office', lambda: ButtonClickOOO(User)),
    )
    icon.icon = Image.open(resource_path('./images/icon.png'))
    icon.title = 'Status Update'

    def setup(icon):
        icon.visible = True
        app = IsilonStatus()

        app.mainloop()

        # while icon.visible==True:
        #     flags, hcursor, (prevx,prevy) = win32gui.GetCursorInfo()
        #     self.after(1000 * 10, self.inactive(prevx, prevy))

    icon.run(setup)

    return icon
Esempio n. 3
0
def main():
    global stop
    global s
    stop = False
    icon_color = "#33ed00"
    if (currentSong[1] in skipListAR
            or currentSong[1] in skipListWR) and currentSong[1] != "":
        icon_color = "#b0000c"

    ic = pystray.Icon('test',
                      create_image(bgcolor=icon_color),
                      menu=Menu(
                          Item(current_to_string(), "", enabled=False),
                          Item('Stop DMCASkipper', lambda: set_stop(True)),
                          Item('Auto skip',
                               on_clicked_autoskip,
                               checked=get_autoskip,
                               radio=True),
                          Item('Skip Atlantic Records\' songs',
                               on_clicked_ar,
                               checked=get_ar_skip,
                               radio=True),
                          Item('Skip Warner Records\' songs',
                               on_clicked_wr,
                               checked=get_wr_skip,
                               radio=True)))

    process = Thread(target=run, args=(ic, ))
    ic.run(process.start())
    process.join()
Esempio n. 4
0
def createApp(io):
    def connectToServer():
        url = 'http://localhost:3333'
        headers = {'usertype': 'desktop', 'password': '******'}

        response = requests.get(url, headers=headers)

        jsonResponse = response.json()

        if (jsonResponse["status"] == 'permission accepted'):
            io.connect('http://localhost:3333')
        else:
            print(jsonResponse["status"])

    def disconnectFromServer(app):
        io.disconnect()
        app.stop()

    connectItem = pystray.MenuItem('Conectar', connectToServer)
    closeItem = pystray.MenuItem('Fechar', disconnectFromServer)

    menuApp = pystray.Menu(connectItem, closeItem)

    filename = abspath('assets/icon.png')
    iconImage = Image.open(filename)

    app = pystray.Icon('Mobile Keyboard', iconImage, menu=menuApp)

    return app
Esempio n. 5
0
 def withdraw_window(self):
     self.root.withdraw()
     image = Image.open(self.resource_path("mirror_assets/logo.png"))
     menu = pystray.Menu(item('Quit', self.quit_window),
                         item('Show', self.show_window, default=True))
     icon = pystray.Icon("Mirror", image, "Mirror", menu)
     icon.run()
Esempio n. 6
0
def withdraw_window():
    window.withdraw()
    image = Image.open("earth.png")
    menu = (item('Quit', quit_window), item('Show', show_window))
    icon = pystray.Icon("name", image, "title", menu)
    icon.HAS_DEFAULT_ACTION = False
    icon.run()
Esempio n. 7
0
File: run.py Progetto: ellet/PyleWM
def start():
    import ctypes
    if not ctypes.windll.shell32.IsUserAnAdmin():
        script_name = sys.argv[0]
        if not script_name.endswith(".py"):
            script_name = "-m pylewm"
        argument_str = " ".join((script_name, *sys.argv[1:]))
        ctypes.windll.shell32.ShellExecuteW(None, "runas", find_pythonw_executable(), argument_str, None, 1)
        sys.exit()
        return
    else:
        # Set up registry variables for running PyleWM correctly
        init_registry_vars()

    pylewm.config.apply()

    for fun in InitFunctions:
        fun()

    threading.Thread(target=key_process_thread, daemon=True).start()

    global tray_icon
    tray_icon = pystray.Icon('PyleWM')
    png_path = os.path.join(os.path.dirname(__file__), "PyleWM.png")
    tray_icon.icon = Image.open(png_path)
    tray_icon.title = "PyleWM"
    tray_icon.menu = pystray.Menu(
        pystray.MenuItem("Open Config Directory", lambda: run_pyle_command(pylewm.execution.open_config)),
        pystray.MenuItem("Restart", lambda: run_pyle_command(restart)),
        pystray.MenuItem("Quit", lambda: run_pyle_command(quit)),
    )
    tray_icon.run()
Esempio n. 8
0
    def __init__(self, title=program_settings.names['Program name']):
        self.running = False
        self.visible = False

        # Create icon
        self.icon = pystray.Icon(name=title, icon=title, title=title)

        # Use provided image as icon or generate default one
        try:
            image = Image.open('icon.ico')
        except IOError:
            print("Could not find icon file")
            image = None

        if image is not None:
            try:
                self.icon.icon = image
            except Exception as e:
                print(e)
                self.icon.icon = generate_icon()
        else:
            self.icon.icon = generate_icon()

        # Add entries to 'right click' menu
        self.icon.menu = pystray.Menu(pystray.MenuItem(text=program_settings.names['Program name'], action=lambda: None, default=True),
                                      pystray.MenuItem(text="Capture text", action=lambda: self.capture_text()),
                                      pystray.MenuItem(text="Exit", action=lambda: self.exit_program()))
Esempio n. 9
0
def run_sys_tray():
    import webbrowser
    import pystray
    from PIL import Image

    def _sys_tray_main(_icon: pystray.Icon):
        _icon.visible = True
        threading.Thread(target=_wait_server_ready,
                         args=[_open_browser]).start()
        run_server()

    def _open_browser():
        webbrowser.open(SERVER_URL)

    def _sys_tray_stop():
        shutdown_server()
        icon.visible = False
        icon.stop()

    icon = pystray.Icon(name='neteasy',
                        icon=Image.open('neteasy/static/image/logo-64.png'),
                        title='Neteasy Music Server',
                        menu=pystray.Menu(
                            pystray.MenuItem('Open',
                                             _open_browser,
                                             default=True),
                            pystray.MenuItem('Stop Server', _sys_tray_stop)))

    icon.run(_sys_tray_main)
Esempio n. 10
0
    def build_tray(self):
        """
        Creates the system tray icon.
        """
        try:
            image = Image.open('kodi-icon.ico')
        except FileNotFoundError:
            image = Image.new('RGB', (64, 64))
        menu = pystray.Menu(
            pystray.MenuItem("KoDiscord v{version}".format(
                version=Path('version').read_text().strip()),
                             self.reload_settings,
                             enabled=False),
            pystray.MenuItem(
                "Settings",
                self.open_settings,
            ),
            pystray.MenuItem("Autoboot",
                             self.auto_start_on_boot,
                             checked=lambda item: state),
            pystray.MenuItem(
                "Reload Settings",
                self.reload_settings,
            ),
            pystray.MenuItem("Exit", self.exit_app),
        )

        self._tray = pystray.Icon("KoDiscord", image, "KoDiscord", menu)

        self._tray.run()
Esempio n. 11
0
def main():
    tray = pystray.Icon('tray-test')
    image = Image.open(ICO_PATH)
    tray.icon = image
    menu = Menu(*create_commands(COMMANDS))
    tray.menu = menu
    tray.run(show)
Esempio n. 12
0
 def _pystray_thread(self):
     self.tray_icon = pystray.Icon(self.title,
                                   self._create_image(self.icon))
     self.tray_icon.default_action = self._default_action_callback
     self.tray_icon.menu = pystray.Menu(*self.menu_items)
     self.tray_icon.title = self.tooltip  # tooltip for the icon
     self.thread_started = True
     self.tray_icon.run()
Esempio n. 13
0
 def __init__(self, key):
     self.key = key
     self.image = Image.open("img.jpg")
     self.menu = (item('get', lambda: self.getData()),
                  item('update', lambda: self.updateData()),
                  item('quit', lambda: self.quit()))
     self.icon = pystray.Icon("name", self.image, "syncboard", self.menu)
     self.icon.run()
Esempio n. 14
0
def icon_start(idk):
    global icon
    image = Image.open("icon.ico")
    menu = (item('Enter Credentials', open_file,
                 default=True), item('Stop Assistant', stop_working))
    icon = pystray.Icon("LNM Login Assistant", image, "LNM Login Assistant",
                        menu)
    icon.run()
Esempio n. 15
0
def main():
    image = Image.open("icon.png")

    menu = pystray.Menu(
        item('Clipboard Scrubber', scrub, default=True, enabled=False),
        pystray.Menu.SEPARATOR, item('Exit', exit))
    icon = pystray.Icon('clipboardscrubber', image, 'Clipboard Scrubber', menu)
    icon.run()
Esempio n. 16
0
def StartRed():
    """Changes systray icon to red to indicate no upgrade available."""
    global proxied
    global icon
    global quit
    menu = (item('Help', action), item('Quit', exit_prg))
    image = Image.open("red.png")
    icon = pystray.Icon("", image, "Vimes", menu)
    icon.run()
Esempio n. 17
0
def generateTrayIcon(release_func):
    global icon, icon_exist
    icon_exist = True
    icon = pystray.Icon('Speak Screenshot')
    ico = Image.open("../src/icon.ico")
    icon.icon = ico
    icon.menu = pystray.Menu(
        pystray.MenuItem('Resume', lambda: resume(release_func)))
    icon.run()
Esempio n. 18
0
def init_icon():
    icon = pystray.Icon('Network downtime detector')

    icon.menu = Menu(MenuItem('Exit', lambda: exit_action(icon)))

    icon.icon = create_image(down, "Start", 12, white)

    icon.title = 'Network downtime detector'

    icon.run(setup)
Esempio n. 19
0
    def launchapp(self):
        self.create_image()
        self.create_menu()
        self.load_config()
        self.keybrain = KeyBrain(self.masterKey, self.recordMode, self.swaps)

        self.tray = pystray.Icon('Unlocc', menu=self.menu)

        self.tray.icon = self.image
        self.tray.run()
Esempio n. 20
0
 def createIcon(self):
     image = self.b.getNextImage()
     self.appData.saveImage(image)
     wall = WindowsWallpaper()
     wall.setWallpaper(self.appData.getImagePath())
     image = Image.open("icon.png")
     menu = Menu(MenuItem('Next Image', self.nextI),
                 MenuItem('Prev Image', self.prevI),
                 MenuItem('Quit', self.quitI))
     self.icon = pystray.Icon("pyBing v0.1", image, "pyBing v0.1", menu)
Esempio n. 21
0
def StartYellow():
    """Changes systray icon to yellow to indicate proxy available but not enabled."""
    global proxied
    global icon
    global quit
    menu = (item('Help', action), item('Proxy Traffic',
                                       ProxyTraffic), item('Quit', exit_prg))
    image = Image.open("yellow.png")
    icon = pystray.Icon("", image, "Vimes", menu)
    icon.run()
Esempio n. 22
0
def init_icon():
    icon = pystray.Icon('mon')
    icon.menu = Menu(
        MenuItem('TimeStamp', lambda: timestamp_action(icon)),
        MenuItem('Exit', lambda: exit_action(icon)),
    )
    icon.icon = Image.open('ICON.png')
    icon.title = 'ToolsBox'

    icon.run(setup)