Esempio n. 1
0
def Launcher2():
    sg.ChangeLookAndFeel('GreenTan')
    window = sg.Window('Script launcher')

    filelist = glob.glob(LOCATION_OF_YOUR_SCRIPTS + '*.py')
    namesonly = []
    for file in filelist:
        namesonly.append(ntpath.basename(file))

    layout = [
        [
            sg.Listbox(values=namesonly,
                       size=(30, 19),
                       select_mode=sg.SELECT_MODE_EXTENDED,
                       key='demolist'),
            sg.Output(size=(88, 20), font='Courier 10')
        ],
        [
            sg.Checkbox('Wait for program to complete',
                        default=False,
                        key='wait')
        ],
        [
            sg.ReadButton('Run'),
            sg.ReadButton('Shortcut 1'),
            sg.ReadButton('Fav Program'),
            sg.Button('EXIT')
        ],
    ]

    window.Layout(layout)

    # ---===--- Loop taking in user input and using it to query HowDoI --- #
    while True:
        (button, value) = window.Read()
        if button in ('EXIT', None):
            break  # exit button clicked
        if button in ('Shortcut 1', 'Fav Program'):
            print(
                'Quickly launch your favorite programs using these shortcuts')
            print(
                'Or  copy files to your github folder.  Or anything else you type on the command line'
            )
            # copyfile(source, dest)
        elif button is 'Run':
            for index, file in enumerate(value['demolist']):
                print('Launching %s' % file)
                window.Refresh()  # make the print appear immediately
                if value['wait']:
                    execute_command_blocking(LOCATION_OF_YOUR_SCRIPTS + file)
                else:
                    execute_command_nonblocking(LOCATION_OF_YOUR_SCRIPTS +
                                                file)
Esempio n. 2
0
    def PlayerChooseSongGUI(self):

        # ---------------------- DEFINION OF CHOOSE WHAT TO PLAY GUI ----------------------------

        layout = [[
            sg.Text('MIDI File Player',
                    font=("Helvetica", 15),
                    size=(20, 1),
                    text_color='green')
        ], [sg.Text('File Selection', font=("Helvetica", 15), size=(20, 1))],
                  [
                      sg.Text('Single File Playback', justification='right'),
                      sg.InputText(size=(65, 1), key='midifile'),
                      sg.FileBrowse(size=(10, 1),
                                    file_types=(("MIDI files", "*.mid"), ))
                  ],
                  [
                      sg.Text('Or Batch Play From This Folder',
                              auto_size_text=False,
                              justification='right'),
                      sg.InputText(size=(65, 1), key='folder'),
                      sg.FolderBrowse(size=(10, 1))
                  ], [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))],
                  [
                      sg.Text('Choose MIDI Output Device', size=(22, 1)),
                      sg.Listbox(values=self.PortList,
                                 size=(30, len(self.PortList) + 1),
                                 key='device')
                  ], [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))],
                  [
                      sg.SimpleButton('PLAY',
                                      size=(12, 2),
                                      button_color=('red', 'white'),
                                      font=("Helvetica", 15),
                                      bind_return_key=True),
                      sg.Text(' ' * 2, size=(4, 1)),
                      sg.Cancel(size=(8, 2), font=("Helvetica", 15))
                  ]]

        window = sg.Window('MIDI File Player',
                           auto_size_text=False,
                           default_element_size=(30, 1),
                           font=("Helvetica", 12)).Layout(layout)
        self.Window = window
        return window.Read()
Esempio n. 3
0
def parseWindow(
        window):  #parses all buttons,checkboxes, etc. for the selected window
    event, values = window.Read()
    event, values = window.Read()
    if event is None or event == "Exit":
        return 0
    elif event == "Open Config":
        fileName = openFileBox()
        os.system("gnome-terminal -e nano " + fileName)
        return 1
    elif event == "Add Account":
        addAccount()
        return 1
    elif event == "Add Client":
        addClient()
        return 1
    elif event == "Add Module":
        addModule()
        return 1
    elif event == "About":
        help = open(currentDir + "/../../README.md", "r").read()
        sg.PopupScrolled(help)
        return 1
    else:
        print event, values

    if event == "Execute":
        if values[1] == "Checkup":
            fullCheckup()
            return 1
        elif values[1] == "Single Account Checkup":
            layoutSingleAccountCheckup = [[
                sg.Listbox(values=(accounts.values()), size=(50, 20))
            ], [sg.Button("OK")]]
            windowSingleAccountCheckup = sg.Window("Check on which account?",
                                                   layoutSingleAccountCheckup)
            eventSC, valuesSC = windowSingleAccountCheckup.Read()
            #print valuesSC
            #print valuesSC[0][0][0]
            #print valuesSC[0][0][1]
            singleAccount(valuesSC[0][0][0], valuesSC[0][0][1])
        else:
            print(event, values)
    return 1
Esempio n. 4
0
def gui():

    #  Gui to get dates from the user
    dates = []
    layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Enter the dates of science images', font=('Helvetica', 14))],
              [sg.T('Format: 20180715'), sg.T('Added Date', size=(19,1), justification='right')],
              [sg.InputText('', size=(12, 1), key='datein'),
              sg.T('', size=(20, 1), justification='right', key='dateout')],
              [sg.Submit('Add Date')],
              [sg.Button('Next'), sg.Button('Exit')]]

    window = sg.Window('Window Title').Layout(layout)

    while True:  # Event Loop
        event, values = window.Read()
        print event, values
        if event is None or event == 'Exit':
            print '\nClosing program based on "Exit" command'
            sys.exit(1)
            break
        if event == 'Next':
            break
        if event == 'Add Date':
            dates.append(values['datein'])
            window.Element('dateout').Update(values['datein'])

    window.Close()


    #  Gui to get Path, Binning, and Temp from user
    layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Enter output path for your files', font=('Helvetica', 12))],
              [sg.InputText(outdir, size=(45, 1), key='path'), sg.Text('Leave as is for default')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Select the type of master frames to find', font=('Helvetica', 14))],
              [sg.Checkbox('Bias', default=True, size=(12, 1), key='Bias'),
               sg.Checkbox('Dark', default=True, size=(12, 1), key='Dark'),
               sg.Checkbox('Flat', default=True, size=(12, 1), key='Flat')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Select the Binning', font=('Helvetica', 14))],
              [sg.Radio('1X1', "RADIO1", default=True, key='1X1'), sg.Radio('2X2', "RADIO1", key='2X2'),
               sg.Radio('3X3', "RADIO1", key='3X3'), sg.Radio('4X4', "RADIO1", key='4X4')],
              [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Select the Temp', font=('Helvetica', 14))],
              [sg.Radio('-25', "RADIO2", default=True, key='-25'), sg.Radio('-30', "RADIO2", key='-30'),
               sg.Radio('-35', "RADIO2", key='-35')],
              [sg.Submit(), sg.Button('Exit')]]

    window = sg.Window('GBO Master Calibration Finder', font=("Helvetica", 12)).Layout(layout)

    event, values = window.Read()
    if event == 'Exit':
        print '\nClosing program based on "Exit" command'
        sys.exit(2)

    window.Close()

    types = ['Bias', 'Dark', 'Flat']
    types = [x for x in types if values[x] == True]
    binning = [x for x in bins if values[x] == True]
    binning = binning[0]
    temp = [x for x in temps if values[x] == True]
    temp = temp[0]

    outpath = values['path']
    if not outpath.endswith('\\'):
        outpath = outpath + '\\'


    #  Gui to get dark exposure times from the user
    if 'Dark' in types:
        darkbin = dark_files.where(done_files['binning'] == binning)
        darkbin.dropna(how='all', inplace=True)
        darktemp = darkbin.where(darkbin['temp'] == temp)
        darktemp.dropna(how='all', inplace=True)

        exposures = np.sort(darktemp['exp'].unique())

        layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
                  [sg.Text('Your Binning is:'), sg.Text(binning)],
                  [sg.Text('Your Temp is:', size=(12,1)), sg.Text(temp)],
                  [sg.Text('',size=(15,1)), sg.Text('Available Exposures')],
                  [sg.Text('', size=(16,1)),
                   sg.Listbox(exposures, size=(10,12), select_mode='multiple', key='exposures')],
                  [sg.Submit(), sg.Button('Exit')]]

        window = sg.Window('GBO Master Calibration Finder', font=("Helvetica", 12)).Layout(layout)

        event, values = window.Read()

        window.Close()

        if event == 'Exit':
            print '\nClosing program based on "Exit" command'
            sys.exit(3)

        exposures = values['exposures']
    else:
        exposures = []

    #  Gui to get filters from the user
    if 'Flat' in types:
        flatbin = flat_files.where(done_files['binning'] == binning)
        flatbin.dropna(how='all', inplace=True)
        flattemp = flatbin.where(flatbin['temp'] == temp)
        flattemp.dropna(how='all', inplace=True)

        filters = np.sort(flattemp['filter'].unique())

        layout = [[sg.Text('GBO Master Calibration Finder', font=('Helvetica', 25), justification='center')],
                  [sg.Text('Your Binning is:'), sg.Text(binning)],
                  [sg.Text('Your Temp is:', size=(12,1)), sg.Text(temp)],
                  [sg.Text('',size=(15,1)), sg.Text('Available Filters')],
                  [sg.Text('', size=(16,1)),
                   sg.Listbox(filters, size=(10,12), select_mode='multiple', key='filters')],
                  [sg.Submit(), sg.Button('Exit')]]

        window = sg.Window('GBO Master Calibration Finder', font=("Helvetica", 12)).Layout(layout)

        event, values = window.Read()

        window.Close()

        if event == 'Exit':
            print '\nClosing program based on "Exit" command'
            sys.exit(4)

        filters = values['filters']
    else:
        filters = []

    return types, outpath, binning, temp, dates, exposures, filters
    'Pyplot ggplot Style Sheet': PyplotGGPlotSytleSheet,
    'Pyplot Line Poly Collection': PyplotLinePolyCollection,
    'Pyplot Line Styles': PyplotLineStyles,
    'Pyplot Scatter With Legend': PyplotScatterWithLegend,
    'Artist Customized Box Plots': PyplotArtistBoxPlots,
    'Artist Customized Box Plots 2': ArtistBoxplot2,
    'Pyplot Histogram': PyplotHistogram
}

sg.ChangeLookAndFeel('LightGreen')
figure_w, figure_h = 650, 650
# define the form layout
listbox_values = [key for key in fig_dict.keys()]
col_listbox = [[
    sg.Listbox(values=listbox_values,
               change_submits=True,
               size=(28, len(listbox_values)),
               key='func')
], [sg.T(' ' * 12), sg.Exit(size=(5, 2))]]

layout = [
    [sg.Text('Matplotlib Plot Test', font=('current 18'))],
    [
        sg.Column(col_listbox, pad=(5, (3, 330))),
        sg.Canvas(size=(figure_w, figure_h), key='canvas'),
        sg.Multiline(size=(70, 35), pad=(5, (3, 90)), key='multiline')
    ],
]

# create the form and show it without the plot
window = sg.Window('Demo Application - Embedding Matplotlib In PySimpleGUI',
                   grab_anywhere=False).Layout(layout)
Esempio n. 6
0
     sg.Multiline(
         default_text=
         'This is the default Text should you decide not to type anything',
         size=(35, 3)),
     sg.Multiline(default_text='A second multi-line', size=(35, 3))
 ],
 [
     sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)),
     sg.Slider(range=(1, 100),
               orientation='h',
               size=(34, 20),
               default_value=85)
 ],
 [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))],
 [
     sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'),
                size=(30, 3)),
     sg.Frame('Labelled Group', [[
         sg.Slider(range=(1, 100),
                   orientation='v',
                   size=(5, 20),
                   default_value=25),
         sg.Slider(range=(1, 100),
                   orientation='v',
                   size=(5, 20),
                   default_value=75),
         sg.Slider(range=(1, 100),
                   orientation='v',
                   size=(5, 20),
                   default_value=10),
         sg.Column(column1, background_color='#F7F3EC')
     ]])
sg.SetOptions(element_padding=(0, 0))

layout = [[
    sg.T('Notes:', pad=((3, 0), 0)),
    sg.In(size=(44, 1),
          background_color='white',
          text_color='black',
          key='notes')
],
          [
              sg.T('Output:', pad=((3, 0), 0)),
              sg.T('', size=(44, 1), text_color='white', key='output')
          ],
          [
              sg.CBox('Checkbox:', default=True, pad=((3, 0), 0), key='cbox'),
              sg.Listbox((1, 2, 3, 4), size=(8, 3), key='listbox'),
              sg.Radio('Radio 1', default=True, group_id='1', key='radio1'),
              sg.Radio('Radio 2', default=False, group_id='1', key='radio2')
          ],
          [
              sg.Spin((1, 2, 3, 4), 1, key='spin'),
              sg.OptionMenu((1, 2, 3, 4), key='option'),
              sg.Combo(values=(1, 2, 3, 4), key='combo')
          ], [sg.Multiline('Multiline', size=(20, 3), key='multi')],
          [sg.Slider((1, 10), size=(20, 20), orientation='h', key='slider')],
          [
              sg.ReadButton('Enable', button_color=('white', 'black')),
              sg.ReadButton('Disable', button_color=('white', 'black')),
              sg.ReadButton('Reset',
                            button_color=('white', '#9B0023'),
                            key='reset'),
Esempio n. 8
0
def Everything():
    sg.ChangeLookAndFeel('TanBlue')

    column1 = [[
        sg.Text('Column 1',
                background_color=sg.DEFAULT_BACKGROUND_COLOR,
                justification='center',
                size=(10, 1))
    ],
               [
                   sg.Spin(values=('Spin Box 1', '2', '3'),
                           initial_value='Spin Box 1',
                           key='spin1')
               ],
               [
                   sg.Spin(values=('Spin Box 1', '2', '3'),
                           initial_value='Spin Box 2',
                           key='spin2')
               ],
               [
                   sg.Spin(values=('Spin Box 1', '2', '3'),
                           initial_value='Spin Box 3',
                           key='spin3')
               ]]

    layout = [
        [
            sg.Text('All graphic widgets in one form!',
                    size=(30, 1),
                    font=("Helvetica", 25))
        ], [sg.Text('Here is some text.... and a place to enter text')],
        [sg.InputText('This is my text', key='in1', do_not_clear=True)],
        [
            sg.Checkbox('Checkbox', key='cb1'),
            sg.Checkbox('My second checkbox!', key='cb2', default=True)
        ],
        [
            sg.Radio('My first Radio!     ',
                     "RADIO1",
                     key='rad1',
                     default=True),
            sg.Radio('My second Radio!', "RADIO1", key='rad2')
        ],
        [
            sg.Multiline(
                default_text=
                'This is the default Text should you decide not to type anything',
                size=(35, 3),
                key='multi1',
                do_not_clear=True),
            sg.Multiline(default_text='A second multi-line',
                         size=(35, 3),
                         key='multi2',
                         do_not_clear=True)
        ],
        [
            sg.InputCombo(('Combobox 1', 'Combobox 2'),
                          key='combo',
                          size=(20, 1)),
            sg.Slider(range=(1, 100),
                      orientation='h',
                      size=(34, 20),
                      key='slide1',
                      default_value=85)
        ],
        [
            sg.InputOptionMenu(
                ('Menu Option 1', 'Menu Option 2', 'Menu Option 3'),
                key='optionmenu')
        ],
        [
            sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'),
                       size=(30, 3),
                       key='listbox'),
            sg.Slider(
                range=(1, 100),
                orientation='v',
                size=(5, 20),
                default_value=25,
                key='slide2',
            ),
            sg.Slider(
                range=(1, 100),
                orientation='v',
                size=(5, 20),
                default_value=75,
                key='slide3',
            ),
            sg.Slider(range=(1, 100),
                      orientation='v',
                      size=(5, 20),
                      default_value=10,
                      key='slide4'),
            sg.Column(column1, background_color='gray34')
        ], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))],
        [
            sg.Text('Your Folder',
                    size=(15, 1),
                    auto_size_text=False,
                    justification='right'),
            sg.InputText('Default Folder', key='folder', do_not_clear=True),
            sg.FolderBrowse()
        ],
        [
            sg.ReadButton('Exit'),
            sg.Text(' ' * 40),
            sg.ReadButton('SaveSettings'),
            sg.ReadButton('LoadSettings')
        ]
    ]

    window = sg.Window('Form Fill Demonstration',
                       default_element_size=(40, 1),
                       grab_anywhere=False)
    # button, values = window.LayoutAndRead(layout, non_blocking=True)
    window.Layout(layout)

    while True:
        button, values = window.Read()

        if button is 'SaveSettings':
            filename = sg.PopupGetFile('Save Settings',
                                       save_as=True,
                                       no_window=True)
            window.SaveToDisk(filename)
            # save(values)
        elif button is 'LoadSettings':
            filename = sg.PopupGetFile('Load Settings', no_window=True)
            window.LoadFromDisk(filename)
            # load(form)
        elif button in ['Exit', None]:
            break
Esempio n. 9
0
    'Module',
]]], ['&Help', '&About']]

mainLayout = [
    [sg.Menu(menu_def, tearoff=True)],
    [sg.Text("Account to send from:", size=(138, 1), justification="right")],
    [
        sg.Combo([
            "Create Payload", "Launch Payload", "Open shell",
            "Check Status of Clients", "Check Status of ProxyChains",
            "Single Account Checkup"
        ],
                 size=(100, 10),
                 enable_events=False,
                 readonly=True),
        sg.Listbox(values=(accounts.values()), size=(50, 20))
    ], [sg.Button("Execute", size=(20, 2), button_color=["red", "black"])],
    [sg.Text("Notes", size=(120, 2)),
     sg.Text("Target Client", size=(15, 2))],
    [
        sg.Multiline(autoscroll=True, size=(100, 10), do_not_clear=True),
        sg.Listbox(values=(clients.values()), size=(50, 10))
    ],
    [
        sg.Button("Save",
                  tooltip='Click to save notes for client',
                  button_color=["black", "white"]),
        sg.Button('Add Client', button_color=["black", "white"]),
        sg.Button('Add Module', button_color=["black", "white"]),
        sg.Button('Add Account', button_color=["black", "white"]),
        sg.Button("Clear", button_color=["black", "white"]),
Esempio n. 10
0
if len(png_files) == 0:
    sg.Popup('No PNG images in folder')
    exit(0)


# define menu layout
menu = [['File', ['Open Folder', 'Exit']], ['Help', ['About',]]]

# define layout, show and read the window
col = [[sg.Text(png_files[0], size=(80, 3), key='filename')],
          [sg.Image(filename=png_files[0], key='image')],
          [sg.ReadButton('Next', size=(8,2)), sg.ReadButton('Prev', size=(8,2)),
           sg.Text('File 1 of {}'.format(len(png_files)), size=(15,1), key='filenum')]]

col_files = [[sg.Listbox(values=filenames_only, size=(60,30), key='listbox')],
             [sg.ReadButton('Read')]]
layout = [[sg.Menu(menu)], [sg.Column(col_files), sg.Column(col)]]
window = sg.Window('Image Browser', return_keyboard_events=True, location=(0,0), use_default_focus=False ).Layout(layout)

# loop reading the user input and displaying image, filename
i=0
while True:

    button, values = window.Read()
    # --------------------- Button & Keyboard ---------------------
    if button is None:
        break
    elif button in ('Next', 'MouseWheel:Down', 'Down:40', 'Next:34') and i < len(png_files)-1:
        i += 1
    elif button in ('Prev', 'MouseWheel:Up', 'Up:38', 'Prior:33') and i > 0:
Esempio n. 11
0
                   location=(0, 0),
                   use_default_focus=False)

# make these 2 elements outside the layout as we want to "update" them later
# initialize to the first file in the list
filename = os.path.join(folder, fnames[0])  # name of first file in list
image_elem = sg.Image(data=get_img_data(filename, first=True))
filename_display_elem = sg.Text(filename, size=(80, 3))
file_num_display_elem = sg.Text('File 1 of {}'.format(num_files), size=(15, 1))

# define layout, show and read the form
col = [[filename_display_elem], [image_elem]]

col_files = [[
    sg.Listbox(values=fnames,
               change_submits=True,
               size=(60, 30),
               key='listbox')
],
             [
                 sg.ReadButton('Next', size=(8, 2)),
                 sg.ReadButton('Prev', size=(8, 2)), file_num_display_elem
             ]]

layout = [[sg.Column(col_files), sg.Column(col)]]

window.Layout(layout)  # Shows form on screen

# loop reading the user input and displaying image, filename
i = 0
while True:
    # read the form
Esempio n. 12
0
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg

sg.ChangeLookAndFeel('BlueMono')

# Column layout
col = [[sg.Text('col Row 1', text_color='white', background_color='blue')],
       [sg.Text('col Row 2', text_color='white', background_color='blue'), sg.Input('col input 1')],
       [sg.Text('col Row 3', text_color='white', background_color='blue'), sg.Input('col input 2')]]
# Window layout
layout = [[sg.Listbox(values=('Listbox Item 1', 'Listbox Item 2', 'Listbox Item 3'),
                      select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, size=(20, 3)),
           sg.Column(col, background_color='blue')],
          [sg.Input('Last input')],
          [sg.OK()]]

# Display the window and get values
button, values = sg.Window('Compact 1-line form with column').Layout(layout).Read()

sg.Popup(button, values, line_width=200)