1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-18 01:52:20 +03:00

45 Commits

Author SHA1 Message Date
A_D
b5a8c03980 Added missing whitespace 2021-04-01 14:45:48 +01:00
A_D
6374fbbeb8 Added event disabling
You can now disable specific event handlers in plugins
2021-04-01 14:45:47 +01:00
A_D
70087a27e4 Added total journal cutoff killswitches 2021-04-01 14:45:47 +01:00
Athanasius
25852997c5 Updated all source to use new config methods
# Conflicts:
#	monitor.py
2021-04-01 14:45:46 +01:00
Athanasius
bd670b7ff1 Updated plugins to expect that CAPI data is safe
# Conflicts:
#	plugins/eddn.py
2021-04-01 14:45:45 +01:00
Athanasius
c1d8a61c60 Whitespace and keyring in requirements sync to develop 2020-08-27 12:56:34 +01:00
Athanasius
364aaf2aef Merge branch 'develop' into main 2020-08-27 12:53:03 +01:00
A_D
d31b0fdbf6 Fixed system link updating on FSDTarget
FSDTarget contains the target system under `SystemAddress`, meaning that
any time you selected a star other than the current one, plugins'
`this.system_address` was updated to that target, rather than the
current system. Said updating causes the links provided from system_url
to reflect that update (for providers that support ID64s).

This changes the journal_entry behaviour to only update
`this.system_address` when the event is any of Location, Docked,
or FSDJump, all of which contain only the current system.
2020-08-27 11:32:39 +01:00
Athanasius
daed08d206 system/station providers: Sanitise {system,station}_url logic
* Make all plugins use `requests.utils.requote_uri()`
* Make all plugins use roughly the same logic, without if/else trees
 (as the bodies do a `return ...`), ending with `return ''` if input
 parameters are None.

 This throws away the inara fallback to `this.station or this.system` as
 it's unlikely the in-plugin tracking did a better job than the
 monitor.py code.
2020-08-27 11:28:27 +01:00
Athanasius
7617ce7e9c system/station plugin providers: Don't override 'url'
By default the ttkHyperlinkLabels for 'system' and 'station' names have
their 'url' members set to the functions in EDMarketConnector.App.

The EDDB one used to override the function as it had to do that special
name -> EDDB ID lookup from systems.p.  When I changed the code to not
need that any more I didn't fully understand what these overrides were.

After updating the EDDB code I then made sure the same logic was also in
the other plugins which meant they *also* set static strings, overriding
the call to the EDMarketConnector.App functions (which chain through to
the current plugin providers).

Unfortunately I didn't quite update the EDSM code enough causing
journal_entry() code to *not* set a new system 'url' despite changing
the 'text'.  This meant that only CAPI updates (so docking and login)
caused the URL to change, despite updating the 'text' to the correct
system name.

Rather than have everything setting static strings just do away with the
overrides as they're not needed!
2020-08-27 11:25:30 +01:00
A_D
d635bd8469
Fixed system link updating on FSDTarget
FSDTarget contains the target system under `SystemAddress`, meaning that
any time you selected a star other than the current one, plugins'
`this.system_address` was updated to that target, rather than the
current system. Said updating causes the links provided from system_url
to reflect that update (for providers that support ID64s).

This changes the journal_entry behaviour to only update
`this.system_address` when the event is any of Location, Docked,
or FSDJump, all of which contain only the current system.
2020-08-26 18:59:14 +02:00
Athanasius
c9dee18d70 system/station providers: Sanitise {system,station}_url logic
* Make all plugins use `requests.utils.requote_uri()`
* Make all plugins use roughly the same logic, without if/else trees
 (as the bodies do a `return ...`), ending with `return ''` if input
 parameters are None.

 This throws away the inara fallback to `this.station or this.system` as
 it's unlikely the in-plugin tracking did a better job than the
 monitor.py code.
2020-08-26 10:18:10 +01:00
Athanasius
d46358796f system/station plugin providers: Don't override 'url'
By default the ttkHyperlinkLabels for 'system' and 'station' names have
their 'url' members set to the functions in EDMarketConnector.App.

The EDDB one used to override the function as it had to do that special
name -> EDDB ID lookup from systems.p.  When I changed the code to not
need that any more I didn't fully understand what these overrides were.

After updating the EDDB code I then made sure the same logic was also in
the other plugins which meant they *also* set static strings, overriding
the call to the EDMarketConnector.App functions (which chain through to
the current plugin providers).

Unfortunately I didn't quite update the EDSM code enough causing
journal_entry() code to *not* set a new system 'url' despite changing
the 'text'.  This meant that only CAPI updates (so docking and login)
caused the URL to change, despite updating the 'text' to the correct
system name.

Rather than have everything setting static strings just do away with the
overrides as they're not needed!
2020-08-25 21:38:22 +01:00
A_D
b27e4a3628
fixed tk import and type annotations 2020-07-27 15:15:56 +02:00
A_D
cad5f72b0a
updated type annotation 2020-07-27 15:15:55 +02:00
A_D
7b231fb244
removed unicode specifier from string
python3 strings are always unicode
2020-07-27 15:15:55 +02:00
A_D
07c43d3057
added type annotations to globals 2020-07-27 15:15:54 +02:00
A_D
e0462d8719
Replaced complex oneliner with multiline if 2020-07-27 15:15:54 +02:00
A_D
37181264c9
Added newline after scope changes 2020-07-27 15:15:53 +02:00
A_D
4eed4404c6
Added Any type hint to this
Resolves most type warnings
2020-07-27 15:15:53 +02:00
A_D
ab58aa6355
autoformatted file 2020-07-27 15:15:52 +02:00
Athanasius
b6f6365566 plugins/edsm: Fix missing line of code
Bad paste or something, who knows ?
2020-07-21 18:25:03 +01:00
Athanasius
99d1578780 plugins/eddb: Align with code tested in inara plugin
* Use same state logic as Inara plugin now has.
* this.system_link for the Tk item, this.system is the system name.
* List some tests to pass (and later to be implemented as unittests).
* Be paranoid about URIs, quote them.
* Ensure station text+link set on prefs change.
2020-07-21 17:29:03 +01:00
Athanasius
4c4511a66d plugins/eddb: Remove misleading comments about 'Only use CAPI...'
This is needed for "not even running the game" CAPI update to be useful.
2020-07-21 17:29:03 +01:00
Athanasius
ec32849a17 plugins/eddb: Fallback to system_name if no system_address
* Cleans up imports.
* Fixes some '<tab># ...' to use 2 spaces.
* Add type hints to system_url().
* Always store, even if not current provider: this.{system_address,
  station_marketid,system_population}
2020-07-13 22:12:29 +01:00
Athanasius
f3e25f0340 EDDB system URL: Don't pick up system_address from CAPI at all 2020-07-13 21:03:57 +01:00
Athanasius
317a0f6b63 EDDB is default station provider, do station_marketid as needed
We need a better way to do provider defaults.  Heck, settings defaults period.
Let's assume we'll put in place a "standard" config file once we move to one.
2020-07-11 19:47:30 +01:00
Athanasius
6932fdc883 EDDB: Use CAPI for system_address/station_marketid only if not already set
See issue #586 - a user had incorrect system_address set, but only sometimes.

This could possibly be due to CAPI errors/lag, so only use it as the source
when the values aren't yet set.  Otherwise Journal should always have provided
the correct value in a timely manner.
2020-07-11 18:57:04 +01:00
Athanasius
cd02d1664a Change EDDB system_url to use SystemAddress
* This means storing this.system_address from both cmdr_data and journal_entry.  NB: If the current value in the event or data is 'None' it will retain the previous value.  Without this Journal entries without SystemAddress erase the stored value.
 * The station_url() fallback to system_url() similarly uses this.system_address in the call.

Addresses #512
2020-07-01 15:51:14 +01:00
Athanasius
f6b3109a09 Remove the last of the {stations,systems}.p code from EDDB plugin
There is one tiny regression for a very, very corner case.

  In 3.46 if you use EDDB as the 'Station' provider and:

	1. Dock at Station A, in System X
	2. Jump out to System Y, which is also populated
	3. Exit out of the game
	4. (Re-)Start EDMC
	5. Hit 'Update' to manually trigger CAPI data retrieval

you will see a "×" character as the Station Name, and can click on it to
take you to the EDDB *System* page.  It is only there because of EDMC
using systems.p to check if System Y is populated.

  With this version in that circumstance there's no way to know that
System Y is populated, so the code assumes not and doesn't show the
"×", and thus there's nothing to click to go to the EDDB *System* page
for System Y.

  But so long as the user is actually running the game and EDMC together
then populated status is detected from Journal events and the "×" will
be there whenever you're undocked but in a populated system.
  Caveat: We know Frontier have allowed some systems that are
technically populated, but show a Population of zero.  This code assumes
that means they're *not* populated.
2020-07-01 15:51:14 +01:00
Athanasius
0541e404ec Track system population in monitor, and use in eddb
EDDB station link now triggers off this.system_population, which is
received via monitor passing 'Population' through in Startup, Location,
FSDJump and CarrierJump events.

  One fewer use cases for systems.p (populated status in this case).
2020-07-01 15:51:14 +01:00
Athanasius
ad81339495 Check eddb.system_name is set before attempting to quote it
urllib.parse.quote does *not* like being passed None.
2020-07-01 15:51:14 +01:00
Athanasius
6ed7590ba9 Update eddb.station_marketid from CarrierJump as well
This shouldn't actually be necessary, the marketid shouln't change
because of a jump, and would have been picked up from the other events
anyway, but it should do no harm to set it again from this.
2020-07-01 15:51:14 +01:00
Athanasius
2df8610e42 eddb: Ensure system_name is quoted for URL 2020-07-01 15:51:14 +01:00
Athanasius
1a11202aea Implement tracking station MarketID, and use in eddb plugin
* Adds monitor.station_marketid, tracked at the same points as
   monitor.station (name).
 * Changes EDDB plugin to also track its own this.station_marketid so
   that it can be used in /market-id/ EDDB URL.
   This removes a use case for stations.p file.
2020-07-01 15:51:14 +01:00
Athanasius
553c7980c1 Change EDDB system_url() to using by-name URL
This removes a use case for systems.p file
2020-07-01 15:51:14 +01:00
Jonathan Harris
e192c2ca2e Plugin migration 2019-10-02 03:01:08 +01:00
Athanasius
a505402d2a plugins/eddb.py: De-future 2019-09-26 11:40:42 +01:00
Athanasius
9910024004 Now runs without console errors so far as pressing 'Update' is concerned.
There's an error on the console about an iterator when doing so
though.
2019-09-26 11:40:41 +01:00
Jonathan Harris
3a3827f168 Make system and station links unclickable if URL not available 2018-04-04 19:34:35 +01:00
Jonathan Harris
6887a225bb Add bubble and Colonia systems to eddb database 2018-04-04 13:52:51 +01:00
Jonathan Harris
0eaa61bdd9 Make system and station info websites configurable 2018-04-03 01:03:07 +01:00
Jonathan Harris
698b37b7bd Update eddb database 2017-10-17 00:21:35 +01:00
Jonathan Harris
60ad3b4c09 Inform plugins of Cmdr and Beta status
Notify plugins when Cmdr or Beta status changes while the preferences dialog
is open.

Display a note on the Credentials tab when Cmdr is not set. Addresses #224
2017-07-29 15:36:43 +01:00
Jonathan Harris
fe0835be10 Switch eddb integration to a plugin 2017-07-29 14:42:00 +01:00