diff --git a/ChangeLog.md b/ChangeLog.md index e94b376f..7cb178e4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -34,6 +34,11 @@ produce the Windows executables and installer. --- +Release 5.8.1 +=== +This fixes a bug where the Cmdr/APIKey sections on Settings > EDSM would never +be shown. + Release 5.8.0 === This release is essentially the same as 5.8.0-rc3 with only the version and diff --git a/PLUGINS.md b/PLUGINS.md index 5cabd8b6..3048f345 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -110,9 +110,9 @@ from the original files unless specified as allowed in this section. `import plug` - For using `plug.show_error()` only. - Use `monitor.game_running()` as follows in case a plugin needs to know if we - think the game is running. *NB: This is a function, and should be called as - such. Using the bare word `game_running` will always be `True`.* +Use `monitor.game_running()` as follows in case a plugin needs to know if we +think the game is running. *NB: This is a function, and should be called as +such. Using the bare word `game_running` will always be `True`.* ``` from monitor import monitor @@ -121,9 +121,16 @@ if monitor.game_running(): ... ``` +Use `monitor.is_live_galaxy()` to determine if the player is playing in the +Live galaxy. Note the implementation details of this. At time of writing it +performs a `semantic_version` >= check. + `import timeout_session` - provides a method called `new_session` that creates -a requests.session with a default timeout on all requests. Recommended to -reduce noise in HTTP requests +a `requests.session` with a default timeout on all requests. Recommended to +reduce noise in HTTP requests. This also ensures your requests use the central +"User-Agent" header value. If you do have reason to make a request otherwise +please ensure you use the `config.user_agent` value as the User-Agent (you can +append a string to call out your plugin if you wish). `from ttkHyperlinkLabel import HyperlinkLabel` and `import myNotebook as nb` - For creating UI elements. @@ -377,6 +384,20 @@ So instead use: # During shutdown ``` +### Use `requests`, not `urllib` for HTTP(S) requests +We use `requests` in lots of core code, so it will always be available. An +advantage to using it, instead of the core `urllib`, is that it brings in +`certifi` with its own set of trusted root certificates. + +We've seen issues where a plugin was using `urllib`, which uses the **system** +certificate store, and a user's system didn't yet have a new root certificate +that was necessary for the operation of a URL the plugin was acessing. + +We keep `requests`, and thus `certifi` up to date via GitHub's dependabot. If +there is ever a certificate update that we don't have in a release then +please open a +[bug report](https://github.com/EDCD/EDMarketConnector/issues/new?assignees=&labels=bug%2C+unconfirmed&template=bug_report.md&title=). + --- ## Plugin Hooks diff --git a/config/__init__.py b/config/__init__.py index da573fb1..7b00f21f 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -52,7 +52,7 @@ appcmdname = 'EDMC' # # Major.Minor.Patch(-prerelease)(+buildmetadata) # NB: Do *not* import this, use the functions appversion() and appversion_nobuild() -_static_appversion = '5.8.0' +_static_appversion = '5.8.1' _cached_version: Optional[semantic_version.Version] = None copyright = '© 2015-2019 Jonathan Harris, 2020-2023 EDCD' diff --git a/monitor.py b/monitor.py index 1770195c..15cd72c4 100644 --- a/monitor.py +++ b/monitor.py @@ -2507,6 +2507,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below """ Indicate if current tracking indicates Live galaxy. + NB: **MAY** be used by third-party plugins. + We assume: 1) `gameversion` remains something that semantic_verison.Version.coerce() can parse. 2) Any Live galaxy client reports a version >= the defined base version. diff --git a/plugins/edsm.py b/plugins/edsm.py index d68a3491..a48177e0 100644 --- a/plugins/edsm.py +++ b/plugins/edsm.py @@ -327,30 +327,27 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr if this.label: this.label.grid(columnspan=2, padx=PADX, sticky=tk.W) - if this.cmdr_label and this.cmdr_text: - # LANG: Game Commander name label in EDSM settings - this.cmdr_label = nb.Label(frame, text=_('Cmdr')) # Main window - this.cmdr_label.grid(row=cur_row, padx=PADX, sticky=tk.W) - this.cmdr_text = nb.Label(frame) - this.cmdr_text.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.W) + # LANG: Game Commander name label in EDSM settings + this.cmdr_label = nb.Label(frame, text=_('Cmdr')) # Main window + this.cmdr_label.grid(row=cur_row, padx=PADX, sticky=tk.W) + this.cmdr_text = nb.Label(frame) + this.cmdr_text.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.W) cur_row += 1 - if this.user_label and this.label: - # LANG: EDSM Commander name label in EDSM settings - this.user_label = nb.Label(frame, text=_('Commander Name')) # EDSM setting - this.user_label.grid(row=cur_row, padx=PADX, sticky=tk.W) - this.user = nb.Entry(frame) - this.user.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.EW) + # LANG: EDSM Commander name label in EDSM settings + this.user_label = nb.Label(frame, text=_('Commander Name')) # EDSM setting + this.user_label.grid(row=cur_row, padx=PADX, sticky=tk.W) + this.user = nb.Entry(frame) + this.user.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.EW) cur_row += 1 - if this.apikey_label and this.apikey: - # LANG: EDSM API key label - this.apikey_label = nb.Label(frame, text=_('API Key')) # EDSM setting - this.apikey_label.grid(row=cur_row, padx=PADX, sticky=tk.W) - this.apikey = nb.Entry(frame) - this.apikey.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.EW) + # LANG: EDSM API key label + this.apikey_label = nb.Label(frame, text=_('API Key')) # EDSM setting + this.apikey_label.grid(row=cur_row, padx=PADX, sticky=tk.W) + this.apikey = nb.Entry(frame) + this.apikey.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.EW) prefs_cmdr_changed(cmdr, is_beta)