1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-26 05:22:13 +03:00

150 Commits

Author SHA1 Message Date
Athanasius
278a78c09a plugins/inara: Don't try to send None-system location
I'm not sure normal use can cause this, but it's an easy obvious check.
2021-05-20 17:34:09 +01:00
Athanasius
b862f6b00a Translations: Add killswitch 'disabled' messages. 2021-05-17 10:18:04 +01:00
Athanasius
7f45953012 plugins/station: *Do* set station from BodyType/Body always
The 'if not this.station' was early paranoia when first getting things
working with Odyssey.  It prevents a relog from Horizons (i.e. different
location) from correctly picking up an Odyssey login station when
on-foot in concourse.

Also, EDSM was defaulting wrongly for this.station_marketid.  Not that
the plugin even *uses* that at this time.
2021-05-12 10:56:43 +01:00
Athanasius
844e6115e3 Also handle Embark (properly) in EDSM and Inara plugins. 2021-05-01 13:50:45 +01:00
A_D
d0bc006f9f Cleared final mypy errors in inara 2021-04-12 08:31:47 +01:00
Athanasius
878a247604 inara: A few final type fixups 2021-04-12 08:31:47 +01:00
Athanasius
aaceaf0f52 inara: More type fixing 2021-04-12 08:31:47 +01:00
Athanasius
7ef6c17fa1 inara: Fix 'fleet' type 2021-04-12 08:31:47 +01:00
Athanasius
3ea6dac00b inara: Further cleanup
* missing 'this' variables declared in This.__init__()
* Types up to end of journal_entry()
2021-04-12 08:31:47 +01:00
Athanasius
6e98cf04d9 inara: Begin conversion to 'This' class. 2021-04-12 08:31:47 +01:00
Athanasius
8cbf37624c Inara: Ignore cognitive complexity & snake_case a var 2021-04-12 08:31:47 +01:00
Athanasius
f494a948eb inara: Rename ALLCAPS function vars for padding. 2021-04-12 08:31:47 +01:00
Athanasius
9fd14a3980 Inara: Don't send a setCommanderReputationMajorFaction if we have no Reputations
Sure the `for k, v in ...` means not sending any that are empty/none,
but it will still send the event, just with *no* reputations.

When you're on a fresh character you have no reputations yet, so avoid
causing an Inara API error, including status line text.

Close #581
2021-04-12 08:31:47 +01:00
Athanasius
5edf8d5b59 Change monitor.state['on_foot'] to 'OnFoot' for consistency 2021-04-12 08:30:51 +01:00
Athanasius
734cb9ed11 Inara plugin now maintains Station Name when on_foot 2021-04-12 08:30:51 +01:00
Athanasius
d585dd9233 Also str() appversion in EDSM and Inara plugins 2021-04-01 14:46:43 +01:00
Athanasius
2f9789afdd Update all code to use config.appversion() as a function
This *also* caught some instances where appversion_nobuild should
already have been used, so those were both changed and updated to a
function call.
2021-04-01 14:45:52 +01:00
Athanasius
3ed08f0f7e plugins/inara: Avoid Tk event_generate() calls during shutdown
# Conflicts:
#	plugins/inara.py
2021-04-01 14:45:48 +01:00
A_D
b5a8c03980 Added missing whitespace 2021-04-01 14:45:48 +01:00
A_D
b694bdc965 Added per-event killswitch 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
A_D
8dca6783fc Fixed spelling, added utility methods 2021-04-01 14:45:47 +01:00
A_D
d5b62d957b Added support for comments in kill switches 2021-04-01 14:45:47 +01:00
A_D
f10cd9d70f Dont exit inara worker thread 2021-04-01 14:45:47 +01:00
A_D
d81093760e Added hooks into killswitches in plugins 2021-04-01 14:45:47 +01:00
A_D
278480b99f replaced ors with defaults in config usage 2021-04-01 14:45:46 +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
9b09d8bd07 plugins/inara: Close down logging & Remove unused this.queue.
* The new_worker/NewThis doesn't currently have a mechanism to ask the
 new_worker to exit.  It's relying on being a daemon thread and dying
 once all non-daemon (i.e. main) threads have exited.
2021-04-01 14:45:44 +01:00
Athanasius
aab2a58a2d Reduce some log spam:
* Comment out the traceback in plugins/eddn.py, the return is enough.
* 'Called with no event_queue' can be TRACE.
* Don't care about "Everything was alright, the near-neutral status just
  wasn't stored." from Inara.
2021-03-23 13:48:44 +00:00
Athanasius
462cd25312 config: Make config.shutting_down() a property, and change 'callers' 2021-01-11 16:54:09 +00:00
Athanasius
111f445cac plugins/inara: Avoid Tk event_generate() calls during shutdown 2021-01-11 16:45:45 +00:00
Athanasius
a3b69fd94d Switch internal plugins to EDMCLogging.get_main_logger() 2020-09-22 16:20:05 +01:00
A_D
6fc2ab063e
finished type annotation 2020-09-18 07:28:30 +02:00
A_D
5af2511137
Updated docstrings 2020-09-18 06:44:20 +02: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
bd7a3eca04 plugins/inara: return '' if can't otherwise make system_url 2020-08-27 11:28:41 +01:00
Athanasius
113b6c427c station providers: Ensure the 'early station' functionality for all
* If you request docking successfully then show the station namd and
  have the link work.
* This is then only undone if you:
	1) Dock and undock
	2) Supercruise away
	3) Jump away
  It is *not* undone if you simply cancel the docking request.

Tested only with same provider for system and station for each of the
three, not the other 6 combinations.
2020-08-27 11:28:36 +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
8d6f761fb9 plugins/inara: return '' if can't otherwise make system_url 2020-08-26 12:01:45 +01:00
Athanasius
bf9d7dff89 station providers: Ensure the 'early station' functionality for all
* If you request docking successfully then show the station namd and
  have the link work.
* This is then only undone if you:
	1) Dock and undock
	2) Supercruise away
	3) Jump away
  It is *not* undone if you simply cancel the docking request.

Tested only with same provider for system and station for each of the
three, not the other 6 combinations.
2020-08-26 11:55:23 +01: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
265faf3cdd
Reordered imports 2020-08-07 13:45:06 +02:00
A_D
3155b929fa
Fixed docstring on Credentials, log wording 2020-08-07 13:37:19 +02:00