mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 18:07:37 +03:00
autoformatted code with autopep8
This commit is contained in:
parent
0f12959d53
commit
37c53e233e
@ -53,8 +53,6 @@ this.station_marketid = None # Frontier MarketID
|
||||
STATION_UNDOCKED: str = '×' # "Station" name to display when not docked = U+00D7
|
||||
|
||||
|
||||
|
||||
|
||||
# Main window clicks
|
||||
def system_url(system_name):
|
||||
if this.system_address:
|
||||
@ -65,6 +63,7 @@ def system_url(system_name):
|
||||
|
||||
return ''
|
||||
|
||||
|
||||
def station_url(system_name, station_name):
|
||||
if system_name and station_name:
|
||||
return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemName={system_name}&stationName={station_name}')
|
||||
@ -108,11 +107,13 @@ def plugin_start3(plugin_dir):
|
||||
|
||||
return 'EDSM'
|
||||
|
||||
|
||||
def plugin_app(parent):
|
||||
this.system_link = parent.children['system'] # system label in main window
|
||||
this.system_link.bind_all('<<EDSMStatus>>', update_status)
|
||||
this.station_link = parent.children['station'] # station label in main window
|
||||
|
||||
|
||||
def plugin_stop():
|
||||
# Signal thread to close and wait for it
|
||||
this.queue.put(None)
|
||||
@ -121,6 +122,7 @@ def plugin_stop():
|
||||
# Suppress 'Exception ignored in: <function Image.__del__ at ...>' errors
|
||||
this._IMG_KNOWN = this._IMG_UNKNOWN = this._IMG_NEW = this._IMG_ERROR = None
|
||||
|
||||
|
||||
def plugin_prefs(parent, cmdr, is_beta):
|
||||
|
||||
PADX = 10
|
||||
@ -130,13 +132,16 @@ def plugin_prefs(parent, cmdr, is_beta):
|
||||
frame = nb.Frame(parent)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
HyperlinkLabel(frame, text='Elite Dangerous Star Map', background=nb.Label().cget('background'), url='https://www.edsm.net/', underline=True).grid(columnspan=2, padx=PADX, sticky=tk.W) # Don't translate
|
||||
HyperlinkLabel(frame, text='Elite Dangerous Star Map', background=nb.Label().cget('background'),
|
||||
url='https://www.edsm.net/', underline=True).grid(columnspan=2, padx=PADX, sticky=tk.W) # Don't translate
|
||||
this.log = tk.IntVar(value=config.getint('edsm_out') and 1)
|
||||
this.log_button = nb.Checkbutton(frame, text=_('Send flight log and Cmdr status to EDSM'), variable=this.log, command=prefsvarchanged)
|
||||
this.log_button = nb.Checkbutton(frame, text=_('Send flight log and Cmdr status to EDSM'),
|
||||
variable=this.log, command=prefsvarchanged)
|
||||
this.log_button.grid(columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
|
||||
nb.Label(frame).grid(sticky=tk.W) # big spacer
|
||||
this.label = HyperlinkLabel(frame, text=_('Elite Dangerous Star Map credentials'), background=nb.Label().cget('background'), url='https://www.edsm.net/settings/api', underline=True) # Section heading in settings
|
||||
this.label = HyperlinkLabel(frame, text=_('Elite Dangerous Star Map credentials'), background=nb.Label().cget(
|
||||
'background'), url='https://www.edsm.net/settings/api', underline=True) # Section heading in settings
|
||||
this.label.grid(columnspan=2, padx=PADX, sticky=tk.W)
|
||||
|
||||
this.cmdr_label = nb.Label(frame, text=_('Cmdr')) # Main window
|
||||
@ -158,6 +163,7 @@ def plugin_prefs(parent, cmdr, is_beta):
|
||||
|
||||
return frame
|
||||
|
||||
|
||||
def prefs_cmdr_changed(cmdr, is_beta):
|
||||
this.log_button['state'] = cmdr and not is_beta and tk.NORMAL or tk.DISABLED
|
||||
this.user['state'] = tk.NORMAL
|
||||
@ -174,9 +180,11 @@ def prefs_cmdr_changed(cmdr, is_beta):
|
||||
this.cmdr_text['text'] = _('None') # No hotkey/shortcut currently defined
|
||||
this.label['state'] = this.cmdr_label['state'] = this.cmdr_text['state'] = this.user_label['state'] = this.user['state'] = this.apikey_label['state'] = this.apikey['state'] = cmdr and not is_beta and this.log.get() and tk.NORMAL or tk.DISABLED
|
||||
|
||||
|
||||
def prefsvarchanged():
|
||||
this.label['state'] = this.cmdr_label['state'] = this.cmdr_text['state'] = this.user_label['state'] = this.user['state'] = this.apikey_label['state'] = this.apikey['state'] = this.log.get() and this.log_button['state'] or tk.DISABLED
|
||||
|
||||
|
||||
def prefs_changed(cmdr, is_beta):
|
||||
config.set('edsm_out', this.log.get())
|
||||
|
||||
@ -374,7 +382,8 @@ def worker():
|
||||
this.discardedEvents = set(r.json())
|
||||
this.discardedEvents.discard('Docked') # should_send() assumes that we send 'Docked' events
|
||||
assert this.discardedEvents # wouldn't expect this to be empty
|
||||
pending = [x for x in pending if x['event'] not in this.discardedEvents] # Filter out unwanted events
|
||||
pending = [x for x in pending if x['event']
|
||||
not in this.discardedEvents] # Filter out unwanted events
|
||||
|
||||
if should_send(pending):
|
||||
if any([p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')]):
|
||||
|
Loading…
x
Reference in New Issue
Block a user