Commit Graph
96 Commits
Author SHA1 Message Date
A_D 87df8d8ab8 suppressed exceptions in migration code 2021-04-01 14:45:46 +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 8aac704fa1 plugins/edsm: start/stop detailed logging. 2021-04-01 14:45:44 +01:00
Athanasius 462cd25312 config: Make config.shutting_down() a property, and change 'callers' 2021-01-11 16:54:09 +00:00
Athanasius bca0231dfc plugins/edsm: Avoid Tk event_generate() calls during shutdown 2021-01-11 16:45:26 +00:00
Athanasius 3d3baaea8e EDSM: Finer-grained and more detailed logging of API results 2020-10-01 11:47:31 +01:00
Athanasius a4b334dcfb EDSM: When we API call a Location event, log all events in that call. 2020-09-28 15:34:39 +01:00
Athanasius 1aba1a0596 Trace: Change several calls from debug to trace. 2020-09-23 22:07:18 +01:00
Athanasius 85d45aadd7 Place detailed logging for "Location" events.
To try and track down what's happening with #713
2020-09-23 11:45:48 +01:00
Athanasius a3b69fd94d Switch internal plugins to EDMCLogging.get_main_logger() 2020-09-22 16:20:05 +01:00
A_D c02b292f50 Removed uneeded list comps 2020-09-22 14:51:45 +02:00
A_D f8523e0a9f removed parens around tuple unpack 2020-09-22 14:49:24 +02:00
A_D e930911415 remove double assign 2020-09-22 14:49:23 +02:00
A_D 9710a5e9bb repalced assert with log and continue 2020-09-22 14:49:23 +02:00
A_D 375573c0a8 fixed docstrings 2020-09-22 14:49:22 +02:00
A_D 615a36452d Added docstrings 2020-09-22 14:49:22 +02:00
A_D 4a7cddc48b removed assert False 2020-09-22 14:48:54 +02:00
A_D 26be93f92e replaced magic number row with var 2020-09-22 14:48:53 +02:00
A_D fb080f8080 Removed unused imports 2020-09-22 14:48:53 +02:00
A_D 893cab3c23 cleaned up logic where possible 2020-09-22 14:48:52 +02:00
A_D f2add920c7 replaced constant contains checks with tuples 2020-09-22 14:48:52 +02:00
A_D 62f3203c3f Added type checker hint for unbound names
Due to the fact that cmdr and entry are only assigned if item exists, a
situation can arise where any access to the names will raise an
UnboundLocalException, this tells the type checker to ignore that
possibility by using a TYPE_CHECKING guarded assignment to those names.

This does not fix the issue at runtime, it just tells the type checker
that its fine. As this remains a bug, I have left TODOs in to note its
existence.
2020-09-22 14:48:51 +02:00
A_D 7ab697a807 Used default option for .get on dicts 2020-09-22 14:48:00 +02:00
A_D 25adf29779 Fixed possible error if credentials is None 2020-09-22 14:48:00 +02:00
A_D 2c2ade05e0 fixed some naming 2020-09-22 14:46:23 +02:00
A_D 20357b3deb replaced modulo formatting with fstrings 2020-09-22 14:46:22 +02:00
A_D 81c977d0da Added type annotations to functions 2020-09-22 14:46:22 +02:00
A_D 14617e72da cleaned up overlong lines 2020-09-22 14:43:24 +02:00
A_D 199e76701d Added line breaks around scope changes 2020-09-22 14:43:24 +02:00
A_D 743984eb11 Added fake definition for _
_ is added by magic in the plugin loading system, which means there are
no imports to indicate its existence to static analysis tools.
2020-09-22 14:41:34 +02:00
A_D d2a1f09fac sorted imports 2020-09-22 14:41:34 +02:00
A_D 37c53e233e autoformatted code with autopep8 2020-09-22 14:41:33 +02:00
Athanasius 0f12959d53 plugins/edsm: Also DEBUG log Location and Docked events. 2020-09-22 12:26:54 +01:00
Athanasius 0efe38540f Extend logging to FSDJump as well for ease of testing.
FSDJump happens, relatively, seldom enough to not be too spammy.
2020-09-18 15:33:18 +01:00
Athanasius 3f001a383f plugins/edsm: Add extra logging for CarrierJump events.
We've had reports about EDSM not updating for these, so add logging to
see if it's a bug our end.
2020-09-18 15:15:02 +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 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
Athanasius f75d8c9c9c plugins/edsm: Set system_link based on system_provider, not station_provider 2020-08-27 11:23:53 +01:00
Athanasius d7c2372417 Flake8 cleanup round #2 2020-07-27 10:14:16 +01:00
Athanasius f9a23cc831 Clean up flake8 output for this branch 2020-07-27 09:37:10 +01:00
Athanasius 2e58d106bd logging.getLogger(appname) instead of import from EDMarketConnector
Using:

from EDMarketConnector import logger

causes issues if EDMarketConnector is already importing 'this' file.

So just get a logger using logger.getLogger(appname) instead.
`from config import appname` if needs be.
2020-07-27 06:57:52 +01:00
Athanasius 7951463fba plugins/edsm: Converted to proper logging 2020-07-27 06:57:52 +01: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 29e3cba67e plugins/edsm: 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.
* Ensure station text+link set on prefs change.
# Add a set of future TODO items.
2020-07-21 17:29:03 +01:00
Athanasius c25120e0aa plugins/edsm.py makes no use of import companion
So remove it.
2020-07-12 19:10:57 +01:00
Athanasius 259bb3bbd6 Merge branch 'release-final-python27' into python3 2020-06-21 16:43:02 +01:00