This was wrong since 291fbf2908e0f7419769a7727ee0a79cf58a9342 due to the
check saying "only active if in CQC", when it needed to be "only active
NOT in CQC, along with these other conditions".
* Session.profile() was unused (used to be called from stats.py, but
that uses cached data now).
* Session.query() was unused, other than by itself. Normal calls will
currently be via companion.Session.station(). Future CAPI queries
like `/fleetcarrier` might add their own companion.Session function.
* And in doing so get --capi-pretend-down working again.
* Small tweak to EDMarketConnector to not throw extra exception if there
was a CAPI query exception.
* If we don't invalidate then the companion.Auth code will do nothing
due to "already auth'd".
* We need to give the auth flow time to complete, so need to return.
* As that auth flow can take indeterminate time, not setting a timed
retry of the CAPI query here. We should consider setting a flag and
reacting in the Auth code though.
I keep observing it take 3-4s to update the UI after a manual CAPI
request. This showed up as mostly *in*
AppWindow.capi_handle_response(), but the moment I ran it under PyCharm
profile that went down to 400ms.
* The 'EDMC' prefix on all these classes is to make it clear they're for
internal passing around of requests/responses, rather than holding the
literal raw CAPI request and response.
* The request and response queues are now commented, including the
detail that the response queue is created by the caller and then set
'here' by Session.set_capi_response_queue().
EDMC.py will also need to make CAPI queries using the new threaded
method, but it has no tkinter, thus we need to pass in the event name
when we expect one to be generated, and only generate it if this is not
None.
It will write a file containing JSON that has a top level dict with a
key per endpoint we have data for, and within each of those a dict with
keys for query_time and the raw_data.
Everything from the opening `{` in that raw_data value until the
matching closing `}` is the raw data from the CAPI service.
The whole file happily goes through `jq -S -C '.'` to examine the
output.
* Base the following on common EDMCCAPIReturn: EDMCFailedrequest,
EDMCCAPIRequest, EDMCCAPIResponse. This saves repeating a bunch of
variable types and comments.
* Use the above throughout the 'Update' button flow.
* Still need to address 'Save Raw Data', i.e. AppWindow.save_raw().
* 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.
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.
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.
* `--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.