def __init__(self): log.info("\n") log.info("Checking for Pushbullet and Streamlabs token") if cfg["pb_token"] == "" or cfg["sl_token"] == "": sg.PopupOK("Opsætning", "Opsætning er krævet") self.setup() log.info("Pushbullet and Streamlabs tokens exist!") GUI().main()
def __init__(self): self.config = run.config win = self.window() while True: event, values = win.read(timeout=100) if event is None or event == 'settings_win_cancel_bttn': win.close() if event == 'settings_win_ok_bttn': qt.PopupOK( 'Saving settings isn\'t currently implemented. This will close the window and NOT save settings', icon=err_icon) win.close() if event == 'look_and_feel_combo': qt.theme(str(values['look_and_feel_combo'])) win.refresh()
def Window(): col_prop = [ [ sg.T(' k [W/(m·K)]', size=(10, 1)), sg.In('', size=(15, 1), justification='right', key='-k-'), sg.Button('Temperature Dependant', size=(18, 1), key='-loadk-'), sg.Button('📊', size=(4, 1), key='-plotk-') ], ] menu_def = [['File', ['Load', 'Save', 'Exit']], ['Help', ['About']]] layout = [[sg.Menu(menu_def)], [sg.Column(col_prop)]] window = sg.Window('Name!', layout) kparams = np.array([['', '']]) while True: event, values = window.read() if event in (None, 'Exit'): break if event == '-loadk-': try: tpar = kWindow(kparams) if tpar is not None: kparams = tpar except: pass if event == '-plotk-': if kparams[0, 0] == '' and values['-k-'] == '': sg.PopupOK( 'You need to define the «Thermal Conductivity» first!', title='Warning') elif values['-k-'] != '': plotk(float(values['-k-'])) else: plotk(kparams) window.close()
lab_output = np.concatenate((l_channel[:,:,np.newaxis],ab_channel_us),axis=2) bgr_output = np.clip(cv.cvtColor(lab_output, cv.COLOR_Lab2BGR), 0, 1) if not os.path.isdir("./temp/"): os.mkdir("./temp/") cv.imwrite("./temp/result.jpg", (bgr_output*255).astype(np.uint8)) FileIMG = "./temp/result.jpg" size = 530, 530 im2 = Image.open("./temp/result.{0}".format(ext)) im2.thumbnail(size, Image.ANTIALIAS) imgByteArr = io.BytesIO() im2.save(imgByteArr, format='PNG') imgByteArr = imgByteArr.getvalue() window['img_display2'].Update(data=imgByteArr, visible=True) window['savefilebrowse'].Update(disabled=False, button_color=("0079d3", "0079d3")) else: sg.PopupOK("Selecione um arquivo antes.", keep_on_top=True, non_blocking=False) if event == "savefile": if window['savefile'].Get(): if FileIMG: if os.path.isfile(FileIMG): if not os.path.isfile(window['savefile'].Get()): os.rename(FileIMG, window['savefile'].Get()) window['img_display2'].Update(filename=resource_path("placeholder.png")) window['savefilebrowse'].Update(disabled=True, button_color=("black","grey")) window.Refresh() else: os.remove(window['savefile'].Get()) os.rename(FileIMG, window['savefile'].Get()) window['img_display2'].Update(filename=resource_path("placeholder.png")) window['savefilebrowse'].Update(disabled=True, button_color=("black","grey"))
if event in [sg.WIN_CLOSED, 'EXIT']: kill() break if event == "RUN": pasta = window["pasta"].Get() Username = window["user"].Get() Password = window["pass"].Get() reqaut = window['auth'].Get() if os.path.isdir(pasta): if reqaut: ThreadPoolExecutor().submit(run, pasta, Username, Password) else: ThreadPoolExecutor().submit(run, pasta, "", "") else: sg.PopupOK("ERROR: No folder selected or folder does not exist.", non_blocking=False, keep_on_top=True) if event == "STOP": kill() if event == "auth": reqaut = window['auth'].Get() if reqaut is True: window['text_user'].Update(text_color="black") window['text_pass'].Update(text_color="black") window['user'].Update(disabled=False) window['pass'].Update(disabled=False) window.Refresh() else: window['text_user'].Update(text_color="grey")
print("-----------------------------------------------------------------") print("Total de arquivos processados: {0}".format(totalfiles)) print("Arquivos copiados: {0}".format(copiados)) print("Erros: {0}".format(erros)) print("") window.Refresh() while True: event, values = window.read() progress = window['prog'] if event is None or event == 'sair': break if event == 'usar': sg.PopupOK( "Esta ferramenta tem como objetivo copiar recursivamente todos os arquivos com a extensão .'EXTENSÃO' na pasta 'ARQUIVOS' para a pasta 'SAÍDA'.", non_blocking=False, keep_on_top=True) if event == 'limpar': window['out'].Update('') window.Refresh() if event == 'exec': try: PASTA_PA = window['Files'].Get() PASTA_SAIDA = window['Saida'].Get() EXT = window['Ext'].Get() error = 0 if not isdir(PASTA_PA): error += 1 sg.PopupOK("Campo 'ARQUIVOS' não é um caminho válido.", non_blocking=False, keep_on_top=True)
Window = sg.Window("AutoClicker", layout=Layout, font="SEGOEUI 11") while True: event, values = Window.read(timeout=1000) if event is None: break if event == 'exec': START = Window['in'].Get() END = Window['out'].Get() DO = Window['do'].Get() TIME = float(Window['tim'].Get().replace(",", '.')) if (START == '' or START == ' ' or START is None) or ( END == '' or END == ' ' or END is None) or (DO == '' or DO == ' ' or DO is None) or ( TIME == '' or TIME == ' ' or TIME is None): sg.PopupOK('ERRO: Um ou mais campos estão sem preenchimento.') else: Window['multi'].Update("Executando...", text_color='green') Window.Refresh() while True: status = False if keyboard.is_pressed(START): Window['multi'].Update("ATIVADO", text_color='green') Window.Refresh() while True: keyboard.press_and_release(DO) sleep(TIME) if keyboard.is_pressed(END): Window['multi'].Update("DESATIVADO", text_color='red') Window.Refresh()
def kWindow(valores): line = "[sg.In('{0}', size=(20,1), key='-temp{id}-', visible={2}, justification='right'), sg.In('{1}', size=(20,1), key='-k{id}-', visible={2}, justification='right'), sg.Button('+', size=(5,1), key='+{id}', visible={3})]" layout = [[ sg.T('Temperature [°C]', size=(20, 1), justification='center'), sg.T('k [W/(m·K)]', size=(20, 1), justification='center') ]] layout.append( [sg.Button('Load', size=(20, 1)), sg.Button('Cancel', size=(20, 1))]) for i in range(0, 10): try: if valores is None: layout.insert(-1, eval(line.format('', '', 'True', 'True', id=i))) valores = np.array([['', '']]) elif i + 1 == valores.shape[0]: layout.insert( -1, eval( line.format(valores[i, 0], valores[i, 1], 'True', 'True', id=i))) else: layout.insert( -1, eval( line.format(valores[i, 0], valores[i, 1], 'True', 'False', id=i))) except: layout.insert(-1, eval(line.format('', '', 'False', 'False', id=i))) window = sg.Window('Thermal Conductivity', layout) while True: event, values = window.read() if event in (None, 'Exit', 'Cancel'): window.close() break if "Load" in event: try: hr, t = [], [] valores = list(values.values()) for i in range(0, len(valores) - 1, 2): if valores[i] != '' and valores[i + 1] != '': hr.append(valores[i]) t.append(valores[i + 1]) params = np.array(list(zip(hr, t)), dtype=float) window.close() return params except ValueError: sg.PopupOK('Invalid Input!', title='Warning') if "+" in event: n = int(event[1:]) + 1 if n < 9: window[f'+{n-1}'].update(visible=False) window[f'-temp{n}-'].update(visible=True) window[f'-k{n}-'].update(visible=True) window[f'+{n}'].update(visible=True) elif n == 9: window[f'+{n-1}'].update(visible=False) window[f'-temp{n}-'].update(visible=True) window[f'-k{n}-'].update(visible=True)