Patch package generation tool,

Source: Internet
Author: User

Patch package generation tool,

#-*-Coding: gbk-*-import osimport datetimeimport timeimport shutilimport tkinter as tkfrom tkinter import * from tkinter import ttkfrom tkinter. filedialog import askdirectoryimport threadingvalue1 = 0def listdirorfile (dir, dates, dst): files = OS. listdir (OS. chdir (dir) for name in files: fullname = OS. path. join (dir, name) if OS. path. isdir (fullname): listdirorfile (fullname, dates, dst) elif OS. path. isfile (fu Llname): if datetime. datetime. fromtimestamp (OS. path. getmtime (fullname )). strftime ("% Y-% m-% d % H: % M: % S")> dates: print (name) # fullname2 = fullname # print (fullname2) a1 = fullname. split (":") [1] a2 = (a1.split ("\") [1:-1]) a3 = "" for I in a2: a3 = a3 + "\" + I print (dst + a3) if OS. path. exists (dst + a3): pass else: OS. makedirs (dst + a3) print (shutil. copy (fullname, dst + a3) def start_click (): print (e1.get () if e1.get () = "" Or e2.get () = "" or datechose. get () = "" or hchose. get () = "" or mchose. get () = "" or scholar. get () = "": tishi2 _. set ("Source code path, output path, date cannot be blank! ") Else: tishi _. set ("Packaging ...... ") b3.configure (state =" disabled ") win. update_idletasks () # listdirorfile (e1.get (), datechose. get () + "" + hchose. get () + ":" + mchose. get () + ":" + scholar. get (), e2.get () b3.configure (state = "active") tishi _. set ("package complete! ") Win. update_idletasks () def submit (): src_path _ = askdirectory () src_path.set (src_path _) dst_path.set (src_path _ + "-patch") def submit (): dst_path _ = askdirectory () dst_path.set (dst_path _) win = tk. tk () src_path = StringVar () dst_path = StringVar () tishi _ = StringVar () tishi2 _ = StringVar () win. resizable (False, False) win. title ("Create By CZR | 2017") Label (win, text = ""). grid (row = 0) Label (win, text = "Source code path :"). grid (row = 1) Label (win, text = "output path :"). grid (row = 2) Label (win, text = "time :"). grid (row = 3) Label (win, textvariable = tishi2 _). grid (row = 4, column = 1, columnspan = 4) l1 = Label (win, textvariable = tishi _). grid (row = 5, column = 1, columnspan = 4) e1 = Entry (win, width = 31, textvariable = src_path) e2 = Entry (win, width = 31, textvariable = dst_path)

date_var=tk.StringVar()
datechose=ttk.Combobox(win,width=10,textvariable=date_var)
h_var=tk.StringVar()
hchose=ttk.Combobox(win,width=2,textvariable=h_var)
m_var=tk.StringVar()
mchose=ttk.Combobox(win,width=2,textvariable=m_var)
s_var=tk.StringVar()
schose=ttk.Combobox(win,width=2,textvariable=s_var)

E1.grid (row = 1, column = 1, columnspan = 4)
E2.grid (row = 2, column = 1, columnspan = 4)
Datechose. grid (row = 3, column = 1)
Hchose. grid (row = 3, column = 2)
Mchose. grid (row = 3, column = 3)
Scholar. grid (row = 3, column = 4)

B0 = Button (win, width = 10, text = "")
B1 = Button (win, width = 10, text = "", command = liulan_src_click)
B2 = Button (win, width = 10, text = "", command = liulan_dst_click)
B3 = Button (win, width = 10, text = "start", command = start_click)

b1.grid(row=1,column=6)
b2.grid(row=2,column=6)
b3.grid(row=3,column=6)

Now = datetime. datetime. now ()
Daysall = []
Hs = []
MS = []
Ss = []
For I in range (1, 8 ):
Delta = datetime. timedelta (days = I)
# Daysall. append (now + delta). strftime ("% Y-% m-% d "))
Daysall. append (now-delta). strftime ("% Y-% m-% d "))
Daysall. append (now. strftime ("% Y-% m-% d "))
Sorts = sorted (daysall)
Datechose ['values'] = sorts
Datechose. current (7)
Print (sorts)
# Hours
For j in range (0, 24 ):
Hs. append (j)
Hchose ['values'] = hs
Nowh = datetime. datetime. now (). strftime ("% H ")
Hchose. current (hs. index (int (nowh )))
# Minute

For m in range (0, 60 ):
Ms. append (m)
Mchose ['values'] = MS
Nowm = datetime. datetime. now (). strftime ("% M ")
Mchose. current (ms. index (int (nowm )))
# Seconds
For s in range (0, 60 ):
Ss. append (s)
Scholar ['values'] = ss
Nows = datetime. datetime. now (). strftime ("% S ")
Scholar. current (ss. index (int (nows )))
Win. mainloop ()


: Https://files.cnblogs.com/files/czrwxw/%E8%A1%A5%E4%B8%81%E7%94%9F%E6%88%90%E5%B7%A5%E5%85%B7.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.