Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def beforequit():
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 beforequit():
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 beforequit():
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()
def add_analyze(self, mission, on_success=None):
def on_finished(err):
if err and not isinstance(err, worker.WorkerExit):
self.thread.later(
self.messagebox,
"error",
mission.module.name,
"解析錯誤!\n{}".format(err)
)
if not err and on_success:
on_success()
download_manager.start_analyze(mission, on_finished=on_finished)
self.pre_url = url
if ask_analyze_update(mission):
mission.state = 'ANALYZE_INIT'
download_manager.start_analyze(mission)
return
try:
mission = create_mission(url)
except ModuleError:
messagebox.showerror(
"Comic Crawler",
"建立任務失敗!不支援的網址!"
)
else:
self.pre_url = url
download_manager.start_analyze(mission)
self.create_view()
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 _():
missions = table.selected()
download_manager.start_check_update(missions)
def libCheckUpdate():
download_manager.start_check_update()
self.btn_update["command"] = libCheckUpdate
def lib_download_update():
missions = mission_manager.get_all("library", lambda m: m.state == "UPDATE")
if not missions:
self.messagebox("error", "Comic Crawler", "沒有新更新的任務")
return
mission_manager.add("view", *missions)
download_manager.start_download()
self.notebook.select(0)
self.btn_download_update["command"] = lib_download_update