Example #1
1
    def run(self):
        def get_wrapper(command):
            def wrapper():
                self.r_queue.put((command, None))

            return wrapper

        def die():
            self.icon_stop()

        menu_items = [
            MenuItem("Show Console", get_wrapper("show_console")),
            MenuItem("Application Menu", get_wrapper("open_player_menu")),
            MenuItem("Open Config Folder", get_wrapper("open_config_brs")),
            MenuItem("Quit", die)
        ]

        icon = Icon(APP_NAME, menu=Menu(*menu_items))
        icon.icon = Image.open(icon_file)
        self.icon_stop = icon.stop

        def setup(icon: Icon):
            icon.visible = True

        icon.run(setup=setup)
        self.r_queue.put(("die", None))
Example #2
0
def tray():
    global icon, thread
    icon = None
    thread = None

    name = 'ED - Autopilot'
    icon = Icon(name=name, title=name)
    logo = Image.open(resource_path('src/logo.png'))
    icon.icon = logo

    icon.menu = Menu(
        MenuItem('Scan Off', set_state(0), checked=get_state(0), radio=True),
        MenuItem('Scan on Primary Fire',
                 set_state(1),
                 checked=get_state(1),
                 radio=True),
        MenuItem('Scan on Secondary Fire',
                 set_state(2),
                 checked=get_state(2),
                 radio=True), MenuItem('Exit', lambda: exit_action()))

    keyboard.add_hotkey('home', start_action)
    keyboard.add_hotkey('end', stop_action)

    icon.run(setup)
Example #3
0
    def run(self):
        from pystray import Icon, MenuItem, Menu
        def get_wrapper(command):
            def wrapper():
                self.r_queue.put((command, None))
            return wrapper

        def die():
            # We don't call self.icon_stop() because it crashes on Linux now...
            if sys.platform == "linux":
                # This kills the status icon uncleanly.
                self.r_queue.put(("die", None))
            else:
                self.icon_stop()

        menu_items = [
            MenuItem(_("Configure Servers"), get_wrapper("show_preferences")),
            MenuItem(_("Show Console"), get_wrapper("show_console")),
            MenuItem(_("Application Menu"), get_wrapper("open_player_menu")),
            MenuItem(_("Open Config Folder"), get_wrapper("open_config_brs")),
            MenuItem(_("Quit"), die)
        ]

        icon = Icon(USER_APP_NAME, menu=Menu(*menu_items))
        icon.icon = Image.open(get_resource("systray.png"))
        self.icon_stop = icon.stop
        def setup(icon):
            icon.visible = True
            self.r_queue.put(("ready", None))
        icon.run(setup=setup)
        self.r_queue.put(("die", None))
Example #4
0
    def run(self):
        from pystray import Icon, MenuItem, Menu

        def get_wrapper(command):
            def wrapper():
                self.r_queue.put((command, None))

            return wrapper

        def die():
            self.icon_stop()

        menu_items = [
            MenuItem("Configure Servers", get_wrapper("show_preferences")),
            MenuItem("Show Console", get_wrapper("show_console")),
            MenuItem("Application Menu", get_wrapper("open_player_menu")),
            MenuItem("Open Config Folder", get_wrapper("open_config_brs")),
            MenuItem("Quit", die)
        ]

        icon = Icon(USER_APP_NAME, menu=Menu(*menu_items))
        with importlib.resources.path(__package__, 'systray.png') as icon_file:
            icon.icon = Image.open(icon_file)
        self.icon_stop = icon.stop

        def setup(icon):
            icon.visible = True
            self.r_queue.put(("ready", None))

        icon.run(setup=setup)
        self.r_queue.put(("die", None))
Example #5
0
def get_tray_icon(config, get_new_secret):
    environ['PYNPUT_BACKEND'] = 'gtk'
    icon = Icon('Secure Notifications')
    icon.icon = Image.open("icon.png")
    menu = (
            MenuItem("Show New QR Key", lambda: show_qr(get_new_secret, config)),
            Menu.SEPARATOR,
            MenuItem("Quit", icon.stop),
    )

    icon.menu = menu
    return icon
Example #6
0
def tray():
    global ICON
    name = 'ED - Autopilot'
    ICON = Icon(name=name, title=name)
    logo = Image.open(join(abspath("."), 'src/logo.png'))
    ICON.icon = logo

    keyboard.add_hotkey('page up', start_action)
    keyboard.add_hotkey('page down', stop_action)
    keyboard.add_hotkey('end', kill_ed)

    # keyboard.wait()
    ICON.run(setup)
Example #7
0
    def run(self):
        menu_items = [
            MenuItem("Configure Servers", self.show_preferences),
            MenuItem("Show Console", self.show_console),
            MenuItem("Application Menu", self.open_player_menu),
        ]

        if open_config:
            menu_items.append(MenuItem("Open Config Folder", open_config))
        menu_items.append(MenuItem("Quit", self.stop))
        icon = Icon(USER_APP_NAME, menu=Menu(*menu_items))
        icon.icon = Image.open(icon_file)
        self.icon_stop = icon.stop
        icon.run()
Example #8
0
def tray():
    global icon, thread
    icon = None
    thread = None

    name = 'ED - Autopilot'
    icon = Icon(name=name, title=name)
    logo = Image.open(resource_path('src/logo.png'))
    icon.icon = logo

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

    keyboard.add_hotkey('home', start_action)
    keyboard.add_hotkey('end', stop_action)

    icon.run(setup)
Example #9
0
def tray():
    global icon, thread
    icon = None
    thread = None

    name = 'ED - Autopilot'
    icon = Icon(name=name, title=name)
    logo = Image.open(resource_path('src/logo.png'))
    icon.icon = logo

    icon.menu = Menu(
        MenuItem(
            'Scan Off',
            set_state(0),
            checked=get_state(0),
            radio=True
        ),
        MenuItem(
            'Scan on Primary Fire',
            set_state(1),
            checked=get_state(1),
            radio=True
        ),
        MenuItem(
            'Scan on Secondary Fire',
            set_state(2),
            checked=get_state(2),
            radio=True
        ),
        MenuItem('Exit', lambda : exit_action())
    )

    keyboard.add_hotkey('home', start_action)
    keyboard.add_hotkey('end', stop_action)

    icon.run(setup)
def setup(icon: Icon):
    icon.visible = True
    is_up_to_date = True

    while True:
        output = []
        wrong_output = []

        # TODO: Please do it better...
        repos, wrong_paths = utils.get_repos_and_wrong_paths(args.file)

        if wrong_paths:
            wrong_output.extend(["", "Those directories does not exist:"])
            for path in wrong_paths:
                wrong_output.append(f"-  {path}")

        for repo in repos:
            if repo_is_up_to_date(repo):
                continue
            text = f"- {repo.path} ({repo.branch})"
            repo.can_ff = can_do_fast_forward(repo)
            if repo.can_ff:
                text += " [FF]"
            output.append(text)

        was_up_to_date = is_up_to_date
        is_up_to_date = not bool(output)

        if is_up_to_date:
            _icon = icon_ok
            _items = [
                MenuItem("All existing repositories are up to date",
                         action=void)
            ]
        else:
            _icon = icon_fail
            _items = [MenuItem(f"{MESSAGE}:", action=void)] + [
                MenuItem(f"{text}", action=void) for text in output
            ]

            if any(repo.can_ff for repo in repos):
                _items.extend([
                    MenuItem("", action=void),
                    MenuItem(
                        text=
                        "Pull changes for fast forwardable repositories marked with [FF]",
                        action=pull_changes_for_list_of_repos(repos),
                    ),
                ])
            if was_up_to_date:
                n = Notifier()

                n.send_notification(output + wrong_output)

        if wrong_paths:
            _items.extend(
                [MenuItem(f"{text}", action=void) for text in wrong_output])

        _menu = Menu(*_items)

        icon.icon = _icon
        icon.menu = _menu

        time.sleep(args.delay)
Example #11
0
icon.visible = True
icon.run(setup=callback)
"""

#rep = stitch.Stitch.getWebsites()

state = True


def on_clicked(icon, item):
    global state
    state = not item.checked

    if item.checked:
        api.start()


def exitAlpha():
    icon.stop()


global icon
icon = Icon('test name')
icon.icon = Image.open("src/alpha.png")
icon.menu = Menu(
    MenuItem('Alpha', None),
    MenuItem('Running', on_clicked, checked=lambda item: state),
    MenuItem('Exit', exitAlpha),
)

icon.run()
Example #12
0
  def func():
    global pick_guid
    pick_guid = guid
  return func

def set_appplan(idx, nf):
  def func(icon, item):
    CFG.corrplans[idx] = nf
  return func
def get_appplan(idx, df):
  def func(item):
    return CFG.corrplans[idx] == df
  return func

icon = Icon('PowerPlan')
icon.icon = ppi.image_unknown(False)

item_apps =       item(CFG.caption_apps, menu(
                      *(item(CFG.corrapps[a],
                        menu( *(item(CFG.plans[i][1], set_appplan(a, i), checked=get_appplan(a, i), radio=True) \
                                for i in range(len(CFG.plans))))) for a in range(len(CFG.corrapps)))
                        ))

item_plans =      item(CFG.caption_plans, menu(
                        item(CFG.caption_ignoreplans, changeplan(PG_DISABLED)),
                        *(item(pp.gglist[i][1], changeplan(i)) for i in range(pp.ggcount)),
                        item(CFG.caption_autoplan, changeplan(PG_AUTO))
                      ))

item_poweroff =   item(CFG.caption_poweroff, menu(
                      item(CFG.caption_now, set_poweroffpick(PP_OFF), checked=get_poweroffpick(0), radio=True),
Example #13
0
        scheduler.shutdown()
        logger.exception(str(e))

    icon.visible = True


menu_items = [
    # MenuItem('Force Execution', lambda: os.system(exe_file)),
    MenuItem('Telegram Shift Push', lambda: os.system(exe_shift_push)),
    MenuItem('ON Calendar Sync', lambda: os.system(exe_on_cal_sync)),
    MenuItem('Show Scheduled Jobs', lambda: scheduler.print_jobs()),
    # MenuItem('AhnLab V3', on_clicked, checked=lambda item: state),
    MenuItem("Exit", lambda: icon.stop()),
]
menu = Menu(*menu_items)

icon = Icon("Kill Shits", menu=menu)
icon.title = "Kill shits"
icon.icon = Image.open(icon_path)

# Set Event Driven Method
t = threading.Thread(target=eventhook.run)
t.daemon = True
t.start()

# Icon run
logger.info("## Icon running")
icon.run(setup=callback)

logger.info("## Quit")