def cmdrchanged(self, event=None): if self.cmdr != monitor.cmdr or self.is_beta != monitor.is_beta: # Cmdr has changed - update settings if self.cmdr is not False: # Don't notify on first run plug.notify_prefs_cmdr_changed(monitor.cmdr, monitor.is_beta) self.cmdr = monitor.cmdr self.is_beta = monitor.is_beta # Poll self.cmdrchanged_alarm = self.after(1000, self.cmdrchanged)
def cmdrchanged(self, event=None): if self.cmdr != monitor.cmdr or self.is_beta != monitor.is_beta: # Cmdr has changed - update settings if monitor.cmdr: self.cred_label['text'] = _( 'Please log in with your Elite: Dangerous account details' ) # Use same text as E:D Launcher's login dialog else: self.cred_label['text'] = _( 'Not available while E:D is at the main menu' ) # Displayed when credentials settings are greyed out self.cmdr_label['state'] = self.username_label[ 'state'] = self.password_label['state'] = self.cmdr_text[ 'state'] = self.username['state'] = self.password[ 'state'] = monitor.cmdr and tk.NORMAL or tk.DISABLED self.cmdr_text['text'] = (monitor.cmdr or _('None')) + ( monitor.is_beta and ' [Beta]' or '' ) # No hotkey/shortcut currently defined self.username['state'] = tk.NORMAL self.username.delete(0, tk.END) self.password['state'] = tk.NORMAL self.password.delete(0, tk.END) if monitor.cmdr and config.get( 'cmdrs') and monitor.cmdr in config.get('cmdrs'): config_idx = config.get('cmdrs').index(monitor.cmdr) self.username.insert( 0, config.get('fdev_usernames')[config_idx] or '') self.password.insert( 0, config.get_password( config.get('fdev_usernames')[config_idx]) or '') elif monitor.cmdr and not config.get('cmdrs') and config.get( 'username') and config.get('password'): # migration from <= 2.25 self.username.insert(0, config.get('username') or '') self.password.insert(0, config.get('password') or '') if self.cmdr is not False: # Don't notify on first run plug.notify_prefs_cmdr_changed(monitor.cmdr, monitor.is_beta) self.cmdr = monitor.cmdr self.is_beta = monitor.is_beta # Poll self.cmdrchanged_alarm = self.after(1000, self.cmdrchanged)