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()
Exemple #2
0
    '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.',
        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)
Exemple #3
0
    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
        if event in 'Translate':
            if not translating:
                translating = True