Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def file_list_has_changed(self,now):
if not now:
return
ident=self.file_store[now[0]]
filename=self.filesystem.get_json_filename_for_type(ident,self.save_type.get())
data=tts.load_json_file(filename)
# TODO: error handling
self.save=tts.Save(savedata=data,
ident=ident,
filename=filename,
save_type=tts.SaveType(self.save_type.get()),
filesystem=self.filesystem)
if self.save.isInstalled:
self.downloadButton.configure(text="All files Downloaded",
state=Tk.DISABLED)
self.exportButton.configure(text="Export",state=Tk.NORMAL)
else:
self.downloadButton.configure(text="Download missing files",
state=Tk.NORMAL)
self.exportButton.configure(text="Download and Export",
state=Tk.NORMAL)
def do_download(self,args):
successful=True
if not args.all:
if not args.save_type:
args.save_type=self.filesystem.get_json_filename_type(args.id)
if not args.save_type:
return 1,"Unable to determine type of id %s" % args.id
successful = tts.download_file(self.filesystem,args.id,args.save_type)
else:
if args.save_type:
for ident in self.filesystem.get_filenames_by_type(args.save_type):
if not tts.download_file(self.filesystem,ident,args.save_type):
successful=False
break
else:
for save_type in tts.SaveType:
for ident in self.filesystem.get_filenames_by_type(save_type):
if not tts.download_file(self.filesystem,ident,save_type):
successful=False
break
if successful:
return 0, "All files downloaded."
else:
return 1, "Some files failed to download."
def file_list_has_changed(self,now):
if not now:
return
ident=self.file_store[now[0]]
filename=self.filesystem.get_json_filename_for_type(ident,self.save_type.get())
data=tts.load_json_file(filename)
# TODO: error handling
self.save=tts.Save(savedata=data,
ident=ident,
filename=filename,
save_type=tts.SaveType(self.save_type.get()),
filesystem=self.filesystem)
if self.save.isInstalled:
self.status_label.config(text="All files found.")
else:
self.status_label.config(text="Some cache files missing - check details on list page.")
self.file_list.event_generate("<>")