mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
Code cleanup and minor adjustments
This commit is contained in:
parent
15dd61805d
commit
8710f14c4a
@ -1,71 +1,53 @@
|
|||||||
import kivy
|
import kivy
|
||||||
from multiprocessing import Process,Queue,Pipe
|
from multiprocessing import Process,Queue,Pipe
|
||||||
kivy.require("1.9.1")
|
kivy.require("1.9.1")
|
||||||
|
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
|
|
||||||
from kivy.uix.gridlayout import GridLayout
|
from kivy.uix.gridlayout import GridLayout
|
||||||
|
|
||||||
from kivy.uix.slider import Slider
|
from kivy.uix.slider import Slider
|
||||||
|
|
||||||
from kivy.uix.label import Label
|
from kivy.uix.label import Label
|
||||||
|
|
||||||
from kivy.uix.floatlayout import FloatLayout
|
from kivy.uix.floatlayout import FloatLayout
|
||||||
|
|
||||||
from kivy.properties import NumericProperty
|
from kivy.properties import NumericProperty
|
||||||
|
|
||||||
from kivy.uix.scatter import Scatter
|
from kivy.uix.scatter import Scatter
|
||||||
|
|
||||||
from kivy.uix.textinput import TextInput
|
from kivy.uix.textinput import TextInput
|
||||||
|
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
|
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
Window.size = (600, 200)
|
###############################################################################
|
||||||
|
|
||||||
|
Window.size = (700, 200)
|
||||||
|
|
||||||
class WidgetContainer(GridLayout):
|
class WidgetContainer(GridLayout):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
super(WidgetContainer, self).__init__(**kwargs)
|
super(WidgetContainer, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############################################################################### right
|
||||||
|
|
||||||
self.cols = 3
|
self.cols = 3
|
||||||
|
|
||||||
|
|
||||||
self.xcc = Slider(min = 1, max = 800,
|
self.xcc = Slider(min = 1, max = 800,
|
||||||
value_track = True,
|
value_track = True,
|
||||||
value_track_color =[1, 1, 1, 1])
|
value_track_color =[1, 1, 1, 1])
|
||||||
|
|
||||||
|
|
||||||
self.add_widget(Label(text ='Search Size X R'))
|
self.add_widget(Label(text ='Search Size X R'))
|
||||||
self.add_widget(self.xcc)
|
self.add_widget(self.xcc)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.xValue = Label(text ='1')
|
self.xValue = Label(text ='1')
|
||||||
|
|
||||||
self.add_widget(self.xValue)
|
self.add_widget(self.xValue)
|
||||||
|
|
||||||
|
|
||||||
self.xcc.bind(value = self.on_value)
|
self.xcc.bind(value = self.on_value)
|
||||||
|
|
||||||
###################################
|
############################################################################### bottom
|
||||||
|
|
||||||
|
|
||||||
self.Y = Slider(min = 1, max = 2000,
|
self.Y = Slider(min = 1, max = 2000,
|
||||||
value_track = True,
|
value_track = True,
|
||||||
value_track_color =[1, 1, 1, 1])
|
value_track_color =[1, 1, 1, 1])
|
||||||
|
|
||||||
|
|
||||||
self.add_widget(Label(text ='Search Size Y R'))
|
self.add_widget(Label(text ='Search Size Y R'))
|
||||||
self.add_widget(self.Y)
|
self.add_widget(self.Y)
|
||||||
|
|
||||||
self.YV = Label(text ='1')
|
self.YV = Label(text ='1')
|
||||||
self.add_widget(self.YV)
|
self.add_widget(self.YV)
|
||||||
self.Y.bind(value = self.on_value1)
|
self.Y.bind(value = self.on_value1)
|
||||||
###############################################
|
|
||||||
|
############################################################################### left
|
||||||
|
|
||||||
self.xlc = Slider(min = 1, max = 800,
|
self.xlc = Slider(min = 1, max = 800,
|
||||||
value_track = True,
|
value_track = True,
|
||||||
@ -75,7 +57,8 @@ class WidgetContainer(GridLayout):
|
|||||||
self.xlValue = Label(text ='1')
|
self.xlValue = Label(text ='1')
|
||||||
self.add_widget(self.xlValue)
|
self.add_widget(self.xlValue)
|
||||||
self.xlc.bind(value = self.on_value2)
|
self.xlc.bind(value = self.on_value2)
|
||||||
####################################################
|
|
||||||
|
############################################################################### top
|
||||||
|
|
||||||
self.ylc = Slider(min = 1, max = 800,
|
self.ylc = Slider(min = 1, max = 800,
|
||||||
value_track = True,
|
value_track = True,
|
||||||
@ -86,19 +69,19 @@ class WidgetContainer(GridLayout):
|
|||||||
self.add_widget(self.ylValue)
|
self.add_widget(self.ylValue)
|
||||||
self.ylc.bind(value = self.on_value3)
|
self.ylc.bind(value = self.on_value3)
|
||||||
|
|
||||||
|
############################################################################### detection
|
||||||
###############################
|
|
||||||
|
|
||||||
self.deth = Slider(min = 1, max = 40,
|
self.deth = Slider(min = 1, max = 40,
|
||||||
value_track = True,
|
value_track = True,
|
||||||
value_track_color =[1, 1, 1, 1])
|
value_track_color =[1, 1, 1, 1])
|
||||||
self.add_widget(Label(text ='Detection thresh default (18)'))
|
self.add_widget(Label(text ='Detection thresh DEFAULT:18'))
|
||||||
self.add_widget(self.deth)
|
self.add_widget(self.deth)
|
||||||
self.dethv= Label(text ='1')
|
self.dethv= Label(text ='1')
|
||||||
self.add_widget(self.dethv)
|
self.add_widget(self.dethv)
|
||||||
self.deth.bind(value = self.on_value4)
|
self.deth.bind(value = self.on_value4)
|
||||||
|
|
||||||
#####################################################
|
############################################################################### camera input
|
||||||
|
|
||||||
self.cam = Slider(min = 0, max = 5,
|
self.cam = Slider(min = 0, max = 5,
|
||||||
value_track = True,
|
value_track = True,
|
||||||
value_track_color =[1, 1, 1, 1])
|
value_track_color =[1, 1, 1, 1])
|
||||||
@ -107,7 +90,9 @@ class WidgetContainer(GridLayout):
|
|||||||
self.camv= Label(text ='Select')
|
self.camv= Label(text ='Select')
|
||||||
self.add_widget(self.camv)
|
self.add_widget(self.camv)
|
||||||
self.cam.bind(value = self.on_value5)
|
self.cam.bind(value = self.on_value5)
|
||||||
################################################
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
def on_value(self, instance, brightness):
|
def on_value(self, instance, brightness):
|
||||||
self.xValue.text = "% d"% brightness
|
self.xValue.text = "% d"% brightness
|
||||||
fx= open("valueX.txt","w+")
|
fx= open("valueX.txt","w+")
|
||||||
@ -144,7 +129,7 @@ class WidgetContainer(GridLayout):
|
|||||||
fyl.write(self.camv.text)
|
fyl.write(self.camv.text)
|
||||||
fyl.close
|
fyl.close
|
||||||
|
|
||||||
class Eyetrack(App):
|
class EyetrackGUI(App):
|
||||||
def build(self):
|
def build(self):
|
||||||
widgetContainer = WidgetContainer()
|
widgetContainer = WidgetContainer()
|
||||||
print()
|
print()
|
||||||
@ -152,7 +137,7 @@ class Eyetrack(App):
|
|||||||
return widgetContainer
|
return widgetContainer
|
||||||
|
|
||||||
|
|
||||||
root = Eyetrack()
|
rootGUI = EyetrackGUI()
|
||||||
|
|
||||||
|
|
||||||
root.run()
|
rootGUI.run()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user