From 3a57b53bbde003fb5a734daaa2d19b75ae5898e9 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 5 Oct 2022 15:11:37 +0100 Subject: [PATCH] config/EDDN: Rename OUT_SYS_DELAY to OUT_EDDN_DO_NOT_DELAY The sense of this `output` flag has been inverted (always?) for a long time. 1. I have the option "Delay sending until docked" showing as *off* in the UI. 2. My config.output value is `100000000001`. 3. The value of this flag is `4096`, which means 12th bit (starting from 1, not zero). 4. So I have the bit set, but the option visibly off. So, rename this both to be more pertinent to its use *and* to be correct as to what `True` for it means. --- config/__init__.py | 2 +- plugins/eddn.py | 10 ++++++++-- prefs.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config/__init__.py b/config/__init__.py index 56679019..b7437b2d 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -176,7 +176,7 @@ class AbstractConfig(abc.ABC): # OUT_SYS_AUTO = 512 # Now always automatic OUT_MKT_MANUAL = 1024 OUT_SYS_EDDN = 2048 - OUT_SYS_DELAY = 4096 + OUT_EDDN_DO_NOT_DELAY = 4096 app_dir_path: pathlib.Path plugin_dir_path: pathlib.Path diff --git a/plugins/eddn.py b/plugins/eddn.py index 6f867fcd..f5469c54 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -349,6 +349,9 @@ class EDDNSender: :param msg: Fully formed, string, message. :return: `True` for "now remove this message from the queue" """ + + # TODO: Check if user options require us to send at this time. + should_return, new_data = killswitch.check_killswitch('plugins.eddn.send', json.loads(msg)) if should_return: logger.warning('eddn.send has been disabled via killswitch. Returning.') @@ -500,6 +503,9 @@ class EDDN: :param cmdr: the CMDR to use as the uploader ID. :param msg: the payload to send. """ + + # TODO: Check if the global 'Send to EDDN' option is off + to_send: OrderedDictT[str, OrderedDict[str, Any]] = OrderedDict([ ('$schemaRef', msg['$schemaRef']), ('header', OrderedDict([ @@ -1854,7 +1860,7 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame: ) this.eddn_system_button.grid(padx=BUTTONX, pady=(5, 0), sticky=tk.W) - this.eddn_delay = tk.IntVar(value=(output & config.OUT_SYS_DELAY) and 1) + this.eddn_delay = tk.IntVar(value=(output & config.OUT_EDDN_DO_NOT_DELAY) and 1) # Output setting under 'Send system and scan data to the Elite Dangerous Data Network' new in E:D 2.2 this.eddn_delay_button = nb.Checkbutton( eddnframe, @@ -1891,7 +1897,7 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None: & (config.OUT_MKT_TD | config.OUT_MKT_CSV | config.OUT_SHIP | config.OUT_MKT_MANUAL)) + (this.eddn_station.get() and config.OUT_MKT_EDDN) + (this.eddn_system.get() and config.OUT_SYS_EDDN) + - (this.eddn_delay.get() and config.OUT_SYS_DELAY) + (this.eddn_delay.get() and config.OUT_EDDN_DO_NOT_DELAY) ) diff --git a/prefs.py b/prefs.py index 03b8dcd8..acc7f12c 100644 --- a/prefs.py +++ b/prefs.py @@ -1221,7 +1221,7 @@ class PreferencesDialog(tk.Toplevel): (self.out_csv.get() and config.OUT_MKT_CSV) + (config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) + (self.out_ship.get() and config.OUT_SHIP) + - (config.get_int('output') & (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN | config.OUT_SYS_DELAY)) + (config.get_int('output') & (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN | config.OUT_EDDN_DO_NOT_DELAY)) ) config.set(