diff --git a/SpanshRouter/SpanshRouter.py b/SpanshRouter/SpanshRouter.py old mode 100755 new mode 100644 index 94725d3..320215f --- a/SpanshRouter/SpanshRouter.py +++ b/SpanshRouter/SpanshRouter.py @@ -116,18 +116,6 @@ class SpanshRouter(): self.jumpcounttxt_lbl.grid_remove() self.clear_route_btn.grid_remove() - if self.update_available: - update_txt = "New Spansh update available!\n" - update_txt += "If you choose to install it, you will have to restart EDMC for it to take effect.\n\n" - update_txt += self.spansh_updater.changelogs - update_txt += "\n\nInstall?" - install_update = confirmDialog.askyesno("SpanshRouter", update_txt) - - if install_update: - confirmDialog.showinfo("SpanshRouter", "The update will be installed as soon as you quit EDMC.") - else: - self.update_available = False - self.update_gui() return self.frame diff --git a/load.py b/load.py index 3d5621f..81cc059 100644 --- a/load.py +++ b/load.py @@ -2,8 +2,10 @@ import sys is_py2 = sys.version[0] == '2' if is_py2: from SpanshRouter import SpanshRouter + import tkMessageBox as confirmDialog else: from SpanshRouter.SpanshRouter import SpanshRouter + import tkinter.messagebox as confirmDialog def plugin_start3(plugin_dir): global spansh_router @@ -35,6 +37,21 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): elif entry['event'] == 'FSSDiscoveryScan' and entry['SystemName'] == spansh_router.next_stop: spansh_router.update_route() +def ask_for_update(): + global spansh_router + if spansh_router.update_available: + update_txt = "New Spansh Router update available!\n" + update_txt += "If you choose to install it, you will have to restart EDMC for it to take effect.\n\n" + update_txt += spansh_router.spansh_updater.changelogs + update_txt += "\n\nInstall?" + install_update = confirmDialog.askyesno("SpanshRouter", update_txt) + + if install_update: + confirmDialog.showinfo("SpanshRouter", "The update will be installed as soon as you quit EDMC.") + else: + spansh_router.update_available = False + def plugin_app(parent): global spansh_router spansh_router.init_gui(parent) + parent.master.after_idle(ask_for_update)