Commit Graph
809 Commits
Author SHA1 Message Date
Athanasius c1deb9113e CAPI: 'station' query going via work queue
* Defined inner functions in the worker function to handle the actual
  queries.  This allows for *them* to simply return data or raise
  exceptions to be caught by the main worker function.  *IT* then
  handles returning any error appropriately via the queue to AppWindow.

* Due to the coupling between AppWindow and these queries there are
  several extra parameters passed into the queue worker and then back
  out.  This is largely due to having to split AppWindow.getandsend()
  into two functions: capi_request_data() and capi_handle_response().

  This might get changed to use a class to encapsulate those values,
  rather than the bare tuple currently being used.

* No full flake8 & mypy pass done yet.

* Some companion.py globals renamed so their use is more obvious.
2021-08-23 18:29:34 +01:00
Athanasius 454c9f3d0c CAPI: Continuing code moving/cleanup up/testing
1. Sending back a spurious CredentialsError() to check it's now handled,
   but other issues blocking the code from getting there currently.
2. Move the "Update suit data from CAPI" call into the AppWindow
   handler.
3. Move some more of the old query() exception handling into the worker.
4. session.query() no longer returns anything, and neither should
   anything that calls it (like session.station()).  This is going to
   take quite some unwinding and code moving.
2021-08-23 18:29:32 +01:00
Athanasius 018b4563b3 CAPI: return good data from worker & start handling reauth 2021-08-23 18:29:32 +01:00
Athanasius 7f362be740 CAPI: Reinstate/format post-query exceptions/etc in AppWindow 2021-08-23 18:29:32 +01:00
Athanasius 407bc9f53a CAPI: Set companion.Session.tk_master ASAP from AppWindow 2021-08-23 18:29:31 +01:00
Athanasius 655c7ea1ca CAPI: Some progress in using a Queue to signal result/error
Due to main app being Tk we can't just use Python async functionality.

So instead we have a class to hold a message and optional exception.
And instance of that goes into a queue.
The reading of that in the main thread is triggered by sending a Tk
event.

Much more to come.
2021-08-23 18:29:31 +01:00
Athanasius 2fc1568bf7 CAPI: Move CAPI response processing into AppWindow.capi_handle_response() 2021-08-23 18:29:31 +01:00
Athanasius e79d219657 CAPI: Rename AppWindow.getandsend() to be more obvious 2021-08-23 18:29:31 +01:00
Athanasius 9c079c190d CAPI: Set up AppWindow handling of <<CAPIResponse>> Tk event 2021-08-23 18:29:31 +01:00
Athanasius 9661d770cb companion: Implement, and use, asking CAPI thread to close down 2021-08-23 18:29:30 +01:00
Athanasius bfaf66d873 EDMarketConnector: Correct back to monitor.start()
Bad PyCharm Refactor ! No Cookie!
2021-08-23 18:29:30 +01:00
Athanasius 81b5d015fd Frontier Auth: Rename start() method to something more obvious 2021-08-23 18:29:29 +01:00
norohind 8d6fae6ef6 EDMarketConnector.py: style fix 2021-08-16 15:28:13 +03:00
norohind d068dc7620 Merge branch 'develop' into enhancement/1096/CAPI-pretend-down-CL-arg 2021-08-13 23:04:42 +03:00
norohind 01bd637730 Add CL arg --capi-pretend-down in order to pretend that CAPI is down 2021-08-13 21:47:47 +03:00
Athanasius 4433b67c82 EDMarketConnector: Use logger.trace_if(...)
Yes, leaving that 'truncating plain logfile' as plain trace.
2021-08-13 15:14:03 +01:00
Athanasius f7d0db8354 TRACE: Add some INFO logging if activating TRACE or TRACE_ALL 2021-08-13 12:03:04 +01:00
Athanasius 80976c8cf5 TRACE: Don't require --trace with other trace options
* `--trace-on ...` no longer requires `--trace` as well.
* Corrected check for `--trace-on *|all`.
* Updated Contributing.md to reflect mandated use of
  `logger.trace_if(...)`, with bare `logger.trace(...)` only for on the
  fly, code not going to be merged, use.
2021-08-13 11:55:10 +01:00
Athanasius cf399da8d7 TRACE: Tweak --trace-all help message
Yes, it actually uses TRACE_ALL level, that's why I didn't capitlise
'trace' in 'Force trace level logging ...'.
2021-08-13 11:39:19 +01:00
Athanasius e10e8390a3 TRACE: Move --trace-on arg to between --trace and --trace-all 2021-08-13 11:37:24 +01:00
Athanasius 80da39d393 TRACE: Tweak --trace-on help reference to */all arg 2021-08-13 11:36:38 +01:00
A_D e75eb6dd4b clarified docs, added * and all support to --trace-on 2021-08-12 20:27:54 +02:00
A_D 03d90daedc added support for --trace-all argument to ignore trace-if directives 2021-08-12 16:46:04 +02:00
norohind 97998e6de9 EDMarketConnector.py: clarify comments about CQC 2021-08-11 14:00:32 +03:00
norohind 3283439485 Code style fixes 2021-08-10 03:00:36 +03:00
norohind ad4304a184 Be more paranoid with empty events when in CQC 2021-08-09 17:23:57 +03:00
norohind 291fbf2908 Use both Ship and GameMode fields of LoadGame event to detect CQC
And freeze update button when in CQC
2021-08-09 15:59:30 +03:00
norohind 27fe43bf8c WIP: implement journal_entry_cqc()
journal_entry_cqc function in plugin's api allow plugins to recieve
journal events when player are in CQC
2021-08-09 04:37:23 +03:00
Athanasius 9a393af430 Merge pull request #1183 from A-UNDERSCORE-D/fix/1182/Option-to-hide-private-group-name
Add options to hide private group name and multicrew commander name from UI
2021-08-07 19:30:42 +01:00
A_D a0c1854818 fixed letter transposition
I hate the word captain.
2021-08-07 20:20:48 +02:00
Athanasius 6e7ef6d80d logging: Don't force DEBUG if not TRACE
This was overriding the user-configured log level for the plain log
output.  The debug output still has DEBUG or TRACE as requested.
2021-08-06 09:06:54 +01:00
Athanasius 40b76d40cc Add --trace-on ... to activate specific trace logging
This is just the parsing and storage of the options for now.
2021-08-05 13:43:15 +01:00
A_D b42fcf1d4f added config option and prefs page 2021-06-28 10:28:56 +02:00
A_D fe7b8dbc6c Add config option for hiding current group/captian name 2021-06-28 08:45:29 +02:00
A_D fe0e752c9b Added support for arbitrary plugins for POST debug
This works by replacing --eddn-local with --debug-sender, and making the
webserver more generic. support has been added to EDSM, EDDN, and INARA.
2021-06-18 23:36:42 +02:00
A_D 4ef153b1b2 Added fake EDDN Listener
A simple HTTP handler has been added that will dump any and all POST
data it gets to EDMC's log.

Additionally, a new command line argument to switch EDMC to using this
as its EDDN target has been added.
2021-06-18 23:34:20 +02:00
Athanasius 713b6b753d CAPI: Catch where we're CAPI-docked, but monitor.station is None
Docked at an EDO settlement means CAPI says we are, but we've forgotten
monitor.station because there's not enough Journal information and too
many corner cases to be *sure* of re-using old data.
2021-06-13 20:09:00 +01:00
Athanasius 88b56b6913 CAPI: Add logger.warning() for *why* we raise ServerLagging 2021-06-13 19:43:14 +01:00
Athanasius a0b310f72e Translations: Amalgamate some LANG comments & en.template updated 2021-06-13 15:49:09 +01:00
Athanasius 7a858b25d2 EDMarketConnector.py: Fix following-line LANG comment 2021-06-13 15:13:09 +01:00
Athanasius cba3835698 EDMarketConnector: Split multi-_(...) line to separate ones for LANG comments 2021-06-13 14:57:14 +01:00
Athanasius e736f30358 Merge pull request #1158 from EDCD/enhancement/l10n-add-missing-LANG-comments
Add all missing LANG comments
2021-06-13 13:48:34 +01:00
Athanasius 7552e93f07 EDMarketConnector: Final LANG comments 2021-06-13 12:59:50 +01:00
A_D 284064d6ed Added CL arg to forget all frontier tokens
This is obviously quite annoying but should provide a magic fix to any
user with weird auth trouble (such as those seen by
EDCD/EDMarketConnector#1166 )

Closes EDCD/EDMarketConnector#890
2021-06-12 16:38:25 +02:00
A_D 09a0b70891 Switched logs to warning 2021-06-07 19:07:24 +02:00
A_D c4e9767974 Don't spam a stacktrace on requests.ConnectionError
ConnectionErrors are expected and not something we can fix. The
exception handler that was catching these previously is a catchall
intended to stop EDMC as a whole from crashing from something
unexpected.

Closes #1082
2021-06-07 19:06:27 +02:00
Athanasius efbc51c714 EDMarketConnector: Improve legacy LANG comments 2021-06-07 16:56:53 +01:00
Athanasius 631446f619 Translations: Final LANG comments
The script now outputs nothing about Unknown comments
2021-06-07 16:02:39 +01:00
Athanasius 2351ee0f02 EDMarketConnector: LANG comment pass 2021-06-07 15:32:52 +01:00
Athanasius 87ff0b08a1 Translations: Full phrase "Error: Check E:D journal file location" 2021-06-07 14:17:28 +01:00