diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 4b599d68..85746985 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -583,6 +583,10 @@ class AppWindow: return # Startup or in CQC if entry['event'] in ['StartUp', 'LoadGame'] and monitor.started: + # Disable WinSparkle automatic update checks, IFF configured to do so when in-game + if config.getint('disable_autoappupdatecheckingame') and 1: + self.updater.setAutomaticUpdatesCheck(False) + print 'Monitor: Disable WinSparkle automatic update checks' # Can start dashboard monitoring if not dashboard.start(self.w, monitor.started): print "Can't start Status monitoring" @@ -602,6 +606,12 @@ class AppWindow: if entry['event'] in ['StartUp', 'Location', 'Docked'] and monitor.station and not config.getint('output') & config.OUT_MKT_MANUAL and config.getint('output') & config.OUT_STATION_ANY and companion.session.state != companion.Session.STATE_AUTH: self.w.after(int(SERVER_RETRY * 1000), self.getandsend) + if entry['event'] == 'ShutDown': + # Enable WinSparkle automatic update checks + # NB: Do this blindly, in case option got changed whilst in-game + self.updater.setAutomaticUpdatesCheck(True) + print 'Monitor: Enable WinSparkle automatic update checks' + # cAPI auth def auth(self, event=None): try: diff --git a/prefs.py b/prefs.py index c1d7e1cc..94a8628e 100644 --- a/prefs.py +++ b/prefs.py @@ -184,6 +184,13 @@ class PreferencesDialog(tk.Toplevel): self.hotkey_play_btn = nb.Checkbutton(configframe, text=_('Play sound'), variable=self.hotkey_play, state = self.hotkey_code and tk.NORMAL or tk.DISABLED) # Hotkey/Shortcut setting self.hotkey_play_btn.grid(columnspan=4, padx=PADX, sticky=tk.W) + # Option to disabled Automatic Check For Updates whilst in-game + ttk.Separator(configframe, orient=tk.HORIZONTAL).grid(columnspan=4, padx=PADX, pady=PADY*4, sticky=tk.EW) + self.disable_autoappupdatecheckingame = tk.IntVar(value = config.getint('disable_autoappupdatecheckingame')) + self.disable_autoappupdatecheckingame_btn = nb.Checkbutton(configframe, text=_('Disable Automatic Application Updates Check when in-game'), variable=self.disable_autoappupdatecheckingame, command=self.disable_autoappupdatecheckingame_changed) + self.disable_autoappupdatecheckingame_btn.grid(columnspan=4, padx=PADX, sticky=tk.W) + + ttk.Separator(configframe, orient=tk.HORIZONTAL).grid(columnspan=4, padx=PADX, pady=PADY*4, sticky=tk.EW) nb.Label(configframe, text=_('Preferred websites')).grid(row=30, columnspan=4, padx=PADX, sticky=tk.W) # Settings prompt for preferred ship loadout, system and station info websites @@ -433,6 +440,11 @@ class PreferencesDialog(tk.Toplevel): self.logdir.set(config.default_journal_dir) self.outvarchanged() + def disable_autoappupdatecheckingame_changed(self): + config.set('disable_autoappupdatecheckingame', self.disable_autoappupdatecheckingame.get()) + # If it's now False, re-enable WinSparkle ? Need access to the AppWindow.updater variable to call down + + def themecolorbrowse(self, index): (rgb, color) = tkColorChooser.askcolor(self.theme_colors[index], title=self.theme_prompts[index], parent=self.parent) if color: diff --git a/update.py b/update.py index 1cbf187a..ef58b68a 100644 --- a/update.py +++ b/update.py @@ -19,6 +19,9 @@ if not getattr(sys, 'frozen', False): def __init__(self, master): self.root = master + def setAutomaticUpdatesCheck(self, onoroff): + return + def checkForUpdates(self): thread = threading.Thread(target = self.worker, name = 'update worker') thread.daemon = True @@ -56,6 +59,10 @@ elif sys.platform=='darwin': # can't load framework - not frozen or not included in app bundle? self.updater = None + def setAutomaticUpdatesCheck(self, onoroff): + if self.updater: + self.updater.win_sparkle_set_automatic_check_for_updates(onoroff) + def checkForUpdates(self): if self.updater: self.updater.checkForUpdates_(None) @@ -98,6 +105,10 @@ elif sys.platform=='win32': print_exc() self.updater = None + def setAutomaticUpdatesCheck(self, onoroff): + if self.updater: + self.updater.win_sparkle_set_automatic_check_for_updates(onoroff) + def checkForUpdates(self): if self.updater: self.updater.win_sparkle_check_update_with_ui()