def _salvar(self): exam = util.getExam() # Salva os valores da captura exam['cameraMode'] = int(self.SensorModeCombo.current()) + 1 exam['fps'] = self.fpsScale.get() # Salva os valores dos parametros da camera exam['contraste'] = self.contrasteScale.get() exam['nitidez'] = self.nitidezScale.get() exam['saturacao'] = self.saturacaoScale.get() exam['brilho'] = self.brilhoScale.get() # Salva os valores dos leds exam['ledIr'] = self.irScale.get() exam['ledBr'] = self.brScale.get() # Salva valores dos filtros de Cor exam['colorEfect'] = self.vCor.get() exam['rColor'] = self.rScale.get() exam['gColor'] = self.gScale.get() exam['bColor'] = self.bScale.get() util.setExam(exam) self._close()
def __init__(self, father, directory): self.father = father exam = util.getExam() widthWindowControl = 300 heightWindowControl = 150 yControl = int((exam['monitorHeight'] / 2) - (heightWindowControl / 2)) xControl = int((exam['monitorWidth'] / 2) - (widthWindowControl / 2)) self.window = Tk() self.window.title("Observações") self.window.minsize(widthWindowControl, heightWindowControl) self.window.geometry('{}x{}+{}+{}'.format(widthWindowControl, heightWindowControl, xControl, yControl)) self.window.resizable(False, False) self.window.config(padx=5, pady=5) root = Frame(self.window) root.pack(fill="both", expand="True") dados = util.getDados(directory) tObservacao = Text(root, height=8, width=35) tObservacao.grid(row=0, column=0, sticky=W + E, padx=3, pady=3) tObservacao.insert(INSERT, dados['observacoes']) tObservacao.config(state=DISABLED) self.window.protocol("WM_DELETE_WINDOW", self._close) self.window.mainloop()
def __init__(self, father, directory): self.father = father exam = util.getExam() widthWindowControl = 300 heightWindowControl = 150 yControl = int((exam['monitorHeight'] / 2) - (heightWindowControl / 2)) xControl = int((exam['monitorWidth'] / 2) - (widthWindowControl / 2)) self.window = Tk() self.window.title("Dados do paciente") self.window.minsize(widthWindowControl, heightWindowControl) self.window.geometry('{}x{}+{}+{}'.format(widthWindowControl, heightWindowControl, xControl, yControl)) self.window.resizable(False, False) self.window.config(padx=5, pady=5) root = Frame(self.window, relief="groove", border=3) root.pack(fill="both", expand="True") dados = util.getDados(directory) if (dados['pacienteAnonimo'] is True): Label(root, text="Paciente Anônimo").grid(column=0, row=0) else: nome = StringVar(root) nome.set("Nome: " + dados['nome']) Label(root, textvariable=nome).grid(column=0, row=0, sticky=W + N) dataNascimento = StringVar(root) dataNascimento.set("Data de Nascimento: " + dados['dataNascimento']) Label(root, textvariable=dataNascimento).grid(column=0, row=1, sticky=W + N) sexo = StringVar(root) sexo.set("Sexo: " + dados['sexo']) Label(root, textvariable=sexo).grid(column=0, row=2, sticky=W + N) estadoCivil = StringVar(root) estadoCivil.set("Estado Civil: " + dados['estadoCivil']) Label(root, textvariable=estadoCivil).grid(column=0, row=3, sticky=W + N) profisao = StringVar(root) profisao.set("Profisão: " + dados['profisao']) Label(root, textvariable=profisao).grid(column=0, row=4, sticky=W + N) telefone = StringVar(root) telefone.set("Telefone: " + dados['telefone']) Label(root, textvariable=telefone).grid(column=0, row=5, sticky=W + N) self.window.protocol("WM_DELETE_WINDOW", self._close) self.window.mainloop()
def __init__(self, window, window_title): global exam exam = util.getExam() # Arrumar isso aqui for m in get_monitors(): exam['monitorHeight'] = m.height exam['monitorWidth'] = m.width util.setExam(exam) widthWindow = 863 heightWindow = 600 y = int((exam['monitorHeight'] / 2) - (heightWindow / 2)) x = int((exam['monitorWidth'] / 2) - (widthWindow / 2)) self.window = window self.window.title(window_title) self.window.minsize(widthWindow, heightWindow) self.window.geometry('{}x{}+{}+{}'.format(widthWindow, heightWindow, x, y)) #self.window.iconbitmap("/resources/icone.ico") #self.window.resizable(0,0) # se quiser deixar sem poder redimencioar a janela # Barra de menus menuBar = Menu(self.window) self.window.config(menu=menuBar) fileMenu = Menu(menuBar, tearoff=0) menuBar.add_cascade(label="Arquivo", menu=fileMenu) fileMenu.add_command(label="Nova aquisição", command=self._novaAquisicao) fileMenu.add_command(label="Processar...", command=self._processa) fileMenu.add_separator() fileMenu.add_command(label="Abrir Vídeo...", command=self._abrir) fileMenu.add_command(label="Abrir Exame...", command=self._abrirExame) fileMenu.add_separator() fileMenu.add_command(label="Sair", command=self._quit) helpMenu = Menu(menuBar, tearoff=0) menuBar.add_cascade(label="Ajuda", menu=helpMenu) helpMenu.add_command(label="Sobre...", command=self._sobre) # Container self.container = StartContainer() self.container.pack(fill='both', expand=True) self.window.mainloop()
def __init__(self, father, directory): self.father = father exam = util.getExam() widthWindowControl = 300 heightWindowControl = 125 yControl = int((exam['monitorHeight'] / 2) - (heightWindowControl / 2)) xControl = int((exam['monitorWidth'] / 2) - (widthWindowControl / 2)) self.window = Tk() self.window.title("Dados da anamnese") self.window.minsize(widthWindowControl, heightWindowControl) self.window.geometry('{}x{}+{}+{}'.format(widthWindowControl, heightWindowControl, xControl, yControl)) self.window.resizable(False, False) self.window.config(padx=5, pady=5) root = Frame(self.window, relief="groove", border=3) root.pack(fill="both", expand="True") dados = util.getDados(directory) if (dados['pacienteAnonimo'] is True): Label(root, text="Paciente Anônimo").grid(column=0, row=0) else: if (dados['problemaSaude'] is "N"): Label(root, text="Possui problema de saúde: Não").grid(column=0, row=0, sticky=W + N) else: psaude = StringVar(root) psaude.set("Possui problema de saúde: " + dados['tProblemaSaude']) Label(root, textvariable=psaude).grid(column=0, row=0, sticky=W + N) if (dados['medicamento'] is "N"): Label(root, text="Usa algum medicamento: Não").grid(column=0, row=1, sticky=W + N) else: medicamento = StringVar(root) medicamento.set("Usa algum medicamento: " + dados['tMedicamento']) Label(root, textvariable=medicamento).grid(column=0, row=1, sticky=W + N) if (dados['tratamento'] is "N"): Label(root, text="Está sob algum tratamento médico: Não").grid( column=0, row=2, sticky=W + N) else: tratamento = StringVar(root) tratamento.set("Está sob algum tratamento médico: " + dados['tTratamento']) Label(root, textvariable=tratamento).grid(column=0, row=2, sticky=W + N) if (dados['alergia'] is "N"): Label(root, text="Possui alergia a algum medicamento: Não").grid( column=0, row=3, sticky=W + N) else: medicamento = StringVar(root) medicamento.set("Possui alergia a algum medicamento: " + dados['tAlergia']) Label(root, textvariable=medicamento).grid(column=0, row=3, sticky=W + N) if (dados['lentes'] is "L"): Label(root, text="Usa lentes corretivas: Lentes de contato").grid( column=0, row=4, sticky=W + N) elif (dados['lentes'] is "O"): Label(root, text="Usa lentes corretivas: Óculos").grid(column=0, row=4, sticky=W + N) else: Label(root, text="Usa lentes corretivas: Não").grid(column=0, row=4, sticky=W + N) self.window.protocol("WM_DELETE_WINDOW", self._close) self.window.mainloop()
def _gravar(self): global exam if (self._validate()): exam = util.getExam() config = util.getConfig() exam['saveLocation'] = self.vDirectory.get() exam['exMin'] = self.v_min.get() exam['exSeg'] = self.v_seg.get() tempo = int(self.v_min.get()) * 60 + int(self.v_seg.get()) util.setExam(exam) red = exam['rColor'] green = exam['gColor'] blue = exam['bColor'] y = float(0.299 * red) + float(0.587 * green) + float(0.114 * blue) u = float(0.492 * (blue - y)) v = float(0.877 * (red - y)) if (platform.system() == "Linux"): self.pwmIr.ChangeDutyCycle(exam['ledIr']) self.pwmWhite.ChangeDutyCycle(exam['ledBr']) with picamera.PiCamera() as camera: camera.sensor_mode = exam["cameraMode"] for key in config['resolutions']: if key['resName'] == "Mode " + str(exam["cameraMode"]): camera.resolution = (key['width'], key['height']) camera.framerate = exam['fps'] camera.brightness = exam['brilho'] camera.contrast = exam['contraste'] camera.sharpness = exam['nitidez'] camera.saturation = exam['saturacao'] if exam['colorEfect']: camera.color_effects = (u, v) camera.start_preview() camera.start_recording('temp.h264') camera.wait_recording(tempo) camera.stop_recording() camera.stop_preview() camera.close() self.pwmIr.ChangeDutyCycle(0) self.pwmWhite.ChangeDutyCycle(0) now = datetime.now() nowstr = now.strftime("%Y-%m-%d %H:%M:%S") command = "MP4Box -fps %d -add temp.h264 exame.mp4" % ( exam['fps']) subprocess.check_output(command, shell=True) location = os.getcwd() + '/temp.h264' os.remove(location) # remove o arquivo temporario location = os.getcwd() + '/exame.mp4' if os.path.isfile("exame.mp4"): result = messagebox.askquestion( "Salvar", "Deseja salvar o arquivo?") if result == 'yes': nowstr = now.strftime("%Y%m%d%H%M%S") pasta = exam['saveLocation'] + '/' + nowstr os.mkdir(pasta) os.link("exame.mp4", str(pasta + "/exame.mp4")) os.remove(location) # remove o arquivo temporario # Cria arquivo de dados dados = { # Dados da aquisição "data": now.strftime("%Y-%m-%d"), "hora": now.strftime("%H:%M:%S"), "ledIr": exam["ledIr"], "ledBr": exam["ledBr"], "contraste": exam["contraste"], "saturacao": exam["saturacao"], "nitidez": exam["nitidez"], "brilho": exam["brilho"], "cameraMode": exam["cameraMode"], "fps": exam['fps'], "colorEfect": exam['colorEfect'], "rColor": exam['rColor'], "bColor": exam['gColor'], "gColor": exam['bColor'], # Dados do paciente "pacienteAnonimo": self.pacienteAnonimo.get(), "nome": self.eNome.get(), "dataNascimento": self.eNascimento.get(), "sexo": self.vSexo.get(), "estadoCivil": self.comboECivil.get(), "profisao": self.eProfisao.get(), "telefone": self.eTelefone.get(), "problemaSaude": self.vPSaude.get(), "tProblemaSaude": self.ePSaude.get(), "medicamento": self.vMedicamento.get(), "tMedicamento": self.eMedicamento.get(), "tratamento": self.vTratamento.get(), "tTratamento": self.eTratamento.get(), "alergia": self.vAlergia.get(), "tAlergia": self.eAlergia.get(), "lentes": self.vLentes.get(), # Obsercações "observacoes": self.tObservacao.get("1.0", END) } util.setDados(pasta, dados) else: messagebox.showerror( "Erro", "Algo deu errado na gravação do arquivo") else: print("Faria um vídeo de ", tempo, " segundos se estivesse no raspberry")
def __init__(self): super().__init__() exam = util.getExam() config = util.getConfig() self.l_footer.set("Modo de captura") # __________________________________________________________________________________________________________ # Frame Raiz root = Frame(self, padx=3, pady=3) root.pack(expand="True", fill="both") # __________________________________________________________________________________________________________ # Frame Dados dados = Frame(root, border=1, relief="raised") dados.pack(expand="True", fill="both") dadosPaciente = Frame(dados, border=1, relief="groove") dadosPaciente.grid(row=0, column=0, sticky="W", padx=3, pady=3) Label(dadosPaciente, text="Dados do paciente", font='bold').grid(row=0, column=0, sticky=W, padx=3, pady=3) self.pacienteAnonimo = BooleanVar() self.pacienteAnonimo.set(False) self.checkAnonimo = Checkbutton(dadosPaciente, text="Paciente anônimo", var=self.pacienteAnonimo, offvalue=False, onvalue=True, command=self._checkAnonimo) self.checkAnonimo.grid(column=6, row=0, sticky=E) # Dados linha 1 Label(dadosPaciente, text="Nome").grid(row=1, column=0, sticky="W", padx=3, pady=3) self.eNome = Entry(dadosPaciente) self.eNome.grid(row=1, column=1, columnspan=7, sticky=W + E, padx=3, pady=3) # Dados linha 2 Label(dadosPaciente, text="Data de nascimento").grid(row=2, column=0, sticky="W", padx=3, pady=3) self.eNascimento = Entry(dadosPaciente, width=10) self.eNascimento.grid(row=2, column=1, sticky=W + E, padx=3, pady=3) Label(dadosPaciente, text="Sexo").grid(row=2, column=2, sticky=W + E, padx=3, pady=3) self.vSexo = StringVar() self.vSexo.set("M") self.radioM = Radiobutton(dadosPaciente, text="Masculino", variable=self.vSexo, value="M") self.radioM.grid(row=2, column=3, sticky=W + E, padx=3, pady=3) self.radioF = Radiobutton(dadosPaciente, text="Feminino", variable=self.vSexo, value="F") self.radioF.grid(row=2, column=4, sticky=W + E, padx=3, pady=3) Label(dadosPaciente, text="Estado civil").grid(row=2, column=5, sticky=W + E, padx=3, pady=3) self.comboECivil = ttk.Combobox(dadosPaciente, state='readonly', width=10) self.comboECivil.grid(row=2, column=6, columnspan=2, sticky=W + E, padx=3, pady=3) self.comboECivil['values'] = [ \ 'Solteiro', 'Casado', 'Divorciado', 'Separado', 'Viúvo', ] # Dados linha 3 Label(dadosPaciente, text="Profisão").grid(row=3, column=0, sticky="W", padx=3, pady=3) self.eProfisao = Entry(dadosPaciente) self.eProfisao.grid(row=3, column=1, columnspan=4, sticky=W + E, padx=3, pady=3) Label(dadosPaciente, text="Telefone").grid(row=3, column=5, sticky="W", padx=3, pady=3) self.eTelefone = Entry(dadosPaciente, width=15) self.eTelefone.grid(row=3, column=6, sticky=W + E, padx=3, pady=3) # Dados linha 4 fAnamnese = Frame(dadosPaciente, border=1, relief="groove") fAnamnese.grid(row=4, column=0, columnspan=7, sticky=W, padx=3, pady=3) Label(fAnamnese, text="Anamnese", font='bold').grid(row=0, column=0, sticky=W, padx=3, pady=3) # Anamnese linha 1 Label(fAnamnese, text="Possui problema de saúde?").grid(row=1, column=0, sticky=W, padx=3, pady=3) self.vPSaude = StringVar() self.vPSaude.set("N") self.radioSPSaude = Radiobutton(fAnamnese, text="Sim", variable=self.vPSaude, value="S", command=self._changePSaude) self.radioSPSaude.grid(row=1, column=1, sticky=W, padx=3, pady=3) self.radioNPSaude = Radiobutton(fAnamnese, text="Não", variable=self.vPSaude, value="N", command=self._changePSaude) self.radioNPSaude.grid(row=1, column=2, sticky=W, padx=3, pady=3) Label(fAnamnese, text="Qual?").grid(row=1, column=3, sticky=W, padx=3, pady=3) self.ePSaude = Entry(fAnamnese, width=27) self.ePSaude.config(state='disabled') self.ePSaude.grid(row=1, column=4, sticky=W + E, padx=3, pady=3) # Anamnese linha 2 Label(fAnamnese, text="Usa algum medicamento?").grid(row=2, column=0, sticky=W, padx=3, pady=3) self.vMedicamento = StringVar() self.vMedicamento.set("N") self.radioSMedicamento = Radiobutton(fAnamnese, text="Sim", variable=self.vMedicamento, value="S", command=self._changeMedicamento) self.radioSMedicamento.grid(row=2, column=1, sticky=W, padx=3, pady=3) self.radioNMedicamento = Radiobutton(fAnamnese, text="Não", variable=self.vMedicamento, value="N", command=self._changeMedicamento) self.radioNMedicamento.grid(row=2, column=2, sticky=W, padx=3, pady=3) Label(fAnamnese, text="Qual?").grid(row=2, column=3, sticky=W, padx=3, pady=3) self.eMedicamento = Entry(fAnamnese) self.eMedicamento.config(state='disabled') self.eMedicamento.grid(row=2, column=4, sticky=W + E, padx=3, pady=3) # Anamnese linha 3 Label(fAnamnese, text="Está sob algum tratamento médico?").grid(row=3, column=0, sticky=W, padx=3, pady=3) self.vTratamento = StringVar() self.vTratamento.set("N") self.radioSTratamento = Radiobutton(fAnamnese, text="Sim", variable=self.vTratamento, value="S", command=self._changeTratamento) self.radioSTratamento.grid(row=3, column=1, sticky=W, padx=3, pady=3) self.radioNTratamento = Radiobutton(fAnamnese, text="Não", variable=self.vTratamento, value="N", command=self._changeTratamento) self.radioNTratamento.grid(row=3, column=2, sticky=W, padx=3, pady=3) Label(fAnamnese, text="Por que?").grid(row=3, column=3, sticky=W, padx=3, pady=3) self.eTratamento = Entry(fAnamnese) self.eTratamento.config(state='disabled') self.eTratamento.grid(row=3, column=4, sticky=W + E, padx=3, pady=3) # Anamnese linha 4 Label(fAnamnese, text="Possui alergia a algum medicamento?").grid(row=4, column=0, sticky=W, padx=3, pady=3) self.vAlergia = StringVar() self.vAlergia.set("N") self.radioSAlergia = Radiobutton(fAnamnese, text="Sim", variable=self.vAlergia, value="S", command=self._changeAlergia) self.radioSAlergia.grid(row=4, column=1, sticky=W, padx=3, pady=3) self.radioNAlergia = Radiobutton(fAnamnese, text="Não", variable=self.vAlergia, value="N", command=self._changeAlergia) self.radioNAlergia.grid(row=4, column=2, sticky=W, padx=3, pady=3) Label(fAnamnese, text="Qual?").grid(row=4, column=3, sticky=W, padx=3, pady=3) self.eAlergia = Entry(fAnamnese) self.eAlergia.config(state='disabled') self.eAlergia.grid(row=4, column=4, sticky=W + E, padx=3, pady=3) # Anamnese linha 5 Label(fAnamnese, text="Usa lentes corretivas?").grid(row=5, column=0, sticky="W", padx=3, pady=3) self.vLentes = StringVar() self.vLentes.set("N") self.radioLLentes = Radiobutton(fAnamnese, text="Lentes", variable=self.vLentes, value="L") self.radioLLentes.grid(row=5, column=1, sticky=W, padx=3, pady=3) self.radioOLentes = Radiobutton(fAnamnese, text="Óculos", variable=self.vLentes, value="O") self.radioOLentes.grid(row=5, column=2, sticky=W, padx=3, pady=3) self.radioNLentes = Radiobutton(fAnamnese, text="Não", variable=self.vLentes, value="N") self.radioNLentes.grid(row=5, column=3, sticky=W, padx=3, pady=3) observacao = Frame(dados, border=1, relief="groove") observacao.grid(row=0, column=1, sticky=E, padx=3, pady=3) Label(observacao, text="Observações").grid(row=0, column=0, columnspan=3, sticky=W, padx=3, pady=3) self.tObservacao = Text(observacao, height=17, width=18) self.tObservacao.grid(row=1, column=0, columnspan=3, sticky=W + E, padx=3, pady=3) exame = Frame(dados, border=1, relief="groove") exame.grid(row=1, column=0, columnspan=2, sticky=W + E, padx=3, pady=3) Label(exame, text="Exame").grid(row=0, column=0, columnspan=3, sticky="W", padx=3, pady=3) Label(exame, text="Local").grid(row=1, column=0, sticky="W", padx=3, pady=3) self.vDirectory = StringVar() if os.path.exists(exam['saveLocation']): self.vDirectory.set(exam['saveLocation']) else: self.vDirectory.set(os.getcwd()) self.directory = Entry(exame, textvariable=self.vDirectory, width=88, state="readonly") self.directory.grid(row=1, column=1, sticky=E + W, padx=3, pady=3) self.bPath = Button(exame, text="Localizar", command=lambda: self._path()) self.bPath.grid(row=1, column=2, sticky=E, padx=3, pady=3) # __________________________________________________________________________________________________________ # Frame Botões buttons = Frame(root) buttons.pack(side="bottom", fill="x") # Botão de gravar e preview self.gravar = Button(buttons, text="Iniciar gravação", command=lambda: self._gravar()) self.gravar.pack(side="right", fill="y", expand=False, padx=5, pady=5) self.preview = Button(buttons, text="Preview", command=lambda: self._preview()) self.preview.pack(side="right", fill="y", expand=False, padx=5, pady=5) # Segundos self.v_seg = StringVar() self.v_seg.set(exam['exSeg']) Label(buttons, text="seg").pack(side="right", fill="y", expand=False, padx=5, pady=5) self.eSeg = Entry(buttons, width=3, textvariable=self.v_seg) self.eSeg.pack(side="right", fill="y", expand=False, padx=5, pady=5) # Minutos self.v_min = StringVar() self.v_min.set(exam['exMin']) Label(buttons, text="min").pack(side="right", fill="y", expand=False, padx=5, pady=5) self.eMin = Entry(buttons, width=3, textvariable=self.v_min) self.eMin.pack(side="right", fill="y", expand=False, padx=5, pady=5) Label(buttons, text="Tempo de exposição").pack(side="right", fill="y", expand=False, padx=5, pady=5) # __________________________________________________________________________________________________________ # Configuração dos pinos de IO do Raspberry # Configura para não mostrar alertas gpio.setwarnings(False) # Configurando GPIO gpio.setmode(gpio.BOARD) gpio.setup(38, gpio.OUT) gpio.setup(40, gpio.OUT) # Configurando o PWM com os valores iniciais de frequencia e dutycicle self.pwmIr = gpio.PWM(38, 200) self.pwmIr.start(0) self.pwmWhite = gpio.PWM(40, 200) self.pwmWhite.start(0)
def __init__(self, father, pwmIr, pwmWhite): exam = util.getExam() config = util.getConfig() # ____ JANELA DE PREVIEW self.camera = PiCamera() self.widthWindowPreview = 640 self.heightWindowPreview = 480 self.yControl = int((exam['monitorHeight'] / 2) - (self.heightWindowPreview / 2) - 135) self.xControl = int((exam['monitorWidth'] / 2) - (self.widthWindowPreview / 2)) for key in config['resolutions']: if key['resName'] == "Mode " + str(exam["cameraMode"]): self.camera.sensor_mode = exam["cameraMode"] self.camera.resolution = (key['width'], key['height']) self.camera.start_preview(fullscreen=False, window=(self.xControl, self.yControl, self.widthWindowPreview, self.heightWindowPreview)) # ____ JANELA DE CONTROLES widthWindowControl = 832 heightWindowControl = 230 yControl = int((exam['monitorHeight'] / 2) - (heightWindowControl / 2) + 230) xControl = int((exam['monitorWidth'] / 2) - (widthWindowControl / 2)) self.window = Toplevel() self.window.title("Preview") self.window.minsize(widthWindowControl, heightWindowControl) self.window.geometry('{}x{}+{}+{}'.format(widthWindowControl, heightWindowControl, xControl, yControl)) self.window.resizable(False, False) self.window.config(padx=5, pady=5) self.window.transient(father) self.window.focus_force() self.window.grab_set() self.pwmIr = pwmIr self.pwmWhite = pwmWhite self.root = Frame(self.window) self.root.pack(fill="both", expand="True") # Frame dos controles f_controles = Frame(self.root, bg="blue") f_controles.grid(column=0, row=0, sticky=N + S + E + W) # Coluna de controle dos leds f_led = Frame(f_controles, border=1, relief="groove") f_led.grid(column=0, row=0) Label(f_led, text="Luminosidade").grid(row=0, column=0, columnspan=4, padx=5, pady=5) Label(f_led, text="IR").grid(column=0, row=1, sticky=N + S + E + W, padx=5, pady=5) self.irScale = Scale(f_led, from_=0, to=100, showvalue="False", orient="horizontal", command=self.ledIrChange) self.irScale.grid(column=1, row=1, sticky=N + S + E + W, padx=5, pady=5) self.irScale.set(exam['ledIr']) self.irValue = Label(f_led, text="%03d" % exam['ledIr']) self.irValue.grid(column=2, row=1, sticky=N + S + E + W, padx=5, pady=5) Label(f_led, text="BR").grid(column=0, row=2, sticky=N + S + E + W, padx=5, pady=5) self.brScale = Scale(f_led, from_=0, to=100, showvalue="False", orient="horizontal", command=self.ledBrChange) self.brScale.grid(column=1, row=2, sticky=N + S + E + W, padx=5, pady=5) self.brScale.set(exam['ledBr']) self.brValue = Label(f_led, text="%03d" % exam['ledBr']) self.brValue.grid(column=2, row=2, sticky=N + S + E + W, padx=5, pady=5) # Coluna de controles rápidos fFast = Frame(f_controles, border=1, relief="groove") fFast.grid(column=1, row=0) Label(fFast, text="Controles Rápidos").grid(row=0, column=0, columnspan=6, padx=5, pady=5) Label(fFast, text="Brilho").grid(column=0, row=1, sticky=N + S + E + W, padx=5, pady=5) self.brilhoScale = Scale(fFast, from_=0, to=100, showvalue="False", orient="horizontal", command=self.brilhoChange) self.brilhoScale.grid(column=1, row=1, sticky=N + S + E + W, padx=5, pady=5) self.brilhoScale.set(exam['brilho']) self.brilhoValue = Label(fFast, text="%03d" % exam['brilho']) self.brilhoValue.grid(column=2, row=1, sticky=N + S + E + W, padx=5, pady=5) Label(fFast, text="Contraste").grid(column=0, row=2, sticky=N + S + E + W, padx=5, pady=5) self.contrasteScale = Scale(fFast, from_=0, to=100, showvalue="False", orient="horizontal", command=self.contrasteChange) self.contrasteScale.grid(column=1, row=2, sticky=N + S + E + W, padx=5, pady=5) self.contrasteScale.set(exam['contraste']) self.contrasteValue = Label(fFast, text="%03d" % exam['contraste']) self.contrasteValue.grid(column=2, row=2, sticky=N + S + E + W, padx=5, pady=5) Label(fFast, text="Saturação").grid(column=3, row=1, sticky=N + S + E + W, padx=5, pady=5) self.saturacaoScale = Scale(fFast, from_=0, to=100, showvalue="False", orient="horizontal", command=self.saturacaoChange) self.saturacaoScale.grid(column=4, row=1, sticky=N + S + E + W, padx=5, pady=5) self.saturacaoScale.set(exam['saturacao']) self.saturacaoValue = Label(fFast, text="%03d" % exam['saturacao']) self.saturacaoValue.grid(column=5, row=1, sticky=N + S + E + W, padx=5, pady=5) Label(fFast, text="Nitidez").grid(column=3, row=2, sticky=N + S + E + W, padx=5, pady=5) self.nitidezScale = Scale(fFast, from_=0, to=100, showvalue="False", orient="horizontal", command=self.nitidezChange) self.nitidezScale.grid(column=4, row=2, sticky=N + S + E + W, padx=5, pady=5) self.nitidezScale.set(exam['nitidez']) self.nitidezValue = Label(fFast, text="%03d" % exam['nitidez']) self.nitidezValue.grid(column=5, row=2, sticky=N + S + E + W, padx=5, pady=5) # Coluna de cores fCores = Frame(f_controles, border=1, relief="groove") fCores.grid(column=3, row=0, rowspan=2, sticky=N + S + E + W) Label(fCores, text="Controle de cores").grid(row=0, column=0, columnspan=6, padx=5, pady=5) self.vCor = BooleanVar() self.checkCores = Checkbutton(fCores, text="Filtro de cores", var=self.vCor, offvalue=False, onvalue=True, command=self.enableCores) self.checkCores.grid(column=0, row=1, columnspan=3, sticky=N + S + E + W) Label(fCores, text="R").grid(column=0, row=2, sticky=N + S + E + W, padx=5, pady=5) self.rScale = Scale(fCores, from_=0, to=255, showvalue="False", orient="horizontal", command=self.rChange) self.rScale.grid(column=1, row=2, sticky=N + S + E + W, padx=5, pady=5) self.rScale.set(exam['rColor']) self.rValue = Label(fCores, text="%03d" % exam['rColor']) self.rValue.grid(column=2, row=2, sticky=N + S + E + W, padx=5, pady=5) Label(fCores, text="G").grid(column=0, row=3, sticky=N + S + E + W, padx=5, pady=5) self.gScale = Scale(fCores, from_=0, to=255, showvalue="False", orient="horizontal", command=self.gChange) self.gScale.grid(column=1, row=3, sticky=N + S + E + W, padx=5, pady=5) self.gScale.set(exam['gColor']) self.gValue = Label(fCores, text="%03d" % exam['gColor']) self.gValue.grid(column=2, row=3, sticky=N + S + E + W, padx=5, pady=5) Label(fCores, text="B").grid(column=0, row=4, sticky=N + S + E + W, padx=5, pady=5) self.bScale = Scale(fCores, from_=0, to=255, showvalue="False", orient="horizontal", command=self.bChange) self.bScale.grid(column=1, row=4, sticky=N + S + E + W, padx=5, pady=5) self.bScale.set(exam['bColor']) self.bValue = Label(fCores, text="%03d" % exam['bColor']) self.bValue.grid(column=2, row=4, sticky=N + S + E + W, padx=5, pady=5) self.canvasCor = Canvas(fCores, width=20, height=20) self.canvasCor.grid(column=0, row=5, columnspan=3, sticky=N + S + E + W, padx=5, pady=5) self.updateCanvasCor(exam['rColor'], exam['gColor'], exam['bColor']) if exam['colorEfect'] is True: self.checkCores.select() self.vCor.set(True) else: self.checkCores.deselect() self.vCor.set(False) self.enableCores() # Linha de captura fCaptura = Frame(f_controles, border=1, relief="groove") fCaptura.grid(column=0, row=1, columnspan=2, sticky=N + S + E + W) Label(fCaptura, text="Captura").grid(row=0, column=0, columnspan=6, padx=5, pady=5) Label(fCaptura, text="Modo de captura").grid(row=1, column=0, sticky="W", padx=3, pady=3) self.SensorModeCombo = ttk.Combobox(fCaptura, state='readonly', width=60) self.SensorModeCombo.grid(row=1, column=1, columnspan=2, sticky=W + E, padx=3, pady=3) self.SensorModeCombo['values'] = [ \ 'Mode 1: to 1920x1080 1-30 fps ', 'Mode 2: to 2592x1944 1-15 fps Image', 'Mode 3: to 2592x1944 0.1666-1 fps Image', 'Mode 4: to 1296x972 1-42 fps', 'Mode 5: to 1296x730 1-49 fps', 'Mode 6: to 640x480 42.1-60 fps', 'Mode 7: to 640x480 60.1-90 fps' ] self.SensorModeCombo.current(exam['cameraMode'] - 1) self.SensorModeCombo.bind('<<ComboboxSelected>>', self.sensorModeChanged) # FrameRate Label(fCaptura, text="Frame Rate:").grid(column=0, row=2, sticky=W, padx=3, pady=3) self.fpsScale = Scale(fCaptura, resolution=0.01, length=450, showvalue="False", orient="horizontal", command=self.fpsChange) self.fpsScale.grid(column=1, row=2, sticky=E + W, padx=5, pady=5) for key in config['resolutions']: if key['resName'] == "Mode " + str(self.SensorModeCombo.current() + 1): self.fpsScale.config(to=key['maxfps'], from_=key['minfps']) self.fpsScale.set(exam['fps']) self.fpsValue = Label(fCaptura, text=exam['fps']) self.fpsValue.grid(column=2, row=2, sticky=E, padx=5, pady=5) #Frame dos botões fButtons = Frame(self.root) fButtons.grid(column=0, row=1, pady=5) self.cancelar = Button(fButtons, text="Descartar configurações", command=lambda: self._close()).grid(column=0, row=0, padx=5, pady=5) self.gravar = Button(fButtons, text="Salvar Configurações", command=lambda: self._salvar()).grid(column=1, row=0, padx=5, pady=5) self.window.protocol("WM_DELETE_WINDOW", self._close) self.window.mainloop()