예제 #1
0
	def build(self):
		root = FloatLayout(orientation='horizontal')
		btnRight = Button(text='Scroll', size_hint=(.05,1),pos_hint={'right':1})#,'y':0})
		btnLeft = Button(text='Scroll', size_hint=(.05,1),pos_hint={'left':1})			
		root.add_widget(btnRight)
		root.add_widget(btnLeft)
#		scrollV = ScrollView(size_hint=(None,None),size=(800,400))
#		scrollV.do_scroll_y=False
		graph = Graph()
		plot = LinePlot(mode='line_strip', color=[1,0,0,1])
		plot.points = [(x[i],y[i]) for i in xrange(len(x))]
		graph.add_plot(plot)
		graph.x_ticks_major=1
		graph.xmin=xmin
		graph.xmax=xmax
		graph.ymin=ymin
		graph.ymax=ymax
		graph.y_ticks_major=25
		graph.y_grid_label=True
		graph.x_grid_label=True
		graph.xlabel='X axis'
		graph.ylabel='Y axis'
		graph.y_grid = True
		graph.x_grid = True
		def moveRight(obj):
			global xmin
			global xmax
			xmin=xmin+.5
			xmax=xmax+.5
			graph.xmin=xmin
			graph.xmax=xmax
			#graph.remove_plot(plot)
			#graph.add_plot(plot)
			#graph._redraw_size(xmin,ymin,xmax,ymax)
		btnRight.bind(on_release=moveRight)
		def moveLeft(obj):
			global xmin
			global xmax
			xmin=xmin-.5
			xmax=xmax-.5
			graph.xmin=xmin
			graph.xmax=xmax
		btnLeft.bind(on_release=moveLeft)
		root.add_widget(graph)
#		graph.bind(minimum_height=graph.setter('height'))
#		scrollV.add_widget(graph)
		return root
예제 #2
0
    def __init__(self, **kwargs):
        super(FourthScreen, self).__init__(**kwargs)

	# create buttons
        btnRight = Button(text='Scroll', size_hint=(.05,1),pos_hint={'x':0.45})#,'y':0})
        btnLeft = Button(text='Scroll', size_hint=(.05,1),pos_hint={'left':1})			
        self.add_widget(btnRight)
        self.add_widget(btnLeft)
        
	# create graph
        graph = Graph()
        plot = LinePlot(mode='line_strip',color=[1,0,0,1])
        plot.points = [(x[i],y[i]) for i in xrange(len(x))]
        graph.add_plot(plot)
        graph.x_ticks_major=.5
        graph.xmin=xmin
        graph.xmax=xmax
        graph.ymin=ymin
        graph.ymax=ymax
        graph.y_ticks_major=10
        graph.xlabel='Time (min)'
        graph.ylabel='Brain Wave Amplitude (mV)'
        graph.y_grid = True
        graph.x_grid = True
        graph.size_hint=(0.4,0.9)
        graph.x_grid_label=True
        graph.y_grid_label=True

        # create video player
        video = VideoPlayer(source='Momona.mp4')
        video.play=False
        video.size_hint=(0.5,0.9)
        video.pos_hint={'right':1,'top':1}       

        graph.pos_hint={'x':0.05,'top':1}
        def moveRight(obj):
	    global xmin
            global xmax
            global xGlobalmax
            xmin=xmin+.5
            xmax=xmax+.5
            graph.xmin=xmin
            graph.xmax=xmax
            
            percent = 1-(xGlobalmax-xmin)/xGlobalmax
            video.seek(percent)

        btnRight.bind(on_release=moveRight)
        def moveLeft(obj):
            global xmin
            global xmax
            global xGlobalmax
            xmin=xmin-.5
            xmax=xmax-.5
            graph.xmin=xmin
            graph.xmax=xmax

            percent = 1-(xGlobalmax-xmin)/xGlobalmax
            video.seek(percent)
        btnLeft.bind(on_release=moveLeft)
        self.add_widget(graph)
        self.add_widget(video)
예제 #3
0
    def playVideo(self,FourthScreen):
	#get data for patient
	with open('choosePatient.txt','r') as f:
      	    patientName=f.read()
#      	data = data.split(',')
      	fileName ='videos/' + patientName + ".mp4"
	
	dataMatrix1 = genfromtxt('DemoEEGFile.txt')
	x = dataMatrix1[:,0]
	x = x - 5.539
	y = dataMatrix1[:,1]
	
	xmin = math.trunc(x[0])
	ymin = math.trunc(min(y))#math.trunc(y[0])
	xmax = xmin+1
	xGlobalmax = math.trunc(x[len(x)-1])
	ymax = math.trunc(max(y))#math.trunc(y[len(y)-1])
	# create buttons
        btnRight = Button(text='Scroll', size_hint=(.05,1),pos_hint={'x':0.45})#,'y':0})
        btnLeft = Button(text='Scroll', size_hint=(.05,1),pos_hint={'left':1})			
        FourthScreen.add_widget(btnRight)
        FourthScreen.add_widget(btnLeft)
        
	# create graph
        graph = Graph()
        plot = LinePlot(mode='line_strip',color=[1,0,0,1])
        plot.points = [(x[i],y[i]) for i in xrange(len(x))]
        graph.add_plot(plot)
        graph.x_ticks_major=.5
        graph.xmin=xmin
        graph.xmax=xmax
        graph.ymin=ymin
        graph.ymax=ymax
        graph.y_ticks_major=10
        graph.xlabel='Time (min)'
        graph.ylabel='Brain Wave Amplitude (mV)'
        graph.y_grid = True
        graph.x_grid = True
        graph.size_hint=(0.4,0.9)
        graph.x_grid_label=True
        graph.y_grid_label=True

        # create video player
        video = VideoPlayer(source=fileName)
        video.play=False
        video.size_hint=(0.5,0.9)
        video.pos_hint={'right':1,'top':1}       

        graph.pos_hint={'x':0.05,'top':1}
        def moveRight(obj):
	    global xmin
            global xmax
            global xGlobalmax
            xmin=xmin+.5
            xmax=xmax+.5
            graph.xmin=xmin
            graph.xmax=xmax
            
            percent = 1-(xGlobalmax-xmin)/xGlobalmax
            video.seek(percent)

        btnRight.bind(on_release=moveRight)
        def moveLeft(obj):
            global xmin
            global xmax
            global xGlobalmax
            xmin=xmin-.5
            xmax=xmax-.5
            graph.xmin=xmin
            graph.xmax=xmax

            percent = 1-(xGlobalmax-xmin)/xGlobalmax
            video.seek(percent)
        btnLeft.bind(on_release=moveLeft)
        FourthScreen.add_widget(graph)
        FourthScreen.add_widget(video)