Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tvdrop():
mission_manager.drop(name, *table.selected())
if download_manager.is_downloading():
if not messagebox.askokcancel(
"Comic Crawler",
"任務下載中,確定結束?"):
return
# going to quit
printer.remove_listener(self.sp_callback)
self.root.destroy()
download_manager.stop_download()
download_manager.stop_analyze()
download_manager.stop_check_update()
mission_manager.save()
config.save()
def libDownloadUpdate():
missions = mission_manager.get_by_state("library", ("UPDATE",), all=True)
if not missions:
messagebox.showerror("Comic Crawler", "沒有新更新的任務")
return
mission_manager.add("view", *missions)
download_manager.start_download()
self.notebook.select(0)
self.btn_download_update["command"] = libDownloadUpdate
def _():
mission_manager.drop(name, *table.selected())
def _(event):
_err, mission = event.data
mission_manager.drop("view", mission)
self.pool_index = {
id(mission_manager.view): self.view_table,
id(mission_manager.library): self.library_table
}
self.bindevent()
self.register_listeners()
printer.add_listener(self.sp_callback)
if (setting.getboolean("libraryautocheck") and
time() - setting.getfloat("lastcheckupdate", 0) > 24 * 60 * 60):
download_manager.start_check_update()
self.update_table(mission_manager.view)
self.update_table(mission_manager.library)
self.save()
self.update()
self.root.mainloop()
def __init__(self):
"""Construct."""
self.create_view()
self.bind_event()
self.thread = worker.current()
self.loop = TkinterLoop(self.root, worker.update)
self.pool_index = {
id(mission_manager.view): self.view_table,
id(mission_manager.library): self.library_table
}
self.register_listeners()
printer.add_listener(self.sp_callback)
if (setting.getboolean("libraryautocheck") and
time() - setting.getfloat("lastcheckupdate", 0) > setting.getfloat("autocheck_interval") * 60 * 60):
download_manager.start_check_update()
self.update_table(mission_manager.view)
self.update_table(mission_manager.library)
self.save()
self.loop.start()