def list_directory_refresh(self): list_directory = database.list() index = 0 self.LB1.delete(0,self.LB1.size()) for line in list_directory: self.LB1.insert(index,line) index += 1
def __init__(self): tk.Tk.__init__(self) self.geometry("1340x300+130+180") helv24 = tkFont.Font(family="Helvetica",size=24,weight="bold") list_directory = database.list() L1 = tk.Label(self, text="list directory") L1 = L1.grid(row=1, column=0) self.LB1 = tk.Listbox(self,selectmode=MULTIPLE) self.LB1.grid(row=2, column=0) yscroll = tk.Scrollbar(command=self.LB1.yview, orient=tk.VERTICAL) yscroll.grid(row=2, column=0, sticky=NS+E,pady=1) self.LB1.configure(yscrollcommand=yscroll.set) self.list_directory_refresh() #index = 0 #for line in list_directory: # self.LB1.insert(index,line) # index += 1 L2 = tk.Label(self, text="source directory") L2 = L2.grid(row=1, column=1) list = listdir('.') list_file=[] for file in list: if path.isfile(file) or file[0] =='.': pass else: list_file.append(file) self.LB2 = tk.Listbox(self) self.LB2.grid(row=2, column=1) yscroll2 = tk.Scrollbar(command=self.LB2.yview, orient=tk.VERTICAL) yscroll2.grid(row=2, column=1, sticky=NS+E,pady=1) self.LB2.configure(yscrollcommand=yscroll2.set) self.list_file_refresh() #index = 0 #for line in list_file: # self.LB2.insert(index,line) # index += 1 L3 = tk.Label(self, text="destination directory") L3 = L3.grid(row=1, column=2) self.E3 = Entry(self, bd =1) self.E3.grid(row=1, column=3) B1 = tk.Button(self, text ="Backup",width = 15,height=2, font=helv24, command = lambda: self.backup(list_directory), justify="center",wraplength=1) B2 = tk.Button(self, text ="Create Empty",width = 15,height=2, font=helv24,command = lambda: self.migrate_empty(list_file), justify="center",wraplength=1) B3 = tk.Button(self, text ="Migrate",width = 15,height=2, font=helv24,command = lambda: self.migrate(list_file), justify="center",wraplength=1) B4 = tk.Button(self, text ="Restore",width = 15,height=2,font=helv24,command = lambda: self.restore(list_file), justify="center",wraplength=1) B5 = tk.Button(self, text ="Drop",width = 15,height=2,font=helv24,command = lambda: self.drop(list_directory), justify="center",wraplength=1) B6 = tk.Button(self, text ="Modules",width = 15,height=2,font=helv24,command = lambda: self.modules(list_directory), justify="center",wraplength=1) B1.grid(row=0, column=0) B2.grid(row=0, column=1) B3.grid(row=0, column=2) B4.grid(row=0, column=3) B5.grid(row=0, column=4) B6.grid(row=0, column=5)
def api_records(): return jsonify(database.list())