1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

733 Commits

Author SHA1 Message Date
Athanasius
0e4e31d733
EDMarketConnector: Correct back to dashboard.start()
Bad PyCharm refactor/rename in 81b5d015fdeecfcf2236a61c433d4c2dac929668
2021-09-02 19:41:37 +01:00
Athanasius
018ee49a0d
Fix logic for 'Update' button visual state wrt CQC
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".
2021-08-31 15:03:41 +01:00
Athanasius
796bb1f863
CAPI: Remove unuses Session.query/profile()
* 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.
2021-08-31 14:08:15 +01:00
Athanasius
092b10447c
EDMarketConnector.py: Early return from AppWindow.save_raw() 2021-08-31 12:09:02 +01:00
Athanasius
d1dbd9da8f
AppWindow.capi_request_data: Specific "We're aborting query" messages 2021-08-30 12:55:45 +01:00
Athanasius
9e206d092c
Fix "" string to be '' 2021-08-28 14:36:54 +01:00
Athanasius
e3cd1d6429
EDMarketConnector: Comment about no timed CAPI retry on re-Auth 2021-08-28 14:27:20 +01:00
Athanasius
024e2ba357
EDMarketConnector: invalidate companion session and return on CredentialsError
* 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.
2021-08-28 14:24:54 +01:00
Athanasius
bc29891cc1
CAPI: Some notes in comments 2021-08-28 14:14:56 +01:00
Athanasius
12b1e9b7bc
CAPI: Add more trace_if('capi.worker', ...) to check timings
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.
2021-08-28 13:58:46 +01:00
Athanasius
6c24d9291a
CAPI: EDMarketConnector: Don't Session.invalidate() on CredentialsError 2021-08-26 15:13:33 +01:00
Athanasius
885745197c
CAPI: EDMarketConnector: Set status text on ServerConnectionError 2021-08-26 15:00:16 +01:00
Athanasius
816384f16f
CAPI: Begin taking auth retries out of CAPI queries
* Only set/use retrying as companion.session.retrying (untested).
* Don't call Session.login() from CAPI query code, raise
  CredentialsError instead.
* Also don't Session.close() in CAPI query code.
2021-08-26 14:44:43 +01:00
Athanasius
e1c6a0e9f8
CAPI: Create response queue in companion.Session
No need to create in callers and then use setter.
2021-08-25 11:50:56 +01:00
Athanasius
69d0d03b9b
CAPI: Rename to EDMCCAPIFailedRequest & comment queues
* 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().
2021-08-25 11:42:53 +01:00
Athanasius
0456996cdd
EDMarketConnector: Save querytime to config *before* triggering API 2021-08-25 11:36:39 +01:00
Athanasius
dad2f95f64
EDMarketConnector: Correct arg to tk overrideredirect to bool 2021-08-25 11:34:51 +01:00
Athanasius
5710f3fd61
CAPI: Only import queue in EDMarketConnector.py 2021-08-25 11:33:52 +01:00
Athanasius
4397acc6fb
CAPI: Status text when aborting due to CQC (& en.template updated) 2021-08-24 14:06:12 +01:00
Athanasius
3df688ecd4
CAPI: Pass in that tk_response_event from AppWindow.capi_request_data() 2021-08-24 12:43:33 +01:00
Athanasius
1dcefafc73
CAPI: Pass tk_response_event in Request to optionally use in response
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.
2021-08-24 12:41:02 +01:00
Athanasius
1c93c3a9fa
CAPI: 'Save Raw Data' now using cached copy
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.
2021-08-23 18:29:37 +01:00
Athanasius
d53b567fca
CAPI: s/querytime/query_time/ in variable names
But not in the config setting, as that would require a migration.
2021-08-23 18:29:36 +01:00
Athanasius
f80623e025
CAPI: Convert full Update flow to class passing
* 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().
2021-08-23 18:29:36 +01:00
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
8d6fae6ef6
EDMarketConnector.py: style fix 2021-08-16 15:28:13 +03:00
d068dc7620
Merge branch 'develop' into enhancement/1096/CAPI-pretend-down-CL-arg 2021-08-13 23:04:42 +03:00
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
97998e6de9
EDMarketConnector.py: clarify comments about CQC 2021-08-11 14:00:32 +03:00
3283439485
Code style fixes 2021-08-10 03:00:36 +03:00
ad4304a184
Be more paranoid with empty events when in CQC 2021-08-09 17:23:57 +03:00