Exemplo n.º 1
0
def main():
    #	Script start!									Yes, I know the comments look awful. I also know there's no reason to have all these comments. I got bored, okay? OKAY?!?!?!
    endfind()  #Checks if the series is on record.
    filechoice = dirscan()  #Series Selector.
    time1 = time.time(
    )  #Duration timer. Might be removed for compiled version.
    busts, end = setup(filechoice)  #Setting up the extra bits.
    query, list1 = reqParse(
        filechoice, end)  #Requests Parsing. i.e. prepping for requests to use.
    list2, list3 = asyncio.run(Asyncquery(
        query))  #Progress bar not needed, moves far too quick for it.
    time1 = time.time(
    ) - time1  #Time break. User input delay will not be counted. Also, only reason why I'm doing this is to benchmark against my bash script.
    list7, list4, didchk = reqProcB(
        busts)  #Busts check. It's all about dem tiddies, innit. *sigh.*
    time2 = time.time()  #Retriggering time check
    list5, list6 = pureCalc(list2, list3)  #Purity calculation.
    dictmerge(
        list1, list2, list3, list4, list5, list6, list7, didchk, filechoice
    )  #This is used to merge it all together. The lists hold these values: 1. Name, 2. Total, 3.Pure count, 4. BustSize, 5.Purity%, 6. Impure count, 7.Alphanumeric translation.
    time2 = time.time() - time2  #End of timecheck. Script is basically over.
    time1 = round(time1)  #Time crunching.
    time2 = round(
        time2
    )  #Read above. Side note, I wonder how much larger I've made the script size because of all the tabs....
    timetotal = time1 + time2  #Final calculation.
    sg.popup(
        'Done! Now go check your results!'
    )  #No comment necessary. < READ WHAT YOU JUST TYPED IN, DUMMY. *smack*
    print('Finished in', timetotal,
          'seconds.')  #Felt cute. Might remove later. *cries in cringe*
Exemplo n.º 2
0
def endfind():
    danend = 'https://danbooru.donmai.us/related_tag?search[category]=4&limit=500&search[query]='
    endtagstat = sg.popup_yes_no(
        'Do you have a list of the names of characters? If no, we can get that for you. But it will require manual filtering.'
    )
    if endtagstat == 'Yes':  #Check endtag status, if we have it or not.
        sg.popup('Okay. Moving on to series check.', title='O.H.D.E.A.R.')
    elif endtagstat == None:
        sg.popup("User closed script. :(", title='O.H.D.E.A.R.')
        sys.exit()
    else:
        #If no, we grab it but the data's messy, due to the nature of user-tagging. Best we can do, considering there is no definitive standard for fandom pages on characters, the closest thing to a central source.
        endtagstat = sg.popup_get_text(
            'Okay, type in the series name. Put an underscore, _, in place of spaces.'
        )
        if endtagstat == None or endtagstat == "":
            sg.popup("User closed script. :(", title="O.H.D.E.A.R.")
            sys.exit()
        else:
            with open(endtagstat + ".txt", "w") as endsave:
                endtagstat = requests.get(danend + endtagstat)
                endsave.write(endtagstat.text)
            sg.popup(
                'Saved the results. Process them as needed, then return! Move the result into the url folder, due to OS differences, this is not able to be auutomated.',
                title='O.H.D.E.A.R.')
            sys.exit()
Exemplo n.º 3
0
def win2():  # Создаем и открываем доп окна
    layout1 = [[sg.Button("Win2")]]  # Кнопка Win2
    window = sg.Window("Win2", layout1)
    while True:
        event, values = window.read(timeout=200)
        if not event:
            break
Exemplo n.º 4
0
def main():
    global bot, tray

    def discord_thread():
        bot.run(TOKEN)

    bot = TempBot(activity=discord.Activity(
        name='!temp help', type=discord.ActivityType.listening))
    threading.Thread(target=discord_thread, name='DiscordThread').start()

    tray_menu = ['menu', ['Exit']]

    tray = sg.SystemTray(menu=tray_menu, data_base64=ICON, tooltip=NAME)

    try:
        if HardwareInfo().failed_to_load:
            win32gui.MessageBox(
                None,
                'Open Hardware Monitor must be running for !temp to work.',
                'Warning', 48)
    except:
        traceback.print_exc()
        bot.loop.create_task(bot.notify_startup_crash())

    while True:  # Handle Tray events
        event = tray.Read()
        if event == 'Exit':
            tray.Hide()
            bot.loop.create_task(bot.temp_wait_before_exit(close=True))
            break
Exemplo n.º 5
0
    def __init__(self):
        super(ProxyConnection, self).__init__()

        self.CONNECT = 'Connect'
        self.DISCONNECT = 'Disconnect'
        self.EXIT = 'Exit'

        # tray icon details
        self.icon_dir = os.path.join(os.getcwd().replace(os.sep, '/') +
                                     '/assets/icons')
        self.on_icon = os.path.join(self.icon_dir + '/on.ico')
        self.off_icon = os.path.join(self.icon_dir + '/off.ico')
        # ##

        # system tray items
        self.context_items = [self.CONNECT, self.DISCONNECT, '---', self.EXIT]
        self.menu_def = ['UNUSED', self.context_items]
        self.tray = sg.SystemTray(menu=self.menu_def, filename=self.off_icon)
        # ##

        # proxy details
        self.proxy = Proxy()
        # ##

        # flags
        self.is_connected = False
Exemplo n.º 6
0
    def run_window(self):
        if not self.has_window_running:
            self.has_window_running = True
            self.window = sg.Window('SC2 Replay Renamer', self.layout)
            
            while True:
                event, values = self.window.read()

                # special case, since values are all set to None here
                if event is None or event == "Exit":
                    self.window.close()
                    break
                
                self.values = values

                if event == 'Detect':
                    src = self.values[defaults._source_dir]
                    directories_to_exclude = split_string(self.values[defaults._exclude_dirs])
                    self.detect_player_id(src, excludes=directories_to_exclude)
                
                elif event == 'Rename':
                    self.save_settings()
                    op = shutil.copy if self.values[defaults._copy] else shutil.move

                    if self.values[defaults._tray]:
                        self.window.Hide()
                        self.run_renamer(op=op, in_tray=True)
                        self.run_tray()
                    
                    else:
                        self.run_renamer(op=op, in_tray=False, question=True)

                elif event == 'Save':
                    self.save_settings()
                    sg.popup_ok('Your settings have been saved!')
                
                elif event == 'Default':
                    self.set_to_default()
                    self.save_settings()
                    sg.popup_ok('Settings reset to default')

                # updates input values in GUI to the most recent by the end of the loop
                self.window.fill(self.values)
        
        else:
            self.window.un_hide()
def gui():
    sg.ChangeLookAndFeel('Topanga')

    sg.SetOptions(border_width=0)

    layout = [
            [sg.T('GitHub Issues Watcher' + 5 * ' ', click_submits=True, key='GitHub'),
            sg.Button('', size=(25,25),
                          image_data=red_x,
                          key='_quit_',button_color=(sg.LOOK_AND_FEEL_TABLE['Topanga']['TEXT'],sg.LOOK_AND_FEEL_TABLE['Topanga']['BACKGROUND']),
                          tooltip='Closes window')],
            [sg.T('', key='_status_', size=(12, 1))],
            [sg.T('', key='_numissues_', size=(20, 1))],
              ]

    window = sg.Window('Issue watcher',
                       no_titlebar=True,
                       grab_anywhere=True,
                       keep_on_top=True,
                       alpha_channel=.8,        # dim the lights a little
                       location=(2360,310),     # locate in upper right corner of screen
                       ).Layout(layout).Finalize()

    window.Refresh()
    status_elem = window.FindElement('_status_')
    issues_elem = window.FindElement('_numissues_')

    initial_issue_count, initial_first_issue = get_num_issues()
    seconds = 0
    poll_frequncy = 1000

    while True:
        event, values = window.Read(timeout=poll_frequncy)
        if event in ('_quit_', None):
            break
        if seconds % 60 == 0 or event.startswith('GitHub'):     # Every 60 seconds read GitHub
            status_elem.Update('Reading...')
            window.Refresh()
            issues, first_issue = get_num_issues()
            if issues == 0 and first_issue == 0:
                print('Read error', time.time())
                continue
            issues_elem.Update('{} Issues. {} is first issue'.format(issues, first_issue))
            window.Refresh()
            # if something changed, then make a popup
            if issues != initial_issue_count or first_issue != initial_first_issue:
                sg.PopupNoWait('Issues changed on GitHub ', 'First issue # is {}'.format(first_issue), background_color='red', keep_on_top=True)
                initial_issue_count = issues
                initial_first_issue = first_issue
            status_elem.Update('')
        else:
            status_elem.Update('.' if seconds%2 else '')  # blink a '.' every 2 seconds so know still running

        seconds += poll_frequncy/1000
    window.Close()
Exemplo n.º 8
0
    def system_tray(self):
        """
        Build the system trap application and start the main event loop.

        Our event loop will allow a user to click on the icon to open a browser to the web application.
        """
        menu = [
            self.title,
            [
                self.title, "---", "Open Dashboard", "Open Github", "---",
                "Bootstrap", "---", "Generate Debug Report", "Exit"
            ]
        ]

        tray = sgw.SystemTray(menu=menu,
                              tooltip=self.title,
                              data_base64=self.logo)

        logging.debug("Beginning System Tray Event Loop...")
        # Begin the event loop for reading and waiting
        # for interaction between the system tray application.
        while True:
            event = tray.Read()

            # Check different cases for the event picked based on the
            # attributes specified in the menu.

            # Exit the application. We are also tearing down the server
            # before completing the event loop.
            if event == "Exit":
                tray.ShowMessage(title="Exiting",
                                 message="Exiting Application Now")
                self.uninhibit()
                self.stop_server()

                # Break to terminate event loop and stop python process.
                break

            # Open up the application in a new browser tab.
            # This is the main function of the tray application.
            if event in ["Open Dashboard", self.title, "__ACTIVATED__"]:
                webbrowser.open_new_tab(url=settings.TITANDASH_DASHBOARD_URL)

            if event == "Open Github":
                webbrowser.open_new_tab(
                    url="https://github.com/becurrie/titandash")

            # Open up the application in a bootstrapping state.
            # Acts as a shortcut to open the page up if not starting
            # the program for the first time.
            if event in "Bootstrap":
                webbrowser.open_new_tab(url=settings.TITANDASH_LOADER_URL)

            # Generate a debug report based on the most current information.
            # Opening the directory once finished.
            if event == "Generate Debug Report":
                call_command("debug_report")
Exemplo n.º 9
0
def pureCalc(
    v1, v2
):  #Purity Calculation. Should be passed over to excel to deal with it, but alas.
    purity = []
    nsfw = []
    invalnk = False
    for t, p in zip(v1, v2):
        try:
            purity.append(str(p / t * 100))
            nsfw.append(t - p)
        except ZeroDivisionError:  #Divide-By-Zero catch. Prevents script from breaking by just forcing a 0.
            purity.append(int(0))
            nsfw.append(int(0))
            invalnk = True
    if invalnk:
        sg.popup(
            'Warning. One (or more) of your links are invalid. Check result for any results with a purity of 0.',
            title='O.H.D.E.A.R.')
    return purity, nsfw
Exemplo n.º 10
0
def dictmerge(
    d1, d2, d3, d4, d5, d6, d7, ckval, filechoice
):  #List Merge. Probably could do better, but it works as a sloppy/amateur workaround. Doesn't take long anyways.
    filetarget = filechoice.replace('url', 'results') + '.xlsx'
    h1 = ['Character Name']  #...There has to be a better way than this.
    h2 = [
        'Total'
    ]  #It's a list because for some reason, append only works with lists.
    h3 = [
        'Pure'
    ]  #Also, it must be seperate cause otherwise it just appends it one by one downwards.
    h4 = ['Bust Size']
    h5 = ['Bust Rank']
    h6 = ['Impure']
    h7 = ['Purity Ratio']
    wb = Workbook()
    ws = wb.active
    if not ckval:
        for item in zip(h1, h2, h3, h6, h7):
            ws.append(item)
        for item in zip(d1, d2, d3, d6, d5):
            ws.append(item)
    else:
        for item in zip(h1, h2, h3, h6, h4, h5, h7):
            ws.append(item)
        for item in zip(d1, d2, d3, d6, d4, d7, d5):
            ws.append(item)
    ws.auto_filter.ref = ws.dimensions
    while True:  #Just used to check if file is opened elsewhere, and waits until it's been closed.
        try:
            endrez = open(filetarget, "r+")
            break
        except IOError as e:
            if e.errno == 2:  #File doesn't exist. That's fine, as we are making it next.
                break
            elif e.errno == 13:  #Permission denied. Most likely because it's opened elsewhere.
                sg.popup(
                    "Permission denied. Is the file still open? And are you allowed to add new files to the folder?"
                )
            else:  #Should cover my other bases.
                sg.popup("Unknown error. Fault follows: ", e)
                sys.exit()
    wb.save(filetarget)
Exemplo n.º 11
0
    def run_tray(self):
        """Runs the tray application"""
        self.tray = sg.SystemTray(menu=self.tray_menu)

        # runs only a single instance of the tray application
        if not self.has_tray_running:
            self.has_tray_running = True
            self.tray.show_message('SC2 Replay Renamer', 'SC2 Auto-Renamer is now running', messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_INFORMATION)

            auto_renamer = AutoRenamer(self.settings)
            auto_renamer.start()

            while True:
                menu_item = self.tray.read()

                if menu_item == 'Exit' or menu_item == 'None':
                    auto_renamer.stop()
                    sys.exit()
                    break
                
                elif menu_item == 'Open' or menu_item == sg.EVENT_SYSTEM_TRAY_ICON_ACTIVATED:
                    auto_renamer.stop()
                    self.has_tray_running = False
                    self.tray.show_message('SC2 Replay Renamer', 'SC2 Auto-Renamer has stopped. To restart it, press the Rename button', messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_INFORMATION)
                    self.tray.close()
                    self.run_window()
                    break

                elif menu_item == 'Open Replay Folder':
                    if defaults._source_dir in self.settings and os.path.isdir(self.settings[defaults._source_dir]):
                        os.startfile(self.settings[defaults._source_dir])
                    else:
                        sg.popup_error('Replay directory is invalid')
                
                elif menu_item == 'Open Destination Folder':
                    if defaults._target_dir in self.settings and os.path.isdir(self.settings[defaults._target_dir]):
                        os.startfile(self.settings[defaults._target_dir])
                    else:
                        sg.popup_error('Destination directory is invalid')

        else:
            return None
Exemplo n.º 12
0
def setup(
    filechoice
):  #Setup. Might not show up for the end user, depends if the file to scrape is on file.
    with open('Options.json') as f:
        data = json.load(f)
        if '/' in filechoice:
            filtchk = filechoice.split('/')[
                -1]  #OS logic, without the os library!
        elif '\\' in filechoice:
            filtchk = filechoice.split('\\')[-1]
        else:  #Just in case. Not really something I expect will occur, but hey.
            sg.popup(
                "No idea what OS you're using. to be safe, the script will die."
            )
            sys.exit()
        busts, end = "", ""
        if filtchk in data["busts"]:
            busts = data["busts"][filtchk]
        if filtchk in data["ignored"]:
            end = ""
        elif filtchk in data["end"]:
            end = data["end"][filtchk]
        else:
            layout = [[
                sg.Text('Would you like to add any end tags to your list?')
            ], [sg.InputText()], [sg.Button('Add this!'),
                                  sg.Button('Nope!')]]
            window = sg.Window('O.H.D.A.M.N.', layout, finalize=True)
            event, values = window.read()
            if event in (None, 'Nope!'):
                data["ignored"][str(filtchk)] = None
                end = ""
            elif event == 'Add this!':
                data["end"][str(filtchk)] = values[0]
                end = data["end"][filtchk]
            with open('Options.json', 'w') as g:
                g.write(
                    json.dumps(data,
                               sort_keys=True,
                               indent='\t',
                               separators=(',', ': ')))
                sg.popup('Settings saved!', title='O.H.D.E.A.R.')
            window.close()
            del window
        return busts, end
Exemplo n.º 13
0
def win1():  # Создаем и открываем доп окна
    win1 = sg.Window('Сеть',
                     layout2,
                     no_titlebar=True,
                     grab_anywhere=True,
                     size=(120, 500))
    while True:
        event, values = win1.read(
            timeout=200)  # Пауза обновления окна в мc  0,2 сек
        if event == 'Закрыть приложение':
            break
        if not event:  # Если нет событии
            break  # Закрыть окно
    win1.close()
Exemplo n.º 14
0
    def detect_player_id(self, source_path, excludes=[]):
        """automagically fills in the player's id after prompting them with popups"""

        # if source path is valid, initialize the sc2reader and load replays
        if source_path and os.path.isdir(source_path):
            sc2 = SC2Factory(directory=source_path, exclude=excludes, depth=1, followlinks=True)
            replays = sc2.load_replays(source_path, load_level=2, load_maps=False, exclude=excludes)
            
            possible_players = []
            number_of_replay_files = len([name for name in os.listdir(source_path) if '.SC2Replay' in name])            
            number_of_replays_to_test = min(150, number_of_replay_files)
            
            # populates possible_players with the list of players detected
            for _ in range(number_of_replays_to_test):
                replay = next(replays)
                possible_players.extend([(player.name, player.toon_id) for player in replay.players if player.is_human])

            # generator to get the next highest player name
            def get_highest(lst):
                while lst:
                    largest = max(lst, key=lambda x: lst.count(x)) if lst else ''
                    lst = list(filter(lambda x: x != largest, lst)) if largest else []
                    yield tuple(largest)


            highest = get_highest(possible_players)
            p = next(highest, None)
            
            # Check if folder is valid and contains replays
            if p:
                popup = sg.popup_yes_no(f'Are you {p[0]} (ID: {str(p[1])})?\n\n(Your ID does not change, even after a name change)', font='Arial 12')
                
                # checks if there are still names remaining
                while p and popup == 'No':
                    p = next(highest, None)
                    popup = sg.popup_yes_no(f'Are you {p[0]} (id={str(p[1])})?\n\n(Your ID does not change, even after a name change)', font='Arial 12') if p else 'No'

                # updates the values to the latest
                if popup == 'Yes':
                    self.values[defaults._player_id] = p[1]
                else:
                    sg.popup_ok('Your ID has not been changed')
            else:
                sg.popup_error(f'Cannot detect any SC2Replay files in:\n\n{source_path}')
        else:
            sg.popup_error('Cannot resolve source path (Replay folder)!')
Exemplo n.º 15
0
def main(args):
    window = make_window(sg.theme())

    if args.use_system_python:
        python_exe = SYSTEM_PYTHON
    else:
        python_exe = BUNDLED_PYTHON

    while True:
        event, values = window.read()
        if event == sg.WIN_CLOSED or event == 'Exit':
            break

        print(event, values)

        if event == KEY_EXEC_BUTTON:
            targetFolder = values[KEY_TARGET_FOLDER]
            if targetFolder == "":
                sg.popup("フォルダを指定してください。")
                continue

            p = Path(targetFolder)
            if not p.glob("*.png") and not p.glob("*.jpg") and not p.glob(
                    "*.jpeg"):
                sg.popup("フォルダ内に画像ファイルが見つかりません。")
                continue

            if values[KEY_ENABLE_DEBUGMODE]:
                enable_debug = True
            else:
                enable_debug = False

            out = run_fgogachacnt(python_exe, targetFolder, enable_debug)
            result = run_csv2report(python_exe, out)

            window[KEY_EXEC_RESULT_OUTPUT].update(result.decode("cp932"))
Exemplo n.º 16
0
def get_file(title):
    fname = sgwx.PopupGetFile(title, no_window=True)
    #    if running_linux():
    #        time.sleep(2)
    return fname
Exemplo n.º 17
0
    def set_layout(self):
        """sets the layout of the entire GUI"""
        template = self.settings[defaults._template]
        source_dir = self.settings[defaults._source_dir]
        target_dir = self.settings[defaults._target_dir]
        operation = self.settings[defaults._operation]
        excludes = self.settings[defaults._excludes]
        includes = self.settings[defaults._includes]
        player_id = self.settings[defaults._player_id]
        tray = self.settings[defaults._tray]
        
        first_column_width = 30
        third_column_width = 50
        button_width = 9
        inner_space = 0.6

        radio_copy = sg.Radio('Copy', 'operation_group', key=defaults._copy)
        radio_move = sg.Radio('Move', 'operation_group', key=defaults._move)

        if operation == defaults._move:
            radio_move = sg.Radio('Move', 'operation_group', key=defaults._move, default=True)

        self.layout = [

            # Rename Operations
            [sg.Text('Rename Operations', font='Arial 12 bold')],
            [sg.Text('Rename Template', size=(first_column_width, 3)), sg.Multiline(default_text=template, size=(third_column_width, 3), do_not_clear=True, key=defaults._template)],
            [sg.Text('Replay Folder', size=(first_column_width, 1)), sg.InputText(default_text=source_dir, key=defaults._source_dir, do_not_clear=True, size=(third_column_width - button_width - inner_space, 1), change_submits=True), sg.FolderBrowse("Browse", size=(button_width, 1), initial_folder=source_dir, target=defaults._source_dir, auto_size_button=False)],
            [sg.Text('Destination Folder', size=(first_column_width, 1)), sg.InputText(default_text=target_dir, key=defaults._target_dir, do_not_clear=True, size=(third_column_width - button_width - inner_space, 1), change_submits=True), sg.FolderBrowse("Browse", size=(button_width, 1), initial_folder=target_dir, target=defaults._target_dir, auto_size_button=False)],
            [sg.Text('Player ID', size=(first_column_width, 1)), sg.InputText(default_text=player_id, key=defaults._player_id, size=(third_column_width - button_width - inner_space, 1)), sg.Button('Detect', target=defaults._player_id, size=(button_width, 1), key='Detect', auto_size_button=False)],
            
            
            # File Operation
            [sg.Text('File Operation', size=(first_column_width, 1)), radio_copy, radio_move],

            # divider
            [sg.Text(' ')],

            # Exclusions
            [sg.Text('Exclusions', font='Arial 14 bold')],
            [sg.Checkbox('Exclude Games with AI', default=excludes[defaults._ai], key=defaults._ai)],
            [sg.Checkbox('Exclude Custom Games', default=excludes[defaults._custom], key=defaults._custom)],
            [sg.Text('Exclude directories (separate by comma)', size=(first_column_width, 1)), sg.InputText(default_text=excludes[defaults._exclude_dirs], size=(third_column_width, 1), key=defaults._exclude_dirs)],

            # divider
            [sg.Text(' ')],

            # Inclusions
            [sg.Text('Inclusions', font='Arial 14 bold')],
            [sg.Text('Minimum Number of Players', size=(first_column_width, 1)), sg.InputText(default_text=includes[defaults._min_players], key=defaults._min_players, size=(third_column_width, 1))],
            [sg.Text('Maximum Number of Players', size=(first_column_width, 1)), sg.InputText(default_text=includes[defaults._max_players], key=defaults._max_players, size=(third_column_width, 1))],
            [sg.Checkbox('WoL Replays', key=defaults._wol, default=includes[defaults._wol])],
            [sg.Checkbox('HotS Replays', key=defaults._hots, default=includes[defaults._hots])],
            [sg.Checkbox('LotV Replays', key=defaults._lotv, default=includes[defaults._lotv])],

            # divider
            [sg.Text(' ')],

            # Matchups
            [sg.Text('Matchups', font='Arial 14 bold')],
            [sg.Text('Exclude Matchups (separate by comma)', size=(first_column_width, 1)), sg.InputText(default_text=excludes[defaults._exclude_matchups], size=(third_column_width, 1), key=defaults._exclude_matchups)],
            [sg.Text('Include Matchups (separate by comma)', size=(first_column_width, 1)), sg.InputText(default_text=includes[defaults._include_matchups], size=(third_column_width, 1), key=defaults._include_matchups)],
        
            # divider
            [sg.Text(' ')],

            # System Tray
            [sg.Checkbox('Automatically rename new replay files', key='tray', default=tray)],

            # divider
            [sg.Text(' ')],

            # Final Buttons
            [sg.Button('Rename', key='Rename'), sg.Save(), sg.Button('Default', key='Default'), sg.Exit()]
        ]
Exemplo n.º 18
0
    def run_renamer(self, op, in_tray=False, question=True):
        """renames all of the files that passed through the filters"""
        
        # asks user if they would like to rename all of their replays, or just new ones if they run in tray for the first time
        rename_all = 'Yes' if not in_tray else 'No'
        my_id = int(self.settings[defaults._player_id]) if self.settings[defaults._player_id] else ''
        
        if in_tray and question:
            rename_all = sg.popup_yes_no("Do you want to rename all replays?\n(If you select no, the tool will only rename newly created replay files)")

        
        source_path = self.settings[defaults._source_dir]
        dest = self.settings[defaults._target_dir]
        template = self.settings[defaults._template]

        # check if template is valid, requires player ID
        if self.template_contains_id_vars(template) and not my_id:
            sg.popup_error('Your template requires you to have Player ID filled in')
            return None

        # checks if source and target dir are the same
        if self.settings[defaults._source_dir] == self.settings[defaults._target_dir] and self.settings[defaults._operation] == defaults._copy:
            check = sg.popup_yes_no('Your replay directory and your Destination folder are the same. This is not recommended, unless your file operation is Move.\n\nAre you sure you want to proceed?')
            if check == 'No':
                return None
        
        # checks if source and target directories exists
        if not os.path.isdir(self.settings[defaults._source_dir]):
            sg.popup_error('Your replays folder is invalid!')
            return None
        
        if not os.path.isdir(self.settings[defaults._target_dir]):
            sg.popup_error('Your destination folder does not exist!')
            return None

        # check if there will be duplicate names
        if self.may_contain_duplicates(template):
            check = sg.popup_yes_no('Your template string may cause different replays to contain the same name. This WILL result in some replays being lost. Are you sure you want to proceed?')
            if check == 'No':
                sg.popup_ok('Your files have not been changed. Please change your template to include the $uniqueID variable')
                return None
        
        # renames all replays detected
        elif rename_all == 'Yes':
            excluded_directories = split_string(self.settings[defaults._excludes][defaults._exclude_dirs])

            # load replays
            sc2 = SC2Factory(directory=source_path, exclude=excluded_directories, depth=1, followlinks=True)
            replays = sc2.load_replays(source_path, load_level=2, load_maps=False, exclude=excluded_directories)
            
            renamed_count = 0
            start_time = time.time()

            for replay in replays:
                
                # exclude AI
                if self.settings[defaults._excludes][defaults._ai] and replay.computers:
                    continue
                
                # exclude customs
                if self.settings[defaults._excludes][defaults._custom] and not replay.is_ladder:
                    continue

                # exclude all replays that are not within the bounds of number of players
                min_players = int(self.settings[defaults._includes][defaults._min_players])
                max_players = int(self.settings[defaults._includes][defaults._max_players])
                if not min_players <= len(replay.players) <= max_players:
                    continue

                # exclude WoL
                if replay.expansion == defaults._wol and not self.settings[defaults._includes][defaults._wol]:
                    continue

                # exclude HotS
                if replay.expansion == defaults._hots and not self.settings[defaults._includes][defaults._hots]:
                    continue

                # exclude LotV
                if replay.expansion == defaults._lotv and not self.settings[defaults._includes][defaults._lotv]:
                    continue

                # check to remove by matchups
                exclude_matchups = split_string(self.settings[defaults._excludes][defaults._exclude_matchups])
                include_matchups = split_string(self.settings[defaults._includes][defaults._include_matchups])

                should_exclude = self.has_matching(replay, exclude_matchups, has_id=self.template_contains_id_vars(template))
                should_include = self.has_matching(replay, include_matchups, has_id=self.template_contains_id_vars(template))
                
                if should_exclude:
                    continue
                
                # if include_matchups actually contains a string and it does not pass the include filter
                if include_matchups and not should_include:
                    continue
                

                # actually doing the renaming, after the filtering
                newname = template

                teams = replay.teams[:]
                if self.template_contains_id_vars(template):
                    my_team_list = list(filter(lambda team: my_id in [player.toon_id for player in team.players], teams))
                    
                    # make the first team the team you were on
                    if len(my_team_list) > 0:
                        my_team = my_team_list[0]
                        if teams[0] != my_team:
                            my_team_index = teams.index(my_team)
                            teams[0], teams[my_team_index] = teams[my_team_index], teams[0]

                    # "forward" everything to be non-ID based
                    newname = newname.replace('$myteamwithmmr', '$t1withmmr')
                    newname = newname.replace('$myteam', '$team1')
                    newname = newname.replace('$oppteams', '$team2')
                    newname = newname.replace('$myraces', '$t1races')
                    newname = newname.replace('$oppraces', '$t2races')
                    newname = newname.replace('$mymmr', '$t1mmr')
                    newname = newname.replace('$oppmmr', '$t2mmr')
                    newname = newname.replace('$oppwithmmr', '$t2withmmr')

                    
                # good luck trying to maintain this
                first_team = teams[0]
                teams.remove(first_team)
                team1player = first_team.players[0]
                team1_player_list = [player.name for player in first_team]
                team2_player_list = ['+'.join([player.name for player in team.players]) for team in teams]
                team2_with_mmr = ['+'.join([player.name for player in team.players]) +'('+ (str(max(0, team.players[0].init_data['scaled_rating'])) if replay.is_ladder else "0") + ')' for team in teams]
                opp_races_list = [team.lineup for team in teams]
                
                # variables to fill
                team1 = '+'.join(team1_player_list)
                t1races = first_team.lineup
                t1mmr = str(max(0, team1player.init_data['scaled_rating'])) if replay.is_ladder else '0'
                WL = 'W' if replay.winner == first_team else 'L'
                wl = WL.lower()
                team2 = 'v'.join(team2_player_list)
                t2withmmr = 'v'.join(team2_with_mmr)
                t2races = 'v'.join(opp_races_list)
                t2mmr = 'v'.join([str(team.players[0].init_data['scaled_rating']) if not replay.computers else '0' for team in teams])
                sc2map = replay.map_name
                durationhours = str(replay.game_length.hours)
                durationmins = str(replay.game_length.mins)
                durationsecs = str(replay.game_length.secs)
                date = datetime.fromtimestamp(replay.unix_timestamp)
                month = add_leading_zero(date.month)
                year = add_leading_zero(date.year)
                day = add_leading_zero(date.day)
                hour = add_leading_zero(date.hour)
                minute = add_leading_zero(date.minute)
                sec = add_leading_zero(date.second)
                currentname = ntpath.split(replay.filename)[1].replace('.SC2Replay', '')
                uniqueID = str(day) + str(month) + str(year) + str(hour) + str(minute) + str(sec)

                template_vars = {
                    'team1': team1,
                    't1races': t1races,
                    't1mmr': t1mmr,
                    't1withmmr': f'{team1}({t1mmr})',
                    'wl': wl,
                    'WL': WL,
                    'team2': team2,
                    't2withmmr': t2withmmr,
                    't2races': t2races,
                    't2mmr': t2mmr,
                    'map': sc2map,
                    'durationhours': durationhours,
                    'durationmins': durationmins,
                    'durationsecs': durationsecs,
                    'month': month,
                    'year': year,
                    'day': day,
                    'hour': hour,
                    'min': minute,
                    'sec': sec,
                    'gametype': replay.real_type,
                    'expansion': replay.expansion,
                    'currentname': currentname,
                    'uniqueID': uniqueID
                }

                # fill in everything in the template
                for var in stringmatch.non_id_variables:
                    newname = newname.replace(f'${var}', template_vars[var])
                
                newname += '.SC2Replay'

                # do the renaming operation
                orig_location = replay.filename
                new_location = join(dest, newname)
                op(orig_location, new_location)
                renamed_count += 1
            
            end_time = time.time()
            sg.popup_ok(f'Job Done!\nRenamed {renamed_count} replays in {str(end_time - start_time)[:3]} seconds')
        
        if in_tray:
            print('going to implement')
Exemplo n.º 19
0
import PySimpleGUIWx as sg

"""
    System Tray Icon
    Your very own peronsal status monitor in your system tray
    Super easy to use.
    1. Find an icon file or use this default
    2. Create your menu defintion
    3. Add if statements to take action based on your input

"""

logo = b'iVBORw0KGgoAAAANSUhEUgAAACEAAAAgCAMAAACrZuH4AAAABGdBTUEAALGPC/xhBQAAAwBQTFRFAAAAMGmYMGqZMWqaMmubMmycM22dNGuZNm2bNm6bNG2dN26cNG6dNG6eNW+fN3CfOHCeOXGfNXCgNnGhN3KiOHOjOXSjOHSkOnWmOnamOnanPHSiPXakPnalO3eoPnimO3ioPHioPHmpPHmqPXqqPnurPnusPnytP3yuQHimQnurQn2sQH2uQX6uQH6vR32qRn+sSXujSHynTH2mTn+nSX6pQH6wTIGsTYKuTYSvQoCxQoCyRIK0R4S1RYS2Roa4SIe4SIe6SIi7Soq7SYm8SYq8Sou+TY2/UYStUYWvVIWtUYeyVoewUIi0VIizUI6+Vo+8WImxXJG5YI2xZI+xZ5CzZJC0ZpG1b5a3apW4aZm/cZi4dJ2/eJ69fJ+9XZfEZZnCZJzHaZ/Jdp/AeKTI/tM8/9Q7/9Q8/9Q9/9Q+/tQ//9VA/9ZA/9ZB/9ZC/9dD/9ZE/tdJ/9dK/9hF/9hG/9hH/9hI/9hJ/9hK/9lL/9pK/9pL/thO/9pM/9pN/9tO/9tP/9xP/tpR/9xQ/9xR/9xS/9xT/91U/91V/t1W/95W/95X/95Y/95Z/99a/99b/txf/txh/txk/t5l/t1q/t5v/+Bb/+Bc/+Bd/+Be/+Bf/+Bg/+Fh/+Fi/+Jh/+Ji/uJk/uJl/+Jm/+Rm/uJo/+Ro/+Rr/+Zr/+Vs/+Vu/+Zs/+Zu/uF0/uVw/+dw/+dz/+d2/uB5/uB6/uJ9/uR7/uR+/uV//+hx/+hy/+h0/+h2/+l4/+l7/+h8gKXDg6vLgazOhKzMiqrEj6/KhK/Qka/Hk7HJlLHJlLPMmLTLmbbOkLXSmLvXn77XoLrPpr/Tn8DaocLdpcHYrcjdssfZus/g/uOC/uOH/uaB/uWE/uaF/uWK/+qA/uqH/uqI/uuN/uyM/ueS/ueW/ueY/umQ/uqQ/uuS/uuW/uyU/uyX/uqa/uue/uye/uyf/u6f/uyq/u+r/u+t/vCm/vCp/vCu/vCy/vC2/vK2/vO8/vO/wtTjwtXlzdrl/vTA/vPQAAAAiNpY5gAAAQB0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AFP3ByUAAAAJcEhZcwAAFw8AABcPASe7rwsAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjEuMWMqnEsAAAKUSURBVDhPhdB3WE1xHMdxt5JV0dANoUiyd8kqkey996xclUuTlEKidO3qVnTbhIyMW/bee5NskjJLmR/f3++cK/94vP76Ps/n/Zx7z6mE/6koJowcK154vvHOL/GsKCZXkUgkWlf4vWGWq5tsDz+JWIzSokAiqXGe7nWu3HxhEYof7fhOqp1GtptQuMruVhQdxZ05U5G47tYUHbQ4oah6Fg9Z4ubm7i57JhQjdHS0RSzUPoG17u6zZTKZh8c8XlytqW9YWUOH1LqFOZ6enl5ec+XybFb0rweM1tPTM6yuq6vLs0lYJJfLvb19fHwDWGF0jh5lYNAe4/QFemOwxtfXz8/fPyBgwVMqzAcCF4ybAZ2MRCexJGBhYGBQUHDw4u1UHDG1G2ZqB/Q1MTHmzAE+kpCwL1RghlTaBt/6SaXS2kx9YH1IaOjSZST8vfA9JtoDnSngGgL7wkg4WVkofA9mcF1Sx8zMzBK4v3wFiYiMVLxlEy9u21syFhYNmgN7IyJXEYViNZvEYoCVVWOmUVvgQVSUQqGIjolRFvOAFd8HWVs34VoA+6OjY2JjY5Vxm4BC1UuhGG5jY9OUaQXci1MqlfHx8YmqjyhOViW9ZsUN29akJRmPFwkJCZsTSXIpilJffXiTzorLXYgtcxRJKpUqKTklJQ0oSt9FP/EonxVdNY4jla1kK4q2ZB6mIr+AipvduzFUzMSOtLT09IyMzMxtJKug/F0u/6dTexAWDcXXLGEjapKjfsILOLKEuYiSnTQeYCt3UHhbwEHjGMrETfBJU5zq5dSTcXC8hLJccSWP2cgLXHPu7cQNAcpyxF1dyjehAKb0cSYUAOXCUw6V8OFPgevTXFymC+fPPLU677Nw/1X8A/AbfAKGulaqFlIAAAAASUVORK5CYII='


menu_def = ['UNUSED', ['My', 'Simple', '---', 'Menu', 'Exit']]

tray = sg.SystemTray(menu=menu_def, data_base64=logo)

tray.ShowMessage('Starting', 'Now Starting the application')

while True:
    event = tray.Read()
    if event == 'Exit':
        break
    elif event == 'Menu':       # add your checks here
        pass
    tray.ShowMessage('Event', '{}'.format(event))
Exemplo n.º 20
0
            "Error", "Could not open file: {}".format(config.__config_path__))


if __name__ == '__main__':
    wd = os.getcwd()

    # Load/set parameters
    icon = resource_path(os.path.join('src', 'assets', 'icon.ico'))
    menu_def = ['MENU', ['Open settings', 'Exit']]
    git_path, root_path, poll_frequency = get_config_info()

    # Start to system tray
    print(
        "Starting git-watch (polling every {} seconds)".format(poll_frequency))
    tray = sg.SystemTray(menu=menu_def,
                         filename=icon,
                         tooltip="git-watch: running")
    tray.ShowMessage(title='git-watch',
                     message='The application has started',
                     time=500)

    # Main loop
    try:
        i = 0
        while True:
            # Reload config data
            os.chdir(wd)
            git_path, root_path, poll_frequency = get_config_info()

            # Read input from tray icon
            event = tray.Read(timeout=1000)
def system_tray():

    menu_def = ['Root',
                ['E&xit']]
    tray = sg.SystemTray(menu=menu_def, data_base64=logo, tooltip='GitHub Issue Watcher')
    # tray = SystemTray(menu=menu_def, filename= ICON_FILE, tooltip='GitHub Issue Watcher')

    # tray.Hide()
    initial_issue_count, initial_first_issue = get_num_issues()
    tray.ShowMessage('Starting up...', '{} Issues\n{} First Issue'.format(initial_issue_count, initial_first_issue),
                     messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_CRITICAL, )
    issues = first_issue = 0
    # The Event Loop runs every 5000ms
    poll_frequncy = 5000
    seconds = 0
    print('Starting', datetime.datetime.now())
    while True:
        menu_item = tray.Read(timeout=poll_frequncy)
        if menu_item == 'Exit':
            break
        if menu_item == 'Run GUI':
            tray.Update(data_base64=red_x)
            gui()
            tray.Update(data_base64=logo)
        elif menu_item.startswith('View Issues'):
            sg.PopupNoWait('Refreshing issue data...', auto_close=True, auto_close_duration=3)
            issues, first_issue = get_num_issues()
            tray.ShowMessage('Refreshed', '{} Issues\n{} First Issue'.format(issues, first_issue), messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_INFORMATION, )
            sp = subprocess.Popen([CHROME, VIEW_ISSUES_URL], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif menu_item  in('Refresh', sg.EVENT_SYSTEM_TRAY_ICON_DOUBLE_CLICKED):
            tray.ShowMessage('Refreshing', 'Old values are\n{} Issues\n{} First Issue'.format(issues, first_issue), messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_NOICON )
            tray.Update(data_base64=red_x)
            issues, first_issue = get_num_issues()
            tray.ShowMessage('Refreshed', '{} Issues\n{} First Issue'.format(issues, first_issue), messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_CRITICAL, )
            tray.Update(data_base64=logo)
        # elif menu_item == sg.EVENT_SYSTEM_TRAY_ICON_ACTIVATED:
        #     tray.ShowMessage('Last check', '{} Issues\n{} First Issue'.format(issues, first_issue), messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_INFORMATION, )
        elif menu_item == sg.EVENT_SYSTEM_TRAY_MESSAGE_CLICKED :
            tray.Update(data_base64=logo)
            sp = subprocess.Popen([CHROME, VIEW_ISSUES_URL], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif  menu_item.startswith('Pull'):
            sp = subprocess.Popen([CHROME, PULL_REQUEST_URL], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif  menu_item.startswith('Announcements'):
            sp = subprocess.Popen([CHROME, ANNOUCEMENTS], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif  menu_item.startswith('Traffic'):
            sp = subprocess.Popen([CHROME, TRAFFIC], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif  menu_item.startswith('Search'):
            sp = subprocess.Popen([CHROME, SEARCH], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif  menu_item.startswith('Discord'):
            sp = subprocess.Popen([DISCORD, r''], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif  menu_item.startswith('PyPI'):
            sp = subprocess.Popen([CHROME, PYPI_STATS], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)


        if seconds % 12 == 0:     # Every 60 seconds read GitHub
            issues, first_issue = get_num_issues()
            if issues != 0:
                menu_def = ['root',
                            ['{} Issues'.format(issues), '{} First Issue'.format(first_issue), '---','&View Issues Online', '&Pull Request','---', 'Announcements', 'Traffic', 'PyPI Stats', 'Search for Project' , '&Discord', '---','&Run GUI', '&Refresh',  'E&xit']]
                tray.Update(menu_def, tooltip='{} First Issue'.format(first_issue))
                # if something changed, then make a popup
                if issues != initial_issue_count or first_issue != initial_first_issue:
                    sg.PopupNonBlocking('Issues changed on GitHub ', 'First issue # is {}'.format(first_issue), background_color='red', keep_on_top=True, grab_anywhere=True)
                    initial_issue_count = issues
                    initial_first_issue = first_issue
                    tray.Update(data_base64=logo32x32red)
                    tray.ShowMessage('Issues changes!', '{} Issues\n{} First Issue'.format(issues, first_issue), messageicon=sg.SYSTEM_TRAY_MESSAGE_ICON_CRITICAL, )

            else:

                sg.PopupNonBlocking('Update error at: ',  datetime.datetime.now(),
                                    background_color='red', keep_on_top=True, grab_anywhere=True)
                print('Update failed', datetime.datetime.now())

        seconds += poll_frequncy/1000
mac build后有问题
'''

import PySimpleGUIWx as sg
import time
import sys
import pathlib
from codelab_adapter_client import AdapterNode
from codelab_adapter_client.topic import NODES_OPERATE_TOPIC
from codelab_adapter_client.utils import is_win, open_webui, open_path

codelab_adapter_dir = pathlib.Path.home() / "codelab_adapter"
app_icon = str(
    codelab_adapter_dir / 'src') + "/app." + ('ico' if is_win() else 'png')
tray = sg.SystemTray(
    menu=['menu', ['Open WebUi', 'Open Adapter Home', 'E&xit']],
    filename=app_icon)
# tray.ShowMessage('My Message', 'The tray icon is up and runnning!')


class MyNode(AdapterNode):
    NODE_ID = "eim/node_status_bar_win"
    # HELP_URL = "https://adapter.codelab.club/extension_guide/status_bar/"
    DESCRIPTION = "status bar"

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def terminate(self, stop_cmd_message_id=None):
        print("terminate")
        super().terminate(stop_cmd_message_id=stop_cmd_message_id)
Exemplo n.º 23
0
import PySimpleGUIWx as sg

# Функции и кнопки окон
layout = [
    [
        sg.Text('Вас приветствует мобильное приложение библиотеки!',
                size=(150, 50)),
    ],
    [sg.Button('Поиск книги', size=(10, 50))],
    # [sg.Text('Enter something on Row 2'), sg.InputText()],  # InputText - небольшое окно для ввода текста
    [sg.Button('Закрыть приложение')],
    #[sg.Button('')],
    [sg.Button('очко товарища')]
]
# TODO доделать кнопки, понять как поставить местоположение текста и кнопок(выполняется)

layout2 = [[
    sg.Radio(text='вкл', default=True, group_id='aa'),
    sg.Radio(text='выкл', group_id='aa')
], [sg.Cancel()]]


def win1():  # Создаем и открываем доп окна
    win1 = sg.Window('Сеть',
                     layout2,
                     no_titlebar=True,
                     grab_anywhere=True,
                     size=(120, 500))
    while True:
        event, values = win1.read(
            timeout=200)  # Пауза обновления окна в мc  0,2 сек
Exemplo n.º 24
0
def make_window(theme):
    sg.theme(theme)

    layout = [
        [
            sg.Text("フォルダ"),
            sg.InputText(key=KEY_TARGET_FOLDER),
            sg.FolderBrowse(),
            sg.Checkbox("デバッグ出力を有効にする",
                        default=False,
                        pad=(20, 0),
                        key=KEY_ENABLE_DEBUGMODE),
        ],
        [sg.Submit("実行", key=KEY_EXEC_BUTTON)],
        [sg.Text("\n実行結果")],
        [sg.Multiline(size=(80, 12), key=KEY_EXEC_RESULT_OUTPUT)],
        [sg.Text("全パターン出力されます。適切なものを1つ選んで Twitter に投稿してください。")],
        [sg.Text("\n\nログ")],
        [sg.Output(size=(80, 12))],
    ]

    return sg.Window(f'fgogachacnt FGOガチャ結果スクショ集計 {version}', layout)
Exemplo n.º 25
0
# import PySimpleGUI as sg
import PySimpleGUIWx as sg
# import PySimpleGUIQt as sg
"""
    System Tray Icon
    Your very own personsal status monitor in your system tray
    Super easy to use.
    1. Find an icon file or use this default
    2. Create your menu definition
    3. Add if statements to take action based on your input

    Note from the imports that this code works on all PySimpleGUI ports (except Web).
    For the tkinter port, however, the icon isn't located in the system tray. Instead it's located just above
    the system tray in the form of what looks like an "icon" on your desktop.  It's actually a very small window.
"""

menu_def = ['UNUSED', ['My', 'Simple', '---', 'Menu', 'Exit']]

tray = sg.SystemTray(menu=menu_def, data_base64=sg.DEFAULT_BASE64_ICON)

while True:
    event = tray.read()
    if event == 'Exit':
        break
    elif event == 'Menu':
        tray.show_message('Title', 'Hey, you clicked Menu!')
Exemplo n.º 26
0
#     if event in '01234567':

#         # step button state and update button colour
#         buttonstate = buttonstate + 1
#         window.FindElement(event).Update(
#             button_color=('black', statecolor[buttonstate]))

# window.Close()

import PySimpleGUIWx as sg
matrix = [[str(x * y) for x in range(5)] for y in range(10)]
header = ["one", "two", "three", "four", "five"]
Table = sg.Table(
    values=matrix,
    key="_table1_",
    headings=header,
)
layout = [[sg.Text("Table")], [Table], [sg.Button("refresh")],
          [sg.Button("Exit")]]
window = (sg.Window("Table", default_element_size=(20, 22),
                    resizable=False).Layout(layout).Finalize())

while True:

    event, values = window.Read()
    if event is None or event == "Exit":
        break
    elif event == "refresh":
        matrix[0][1] = "10000"
        window.FindElement("_table1_").Update(matrix)
Exemplo n.º 27
0
        print(trlog + desiredlang)
        translation = translator.translate(translation.text, dest=desiredlang)
        translation = translator.translate(translation.text, dest=sourcelang)
        global translating
        translating = False
        print(trdone)
        return translation.text
    except json.decoder.JSONDecodeError:
        translating = False
        return googlebannotice
    except Exception:
        translating = False
        return etcexception


sg.theme('DarkBrown1')

layout = [[sg.Text(title, size=(25, 1), justification='center')],
          [sg.Text(netspeednote, size=(30, 1), justification='center')],
          [sg.InputText(default_text=ttt, size=(30, 1))],
          [sg.Text(result, justification='center')],
          [sg.InputText(key='-OUTPUT-', size=(30, 1))],
          [sg.T(' ' * 15),
           sg.Button('Translate', focus=True),
           sg.Quit()]]

window = sg.Window(wintitle, layout)

print(initdone)

while True:
Exemplo n.º 28
0
import PySimpleGUIWx as sg
import sys
import time

sg.Popup('Test' * 10, title='My title')
# sg.Print('test', location=(400,200))
# sg.PopupScrolled(sg.ObjToString(sg.Window), title='My scrolled popup', non_blocking=True)
# sg.Print('Outputting to another line\n')
sg.PopupNonBlocking('Issues changed on GitHub ',
                    'First issue # is {}'.format(1),
                    background_color='red',
                    keep_on_top=False)
file = sg.PopupGetFile('Get file',
                       save_as=False,
                       file_types=(("ALL Files", "*.jpg"), ),
                       no_window=False)
folder = sg.PopupGetFolder('Getting a folder', no_window=False)
sg.Popup('Test' * 10, title='My title')
sg.Print('file = ', file)
sg.Print('folder = ', folder)
sg.Print(file)
# sg.Print(file)
sg.PopupQuickMessage('This is a quick message', location=(1000, 600))
# Here, have some windows on me....
[
    sg.PopupNoWait('No-wait Popup', location=(500 + 100 * x, 500))
    for x in range(10)
]

answer = sg.PopupYesNo(
    'Do not worry about all those open windows... they will disappear at the end',
Exemplo n.º 29
0
notebookActive = False
analyticsActive = False
historyActive = False
dash_active = False
signup_active = False

# # # # # # # #
# Handy dates #
# # # # # # # #

today_date = str(datetime.date.today())
year = int(today_date[0:4])
month = int(today_date[5:7])
day = int(today_date[9:])

sg.ChangeLookAndFeel('NeutralBlue')

tooltips = [
    'Log a new transaction',
    'Quickly jot down transactions and make calculations. Export them to a csv file',
    'View graphs of your expenditure and income history',
    'See all of your transactions'
]

# # # # # # # # # # # # # # # # # # # #
#             LOGIN AREA              #
# # # # # # # # # # # # # # # # # # # #

layout = [[
    sg.Text(
        'Welcome to Xpnsit, the best way to manage your expenses! To begin, login or signup below.',
Exemplo n.º 30
0
    sg.LOOK_AND_FEEL_TABLE["Native"] = {
        "BACKGROUND": sg.COLOR_SYSTEM_DEFAULT,
        "TEXT": sg.COLOR_SYSTEM_DEFAULT,
        "INPUT": sg.COLOR_SYSTEM_DEFAULT,
        "TEXT_INPUT": sg.COLOR_SYSTEM_DEFAULT,
        "SCROLL": sg.COLOR_SYSTEM_DEFAULT,
        "BUTTON": (sg.COLOR_SYSTEM_DEFAULT, sg.COLOR_SYSTEM_DEFAULT),
        "PROGRESS": sg.DEFAULT_PROGRESS_BAR_COLOR,
        "BORDER": 1,
        "SLIDER_DEPTH": 0,
        "PROGRESS_DEPTH": 0,
    }

    sg.wx.NO_BORDER = 0  # No styling
    sg.theme("Native")

    hex_path, pcap_path = set_path()

    layout = [
        [
            sg.Frame(
                "Exe Path",
                [
                    [
                        sg.Text("convert-hex", size=(12, 1)),
                        sg.Input(key="hex_path", default_text=hex_path),
                        sg.FileBrowse(file_types=(("EXE", "convert-hex.exe"),)),
                    ],
                    [
                        sg.Text("text2pcap", size=(12, 1)),