Example #1
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 #2
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 #3
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 #4
0
def configure_systray():
    def setup(icon):
        icon.visible = True

    def exit_action(icon):
        icon.visible = False
        icon.stop()
        os._exit(1)

    image = Image.open(os.path.join("images", "snappy_systray.png"))

    icon = Icon("snappy", icon=image, title="snappy")

    menu = Menu(MenuItem("exit", lambda: exit_action(icon)))
    icon.menu = menu

    icon.run(setup)
Example #5
0
    def start(self):
        def on_clicked(icon, _):
            logging.info('[APP] Closing. Source: TrayIcon')
            states.running = False
            icon.stop()

        def clicked_display(_, item):
            states.displayed = item.checked

        tray_icon = Icon('chesscord',
                         title='chesscord',
                         icon=Image.open(RESOURCES_DIR / 'logo.png'))
        tray_icon.menu = Menu(
            MenuItem('update config', utils.open_webpage),
            MenuItem('hide',
                     clicked_display,
                     checked=lambda item: not states.displayed),
            MenuItem('Exit', on_clicked))

        tray_icon.run()
Example #6
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 #8
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 #9
0
                      *(item(str(beeps_list[i]) + ' ' + CFG.caption_minutes, set_beep(i),
                             checked=get_beep(i), radio=True) for i in range(1, len(beeps_list)))
                  ))

item_exit = None if CFG.caption_exit is None else item(CFG.caption_exit, lambda: icon.stop())

itemlist = []
if item_beep is not None:
  itemlist.append(item_beep)
itemlist.append(item_apps)
itemlist.append(item_plans)
itemlist.append(item_poweroff)
if item_exit is not None:
  itemlist.append(item_exit)

icon.menu = menu(*itemlist)

exec_thread = threading.Thread(target=exec_func, args=())
exec_thread.start()
icon.run()

print ('Terminating... waiting for exec_thread finish')
time2finish = True
exec_thread.join(CFG.timestep + 1)
print ('Terminated. Good Bye!')

# import wmi
# def check_process(proclist):
# c = wmi.WMI()
# for process in c.Win32_Process():
#   if process.Name in proclist: