diff --git a/ChangeLog.md b/ChangeLog.md index 92083dcf..c6c6e64b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,22 @@ This is the master changelog for Elite Dangerous Market Connector. Entries are in reverse chronological order (latest first). --- +Release 4.0.6 +=== + + * Correct the three System Provider plugins to *not* show the *next* system + in a plotted route instead of the current system. + +Release 4.0.5 +=== + + * Built using Python 3.7.9. + * Fix EDSM plugin so the System provider actually updates the URLs for + jumps to new systems. + + In general this cleans up the code for all three System and Station Providers; + EDDB, EDSM, Inara. + Release 4.0.4 === diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 8867dfbf..94083df5 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -949,9 +949,26 @@ if __name__ == "__main__": def messagebox_not_py3(): plugins_not_py3_last = config.getint('plugins_not_py3_last') or 0 if (plugins_not_py3_last + 86400) < int(time()) and len(plug.PLUGINS_not_py3): + # Yes, this is horribly hacky so as to be sure we match the key + # that we told Translators to use. + popup_text = "One or more of your enabled plugins do not yet have support for Python 3.x. Please see the " \ + "list on the '{PLUGINS}' tab of '{FILE}' > '{SETTINGS}'. You should check if there is an " \ + "updated version available, else alert the developer that they need to update the code for " \ + "Python 3.x.\r\n\r\nYou can disable a plugin by renaming its folder to have '{DISABLED}' on " \ + "the end of the name." + popup_text = popup_text.replace('\n', '\\n') + popup_text = popup_text.replace('\r', '\\r') + # Now the string should match, so try translation + popup_text = _(popup_text) + # And substitute in the other words. + popup_text = popup_text.format(PLUGINS=_('Plugins'), FILE=_('File'), SETTINGS=_('Settings'), DISABLED='.disabled') + # And now we do need these to be actual \r\n + popup_text = popup_text.replace('\\n', '\n') + popup_text = popup_text.replace('\\r', '\r') + tk.messagebox.showinfo( _('EDMC: Plugins Without Python 3.x Support'), - _("One or more of your enabled plugins do not yet have support for Python 3.x. Please see the list on the '{PLUGINS}' tab of '{FILE}' > '{SETTINGS}'. You should check if there is an updated version available, else alert the developer that they need to update the code for Python 3.x.\r\n\r\nYou can disable a plugin by renaming its folder to have '{DISABLED}' on the end of the name.".format(PLUGINS=_('Plugins'), FILE=_('File'), SETTINGS=_('Settings'), DISABLED='.disabled')) + popup_text ) config.set('plugins_not_py3_last', int(time())) diff --git a/L10n/pt-PT.strings b/L10n/pt-PT.strings index 1da61a83..1f6c7c23 100644 --- a/L10n/pt-PT.strings +++ b/L10n/pt-PT.strings @@ -490,6 +490,9 @@ /* Update button in main window. [EDMarketConnector.py] */ "Update" = "Actualizar"; +/* Option to use alternate URL method on shipyard links [prefs.py] */ +"Use alternate URL method" = "Usar método URL alternativo."; + /* Status dialog subtitle - CR value of ship. [stats.py] */ "Value" = "Valor"; diff --git a/config.py b/config.py index c65b59dc..1e1e9146 100644 --- a/config.py +++ b/config.py @@ -13,7 +13,7 @@ appcmdname = 'EDMC' # appversion **MUST** follow Semantic Versioning rules: # <https://semver.org/#semantic-versioning-specification-semver> # Major.Minor.Patch(-prerelease)(+buildmetadata) -appversion = '4.0.4' #-rc1+a872b5f' +appversion = '4.0.6' #-rc1+a872b5f' # For some things we want appversion without (possible) +build metadata appversion_nobuild = str(semantic_version.Version(appversion).truncate('prerelease')) copyright = u'© 2015-2019 Jonathan Harris, 2020 EDCD' diff --git a/docs/Releasing.md b/docs/Releasing.md index 0e704d08..26246803 100644 --- a/docs/Releasing.md +++ b/docs/Releasing.md @@ -32,7 +32,7 @@ You will need several pieces of software installed, or the files from their "Windows Software Development Kit - Windows 10.0.18362.1" in "Apps & Features", *not* "Windows SDK AddOn". 1. [Python](https://python.org): 32-bit version of Python 3.7 for Windows. - [v3.7.7](https://www.python.org/downloads/release/python-377/) is the most + [v3.7.9](https://www.python.org/downloads/release/python-379/) is the most recently tested version. You need the `Windows x86 executable installer` file, for the 32-bit version. 1. [py2exe](https://github.com/albertosottile/py2exe): diff --git a/edmarketconnector.xml b/edmarketconnector.xml index fdba6d04..3addd416 100644 --- a/edmarketconnector.xml +++ b/edmarketconnector.xml @@ -168,11 +168,26 @@ <!-- Windows --> <item> - <title>Release 4.0.4</title> + <title>Release 4.0.6</title> <description> <![CDATA[ <style>body { font-family:"Segoe UI","Tahoma"; font-size: 75%; } h2 { font-family:"Segoe UI","Tahoma"; font-size: 105%; }</style> +<h2>Release 4.0.6</h2> +<ul> +<li>Correct the three System Provider plugins to <em>not</em> show the <em>next</em> system +in a plotted route instead of the current system.</li> +</ul> + +<h2>Release 4.0.5</h2> +<ul> +<li>Built using Python 3.7.9.</li> +<li>Fix EDSM plugin so the System provider actually updates the URLs for +jumps to new systems.</li> +</ul> +<p>In general this cleans up the code for all three System and Station Providers; +EDDB, EDSM, Inara.</p> + <h2>Release 4.0.4</h2> <ul> <li> @@ -603,11 +618,11 @@ If any of your plugins are listed in that section then they will need updating, ]]> </description> <enclosure - url="https://github.com/EDCD/EDMarketConnector/releases/download/Release/4.0.4/EDMarketConnector_win_4.0.4.msi" + url="https://github.com/EDCD/EDMarketConnector/releases/download/Release/4.0.6/EDMarketConnector_win_4.0.6.msi" sparkle:os="windows" sparkle:installerArguments="/passive LAUNCH=yes" - sparkle:version="4.0.4" - length="11419648" + sparkle:version="4.0.6" + length="11317248" type="application/octet-stream" /> </item> diff --git a/plugins/eddb.py b/plugins/eddb.py index 17e72bf4..7f48f0a2 100644 --- a/plugins/eddb.py +++ b/plugins/eddb.py @@ -46,16 +46,17 @@ this.station_marketid = None def system_url(system_name: str) -> str: if this.system_address: return requests.utils.requote_uri(f'https://eddb.io/system/ed-address/{this.system_address}') - elif system_name: + + if system_name: return requests.utils.requote_uri(f'https://eddb.io/system/name/{system_name}') - else: - return '' + + return '' def station_url(system_name: str, station_name: str) -> str: if this.station_marketid: return requests.utils.requote_uri(f'https://eddb.io/station/market-id/{this.station_marketid}') - else: - return system_url('') + + return system_url(system_name) def plugin_start3(plugin_dir): return 'eddb' @@ -70,17 +71,17 @@ def plugin_app(parent): this.station_link.configure(popup_copy = lambda x: x != STATION_UNDOCKED) def prefs_changed(cmdr, is_beta): - # Override standard URL functions - if config.get('system_provider') == 'eddb': - this.system_link['url'] = system_url(this.system) - if config.get('station_provider') == 'eddb': - this.station_link['url'] = station_url(this.system, this.station) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. + pass def journal_entry(cmdr, is_beta, system, station, entry, state): - # Always update, even if we're not the *current* system or station provider. - this.system_address = entry.get('SystemAddress') or this.system_address - this.system = entry.get('StarSystem') or this.system + # Always update our system address even if we're not currently the provider for system or station, but dont update + # on events that contain "future" data, such as FSDTarget + if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'): + this.system_address = entry.get('SystemAddress') or this.system_address + this.system = entry.get('StarSystem') or this.system # We need pop == 0 to set the value so as to clear 'x' in systems with # no stations. @@ -98,13 +99,15 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): # Only actually change URLs if we are current provider. if config.get('system_provider') == 'eddb': this.system_link['text'] = this.system - this.system_link['url'] = system_url(this.system) # Override standard URL function + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.system_link.update_idletasks() # But only actually change the URL if we are current station provider. if config.get('station_provider') == 'eddb': this.station_link['text'] = this.station or (this.system_population and this.system_population > 0 and STATION_UNDOCKED or '') - this.station_link['url'] = station_url(this.system, this.station) # Override standard URL function + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.station_link.update_idletasks() @@ -119,7 +122,8 @@ def cmdr_data(data, is_beta): # Override standard URL functions if config.get('system_provider') == 'eddb': this.system_link['text'] = this.system - this.system_link['url'] = system_url(this.system) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.system_link.update_idletasks() if config.get('station_provider') == 'eddb': if data['commander']['docked']: @@ -129,6 +133,7 @@ def cmdr_data(data, is_beta): else: this.station_link['text'] = '' - this.station_link['url'] = station_url(this.system, this.station) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.station_link.update_idletasks() diff --git a/plugins/edsm.py b/plugins/edsm.py index 34b64b80..a90526fe 100644 --- a/plugins/edsm.py +++ b/plugins/edsm.py @@ -14,8 +14,6 @@ import json import requests import sys -import time -import urllib.request, urllib.error, urllib.parse from queue import Queue from threading import Thread @@ -59,14 +57,26 @@ STATION_UNDOCKED: str = '×' # "Station" name to display when not docked = U+00 # Main window clicks def system_url(system_name): - return 'https://www.edsm.net/en/system?systemName=%s' % urllib.parse.quote(system_name) + if this.system_address: + return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemID64={this.system_address}') + + if system_name: + return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemName={system_name}') + + return '' def station_url(system_name, station_name): - if station_name: - return 'https://www.edsm.net/en/system?systemName=%s&stationName=%s' % (urllib.parse.quote(system_name), urllib.parse.quote(station_name)) - else: - return 'https://www.edsm.net/en/system?systemName=%s&stationName=ALL' % urllib.parse.quote(system_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}') + # monitor state might think these are gone, but we don't yet + if this.system and this.station: + return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemName={this.system}&stationName={this.station}') + + if system_name: + return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemName={system_name}&stationName=ALL') + + return '' def plugin_start3(plugin_dir): # Can't be earlier since can only call PhotoImage after window is created @@ -207,9 +217,11 @@ def credentials(cmdr): def journal_entry(cmdr, is_beta, system, station, entry, state): - # Always update, even if we're not the *current* system or station provider. - this.system_address = entry.get('SystemAddress') or this.system_address - this.system = entry.get('StarSystem') or this.system + # Always update our system address even if we're not currently the provider for system or station, but dont update + # on events that contain "future" data, such as FSDTarget + if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'): + this.system_address = entry.get('SystemAddress') or this.system_address + this.system = entry.get('StarSystem') or this.system # We need pop == 0 to set the value so as to clear 'x' in systems with # no stations. @@ -294,9 +306,10 @@ def cmdr_data(data, is_beta): this.station = this.station or data['commander']['docked'] and data['lastStarport']['name'] # TODO: Fire off the EDSM API call to trigger the callback for the icons - if config.get('station_provider') == 'EDSM': + if config.get('system_provider') == 'EDSM': this.system_link['text'] = this.system - this.system_link['url'] = system_url(this.system) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.system_link.update_idletasks() if config.get('station_provider') == 'EDSM': if data['commander']['docked']: @@ -306,7 +319,8 @@ def cmdr_data(data, is_beta): else: this.station_link['text'] = '' - this.station_link['url'] = station_url(this.system, this.station) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.station_link.update_idletasks() diff --git a/plugins/inara.py b/plugins/inara.py index da71d0a0..61fb7abe 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -73,15 +73,20 @@ def system_url(system_name): elif system_name: return requests.utils.requote_uri(f'https://inara.cz/galaxy-starsystem/?search={system_name}') - return this.system + return '' def station_url(system_name, station_name): + if system_name and station_name: + return requests.utils.requote_uri(f'https://inara.cz/galaxy-station/?search={system_name}%20[{station_name}]') + + # monitor state might think these are gone, but we don't yet + if this.system and this.station: + return requests.utils.requote_uri(f'https://inara.cz/galaxy-station/?search={this.system}%20[{this.station}]') + if system_name: - if station_name: - return requests.utils.requote_uri(f'https://inara.cz/galaxy-station/?search={system_name}%20[{station_name}]') return system_url(system_name) - return this.station or this.system + return '' def plugin_start3(plugin_dir): @@ -155,12 +160,6 @@ def prefs_changed(cmdr, is_beta): changed = config.getint('inara_out') != this.log.get() config.set('inara_out', this.log.get()) - # Override standard URL functions - if config.get('system_provider') == 'Inara': - this.system_link['url'] = system_url(this.system) - if config.get('station_provider') == 'Inara': - this.station_link['url'] = station_url(this.system, this.station) - if cmdr and not is_beta: this.cmdr = cmdr this.FID = None @@ -232,9 +231,11 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): elif entry['event'] in ['ShipyardNew', 'ShipyardSwap'] or (entry['event'] == 'Location' and entry['Docked']): this.suppress_docked = True - # Always update, even if we're not the *current* system or station provider. - this.system_address = entry.get('SystemAddress') or this.system_address - this.system = entry.get('StarSystem') or this.system + # Always update our system address even if we're not currently the provider for system or station, but dont update + # on events that contain "future" data, such as FSDTarget + if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'): + this.system_address = entry.get('SystemAddress') or this.system_address + this.system = entry.get('StarSystem') or this.system # We need pop == 0 to set the value so as to clear 'x' in systems with # no stations. @@ -752,12 +753,14 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): # Only actually change URLs if we are current provider. if config.get('system_provider') == 'Inara': this.system_link['text'] = this.system - this.system_link['url'] = system_url(this.system) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.system_link.update_idletasks() if config.get('station_provider') == 'Inara': this.station_link['text'] = this.station or (this.system_population and this.system_population > 0 and STATION_UNDOCKED or '') - this.station_link['url'] = station_url(this.system, this.station) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.station_link.update_idletasks() def cmdr_data(data, is_beta): @@ -773,7 +776,8 @@ def cmdr_data(data, is_beta): # Override standard URL functions if config.get('system_provider') == 'Inara': this.system_link['text'] = this.system - this.system_link['url'] = system_url(this.system) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.system_link.update_idletasks() if config.get('station_provider') == 'Inara': if data['commander']['docked']: @@ -783,7 +787,8 @@ def cmdr_data(data, is_beta): else: this.station_link['text'] = '' - this.station_link['url'] = station_url(this.system, this.station) + # Do *NOT* set 'url' here, as it's set to a function that will call + # through correctly. We don't want a static string. this.station_link.update_idletasks() if config.getint('inara_out') and not is_beta and not this.multicrew and credentials(this.cmdr):