コード例 #1
0
ファイル: systray.py プロジェクト: rikbarker/watcher
 def __init__(self, bus):
     plugins.SimplePlugin.__init__(self, bus)
     menu_options = (('Open Browser', None, self.open),)
     self.systray = SysTrayIcon('core/favicon.ico', 'Watcher',
                                menu_options, on_quit=self.on_quit)
     self.quit_method = None
     return
コード例 #2
0
def main():
    menu_options = (('Launch Nix Box', "hello.ico",
                     partial(do_launch_dev_box,
                             name='nixos')), ('Launch Ubuntu Box', "hello.ico",
                                              partial(do_launch_dev_box,
                                                      name='ubuntu')),
                    ('Copy Nix Box hostname', None,
                     partial(copy_dev_box_hostname,
                             name='nixos')), ('Copy Ubuntu Box hostname', None,
                                              partial(copy_dev_box_hostname,
                                                      name='ubuntu')),
                    ('Do nothing', None,
                     do_nothing), ('A sub-menu', "submenu.ico", (
                         ('Say Hello to Simon', "simon.ico", simon),
                         ('Do nothing', None, do_nothing),
                     )))
    sysTrayIcon = SysTrayIcon("main.ico",
                              hover_text,
                              menu_options,
                              on_quit=bye,
                              default_menu_index=1)
    sysTrayIcon.start()
    print("started systray")

    app.run(port=9999)

    print("started flask")
コード例 #3
0
    def __init__(self, title, menu=None, on_quit=None, icon=icon_fn):
        """
        Param *menu: Recebe tupla contendo tuplas com ("texto do botão","ícone do menu",função).
        Param icon: Recebe o nome do ícone a ser carregado.
        """

        self.__sysTrayIcon = SysTrayIcon(icon, title, menu, on_quit=on_quit)
コード例 #4
0
def run():
    init_logging()
    decorate_tkinter()

    cp = ConfigParser("test_config.yaml").parse()

    Theme.set(cp.theme if cp.theme else "rainbow")

    _selector = Selector(cp.choices)
    _view = View(_selector)

    def about(systray):
        logging.info("About PieMacros...")

    menu_options = (('About PieMacros...', None, about), )

    _systray = SysTrayIcon(None,
                           "PieMacros",
                           menu_options,
                           on_quit=lambda e: stop())
    _systray.start()

    GlobalHotkey.register('A', (Modifiers.WIN, Modifiers.SHIFT),
                          _selector.init_choices)
    try:
        GlobalHotkey.listen()
    finally:
        stop()
コード例 #5
0
def main():
    wall = AutoWallpaper()
    wall.start()
    menu = (("Refresh", None, wall.refresh), ("Restart", None, wall.restart))
    res = resource_path("icon.ico")
    systray = SysTrayIcon(res, "Auto Wallpaper", menu, on_quit=sys.exit)
    systray.start()
コード例 #6
0
ファイル: test_systray.py プロジェクト: ZacTallberg/caniping
def restartSystray(systray):
    systray.shutdown()
    systray = SysTrayIcon('grey_icon.ico',
                          'null_internet',
                          menu_options,
                          on_quit=quitApplication)
    systray.start()
コード例 #7
0
def trayMenu():
    slider = getApplicationPerSlider()

    hover_text = "PyNK2"
    sub_menu = [
        (slider[0], None, submenu),
        (slider[1], None, submenu),
        (slider[2], None, submenu),
        (slider[3], None, submenu),
        (slider[4], None, submenu),
        (slider[5], None, submenu),
        (slider[6], None, submenu),
        (slider[7], None, submenu)
    ]

    menu_options = (
        (slider[0], None, submenu),
        (slider[1], None, submenu),
        (slider[2], None, submenu),
        (slider[3], None, submenu),
        (slider[4], None, submenu),
        (slider[5], None, submenu),
        (slider[6], None, submenu),
        (slider[7], None, submenu),
        ('RemoveFromSlider', "../slider.ico", sub_menu),
    )

    sysTrayIcon = SysTrayIcon("../slider.ico", hover_text, menu_options, on_quit=killAll, default_menu_index=1)
    sysTrayIcon.start()
コード例 #8
0
ファイル: systray.py プロジェクト: mrworf/window-opener
 def __init__(self, reloadFunc, shutdownFunc, aboutFunc):
     menu = (("Reload config", None, reloadFunc), ("About...", None,
                                                   aboutFunc))
     self.systray = SysTrayIcon("icon.ico",
                                "Window Opener",
                                menu,
                                on_quit=shutdownFunc)
コード例 #9
0
 def stray_strt(self, sysTrayIcon):
     menu_options = ()  # (('Settings', None, self.setng),)
     self.systrayicon = SysTrayIcon("va.ico",
                                    "Virtual Assistant",
                                    menu_options,
                                    on_quit=self.pas_thq)
     self.systrayicon.start()
コード例 #10
0
ファイル: main.py プロジェクト: snuq/SnuClipboardManager
    def build(self):
        global app
        app = self
        if platform == 'win' and self.config.getboolean(
                "Settings", "showtray"):
            #setup system tray
            from infi.systray import SysTrayIcon
            tray_menu = (
                ("Toggle Minimize", None, self.tray_click),
                ("Undo Clipboard", None, self.undo_clipboard),
                ("Strip Clipboard", None, self.strip_clipboard),
            )
            icon_file = kivy.resources.resource_find('icon.ico')
            self.tray = SysTrayIcon(icon_file,
                                    'Snu Clipboard Manager',
                                    tray_menu,
                                    on_quit=self.tray_quit)
            self.tray.start()
        else:
            self.tray = None

        self.clipboard_folder = self.config.get("Settings", "presetsfolder")
        self.load_clipboard_folders()
        self.load_clipboards()
        Window.bind(on_key_down=self.key_down)
        Window.bind(on_key_up=self.key_up)
        Window.bind(on_cursor_leave=self.window_exited)
        Window.bind(on_cursor_enter=self.window_entered)
        Window.bind(on_minimize=self.on_minimize)
        Window.bind(on_restore=self.on_restore)
        return MainScreen()
コード例 #11
0
ファイル: sync-it-v060.py プロジェクト: steveshambles/Sync-It
def main(stray):
    """Main program control using infi.systray module."""
    hover_text = 'Sync It V0.60'

    menu_options = (('Sync it', None, sync_it), ('Settings', None, (
        ('Set source folder', None, set_src_fldr),
        ('Set destination folder', None, set_dest_fldr),
        ('-----', None, fake),
        ('Purge ON', None, set_purge_on),
        ('Purge OFF', None, set_purge_off),
    )), ('Options', None, (
        ('Open source folder', None, open_src_folder),
        ('Open destination folder', None, open_dest_folder),
        ('-----', None, fake),
        ('About', None, about_syncit),
        ('Help', None, sync_help),
        ('-----', None, fake),
        ('Contact author', None, contact_me),
        ('Make a small donation to author', None, donate_me),
        ('Visit blog', None, visit_blog),
    )), ('Profiles', None, (
        ('Load Profile', None, load_profile),
        ('Save Profile', None, save_profile),
        ('View profiles folder', None, view_profiles_folder),
    )))

    stray = stray('sync-it.ico',
                  hover_text,
                  menu_options,
                  on_quit=exit_prg,
                  default_menu_index=0)
    stray.start()
コード例 #12
0
def init():
    # Context menu actions
    menu_options = ((TITLE_BT_ON, None, turn_on), (TITLE_BT_OFF, None,
                                                   turn_off))

    systray = SysTrayIcon(ICON_APP, TITLE_APP, menu_options)
    systray.start()
コード例 #13
0
ファイル: _new_testing.py プロジェクト: ZacTallberg/caniping
    async def shell(asyncState):

        while True:
            if not asyncState.loop_running and not asyncState.restarting:
                systray = SysTrayIcon("grey_icon.ico",
                                      "null_internet",
                                      asyncState.menu_options,
                                      on_quit=quitApplication)
                systray.start()
                asyncState.loop_running = True

            if asyncState.loop_running and asyncState.restarting:
                test_input = ('test_item', None, newMenu)
                await addMenuOption(asyncState, test_input)
                systray.shutdown()
                systray = SysTrayIcon("grey_icon.ico",
                                      "null_internet",
                                      asyncState.menu_options,
                                      on_quit=quitApplication)
                systray.start()
                asyncState.restarting = False

            if systray:
                await ping(systray, asyncState)

            await asyncio.sleep(1)
コード例 #14
0
    def __init__(self, wallcord):
        global credit_text

        self.window = wallcord
        self.root = self.window.root
        self.version = self.window.version

        with open("data.json", "r") as f:
            self.data = load(f)
        credit_text = credit_text.replace("!version!", self.version)

        if self.version in ["1.1.1", "1.1.0", "1.0.0"]:
            messagebox.showwarning(
                "FreedomWall",
                "バージョンとFreedomWallのプログラムがあいませんでした。\n再ダウンロードしてください。")
            self.window.onoff = False
            self.window.q.append(self.exit)

        # メインスレッドじゃないとTkinterメソッドを実行できない。
        # だからメインスレッドのFreedomWallクラスのself.qに実行したいのを追加する。
        # そしてメインスレッドから実行する。
        # だから lambda がある。
        self.icon = SysTrayIcon(
            "icon.ico",
            "FreedomWall",
            (("FreedomWall", None,
              lambda sysTrayIcon: self.window.q.append(self.credit)),
             ("Set", None,
              lambda sysTrayIcon: self.window.q.append(self.setting)),
             ("Del", None,
              lambda sysTrayIcon: self.window.q.append(self.delete)),
             ("List", None,
              lambda sysTrayIcon: self.window.q.append(self.setting_list))),
            on_quit=lambda sysTrayIcon: self.window.q.append(self.exit))
コード例 #15
0
ファイル: Minimise.py プロジェクト: Cmd858/Server_V2
class ConsoleManager:
    def __init__(self, exitCallback):
        self.exitCallback = exitCallback
        options = (("Activate Console", None,
                    lambda x: self.ConsoleVisible(True)),
                   ("Deactivate Console", None,
                    lambda x: self.ConsoleVisible(False)))
        self.trayIcon = SysTrayIcon(None,
                                    'Server_V2 Options',
                                    options,
                                    on_quit=self.CallKillServer)

    def ConsoleVisible(self, visBool):
        if visBool is False:
            ctypes.windll.user32.ShowWindow(
                ctypes.windll.kernel32.GetConsoleWindow(), 0)
        else:
            ctypes.windll.user32.ShowWindow(
                ctypes.windll.kernel32.GetConsoleWindow(), 1)

    def CallKillServer(self, systray):
        try:
            pass
            #SysTrayIcon.shutdown
        except Exception as e:
            print(e)
        self.exitCallback()

    def StartTrayIcon(self):
        self.trayIcon.start()
コード例 #16
0
ファイル: test_systray.py プロジェクト: ZacTallberg/caniping
async def restart_systray(systray):
    systray.shutdown()
    systray = SysTrayIcon("grey_icon.ico",
                          "caniping",
                          asyncState.menu_options,
                          on_quit=quitApplication)
    systray.start()
    return True
コード例 #17
0
ファイル: tray.py プロジェクト: blevert/MRNotifier
class Tray:
    def __init__(self, hover_text, tray_options):
        self.sys_tray_icon = SysTrayIcon(None, hover_text,
                                         convert_to_tuple(tray_options))
        self.sys_tray_icon.start()

    def set_icon(self, icon):
        self.sys_tray_icon.update(icon=icon)
コード例 #18
0
ファイル: win_tray.py プロジェクト: BriFuture/myfacilities
    def __init__(self):
        icon_path = os.path.join(os.path.dirname(__file__), "imgs", "logo.ico")
        self.systray = SysTrayIcon(icon_path, "bf-facilities", 
            self.make_menu(), on_quit = self.on_quit)
            # , left_click=self.on_show, right_click=self.on_right_click)

        reg_path = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings'
        self.before_quit = None
コード例 #19
0
def startTrayIcon():  #Starts systemtray icon
    icon_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             "Volume mixer icon.ico")

    shutdown_called = False  #Do know

    menu_options = (("About", None, on_about), )
    systray = SysTrayIcon(icon_path, "Volume Mixer", menu_options, on_quit)
    systray.start()
コード例 #20
0
    def __init__(self, bus, icon, name, menu_options, on_quit=lambda: None):
        if not callable(on_quit):
            raise TypeError('on_quit not a callable object.')
        self.on_quit = on_quit

        plugins.SimplePlugin.__init__(self, bus)
        self.systray = SysTrayIcon(icon, name, menu_options, on_quit=self._on_quit)
        self.quit_method = None
        return
コード例 #21
0
 def __init__(self, mouse_tracker):
     self.mouse_tracker = mouse_tracker
     self.activated = True
     self.menu_options = (
         ("Activate", None, self.activate),
         ("Deactivate", None, self.deactivate),
     )
     self.systray = SysTrayIcon("bogazici.ico", "BUICS Security Lab",
                                self.menu_options)
     self.mouse_tracker.start_listening()
コード例 #22
0
ファイル: Minimise.py プロジェクト: Cmd858/Server_V2
 def __init__(self, exitCallback):
     self.exitCallback = exitCallback
     options = (("Activate Console", None,
                 lambda x: self.ConsoleVisible(True)),
                ("Deactivate Console", None,
                 lambda x: self.ConsoleVisible(False)))
     self.trayIcon = SysTrayIcon(None,
                                 'Server_V2 Options',
                                 options,
                                 on_quit=self.CallKillServer)
コード例 #23
0
def main():
    try:
        with open('read_files.txt', 'r') as file:
            finished_logs = {line.strip() for line in file.readlines()}
    except FileNotFoundError:
        with open('read_files.txt', 'w') as file:
            file.write('read files:\n')
            finished_logs = set()

    running = State(True)
    hummus = ReplayParser()
    parent_dir = find_log_path()
    URL = "https://f0t66fsfkd.execute-api.us-east-2.amazonaws.com/default/receive_game_data"

    def one_loop(*_):
        log_path = find_log(parent_dir)
        print(log_path)
        if log_path and log_path not in finished_logs:
            matches, validation_key = read_log(log_path)
            print(validation_key)
            if matches:
                for game_list in matches.values():
                    if game_list != []:
                        path_dictionary = {}
                        cleaned_replay_dicts = []
                        for replay in game_list:
                            replay_object = hummus.parse(replay)
                            path_dictionary[replay] = replay_object
                        for path in path_dictionary:
                            replay = path_dictionary[path]
                            cleaned_replay_dicts.append(get_data(replay, path))
                        for game in cleaned_replay_dicts:
                            send_data = json.dumps(game)
                            requests.post(url=URL, params={'report_type': 'game_result'}, data=send_data)
                            print(send_data)
                        formatted_match = format_match(cleaned_replay_dicts, validation_key)
                        match_data = json.dumps(formatted_match)
                        requests.post(url=URL, params={'report_type': 'match_result'}, data=match_data)
                        print(match_data)
                    with open('read_files.txt', 'a') as write_path:
                        finished_logs.add(log_path)
                        write_path.write(log_path + "\n")

    def end_loop(_):
        running.set_state(False)

    if HAVE_SYSTRAY:
        stray = SysTrayIcon("k.ico", "SpyParty Ranked", (
            ('Manual Submit', None, one_loop),
        ), on_quit=end_loop, default_menu_index=1)
        stray.start()

    while running.get_state():
        one_loop()
        time.sleep(15)
コード例 #24
0
    def __init__(self):
        self.widgets = {}
        self.running_gui = False
        self.refresh_thread = threading.Thread(target=self.refresh_widgets)

        menu = (
            ("Open", "./img/icon.ico", self._open_gui),
            ("Exit", "./img/x.ico", self.__shutdown),
        )

        self.stray = SysTrayIcon("./img/icon.ico", "DeskopUtils", menu_options=menu)
コード例 #25
0
ファイル: TrayIcon.py プロジェクト: link00000000/mimic
    def run(self):
        """
        Display the tray icon in the system tray.

        Tray icon thread is spawned and the tray loop is executed.
        """
        self._icon = SysTrayIcon(
            self._icon_image, self._hover_text, tuple(self._menu_options), on_quit=self.handle_quit)

        self._thread = Thread(target=self._loop)
        self._thread.start()
コード例 #26
0
 def __init__(self):
     menuOptions = (('Audio', None, (('Select Alert Sound', None,
                                      self._onSelectAlertSound),
                                     ('Play', None, self._onPlayAlert),
                                     ('Stop', None, self._onStopAlert))),
                    ('Open Maps File', None, self._onOpenMapsFile),
                    ('Select Path of Exile folder', None,
                     self._onSelectPathOfExileDirectory))
     self._icon = SysTrayIcon(iconPath,
                              'Map Alert',
                              menu_options=menuOptions,
                              on_quit=self._onQuit)
     self._callbackQueue = queue.Queue()
コード例 #27
0
 def start(self):
     # TODO notification anpassen (kein ToolTip)
     logger.info('Run: iniSystray')
     menu_options = (
         ("Settings", None, self.openSettings),
         ("Restart", None, self.restart),
         ("About", None, self.about),
     )
     self.systray = SysTrayIcon(CHECK_ICO,
                                STATUS_OK,
                                menu_options,
                                on_quit=self.on_quit_callback)
     logger.info('systray start')
     self.systray.start()
コード例 #28
0
ファイル: gw2rpc.py プロジェクト: sobrinth/GW2RPC
    def __init__(self):
        def fetch_registry():

            # First one only for building
            # Only used for debugging without the web based API
            #registry_path = resource_path('./data/registry.json')
            #registry_path = resource_path('../data/registry.json')
            #registry = json.loads(open(registry_path).read())
            #return registry

            url = GW2RPC_BASE_URL + "registry"
            res = requests.get(url)
            if res.status_code != 200:
                log.error("Could not fetch the web registry")
                return None
            return res.json()

        def icon_path():
            try:
                return os.path.join(sys._MEIPASS, "icon.ico")
            except:
                return "icon.ico"

        def fetch_support_invite():
            try:
                return requests.get(GW2RPC_BASE_URL +
                                    "support").json()["support"]
            except:
                return None

        self.rpc = DiscordRPC(GW2RPC_APP_ID)
        self.game = MumbleData()
        self.registry = fetch_registry()
        self.support_invite = fetch_support_invite()
        menu_options = ((_("About"), None, self.about), )
        if self.support_invite:
            menu_options += ((_("Join support server"), None,
                              self.join_guild), )
        self.systray = SysTrayIcon(icon_path(),
                                   _("Guild Wars 2 with Discord"),
                                   menu_options,
                                   on_quit=self.shutdown)
        self.systray.start()
        self.process = None
        self.last_map_info = None
        self.last_continent_info = None
        self.last_boss = None
        self.boss_timestamp = None
        self.no_pois = set()
        self.check_for_updates()
コード例 #29
0
ファイル: WinSysTray.py プロジェクト: richwandell/ocr_snip
    def __init__(self):
        hkt = Hotkey()
        hkt.start()

        def settings(systray):
            nonlocal hkt
            SettingsDialog()
            hkt.terminate()
            hkt = Hotkey()
            hkt.start()

        menu_options = (("Settings", None, settings),)
        systray = SysTrayIcon(os.path.join(os.getcwd(), "images", "lasso.ico"), "OCR Snip", menu_options)
        systray.start()
コード例 #30
0
class SystemTray(object):
    def __init__(self):
        self._hover_text = "Media Server Client"
        self._icon = "server.ico"
        self._options = (('Plex', None, self._openPlex),('Torrent', None, self._openTorrent))
        self._system_tray = SysTrayIcon(self._icon, self._hover_text, self._options)

    def _openPlex(self, icon: SysTrayIcon):
        webbrowser.open(ServerPrograms.plex)

    def _openTorrent(self, icon: SysTrayIcon):
        webbrowser.open(ServerPrograms.torrent)

    def run(self):
        self._system_tray.start()
コード例 #31
0
ファイル: test.py プロジェクト: Infinidat/infi.systray
from __future__ import print_function
from infi.systray import SysTrayIcon
import os
import ctypes

icon_path = os.path.join(os.path.dirname(__file__), "test.ico")
shutdown_called = False
def on_quit(systray):
    print("Bye")
def do_example(systray):
    print("Example")
def on_about(systray):
    ctypes.windll.user32.MessageBoxW(None, u"This is a test of infi.systray", u"About", 0)

menu_options = (("Example", None, do_example),
                ("About", None, on_about))
systray = SysTrayIcon(icon_path, "Systray Test", menu_options, on_quit)
systray.start()