Files
@ 18d23ce9a53f
Branch filter:
Location: OneEye/src/gui/settings.py - annotation
18d23ce9a53f
1.9 KiB
text/x-python
settings:
setting and getting parameters
entering setup state
closing on setRecording
setting and getting parameters
entering setup state
closing on setRecording
5f2136fcbebd 18d23ce9a53f 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 5f2136fcbebd 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 5f2136fcbebd 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f 18d23ce9a53f | import tkinter as tk
from tkinter import N,S,E,W,LEFT
from .util import MsgMixin
class Settings(tk.Toplevel,MsgMixin):
def __init__(self,parent):
self.parent=parent
tk.Toplevel.__init__(self, parent.root)
self.title("Settings | OneEye")
self.columnconfigure(0,weight=1)
self.content=tk.Frame(self)
self.content.grid(column=0,row=0,sticky=(N,S,E,W))
self.content.columnconfigure(0,weight=1)
self._create()
self.parent.settings=self
self.parent.root.event_generate("<<setUp>>")
self.parent.sendMsg("fetchParams")
def _create(self):
self.scaleTresB=tk.Scale(self.content, orient=tk.HORIZONTAL, length=200, from_=0.0, to=100.0, command=self.refreshTresholds)
self.scaleTresW=tk.Scale(self.content, orient=tk.HORIZONTAL, length=200, from_=0.0, to=100.0, command=self.refreshTresholds)
blackLabel=tk.Label(self.content,text="Black stone treshold (intensity)")
whiteLabel=tk.Label(self.content,text="White stone treshold (intensity)")
blackLabel.grid(column=0,row=0)
self.scaleTresB.grid(column=0,row=1,sticky=(E,W))
whiteLabel.grid(column=0,row=2)
self.scaleTresW.grid(column=0,row=3,sticky=(E,W))
self.buttonFrame=tk.Frame(self.content)
self.buttonFrame.grid(column=0,row=4,sticky=(W,))
self.confirmButton=tk.Button(self.buttonFrame,text="OK",command=self.sendParams)
self.cancelButton=tk.Button(self.buttonFrame,text="Cancel",command=lambda: self.destroy())
self.confirmButton.pack(side=LEFT)
self.cancelButton.pack(side=LEFT)
def refreshTresholds(self,_):
self.parent.sendMsg("setTresholds",tuple(),self._compileParams())
def setParams(self,tresB=0,tresW=0):
self.scaleTresB.set(tresB)
self.scaleTresW.set(tresW)
def sendParams(self):
self.parent.sendMsg("setParams",tuple(),self._compileParams())
self.destroy()
def _compileParams(self):
params={
"tresB": self.scaleTresB.get(),
"tresW": self.scaleTresW.get()
}
return params
|