Ejemplo n.º 1
0
def reqProcB(tag):  #Requests Busts tag.
    bust = []  #Alphabet
    cup = []  #Raw Number
    did = False
    if not tag == '':
        layout = [[sg.Text('Would you like to search for bust size too?')],
                  [sg.Button('Hell Yes!'),
                   sg.Button('Nah...')]]
        window = sg.Window('O.H.D.A.M.N.', layout, finalize=True)
        event, garbval = window.read()
        if event in ('Hell Yes!'):
            sg.popup_quick_message(
                'Please use this responsibly, as to not DOS attack the server!'
            )
            bustsurl = 'https://paizukan.com/html/'
            toget = bustsurl + tag
            check = []
            check1 = 'data-bust="'  #rating, numerically
            try:
                response = requests.get(toget)
                response.raise_for_status(
                )  #untested, but in theory it should test for 401 (or other errors) and if true, send it to except.
                did = True
                response = response.text
                check = [
                    line for line in response.splitlines() if check1 in line
                ]  #checking each line. I refuse to use beautifulsoup.
                for i in range(
                        len(check)
                ):  #check now contains all the goodies, but has trash.
                    hold = check[i].split(" d")  #splits them into three.
                    cup.append(re.sub("[^0-9]", "",
                                      hold[1]))  #getting the raw number.
                    bust.append(hold[0].split(" ")[-1]
                                [:-1])  #getting the alphabetical designation.
            except requests.exceptions.HTTPError as err:  #Temp fix for errors, usually because no auth. Anything else, they changed something on their end.
                sg.popup(
                    'Paizukan has returned an error. Skipped. Error code ',
                    err,
                    title='O.H.D.E.A.R.')
        elif event in (None, 'Nah...'):
            sg.popup('Alright then.', title="O.H.D.E.A.R.")
        window.close()
        del window
    else:
        sg.popup('Skipping bustcheck as it is unsupported.',
                 title='O.H.D.E.A.R.')
    return bust, cup, did
Ejemplo n.º 2
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
Ejemplo n.º 3
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
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()
Ejemplo n.º 5
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
Ejemplo n.º 6
0
        '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

while True:
    # if not dash_active or not signup_active:
    event, values = login_window.Read(timeout=100)

    if event != sg.TIMEOUT_KEY:
        print(i, event, values)

    if event is None or event == 'Exit':
Ejemplo n.º 7
0
        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
        if event in 'Translate':
            if not translating:
                translating = True
                window['-OUTPUT-'].update(translate(values[0]))
Ejemplo n.º 8
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()]
        ]
Ejemplo n.º 9
0
                    [
                        sg.Text("text2pcap", size=(12, 1)),
                        sg.Input(key="pcap_path", default_text=pcap_path),
                        sg.FileBrowse(file_types=(("EXE", "text2pcap.exe"),)),
                    ],
                ],
            )
        ],
        [sg.Text("Select text file:")],
        [
            sg.Text("File", size=(12, 1)),
            sg.Input(key="file_path"),
            sg.FileBrowse(initial_folder=".\\", file_types=(("TXT", "*.txt"),)),
        ],
        [
            sg.Button("txt", size=(8, 2), auto_size_button=False),
            sg.Button("pcap", size=(8, 2), auto_size_button=False),
        ],
        [sg.Output(size=(45, 7))],
    ]

    window = sg.Window("Window Title", layout)

    while True:
        event, values = window.read()
        if event in (sg.WIN_CLOSED):
            break
        if event == "txt":
            execute_command(values["hex_path"], values["file_path"])
        elif event == "pcap":
            fname = "hex-" + Path(values["file_path"]).stem
Ejemplo n.º 10
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 сек
Ejemplo n.º 11
0
#         # 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)
    print(event, values)
window.Close()
#ログイン状態 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)],
                  [sg.Button('利用規約を確認', key='terms'),sg.Checkbox('利用規約に同意する', default=False)],
                  [sg.Button('操作開始', key='start')],]
                  )

frame3 = sg.Frame('\n個別操作',[[sg.Text('\nツイート')],