Exemplo n.º 1
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.º 2
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.º 3
0
def dirscan(
):  #Directory Scan. Used to allow user to locate the file to scrape.
    layout = [[sg.Text('Which list would you like to scour?')],
              [
                  sg.InputText(),
                  sg.FileBrowse(file_types=(''), initial_folder='./url')
              ], [sg.Button('Confirm'),
                  sg.Button('Cancel')]]
    window = sg.Window('O.H.D.A.M.N.', layout)
    while True:
        event, values = window.read()
        if not values[0] and not event in (None, 'Cancel'):
            sg.popup('No file selected. Please select a file!',
                     title='O.H.D.E.A.R.')
        elif event in (None, 'Cancel'):
            sg.popup('User closed script. :(', title='O.H.D.E.A.R.')
            sys.exit()
        elif event == 'Confirm':
            sg.popup('Confirmed!', title='O.H.D.E.A.R.')
            filechosen = values[0]
            break
    window.close()
    del window
    return filechosen
Exemplo n.º 4
0
    '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.',
        font=('Helvetica', 15),
        justification='center')
], [
    sg.T(space1),
    sg.Text('Username', size=(15, 1)),
    sg.InputText(key='_name_')
],
          [
              sg.T(space1),
              sg.Text('Password', size=(15, 1)),
              sg.InputText(key='_password_', password_char='*')
          ], [sg.T('')],
          [
              sg.T(space2),
              sg.Button('Login', tooltip='Login', bind_return_key=True),
              sg.Button('Signup', tooltip='Signup (if you haven\'t already)')
          ]]
login_window = sg.Window('Xpnsit v0.1').Layout(layout)

# Calling the login window and starting an event loop
i = 0
Exemplo n.º 5
0
        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:
    try:
        event, values = window.read(timeout=10)
        if event in (None, 'Quit'):
            break
Exemplo n.º 6
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()]
        ]
import threading
import time
import sys
import os

#ログイン状態 0=ログインしてない 1=ログインしている
account = 0

#今いるパスの検出
path = os.getcwd()

#レイアウトの設定と起動
sg.theme('Material2')

frame1 = sg.Frame('Twitterのアカウント情報を入力してください',[[sg.Text('電話、メールまたはユーザー名')],
                  [sg.InputText('', size=(80, 1), key='LoginID')],
                  [sg.Text('パスワード')],
                  [sg.InputText('', size=(80, 1), key='LoginPASS')],
                  [sg.Checkbox('セッション情報をファイルに出力しますか?', default=False)],
                  [sg.Text('セッションファイル'), sg.Input(path + '/cookies.pkl', size=(40, 1)), sg.FileBrowse('ファイルを選択', key='inputFilePath')],
                  [sg.Button('ログイン', key='login'),sg.Button('ログアウト', key='logout'),sg.Button('セッションログイン', key='session_login')],]
                  )

frame2 = sg.Frame('\n項目選択',[[sg.Checkbox('全フォロワーブロ解', default=False)],
                  [sg.Checkbox('全リム', default=False)],
                  [sg.Checkbox('Bio削除', default=False)],
                  [sg.Checkbox('ミュート、ブロック解除', default=False)],
                  [sg.Checkbox('連携解除', default=False)],
                  [sg.Checkbox('ツイ消し', default=False)],
                  [sg.Checkbox('ふぁぼ取り消し', default=False)],
                  [sg.Checkbox('DM削除', default=False)],