Beispiel #1
0
class SplashScreen:

    root = None
    win = None
    img = 'images/splash-screen'
    flag = 0

    def __init__(self, root):
        self.root = root
        self.width = 500
        self.height = 300
        self.flag = config.preferences.show_splash

    def show(self):
        self.root.withdraw()
        if self.flag:
            img_file = os.path.join(app.config.sk_share_dir, self.img + '.png')
            from sk1sdk.tkpng import load_icon
            load_icon(self.root, img_file, self.img)

            scrnWt = self.root.winfo_screenwidth()
            scrnHt = self.root.winfo_screenheight()
            winXPos = (scrnWt / 2) - (self.width / 2)
            winYPos = (scrnHt / 2) - (self.height / 2)

            self.win = Toplevel()
            self.win.overrideredirect(1)
            self.win.configure(background='black')
            self.banner = Label(self.win,
                                image=self.img,
                                cursor='watch',
                                borderwidth=0)
            self.banner.pack()

            self.verlb = Label(self.win,
                               text='version %s' % (config.version, ),
                               bg='white')
            self.verlb.place(x=10, y=240)
            self.verlb['font'] += ' bold'

            self.txtlb = Label(self.win, text='Start...', bg='white')
            self.txtlb.place(x=10, y=265)
            self.progress_bar = SS_ProgressBar(self.win)
            self.progress_bar.pack(fill=X, side=TOP)
            geom = (self.width, self.height, winXPos, winYPos)
            self.win.geometry('%dx%d+%d+%d' % geom)
            self.win.update()

    def hide(self):
        if self.flag and self.win:
            self.win.withdraw()
            self.win.destroy()

    def set_val(self, val, txt=''):
        self.progress_bar.set_val(val)
        if txt: self.txtlb['text'] = txt
        self.win.update()
Beispiel #2
0
class SplashScreen:

	root = None
	win = None
	img = 'images/splash-screen'
	flag = 0

	def __init__(self, root):
		self.root = root
		self.width = 500
		self.height = 300
		self.flag = config.preferences.show_splash

	def show(self):
		self.root.withdraw()
		if self.flag:
			img_file = os.path.join(app.config.sk_share_dir, self.img + '.png')
			from sk1sdk.tkpng import load_icon
			load_icon(self.root, img_file, self.img)

			scrnWt = self.root.winfo_screenwidth()
			scrnHt = self.root.winfo_screenheight()
			winXPos = (scrnWt / 2) - (self.width / 2)
			winYPos = (scrnHt / 2) - (self.height / 2)

			self.win = Toplevel()
			self.win.overrideredirect(1)
			self.win.configure(background='black')
			self.banner = Label(self.win, image=self.img, cursor='watch',
							borderwidth=0)
			self.banner.pack()

			self.verlb = Label(self.win, text='version %s' % (config.version,),
							bg='white')
			self.verlb.place(x=10, y=240)
			self.verlb['font'] += ' bold'

			self.txtlb = Label(self.win, text='Start...',
							bg='white')
			self.txtlb.place(x=10, y=265)
			self.progress_bar = SS_ProgressBar(self.win)
			self.progress_bar.pack(fill=X, side=TOP)
			geom = (self.width, self.height, winXPos, winYPos)
			self.win.geometry('%dx%d+%d+%d' % geom)
			self.win.update()

	def hide(self):
		if self.flag and self.win:
			self.win.withdraw()
			self.win.destroy()

	def set_val(self, val, txt=''):
		self.progress_bar.set_val(val)
		if txt: self.txtlb['text'] = txt
		self.win.update()
def test():
    from Tkinter import Toplevel
    import PyShell
    root = Toplevel(PyShell.root)
    root.configure(bd=0, bg="yellow")
    root.focus_set()
    sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = FileTreeItem("C:/windows/desktop")
    node = TreeNode(sc.canvas, None, item)
    node.expand()
def test():
    from Tkinter import Toplevel
    import PyShell
    root = Toplevel(PyShell.root)
    root.configure(bd=0, bg="yellow")
    root.focus_set()
    sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = FileTreeItem("C:/windows/desktop")
    node = TreeNode(sc.canvas, None, item)
    node.expand()
 def Error(self, error="Se produjo un error"):
     Ventana2 = Toplevel(self.master)
     Ventana2.configure(height=100, width=260, bg="#4a4a4a")
     Ventana2.title("Error")
     Error = Label(Ventana2, text=error, bg="#4a4a4a", fg="#FFFFFF")
     Error.place(x=40, y=15)
     Error.config(font=("", 12))
     Salir = Button(Ventana2,
                    width=10,
                    text="Salir",
                    command=Ventana2.destroy)
     Salir.place(x=85, y=55)
def test():
    import sys
    from Tkinter import Toplevel
    import PyShell
    root = Toplevel(PyShell.root)
    root.configure(bd=0, bg="yellow")
    root.focus_set()
    sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = make_objecttreeitem("sys", sys)
    node = TreeNode(sc.canvas, None, item)
    node.expand()
Beispiel #7
0
def test():
    import sys
    from Tkinter import Toplevel
    import PyShell
    root = Toplevel(PyShell.root)
    root.configure(bd=0, bg="yellow")
    root.focus_set()
    sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
    sc.frame.pack(expand=1, fill="both")
    item = make_objecttreeitem("sys", sys)
    node = TreeNode(sc.canvas, None, item)
    node.expand()
def inicio(c):
    global ventana2, Labeli, Labelt, img0, img1, imgF, row, cont
    instruction=None
    img0=PhotoImage(file="00.gif") # Reads photos
    img00=PhotoImage(file="0000.gif")
    imgF=PhotoImage(file="FF.gif")

    if c:  
        ventana2=Toplevel(ventana)
        ventana2.title("MANITOR")
        ventana2.configure(bg="white")
        ventana2.geometry("1000x600+5+40")
    
        Labelt=Label(ventana2,text='BIENVENIDO ', # ventana2 TEXTO
                fg="black",bg="white",font=("Helvetica 36 "))
        ventana2.columnconfigure(0,weight=1)
        Labelt.grid(row=1,column=0)
        Labeli=Label(ventana2,image=img00) # ventana2 IMAGEN
        Labeli.grid(row=2,column=0)
                
    else:
        Labelt.config(text='BIENVENIDO ')
        Labeli.image = img00
        Labeli.config(image=img00)
    ventana.iconify() # Turns window into an icon
    
    row=row+1
    cont=cont+1

    

    
    while 1:
        
        nuevoUsuario = detectUser.newUser(3,lower,upper)
        
    
        Labelt.config(text='BIENVENIDO \n  Por favor moje sus manos con agua')
        worksheet.write_datetime(row, col, date_time,f2)
        worksheet.write_datetime(row, col+1, date_time,f3)
        worksheet.write(row, col +2, cont, f6)
        worksheet.write(row, col +3, 'NUEVA PERSONA',f4)
        ventana2.update()
        video000()


        jabon()        

        primero1()
            
####################### fin instrucciones

        Labeli=Label(ventana2,image=img00)
        Labeli.grid(row=2,column=0)
        Labelt.config(text='Sus manos son seguras')
        row=row+1
        worksheet.write_datetime(row, col, date_time, f2)
        worksheet.write_datetime(row, col+1, date_time,f3)
        worksheet.write(row, col +3, 'TERMINO')
        ventana2.update()
        ventana2.after(2000)
    def showOne(self):

        Ventana2 = Toplevel(self.master)
        try:
            Ventana2.configure(height=210, width=428, bg="#FFFFFF")
            Ventana2.resizable(1, 1)
            Ventana2.title("Buscar")

            frameAux = Frame(Ventana2, height=210, width=428, bg="#4a4a4a")
            frameAux.place(x=0, y=0)

            if sys.platform.startswith('win32'):
                r = "image\\BuscarBosch.png"
                ruta = "image\\Back.png"
                ruta2 = "image\\SearchOne.png"

            elif sys.platform.startswith('linux') or sys.platform.startswith(
                    'darwin'):
                r = "image/BuscarBosch.png"
                ruta = "image/Back.png"
                ruta2 = "image/SearchOne.png"

            l = Image.open(r)
            re = ImageTk.PhotoImage(l)
            labelFont = Label(frameAux, image=re, borderwidth=0)
            labelFont.image = re
            labelFont.place(x=0, y=0)

            labelText1 = Label(frameAux,
                               height=1,
                               width=24,
                               bg="#4a4a4a",
                               text="Serie",
                               fg="#FFFFFF",
                               anchor=W)
            labelText1.config(font=("Tahoma", 11))
            labelText1.place(x=15, y=25)
            labelText11 = Label(frameAux,
                                height=1,
                                width=24,
                                bg="#4a4a4a",
                                fg="#FFFFFF",
                                anchor=W)
            labelText11.config(font=("Tahoma", 11))
            labelText11.place(x=210, y=25)

            labelText2 = Label(frameAux,
                               height=1,
                               width=24,
                               bg="#696969",
                               text="Gravedad",
                               fg="#FFFFFF",
                               anchor=W)
            labelText2.config(font=("Tahoma", 11))
            labelText2.place(x=15, y=50)
            labelText22 = Label(frameAux,
                                height=1,
                                width=24,
                                bg="#696969",
                                fg="#FFFFFF",
                                anchor=W)
            labelText22.config(font=("Tahoma", 11))
            labelText22.place(x=210, y=50)

            labelText3 = Label(frameAux,
                               height=1,
                               width=24,
                               bg="#4a4a4a",
                               text="Fecha",
                               fg="#FFFFFF",
                               anchor=W)
            labelText3.config(font=("Tahoma", 11))
            labelText3.place(x=15, y=75)
            labelText33 = Label(frameAux,
                                height=1,
                                width=24,
                                bg="#4a4a4a",
                                fg="#FFFFFF",
                                anchor=W)
            labelText33.config(font=("Tahoma", 11))
            labelText33.place(x=210, y=75)

            labell = Label(frameAux,
                           height=1,
                           width=25,
                           bg="#4a4a4a",
                           text="Ingresa el numero de serie",
                           fg="#FFFFFF",
                           anchor=W)
            #labell.place(x=15,y=135)
            labell.config(font=("Tahoma", 11))

            listbox3 = Entry(frameAux,
                             width=24,
                             justify=RIGHT,
                             bg="#696969",
                             fg="#FFFFFF",
                             borderwidth=0)
            listbox3.place(x=210, y=125)
            listbox3.config(font=("Tahoma", 11))

            load = Image.open(ruta)
            render = ImageTk.PhotoImage(load)
            backbutton = Button(
                frameAux,
                image=render,
                bg="#8d8e8c",
                borderwidth=0,
                activebackground="#696969",
                command=lambda: self.Switch(self.master, Ventana2))
            backbutton.image = render
            backbutton.place(x=245, y=155)
            load2 = Image.open(ruta2)
            render2 = ImageTk.PhotoImage(load2)
            searchButton = Button(
                frameAux,
                image=render2,
                bg="#8d8e8c",
                borderwidth=0,
                activebackground="#c4c4c4",
                command=lambda: self.load1(listbox3, labelText11, labelText22,
                                           labelText33))
            searchButton.image = render2
            searchButton.place(x=324, y=155)
        except Exception as e:
            print(e)
            Ventana2.destroy()
            self.Error("Se produjo un error al cargar")
 def showAll(self):
     Ventana2 = Toplevel(self.master)
     try:
         Poss = [0, 50]
         maxi = self.buscMax()
         if int(maxi) < Poss[1]:
             Poss[1] = int(maxi)
         Ventana2.configure(height=45, width=25, bg="#4a4a4a")
         Ventana2.resizable(0, 0)
         frameAux = Frame(Ventana2, bg="#4a4a4a", borderwidth=0)
         frameAux.pack(fill=BOTH)
         scrolly = Scrollbar(frameAux, orient=VERTICAL)
         self.listbox1 = Listbox(frameAux,
                                 width=90,
                                 background="#4a4a4a",
                                 borderwidth=0,
                                 fg="#FFFFFF",
                                 highlightcolor="#4d86a1",
                                 highlightbackground="#4d86a1",
                                 yscrollcommand=scrolly.set)
         self.listbox1.config(font=("", 11))
         self.listbox1.pack(side=LEFT)
         scrolly.pack(side=RIGHT, fill=Y)
         scrolly.configure(command=self.yview)
         self.load50(Poss)
         if sys.platform.startswith('win32'):
             ruta = "image\\GoBack.png"
             ruta2 = "image\\GoOn.png"
         elif sys.platform.startswith('linux') or sys.platform.startswith(
                 'darwin'):
             ruta = "image/GoBack.png"
             ruta2 = "image/GoOn.png"
         load = Image.open(ruta)
         render = ImageTk.PhotoImage(load)
         load2 = Image.open(ruta2)
         render2 = ImageTk.PhotoImage(load2)
         backbutton1 = Button(Ventana2,
                              image=render,
                              bg="#4a4a4a",
                              borderwidth=0,
                              activebackground="#4d86a1",
                              highlightcolor="#4d86a1",
                              highlightbackground="#4a4a4a",
                              command=lambda: self.load50(Poss, "-"))
         backbutton1.image = render
         backbutton1.pack(side=LEFT)
         backbutton2 = Button(Ventana2,
                              image=render2,
                              bg="#4a4a4a",
                              borderwidth=0,
                              activebackground="#4d86a1",
                              highlightcolor="#4d86a1",
                              highlightbackground="#4a4a4a",
                              command=lambda: self.load50(Poss, "+"))
         backbutton2.image = render2
         backbutton2.pack(side=LEFT)
         backbutton3 = Button(
             Ventana2,
             height=2,
             width=10,
             text="Back",
             command=lambda: self.Switch(self.master, Ventana2))
         backbutton3.pack(side=RIGHT)
     except Exception as e:
         print(e)
         Ventana2.destroy()
         self.Error("Se produjo un error al cargar")
Beispiel #11
0
def inicio(c):
    global ventana2, Labeli, Labelt, img0, img1, imgF, row, cont
    instruction = None
    img0 = PhotoImage(file="00.gif")  # Reads photos
    img00 = PhotoImage(file="0000.gif")
    imgF = PhotoImage(file="FF.gif")

    if c:
        ventana2 = Toplevel(ventana)
        ventana2.title("MANITOR")
        ventana2.configure(bg="white")
        ventana2.geometry("1000x600+5+40")

        Labelt = Label(
            ventana2,
            text='BIENVENIDO ',  # ventana2 TEXTO
            fg="black",
            bg="white",
            font=("Helvetica 36 "))
        ventana2.columnconfigure(0, weight=1)
        Labelt.grid(row=1, column=0)
        Labeli = Label(ventana2, image=img00)  # ventana2 IMAGEN
        Labeli.grid(row=2, column=0)

    else:
        Labelt.config(text='BIENVENIDO ')
        Labeli.image = img00
        Labeli.config(image=img00)
    ventana.iconify()  # Turns window into an icon

    row = row + 1
    cont = cont + 1
    while 1:

        queue = Queue()
        Labelt.config(text='BIENVENIDO \n  Por favor moje sus manos con agua')
        worksheet.write_datetime(row, col, date_time, f2)
        worksheet.write_datetime(row, col + 1, date_time, f3)
        worksheet.write(row, col + 2, cont, f6)
        worksheet.write(row, col + 3, 'NUEVA PERSONA', f4)
        ventana2.update()
        video000()

        def jabon():
            def cero(q):
                analysisRegion = 1
                print regionCoord
                tipoMovimiento = BByOFfile.BByOF(2, lower, upper, regionCoord,
                                                 analysisRegion, 10)
                q.put([tipoMovimiento])

            Labelt.config(text='Deposite jabón en la mano')
            global row
            row = row + 1
            worksheet.write(row, col + 3, 'jabon', f5)
            ventana2.update()
            c = threading.Thread(target=cero, args=(queue, ))
            c.start()
            video00()

            if c.isAlive():
                c.join()
            instruction = queue.get()
            instruction = falseType(instruction[0], Labelt, Labeli, img0, imgF)
            if not instruction:
                jabon()

        jabon()

        ######################## instruccion 1

        def primero1():
            def primero(q):
                analysisRegion = 2
                tipoMovimiento = BByOFfile.BByOF(2, lower, upper, regionCoord,
                                                 analysisRegion, 10)
                q.put([tipoMovimiento])

            p = Thread(target=primero, args=(queue, ))
            p.start()
            Labelt.config(text='Frote las palmas de las manos \n entre sí')
            global row
            row = row + 1
            worksheet.write(row, col + 3, 'instruccion1', f5)
            ventana2.update()
            ventana2.update()
            video1()

            if p.isAlive():
                p.join()
            instruction = queue.get()
            instruction = falseType(instruction[0], Labelt, Labeli, img0, imgF)
            if not instruction:
                primero1()

        primero1()

        ########################## instruccion2

        ##        def segundo(q):
        ##            analysisRegion = 2
        ##            tipoMovimiento=BByOFfileO.BByOF(2,lower,upper,regionCoord,analysisRegion,10)
        ##            q.put([tipoMovimento])
        ##
        ##        s=Thread(target=segundo, args=(queue,))
        ##        s.start()
        ##        Labelt.config(text='Frote la palma de la mano derecha \n contra el dorso de la mano izquierda  \n entrelazando los dedos y viceversa')
        ##        ventana2.update()
        ##        video2()
        ##
        ##        if s.isAlive():
        ##            s.join()
        ##        instruction=queue.get()
        ##        instruction=falseType(instruction[0],Labelt,Labeli,img0,imgF)
        ##        if not instruction:
        ##            inicio(0)

        ######################## fin instrucciones

        Labeli = Label(ventana2, image=img00)
        Labeli.grid(row=2, column=0)
        Labelt.config(text='Sus manos son seguras')
        row = row + 1
        worksheet.write_datetime(row, col, date_time, f2)
        worksheet.write_datetime(row, col + 1, date_time, f3)
        worksheet.write(row, col + 3, 'TERMINO')
        ventana2.update()
        ventana2.after(2000)
def inicio(c):
    global ventana2, Labeli, Labelt, panel
    global img0, img1, imgF
    img0=PhotoImage(file="00.gif") # Reads photos
    img1=PhotoImage(file="11.gif")
    imgF=PhotoImage(file="FF.gif")
    
    if c:  
        ventana2=Toplevel(ventana)
        ventana2.title("MANITOR")
        ventana2.configure(bg="white")
        ventana2.geometry("1000x600+5+40")
    
        Labelt=Label(ventana2,text='BIENVENIDO ', # ventana2 TEXTO
                fg="black",bg="white",font=("Helvetica 36 "))
        ventana2.columnconfigure(0,weight=1)
        Labelt.grid(row=1,column=0)
        
        Labeli=Label(ventana2,image=img1) # ventana2 IMAGEN
        ventana2.columnconfigure(0,weight=1)
        ventana2.update()
        Labeli.grid(row=2,column=0)
        
    else:#Toda esta parte no es necesaria se podria borrar hasta el update, ya que es un estado inical que nunca se muestra igual que arriba
        Labelt.config(text='BIENVENIDO ')
        ventana2.update()
        Labeli=Label(ventana2,image=img1)
        ventana2.columnconfigure(0,weight=1)
        Labeli.grid(row=2,column=0)
        Labeli.config(image=img1)
        Labeli.image=img1
        ventana2.update()
    ventana.iconify() # Turns window into an icon

    while 1:

##        cur.execute("INSERT INTO manitor VALUES(nextval('usuario_sequence'), current_timestamp, ' inicio ')")
        Labeli.destroy()
        ventana2.update()
        Labelt.config(text='BIENVENIDO \n  Por favor moje sus manos con agua')
        ventana2.update()
        video000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ()
        ventana2.update()
        
        Labelt.config(text='Deposite jabón en la mano')
##        cur.execute("INSERT INTO manitor VALUES(nextval('usuario_sequence'), current_timestamp, ' nuevo usuario ')")
        ventana2.update()

        def cero():
            b,auxType = contadorMovimiento.funcionMovimientoEnRegion(y[1],3,2,lower,upper) 
            instruction = falseType(b,auxType,Labelt,Labeli,img0,imgF)
            if not instruction:
                inicio(0)
                
        Thread(target=cero).start()
        Thread(target=video00()).start()

######################## instruccion 1
        
        Labeli.destroy()
        Labelt.config(text='Frote las palmas de las manos \n entre sí')
        ventana2.update()

        def primero():
            d,auxType = contadorMovimiento.funcionMovimientoEnRegion(y[1],3,2,lower,upper) 
            instruction = falseType(d,auxType,Labelt,Labeli,img0,imgF)
            if not instruction:
                inicio(0)
                
        Thread(target=primero).start()
        Thread(target=video1()).start()

########################## instruccion2
##
##        Labeli.destroy()
##        Labelt.config(text='Frote la palma de la mano derecha \n contra el dorso de la mano izquierda  \n entrelazando los dedos y viceversa')
##        panel = Label(ventana2)

##        def segundo():
##            e,auxType = contadorMovimiento.funcionMovimientoEnRegion(y[1],10,2,lower,upper) 
##            instruction = falseType(e,auxType,Labelt,Labeli,img0,imgF)
##            if not instruction:
##                inicio(0)
##                
##        Thread(target=segundo).start()
##        Thread(target=video1()).start()
##        
##        time.sleep(10)

######################## fin instrucciones
##
        Labeli=Label(ventana2,image=img12)
        ventana2.columnconfigure(0,weight=1)
        Labeli.grid(row=2,column=0)
        ventana2.update()
        Labelt.config(text='Sus manos son seguras')
##        Labeli.config(image=img12)
##        Labeli.image=img12
        ventana2.update()
        time.sleep(5)