Files
@ 6f9ec51a8142
Branch filter:
Location: OneEye/src/gui/settings.py - annotation
6f9ec51a8142
1.8 KiB
text/x-python
moving responsibilities
GUI got its own ImageAnalyzer instance for doing previews
accordingly changed APIs to keep only useful messages
ImageAnalyzer params wrapped in a separate class
GUI got its own ImageAnalyzer instance for doing previews
accordingly changed APIs to keep only useful messages
ImageAnalyzer params wrapped in a separate class
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 6f9ec51a8142 6f9ec51a8142 6f9ec51a8142 18d23ce9a53f 6f9ec51a8142 6f9ec51a8142 6f9ec51a8142 18d23ce9a53f 18d23ce9a53f 6f9ec51a8142 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,_):
params=self.parent.detector.params
params.tresB=self.scaleTresB.get()
params.tresW=self.scaleTresW.get()
def setParams(self,params):
self.scaleTresB.set(params.tresB)
self.scaleTresW.set(params.tresW)
def sendParams(self):
self.parent.sendParams()
self.destroy()
|