X-FTP
[x93.git/.git] / xftp.git / ext / puntua.pyw
diff --git a/xftp.git/ext/puntua.pyw b/xftp.git/ext/puntua.pyw
new file mode 100644 (file)
index 0000000..df45a6b
--- /dev/null
@@ -0,0 +1,227 @@
+from tkinter import Tk,Label,Entry,StringVar,IntVar,Checkbutton,Button,Text,END,messagebox\r
+from tkinter.ttk import Scrollbar\r
+import os,getpass\r
+try:\r
+       import ext.crud as crud\r
+except:\r
+       import crud\r
+import smtplib\r
+from email.mime.text import MIMEText\r
+import io\r
+from color import Color\r
+\r
+\r
+\r
+def conn():\r
+       global theme2,color,color2,banner,banner1,banner_name2\r
+       try:\r
+               theme=io.open("configs\\themes\\theme.thm","r")\r
+               theme2=theme.readlines()\r
+               print("THEME-NAME: ",theme2[0].rstrip(" \n"))\r
+               try:\r
+                       color_class=Color(theme2[1].rstrip(" \n"))\r
+               except:\r
+                       color_class=Color("#000000")\r
+               color=color_class.get()\r
+               print(len(color))\r
+               color2_class=Color(theme2[2].rstrip("\n"))\r
+               color2=color2_class.get()\r
+               banner=Color(theme2[3].rstrip("\n"))\r
+               banner1=Color(theme2[4].rstrip("\n"))\r
+               banner=banner.get()\r
+               banner1=banner1.get()\r
+               banner_name2=theme2[5].rstrip("\n")\r
+               theme.close()\r
+               del(theme)\r
+       except ValueError:\r
+               messagebox.showwarning("ColorError","Uno/s color no esta bien escrito")\r
+               raise(ValueError)\r
+       except:\r
+               try:\r
+                       os.mkdir("configs")\r
+               except:\r
+                       pass\r
+               try:\r
+                       os.mkdir("configs\\themes")\r
+               except:\r
+                       pass\r
+               theme=io.open("configs\\themes\\theme.thm","w")\r
+               theme.write("Photoshop-theme\n#5e5c5c\n#ffffff\n#5e5c5c\n#ffffff\nSERVIDOR FTP V6.5")\r
+               theme.close()\r
+               theme=io.open("configs\\themes\\theme.thm","r")\r
+               theme2=theme.readlines()\r
+               theme.close()\r
+               color_class=Color(theme2[1].rstrip(" \n"))\r
+               color=color_class.get()\r
+               color2_class=Color(theme2[2].rstrip(" \n"))\r
+               color2=color2_class.get()\r
+               banner=Color(theme2[3].rstrip("\n"))\r
+               banner1=Color(theme2[4].rstrip("\n"))\r
+               banner=banner.get()\r
+               banner1=banner1.get()\r
+               banner_name2=theme2[5].rstrip(" \n")\r
+               del(theme)\r
+               print("THEME-NAME: ",theme2[0].rstrip(" \n"))\r
+conn()\r
+\r
+\r
+\r
+root=Tk()\r
+root.title("Puntuanos")\r
+root.geometry("340x220")\r
+root.config(bg=color)\r
+\r
+\r
+\r
+user=StringVar()\r
+user.set(getpass.getuser())\r
+\r
+\r
+r1=IntVar()\r
+r2=IntVar()\r
+r3=IntVar()\r
+r4=IntVar()\r
+r5=IntVar()\r
+\r
+\r
+\r
+\r
+l1=Label(text="Usuario",fg=color2,bg=color)\r
+l1.place(x=30,y=20)\r
+\r
+l2=Label(text="Mensaje",fg=color2,bg=color)\r
+l2.place(x=30,y=110)\r
+\r
+l3=Label(text="Puntuación",fg=color2,bg=color)\r
+l3.place(x=30,y=63)\r
+\r
+e1=Entry(textvariable=user,width=32,fg=color2,bg=color)\r
+e1.place(x=100,y=20)\r
+\r
+t1=Text(width=24,height=3,fg=color2,bg=color)\r
+t1.insert(0.1,"La app me a encantado")\r
+s1=Scrollbar(command=t1.yview)\r
+s1.place(x=300,y=95)\r
+t1.place(x=100,y=95)\r
+t1.config(yscrollcommand=s1.set)\r
+\r
+punt=0\r
+def punt1():\r
+       if r5.get()==1 or r4.get()==1 or r3 .get()==1 or r2.get()==1:\r
+               r5.set(0)\r
+               r4.set(0)\r
+               r3.set(0)\r
+               r2.set(0)\r
+               punt="⭐❌❌❌❌"\r
+       \r
+       elif r1.get()==1:\r
+               pass\r
+       else:\r
+               r1.set(0)\r
+               punt="❌❌❌❌❌"\r
+def punt2():\r
+       if r5.get()==1 or r4.get()==1 or r3.get()==1 or r1.get()==1:\r
+               r5.set(0)\r
+               r4.set(0)\r
+               r3.set(0)\r
+               r1.set(1)\r
+               punt="⭐⭐❌❌❌"\r
+       elif r1.get()==0:\r
+               r1.set(1)\r
+               r2.set(1)\r
+       else:\r
+               r2.set(0)\r
+               punt="⭐❌❌❌❌"\r
+def punt3():\r
+       if r5.get()==1 or r4.get()==1 or r2.get()==1 or r1.get()==1:\r
+               r5.set(0)\r
+               r4.set(0)\r
+               r2.set(1)\r
+               r1.set(1)\r
+               punt="⭐⭐⭐❌❌"\r
+       elif r1.get()==0:\r
+               r1.set(1)\r
+               r2.set(1)\r
+               r3.set(1)\r
+       else:\r
+               r3.set(0)\r
+               punt="⭐⭐❌❌❌"\r
+def punt4():\r
+       if r5.get()==1 or r3.get()==1 or r2.get()==1 or r1.get()==1:\r
+               r5.set(0)\r
+               r3.set(1)\r
+               r2.set(1)\r
+               r1.set(1)\r
+               punt="⭐⭐⭐⭐❌"\r
+       elif r1.get()==0:\r
+               r1.set(1)\r
+               r2.set(1)\r
+               r3.set(1)\r
+               r4.set(1)\r
+       else:\r
+               r4.set(0)\r
+               punt="⭐⭐⭐❌❌"\r
+def punt5():\r
+       if r5.get()==1:\r
+               r1.set(1)\r
+               r2.set(1)\r
+               r3.set(1)\r
+               r4.set(1)\r
+               punt="⭐⭐⭐⭐⭐"\r
+       elif r1.get()==0:\r
+               r1.set(1)\r
+               r2.set(1)\r
+               r3.set(1)\r
+               r4.set(1)\r
+               r5.set(1)\r
+       else:\r
+               punt="⭐⭐⭐⭐❌"\r
+\r
+r5.set(1)\r
+punt5()\r
+\r
+\r
+\r
+c_1=Checkbutton(variable=r1,onvalue=1,offvalue=0,command=punt1,selectcolor=color,fg=color2,bg=color,overrelief="sunken")\r
+c_2=Checkbutton(variable=r2,onvalue=1,offvalue=0,command=punt2,selectcolor=color,fg=color2,bg=color,overrelief="sunken")\r
+c_3=Checkbutton(variable=r3,onvalue=1,offvalue=0,command=punt3,selectcolor=color,fg=color2,bg=color,overrelief="sunken")\r
+c_4=Checkbutton(variable=r4,onvalue=1,offvalue=0,command=punt4,selectcolor=color,fg=color2,bg=color,overrelief="sunken")\r
+c_5=Checkbutton(variable=r5,onvalue=1,offvalue=0,command=punt5,selectcolor=color,fg=color2,bg=color,overrelief="sunken")\r
+c_1.place(y=62,x=125)\r
+c_2.place(y=62,x=155)\r
+c_3.place(y=62,x=185)\r
+c_4.place(y=62,x=215)\r
+c_5.place(y=62,x=245)\r
+\r
+\r
+\r
+\r
+def send():\r
+       mailServer = smtplib.SMTP('smtp.nauta.cu',25)\r
+       mailServer.ehlo()\r
+       mailServer.starttls()\r
+       mailServer.ehlo()\r
+       mailServer.login("borisdanielmm@nauta.cu",crud.decode("YmFsYmlub3RBMTIu"))\r
+       mensaje = MIMEText("\n"+"Puntuación: "+punt+"\n"+t1.get("1.0",END))\r
+       mensaje['From']="borisdanielmm@nauta.cu"\r
+       mensaje['To']="borisdanielmm@nauta.cu"\r
+       mensaje['Subject']="Calificación"\r
+       # Envio del mensaje\r
+       mailServer.sendmail("borisdanielmm@nauta.cu",\r
+       "borisdanielmm@nauta.cu",\r
+       mensaje.as_string())\r
+       mailServer.close()\r
+\r
+b1=Button(text="Enviar",overrelief="sunken",command=send,fg=color2,bg=color,width=20)\r
+b1.place(x=92,y=170)\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+root.mainloop()\r