예제 #1
0
    def get_user_input(self):
        """GUI func to get input from GUI"""
        layout = [
            [sg.Text('Select files or a folder to analyze')],
            [sg.Text('Files', size=(8, 1)),
             sg.Input(),
             sg.FilesBrowse()],
            [sg.Text('OR Folder', size=(8, 1)),
             sg.Input(),
             sg.FolderBrowse()], [],
            [sg.Text('Select sample images for all experimental conditions')],
            [sg.Text('Images', size=(8, 1)),
             sg.Input(),
             sg.FilesBrowse()],
            [
                sg.Text('Screen resolution'),
                sg.Input(size=(8, 1)),
                sg.Text('*'),
                sg.Input(size=(8, 1)),
                sg.Text('Fixation point'),
                sg.Input(size=(8, 1)),
                sg.Text('*'),
                sg.Input(size=(8, 1))
            ], [sg.OK(), sg.Cancel()]
        ]

        window = sg.Window('Eye Tracker Analysis', layout)
        event, self.values = window.Read()
예제 #2
0
def make_win2FIRMWARE():  ##define Frimware Window loayout and conents
    sg.theme('DarkAmber')
    sg.set_options(element_padding=(1, 1))
    layout = [
        [sg.Menu(menu_def, tearoff=False, pad=(200, 1))],
        [sg.Text('Hardware and  Firmware build selection')],
        [
            sg.Checkbox('T-Beam', key='-T-Beam-', enable_events=True),
            sg.Checkbox('heltec', key='-heltec-'),
            sg.Checkbox('T-LoRa', key='-T-LoRa-'),
            sg.Checkbox('LoRa Relay', key='-LoRa Relay-')
        ],
        [
            sg.Checkbox('1.2.42', key='-1.2.42-'),
            sg.Checkbox('1.2.49', key='-1.2.49-'),
            sg.Checkbox('1.2.50', key='-1.2.50-'),
            sg.Checkbox('Hamster Nightly', key='-HN-')
        ], [sg.Button('Download Firmware')],
        [sg.Text('Firmware'),
         sg.Input(key='_FILES_'),
         sg.FilesBrowse()],
        [sg.Text('spiff'),
         sg.Input(key='_FILES2_'),
         sg.FilesBrowse()],
        [sg.Text('system-info'),
         sg.Input(key='_FILES3_'),
         sg.FilesBrowse()],
        [
            sg.Text(
                'You can then browse to the needed binary in the firmware folder.'
            )
        ],
        [
            sg.Text(
                'Flashing Firmware requires you select a firmware, spiff and system-info file locations'
            )
        ],
        [
            sg.Button('Flash Firmware'),
            sg.Button('Update Firmware'),
            sg.Button('Erase Firmware')
        ], [sg.Button('Backup Firmware'),
            sg.Input(key='_BACKUP_FILE_')],
        [
            sg.Button('Restore Frimware'),
            sg.Input(key='_RESTORE_FILE_'),
            sg.FilesBrowse()
        ], [sg.Button('Close'), sg.Cancel()]
    ]
    return sg.Window('Firmware Utility',
                     layout,
                     finalize=True,
                     no_titlebar=True,
                     grab_anywhere=True)
예제 #3
0
def my_gui():
    '''
        Function to execute program user interface.
    '''

    sg.theme("LightGreen")

    # Create layout for our window
    layout = [
                [
                sg.In(default_text='Modelo', size=(25,1), enable_events=True, key="-MODEL-"),
                    sg.FilesBrowse(button_text='Buscar'),
                ],

                [
                    sg.In(default_text='Dados', size=(25,1), enable_events=True, key="-DATA-"),
                    sg.FilesBrowse(button_text='Buscar'),
             ],

                [
                    sg.Button("Preencher"),
                ]
         ]

    # Instatiate window

    window = sg.Window("Substituidor de Tags", layout)

    # GUI loop event

    while True:
        event, values = window.read()

        if event == "Preencher":
            model_path = values["-MODEL-"]
            data_path = values["-DATA-"]

            if model_path == '' or data_path == '':
                sg.popup_error("Por favor, preencha os campos obrigatórios!", title="Erro!")
            else:
                repeat_model, index_data = code.process_files(model_path, data_path)

                subs = code.substitute_tags(repeat_model, index_data)

                code.save_as_xlsx(subs, data_path)

                sg.popup_ok("Finalizado com sucesso!", title="Sucesso!", auto_close=True ,auto_close_duration=5)


        if event == sg.WIN_CLOSED:
            break

    window.close()
def main():
	layout = [[sg.Text('Convert Retention Times')],
              [sg.Text('Reference File', size=(18, 1)), sg.InputText(), sg.FileBrowse()],
              [sg.Text('Conversion File', size=(18, 1)), sg.InputText(), sg.FilesBrowse()],
              [sg.Text('Output Folder', size=(18,1)), sg.InputText(), sg.FolderBrowse()],
              [sg.Text('Output Data File Name', size=(18, 1)), sg.InputText()],
              [sg.Button('Convert'), sg.Exit()]]

	window = sg.Window('Retention Index Converter', layout)
	while True:
		event, values = window.Read()
		if event is None or event == 'Exit':
			break
		if event == 'Convert':
			reference_path, database_path, save_folder, save_file_tag = values[0], values[1], values[2], values[3]
			for file in database_path.split(";"):
				if (save_file_tag.endswith('.csv')):
					save_file_path = (save_folder + "/" + save_file_tag)
				else:
					save_file_path = (save_folder + "/" + save_file_tag + ".csv")	
				convertFile(reference_path, database_path,  save_file_path)
			
			sg.Popup('Conversion Complete')
				
	window.Close()
예제 #5
0
    def display_file_read(self):
        layout = [[sg.Text('簡単字幕結合')],
                  [
                      sg.Text('動画ファイル'),
                      sg.InputText(),
                      sg.FileBrowse(key="video_file")
                  ],
                  [
                      sg.Text('字幕ファイル'),
                      sg.InputText(),
                      sg.FilesBrowse(key="caption_file")
                  ], [sg.Button('次へ', key='next')]]

        window: Any = sg.Window("メイン", layout)

        while True:
            event, values = window.read()
            if event == sg.WINDOW_CLOSED:
                break
            elif event == 'next':
                if values['video_file'] == "":
                    sg.popup('動画ファイルを指定してください')
                    event = ""
                elif values['caption_file'] == "":
                    sg.popup('字幕ファイルを指定してください')
                    event = ""
                else:
                    self.load_video(values['video_file'])
                    self.load_caption(values['caption_file'])
                    break
        window.close()
예제 #6
0
def gui() -> None:
    sg.theme("Dark Blue 3")
    layout = [[sg.Text("Welcome to file-renamepy", font="Any 18")],
              [
                  sg.Text("Choose files to be renamed:"),
                  sg.FilesBrowse(key="-SELECTED_FILES-", target=(None, None))
              ],
              [
                  sg.Text("Enter new filenames:"),
                  sg.Multiline(key="-FILENAMES-")
              ], [sg.Button("Rename Files")]]
    window = sg.Window("file-renamepy", layout)
    event, values = window.read()

    # Extract values
    global fileList, filenameList
    fileList = values["-SELECTED_FILES-"].split(";")
    print("Selected files: ", fileList)
    filenameList = parse_filenames(values["-FILENAMES-"])
    print("Filenames: ", filenameList)

    # Action
    rename_files(filenameList, fileList)

    window.close()
def UI_SerBrowse(WorkDir):
    """
    Parameters
    ----------
    WorkDir : TYPE string
        repertoire par defaut à l'ouverture de la boite de dialogue

    Returns 
    -------
    Filenames : TYPE string
        liste des fichiers selectionnés, avec leur extension et le chemin complet
    Shift : Type string
        Ecart en pixel demandé pour reconstruire le disque 
        sur une longeur d'onde en relatif par rapport au centre de la raie  
    ratio_fixe : ratio Y/X en fixe, si egal à zéro alors calcul automatique
    flag_isplay: affiche ou non la construction du disque en temps réel
    """
    sg.theme('Dark2')
    sg.theme_button_color(('white', '#500000'))

    layout = [[
        sg.Text('Nom du fichier', size=(15, 1)),
        sg.InputText(default_text='', size=(65, 1), key='-FILE-'),
        sg.FilesBrowse('Open',
                       file_types=(("SER Files", "*.ser"), ),
                       initial_folder=WorkDir)
    ], [sg.Checkbox('Affiche reconstruction', default=False, key='-DISP-')],
              [
                  sg.Text('Ratio X/Y fixe ', size=(15, 1)),
                  sg.Input(default_text='0', size=(8, 1), key='-RATIO-')
              ],
              [
                  sg.Text('Decalage pixel', size=(15, 1)),
                  sg.Input(default_text='0',
                           size=(8, 1),
                           key='-DX-',
                           enable_events=True)
              ], [sg.Button('Ok'), sg.Cancel()]]

    window = sg.Window('Processing', layout, finalize=True)
    window['-FILE-'].update(WorkDir)
    window.BringToFront()

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

        if event == 'Ok':
            break

    window.close()

    FileNames = values['-FILE-']
    Shift = values['-DX-']

    flag_display = values['-DISP-']
    ratio_fixe = float(values['-RATIO-'])

    return FileNames, Shift, flag_display, ratio_fixe
예제 #8
0
    def select_file(self):

        sg.theme('SystemDefault')

        layout = [
            [sg.Text('ラベルチェック用ファイルを選んでください', size=(50, 1), font=('メイリオ', 14))],
            [
                sg.InputText(font=('メイリオ', 14)),
                sg.FilesBrowse('開く', key='File1', font=('メイリオ', 14))
            ], [sg.Text('入出庫管理ファイルを選んでください', size=(50, 1), font=('メイリオ', 14))],
            [
                sg.InputText(font=('メイリオ', 14)),
                sg.FilesBrowse('開く', font=('メイリオ', 14))
            ],
            [
                sg.Submit(button_text='設定', font=('メイリオ', 14)),
                sg.Submit(button_text="閉じる", font=('メイリオ', 14))
            ]
        ]

        # セクション 2 - ウィンドウの生成z
        window = sg.Window('ファイル選択', layout)

        # セクション 3 - イベントループ
        while True:
            event, values = window.read()

            if event is None:
                print('exit')
                break

            if event == '設定':
                path_dict = {}
                label_check_path = values[0]
                path_dict["label_check_path"] = label_check_path
                stock_path = values[1]
                path_dict["stock_path"] = stock_path
                csv = w_csv.Write_csv()
                csv.write_csv(path_dict=path_dict)

                return path_dict

            if event == '閉じる':
                break

        #  セクション 4 - ウィンドウの破棄と終了
        window.close()
예제 #9
0
파일: main.py 프로젝트: warrinot/pdf_editor
def merge_window():
    layout_merge = [
        [sg.Text('Выберите pdf файлы, которые нужно объединить')],
        [
            sg.In(key='-FILE_INPUT-', disabled=True, enable_events=True),
            sg.FilesBrowse(file_types=(("Pdf-file", "*.pdf"), ))
        ],
        # [sg.Text('Выбраны файлы:')],
        # [sg.Multiline('', size=(50, 10), key='-FILESMERGE-', auto_size_text=True, disabled=True)],
        [sg.Text('Сохранить как:')],
        [
            sg.In(disabled=True, enable_events=True, key='-SAVEASIN-'),
            sg.SaveAs(
                enable_events=True,
                file_types=(("Pdf-file", ".pdf"), ),
            )
        ],
        [sg.Button('Merge'), sg.Exit()],
    ]

    window_merge = sg.Window('Pdf merge',
                             layout_merge,
                             return_keyboard_events=True)
    window_merge.Finalize()
    window_merge.TKroot.focus_force()  # make active

    while True:
        event, values = window_merge.read(timeout=100)

        if event is None or event == 'Exit' or event == 'Escape:27':
            break

        elif event == '-SAVEASIN-':
            saveas_value = values['-SAVEASIN-']

            if not saveas_value.endswith('.pdf'):
                saveas_value += '.pdf'
            window_merge['-SAVEASIN-'].Update(saveas_value)

        elif event == 'Merge':
            saveas_value = values['-SAVEASIN-']
            input_files = values['-FILE_INPUT-'].split(';')
            input_len = len(input_files)

            if not input_files[0]:
                sg.PopupOK('Вы не выбрали файлы.')

            elif input_len == 1:
                sg.PopupOK('Выбран только 1 файл, требуется минимум 2')

            elif not saveas_value:
                sg.PopupOK('Сохраните файл')

            else:
                merge_docs(input_files, saveas_value)
                sg.popup_ok(f'Файлы объединены в {saveas_value}')

    window_merge.close()
예제 #10
0
파일: gui.py 프로젝트: DaniloToroL/PDFWork
def Merge():
    return [
        [sg.Image('img/merge.jpg', size=(500,200 ))],
        [sg.Text('Select PDFs')],
        [sg .Input(key="input"), sg.FilesBrowse()],
        [sg.Text('Save')],
        [sg .Input(key="output"), sg.FileSaveAs(file_types=(("Pdf", "*.pdf"),))],
        [sg.Ok()]
    ]
예제 #11
0
def playlist_editor(initial_folder, playlists, playlist_name=''):
    paths = playlists.get(playlist_name, [])
    songs = [
        f'{i+1}. {os.path.basename(path)}' for i, path in enumerate(paths)
    ]
    # TODO: remove .mp3
    layout = [[
        Sg.Text('Playlist name',
                text_color=fg,
                background_color=bg,
                font=font_normal),
        Sg.Input(playlist_name, key='playlist_name'),
        Sg.Submit('Save', font=font_normal, pad=(('11px', '11px'), (0, 0))),
        Sg.Button('Cancel', key='Cancel', font=font_normal, enable_events=True)
    ],
              [
                  Sg.Frame('', [[
                      Sg.FilesBrowse('Add songs',
                                     key='Add songs',
                                     file_types=(('Audio Files', '*.mp3'), ),
                                     pad=(('21px', 0), (5, 5)),
                                     initial_folder=initial_folder,
                                     font=font_normal,
                                     enable_events=True)
                  ],
                                [
                                    Sg.Button('Remove song',
                                              key='Remove song',
                                              font=font_normal,
                                              enable_events=True)
                                ]],
                           background_color=bg,
                           border_width=0),
                  Sg.Listbox(songs,
                             size=(41, 5),
                             select_mode=Sg.SELECT_MODE_SINGLE,
                             text_color=fg,
                             key='songs',
                             background_color=bg,
                             font=font_normal,
                             enable_events=True),
                  Sg.Frame('', [[
                      Sg.Button('Move up',
                                key='Move up',
                                font=font_normal,
                                enable_events=True)
                  ],
                                [
                                    Sg.Button('Move down ',
                                              key='Move down',
                                              font=font_normal,
                                              enable_events=True)
                                ]],
                           background_color=bg,
                           border_width=0)
              ]]
    return layout
예제 #12
0
def choose_files():
    sg.theme('Reds')
    layout = [[sg.Input(key='_FILES_'),
               sg.FilesBrowse()], [sg.OK(), sg.Cancel()]]
    window = sg.Window('Choose Files...', layout)
    event, values = window.Read()
    file_names = values['_FILES_'].split(';')
    window.close()
    return file_names
예제 #13
0
파일: gui.py 프로젝트: DaniloToroL/PDFWork
def Word2PDF():
    return [
        [sg.Image('img/word-to-pdf.png', size=(500,200 ))],
        [sg.Text('Select Folder')],
        [sg.Input(key="from"), sg.FilesBrowse(file_types=(("Word", "*.docx"),))],
        [sg.Text('Save')],
        [sg.Input(key="to"), sg.FileSaveAs(file_types=(("Pdf", "*.pdf"),))],
        [sg.Ok()]
    ]
예제 #14
0
def make_layout_nav_filelist(target='files you want to test'):
    layout = [[sg.Text('Please use CTRL and SHIFT to choose ' + target + "!")],
              [
                  sg.InputText("",
                               key="data",
                               tooltip='separate files with a ;'),
                  sg.FilesBrowse(target="data")
              ], [sg.Submit(), sg.Cancel()]]
    return layout
예제 #15
0
파일: gui.py 프로젝트: DaniloToroL/PDFWork
def Image2PDF():
    return [
        [sg.Image('img/image-to-pdf.jpg', size=(500,200))],
        [sg.Text('Select images')],
        [sg .Input(key="input"), sg.FilesBrowse(file_types=(("JPEG", "*.jpg"),))],
        [sg.Text('Save')],
        [sg .Input(key="output"), sg.FileSaveAs(file_types=(("Pdf", "*.pdf"),))],
        [sg.Ok()]
    ]
def main():
    """
	Displays GUI window for inputting required files.
	
	Input Image : Desired png file to undergo green pixel analysis
	Reference File : Contains the names of the columns and rows in txt format.
		Starts to bottom and then left to right.
	Output Folder : Folder to save the resulting csv file
	Output Data File Name : The desired name of the csv file.
	"""

    layout = [[sg.Text('Plant Image Analysis')],
              [
                  sg.Text('Input Image', size=(18, 1)),
                  sg.InputText(),
                  sg.FileBrowse()
              ],
              [
                  sg.Text('Reference File', size=(18, 1)),
                  sg.InputText(),
                  sg.FilesBrowse()
              ],
              [
                  sg.Text('Output Folder', size=(18, 1)),
                  sg.InputText(),
                  sg.FolderBrowse()
              ],
              [sg.Text('Output Data File Name', size=(18, 1)),
               sg.InputText()], [sg.Button('Analyze'),
                                 sg.Exit()]]

    # Display window and wait for user input
    window = sg.Window('Plant Image Analysis', layout)
    while True:
        event, values = window.Read()

        if event is None or event == 'Exit':
            break
        if event == 'Analyze':
            # Grab the input files from the from the input file window
            input_image, reference_file, save_folder, save_file_tag = values[
                0], values[1], values[2], values[3]
            if not (save_file_tag.endswith('.csv')):
                save_file_tag = (save_file_tag + ".csv")
            save_file_path = (save_folder + "/" + save_file_tag)
            if not (reference_file.endswith('.txt')):
                sg.Popup('Please input a txt file!')
            elif not (input_image.endswith('.png')):
                sg.Popup('Please input a png file!')
            else:
                # Close file input window and open the image analysis window
                window.Close()
                image_analysis(input_image, reference_file, save_file_path)
예제 #17
0
def make_win2VERSION():
    layout = [
        [sg.Text('Hardware and  Firmware build selection')],
        #[sg.Text('Enter something to output to Window 1')],
        #[sg.Input(key='-IN-', enable_events=True)],
        #[sg.Text(size=(25,1), key='-OUTPUT-')],
        [
            sg.Checkbox('T-Beam', key='-T-Beam-'),
            sg.Checkbox('heltec', key='-heltec-'),
            sg.Checkbox('T-LoRa', key='-T-LoRa-'),
            sg.Checkbox('LoRa Relay', key='-LoRa Relay-')
        ],
        [
            sg.Checkbox('ANZ'),
            sg.Checkbox('CN'),
            sg.Checkbox('EU865'),
            sg.Checkbox('EU443'),
            sg.Checkbox('JP'),
            sg.Checkbox('KR'),
            sg.Checkbox('US')
        ],
        [
            sg.Checkbox('Stable'),
            sg.Checkbox('Beta'),
            sg.Checkbox('Alpha'),
            sg.Checkbox('Hamster Nightly')
        ],
        [sg.Button('Download Firmware')],
        [sg.Input(key='_FILES_'), sg.FilesBrowse()],
        [
            sg.Text(
                'Firmware festure not complete, the download just downloads the 1.33 binary to a test.zip'
            )
        ],
        [
            sg.Text(
                'If you extract that folder you will find the binareies you need and you can browse to the'
            )
        ],
        [
            sg.Text(
                'needed one using the browse button and then use the flash or update buttons.'
            )
        ],
        [
            sg.Button('Flash Firmware'),
            sg.Button('Update Firmware'),
            sg.Cancel()
        ],
        [sg.Button('Exit')]
    ]
    return sg.Window('Firmware Utility', layout, finalize=True)
예제 #18
0
def image_windows_show(outdir=""):
    image = [[sg.Text('选择你要读取的发票')],
             [
                 sg.Input(key='_FILES_'),
                 sg.FilesBrowse(file_types=(("image", "*.png *.jpg *.pdf"), ))
             ], [sg.Text(('选择文件输出路径(默认路径:%s)' % outdir))],
             [sg.Input(key='_DIR_', default_text=outdir),
              sg.FolderBrowse()], [sg.OK()]]
    form = sg.FlexForm('猴子选图')
    form.Layout(image)
    button_name, values = form.Read()
    form.close()
    return (values["_FILES_"], values["_DIR_"])
예제 #19
0
def select_files():
    layout = [
        [PySimpleGUI.Text("Welcome to Duplex Scanpy")],
        [
            PySimpleGUI.Text("Select scanned PDFs: "),
            PySimpleGUI.FilesBrowse(key="-SELECTED_PDFS-",
                                    file_types=(("PDFs", "*.pdf"), ("PDFs",
                                                                    "*.PDF")),
                                    target=(None, None))
        ],
        [
            PySimpleGUI.Text("How many sides is each individual document?"),
            PySimpleGUI.Input(key="-DOC_LENGTH-")
        ],
        [
            PySimpleGUI.Text("Where should generated files be saved?"),
            PySimpleGUI.FolderBrowse(key="-OUTPUT_LOCATION-",
                                     target=(None, None))
        ],
        [
            PySimpleGUI.Text("What should be the file prefix?"),
            PySimpleGUI.Input(key="-FILE_PREFIX-")
        ], [PySimpleGUI.Button('Start Generating Files')]
    ]

    window = PySimpleGUI.Window('duplex-scanpy', layout)

    event, values = window.read()

    # Extract values
    global listOfFiles, documentLength, outputFolder, filenamePrefix, indexSigFig, documentCount
    listOfFiles = str(values["-SELECTED_PDFS-"]).split(";")
    print("Selected PDFs: ", listOfFiles)

    documentLength = int(values["-DOC_LENGTH-"])
    print("Document Length: ", documentLength)

    outputFolder = values["-OUTPUT_LOCATION-"]
    print("Output Location: ", outputFolder)

    filenamePrefix = values["-FILE_PREFIX-"]
    print("File Prefix: ", filenamePrefix)

    documentCount = len(listOfFiles) // documentLength
    indexSigFig = len(str(documentCount))
    print("Index SigFig: ", indexSigFig)

    # Close the window
    window.close()
예제 #20
0
def encrypt_app():
    layout = [[sg.Text('Select the files to encrypt')],
              [sg.Input(), sg.FilesBrowse()], [sg.Submit(),
                                               sg.Cancel()]]
    window = sg.Window('Encrypt Files', layout)
    event, values = window.Read()
    window.Close()

    if (event == "Cancel"):
        app()

    x = values[0].split(";")
    a = len(x)
    for i in range(a):
        encrypt.encrypt_file(x[i])
예제 #21
0
def Pdf_Office():
    Create_PDF_layout = [[sg.FilesBrowse()],
                         [sg.Button("Create PDF", key="create pdf")],
                         [sg.OK(), sg.Cancel()]]
    window = sg.Window('PDF Office', Create_PDF_layout)
    while True:
        event, values = window.Read()
        if event == "Exit" or event is None:
            break
        if event != sg.TIMEOUT_KEY:
            sg.Print(f"Event: {event}")
        if event == "create pdf":
            filename = values["Browse"]
            print(f"The filename is {filename}")
            Create_PDF(filename, findOutdir(filename))
예제 #22
0
    def get_user_input(self) -> bool:
        """GUI func to get input from GUI"""
        layout = [
            [sg.Text('Select files or a folder to analyze')],
            [
                sg.Text('Files', size=(8, 1)),
                sg.Input(),
                sg.FilesBrowse(file_types=(("CSV Files", "*.csv"), ))
                if platform.system() == 'Windows' else sg.FilesBrowse()
            ],
            [sg.Text('OR Folder', size=(8, 1)),
             sg.Input(),
             sg.FolderBrowse()],
            [sg.Text('Select sample images for all experimental conditions')],
            [
                sg.Text('Images', size=(8, 1)),
                sg.Input(),
                sg.FilesBrowse(file_types=(("PNG Files", "*.png"), ))
                if platform.system() == 'Windows' else sg.FilesBrowse()
            ],
            [
                sg.Text('Screen resolution'),
                sg.Input(default_text='1920', size=(6, 1)),
                sg.Text('*'),
                sg.Input(default_text='1080', size=(6, 1)),
                sg.Text('Fixation point'),
                sg.Input(size=(6, 1)),
                sg.Text('*'),
                sg.Input(size=(6, 1))
            ], [sg.OK(size=(7, 1)), sg.Cancel(size=(7, 1))]
        ]

        window = sg.Window('Eye Tracker Analysis', layout)
        event, self.values = window.Read()
        window.Close()
        return True if event == 'OK' else False
예제 #23
0
def decrypt_app():
    layout = [[sg.Text('Select the files to decrypt')],
              [
                  sg.Input(),
                  sg.FilesBrowse(file_types=(("Encrypted Files", "*.enc"), ))
              ], [sg.Submit(), sg.Cancel()]]
    window = sg.Window('Decrypt Files', layout)
    event, values = window.Read()
    window.Close()

    if (event == "Cancel"):
        app()

    x = values[0].split(";")
    a = len(x)
    for i in range(a):
        decrypt.decrypt_file(x[i])
        os.remove(x[i])
예제 #24
0
def collect_user_input():
    sg.theme('Dark Blue 3')  
    layout = [
            [sg.Text('Title', size=(15, 1)), sg.InputText(), sg.Text('1. Enter a title for your vocabulary list.')],
            [sg.Text('Input type', size=(15, 1)), sg.Combo(['Document', 'Image']),sg.Text('2. Select type of file')],
            [sg.Text('Select Files', size=(15, 1)), sg.Input(key='_FILES_',), sg.FilesBrowse(
                file_types=("*.jpg", "*.png", '*.docx')), sg.Text('3. Select file(s) (must be same filetype).')],  # file_types=("*.jpg", "*.png"), takes multiple images
            [sg.OK()]]

    window = sg.Window('JPVL Auto', layout)
    event, values = window.read() #'event' is required here, contrary to what linting might say 
    title.append(values[0])
    files = values['_FILES_'].split(';') #files this var + if input type img lauch img_processing on file or if doc launch doctprocessing
    for item in files:
        input_files.append(item)
    window.close()
    print(files)
    input_type.append(values[1])
    print(input_type)
예제 #25
0
def create_main_windows(msg):
    message_text = sg.Text(msg)
    type_label = sg.Text('File Type')
    type_selector = sg.Combo(file_types, readonly=True, key='task')
    type_checker = sg.Checkbox('Check Data Format', False, key='check', disabled=True)
    files_label = sg.Text('Select Input Files')
    files_selector = sg.FilesBrowse('Select Files', key='files', change_submits=True)
    files_selector.FileTypes = [("CSV Files", "*.csv")]
    files_selector.Target = 'files'
    files_previews = sg.Listbox(values=[], key='list', size=(100, 6))
    submit_button = sg.Button('Submit')
    layout = [
        [message_text],
        [type_label, type_selector, type_checker],
        [files_label, files_selector],
        [files_previews],
        [submit_button]
    ]
    return sg.Window('CSV INPUT UPLOADER Ver 0.2').Layout(layout)
예제 #26
0
 def convert(self):
     self.layout = [[
         sg.Text('Video', size=(20, 1)),
         sg.Input(key='video_convert', size=(20, 1)),
         sg.FilesBrowse(target='video_convert')
     ],
                    [
                        sg.Text('Diretorio', size=(20, 1)),
                        sg.Input(key='_path', size=(20, 1)),
                        sg.FolderBrowse(target='_path')
                    ],
                    [
                        sg.Text('Nome', size=(20, 1)),
                        sg.Input(key='name', size=(20, 1))
                    ],
                    [
                        sg.Button('Converter', key='b_convert'),
                        sg.Button('Voltar', key='voltar')
                    ]]
     return sg.Window('Conversor', self.layout, finalize=True)
예제 #27
0
    def criar_interface(self):
        # TEMA
        sg.theme('BlueMono')

        # LAYOUT DADOS DE EMAIL
        layout_dados_email = [[
            sg.Text('De:        '),
            sg.Input(key='input_de'),
            sg.Text('Senha do E-mail'),
            sg.Input(key='input_senha', password_char='*', size=(15, 1))
        ], [sg.Text('Para:     '),
            sg.Input(key='input_para', size=(78, 1))],
                              [
                                  sg.Text('Assunto:'),
                                  sg.Input(key='input_assunto', size=(78, 1))
                              ],
                              [
                                  sg.Text('Anexo:   '),
                                  sg.Input(key='input_anexo', size=(35, 1)),
                                  sg.FilesBrowse('Selecionar Anexo'),
                                  sg.Radio('Imagem',
                                           key='rd_imagem',
                                           group_id='rd_anexos'),
                                  sg.Radio('Outros Docs',
                                           key='rd_outros_docs',
                                           default=True,
                                           group_id='rd_anexos')
                              ]
                              # [sg.Button('Iniciar'),sg.Button('Parar')]
                              ]

        # LAYOUT MENSAGEM
        layout_mensagem = [[
            sg.Multiline(autoscroll=True, size=(86, 10), key='mtl_email')
        ]]

        # LAYOUT PRINCIPAL
        layout = [[sg.Frame('Dados do E-mail # GMAIL #', layout_dados_email)],
                  [sg.Frame('Mensagem', layout_mensagem)],
                  [sg.Button('Enviar Mensagem', key='btn_enviar')]]
        return sg.Window('Envio de E-mail', layout)
def main():
    layout = [[sg.Text('Convert Retention Times')],
              [sg.Text('Reference File', size=(15, 1)), sg.InputText(), sg.FileBrowse()],
              [sg.Text('MzML Data File', size=(15, 1)), sg.InputText(), sg.FilesBrowse()],
              [sg.Text('Output Folder', size=(15,1)), sg.InputText(), sg.FolderBrowse()],
              [sg.Text('Output Data File Tag', size=(15, 1)), sg.InputText()],
              [sg.Button('Convert'), sg.Exit()]]

    window = sg.Window('Retention Time Converter', layout)

    while True:
        event, values = window.Read()
        if event is None or event == 'Exit':
            break
        if event == 'Convert':
            reference_path, raw_files_path, save_folder, save_file_tag = values[0], values[1], values[2], values[3]
            for file in raw_files_path.split(";"):
                save_file_path = (save_folder + "/" + save_file_tag + file.split("/")[-1])
                convertFile(reference_path, file, save_file_path)
            sg.Popup('Conversion Complete')
    window.Close()
예제 #29
0
def userInputWindowLayOut() -> sg.Window:
    """Creates an interactive window and returns the Window object.

    Contains the data for the layout of a PySimpleGUI window. Creates the window using the layout \
    information and returns it as a PySimpleGUI.Window object.
    """

    layout = [
        [sg.Text("Select a folder containing all of the log reports")],
        [
            sg.Text("File(s)", size=(10, 1)),
            sg.Input(visible=False, key='-FILES-'),
            sg.FilesBrowse(button_text='Browse', enable_events=True)
        ],
        [
            sg.Text(
                "Input the first keyword to search for the first occurrence")
        ],
        [
            sg.Text("Key Word 1", size=(10, 1)),
            sg.Input(default_text="ix_lgm_power_set_blocking",
                     key='-FIRSTKEYWORD-')
        ],
        [sg.Text("Input the last keyword to search for the last occurrence")],
        [
            sg.Text("Key Word 2", size=(10, 1)),
            sg.Input(default_text="ix_lgm_power_rsp", key='-LASTKEYWORD-')
        ],
        [
            sg.Submit(button_text="Search",
                      tooltip="Runs a search with the given parameters"),
            sg.Exit(tooltip="Closes and exits the program")
        ]
    ]

    # 'ix_lgm_power_set_blocking' and 'ix_lgm_power_rsp' are set as default values for
    # key word 1 and key word 2. EDIT LATER

    return sg.Window('Key Words Search',
                     layout)  # Window is titled, and has the given layout
def startGUI():
    gui_layout = [[psg.Text('Choose files to convert:')],
                  [
                      psg.InputText("", size=(70, 10), disabled=True),
                      psg.FilesBrowse(file_types=(("XML Files", "*.xml"),
                                                  ("CPN Files", "*.cpn")))
                  ], [psg.Text('Choose location for output file:')],
                  [
                      psg.InputText("", size=(70, 10), disabled=True),
                      psg.FolderBrowse()
                  ],
                  [
                      psg.OK("Transform PIPE XML file into Woflan .tpn file",
                             auto_size_button=True)
                  ]]
    window = psg.Window('PIPEtoWoflan', layout=gui_layout, disable_close=True)
    while True:
        event, values = window.read()
        if event in (None, 'Transform PIPE XML file into Woflan .tpn file'):
            if values[1] == '':
                psg.popup_ok('Output location must be selected.')
            else:
                break
    pathways = values[0]
    output_location = values[1]
    pathways = pathways.split(';')
    print(pathways)
    for pathway in pathways:
        print(pathway)
        BuildTPNFile(pathway, output_location)
    gui_exit_layout = [[
        psg.Text(
            "Files have been processed, and outputs will be at specified location."
        )
    ], [psg.Text("Click 'OK' to finish execution.")], [psg.OK('OK')]]
    window = psg.Window('PIPEtoWoflan - Files Processed',
                        layout=gui_exit_layout,
                        disable_close=True)
    event, values = window.read()