Commit Graph
688 Commits
Author SHA1 Message Date
Athanasius 3fb372fb11 EDSM: Remove actually un-necessary, and bug-inducing "not None" checks
I would have added these during a mypy cleanup, but it turns out they're both
not necessary *and* it actually prevents the EDSM Settings tab from properly
populating.
2023-01-22 13:09:34 +00:00
Athanasius dbb471f2c2 eddn/tracking: Add BodyType to tracking UI
This helps demonstrate that a 'spurious' Station BodyName/ID is actually OK,
because BodyType makes it clear.
2023-01-16 19:32:44 +00:00
Athanasius 46fd129d3e eddn: Expand the tracking UI for all system, body & station location data
* Also renamed This.systemaddress to this.system_address, which impacted
  misc. other lines of code.
2023-01-16 18:10:57 +00:00
Athanasius b5bb9657d8 eddn: Move tracking_ui_update() nearer top of journal_entry()
With the tracking now being in monitor.py this needs to be ASAP after the
local copies of the tracking have been updated.

Below the possible `this.status_body_name` blanking, in case that's hit.
2023-01-15 21:54:02 +00:00
Athanasius 7b62fa1125 plugins/inara: Use state[...] values for system/station
* Also renamed system -> system_name & station -> station_name
2023-01-11 19:44:47 +00:00
Athanasius c396a253f8 plugins/edsm: Use state[...] values for system/station
* Also renamed system -> system_name and station -> station_name
2023-01-11 19:44:46 +00:00
Athanasius 31e8d0372d monitor/tracking: Move .station_marketid to state['MarketID']
1. plugins/eddb.py uses this for MarketID-based station URLs.

* So do the 'rename'.
* Remove EDDB tracking in favour of this.
* Update PLUGINS.md
2023-01-11 19:44:44 +00:00
Athanasius 2a8dd14e24 tracking/stationname; Minor fixups
* Missed a some `self.station` in monitor.py
* Fixed EDDB system *and* station link setting.  Brainfart had mixed them
  together in last commit.
2023-01-11 19:44:43 +00:00
Athanasius dde0cf876c monitor/tracking: Move .station to state['StationName']
1. EDDB tracks this.

* So move monitor.station to monitor.state['StationName'].
* PLUGINS.md updated to cite this.
2023-01-11 19:44:41 +00:00
Athanasius df5eb5b270 monitor/tracking: Switch .systempopulation to state['SystemPopulation']
1. EDDB plugin tracked this for keeping the Station link text up to date.

* So moved it to monitor.state['SystemPopulation'].
* PLUGINS.md updated to cite this.
* PLUGINS.md also updated to note state entries that are set to None if
  remote multi-crew is detected.
2023-01-11 19:44:14 +00:00
Athanasius dbad45cf3b EDDB: Use only state['SystemName'] for this.system_name tracking 2023-01-11 19:44:13 +00:00
Athanasius 86e81adb3d EDDB: Rename this.system to this.system_name 2023-01-11 19:44:12 +00:00
Athanasius fa1c072d9e monitor: Change .system to state['SystemName']
1. EDDB plugin needs to track the system name, but we're moving all of that
  into monitor.py.
2. monitor.py was tracking this in monitor.system, but it needs to be in
  monitor.state['SystemName'] in order for plugins to access it.

So, move monitor.system to monitor.state['SystemName'] and update all uses.
2023-01-11 19:44:08 +00:00
Athanasius fafe9a5f7b eddn: Remove un-necessary 'music'/'MainMenu' body tracking clearance
monitor.py does this for `state` passed in, which *this* code then uses
to set `this` values.
2023-01-11 19:43:23 +00:00
Athanasius 427a238dee eddn: Remove un-necessary 'leavebody' state clearing
This is now handled in monitor.py, and *this* code explicitly sets the
'this' values to those in `state` as passed in.
2023-01-11 19:43:22 +00:00
Athanasius 386ea1636e eddn: For 'docked' only set entry Body(Type) if latter is 'Planet'
We explicitly must not set this for other BodyType, e.g. 'Station'.
2023-01-11 19:43:20 +00:00
Athanasius 6f3967fb7f eddn/tracking: Tweak commenting about coordinates
* `entry_augment_system_data()` will now always be passed starpos based
  on state['StarPos'].
* Removed TODO about deprecating in-plugin tracking.
2023-01-11 19:43:19 +00:00
Athanasius e6abc137ce monitor/tracking: Shift .coordinates to state['StarPos']
* Some additional commenting for future clarity.
* Remove the old eddn.py tracking.
2023-01-11 19:43:18 +00:00
Athanasius 232e91ebfc monitor/Body: Tweak & comment, and remove defunct tracking from eddn.py
* Typod '.status' instead of 'state'.
* Bring in some sanity-checks and comments from eddn.py to monitor.py.
* Have a 'pass' elif for 'supercruiseentry' so as to comment why we do NOT
  use this to blank out body state.
* Bring in the 'if we exit to main menu, blank body state' from eddn.py.
* Remove checks from eddn.py that are now in monitor.py.
* Have a disctinct 'docked' event check in eddn.py for triggering the
  "Now we're docked, so the Delay sending until docked is satisfied"
  sending of messages.
2023-01-11 19:43:17 +00:00
Athanasius 86b0aa4550 monitor: Track all System and Body state in monitor.state
* Minor grammar edit only in PLUGINS.md (I was checking if it explicitly
  stated what data is expected in the synthetic 'StartUp' event, it doesn't).
* First changes to move some monitor properties into the monitor.state
  dictionary.  This is for system or body data.
* Re-factored the generation of 'StartUp' event into
  `EDLogs.synthesize_startup_event()`.  It's done in two places, so was
  anti-DRY.
* In general any bulk setting of system & body data is now done in the
  same order for comparison clarity.
* A little of the location tracking has been duplicated from plugins/eddn.py.
  This is with a view to switching *it* to using the state version.
2023-01-11 19:43:14 +00:00
Athanasius 7d4118738b Add some missing LANG comments, as per script output 2023-01-03 11:46:27 +00:00
Athanasius 0fd835e9ac core plugins: A little more 'children' fixup
* eddn: Needs to find status text, although really there should be a helper
  function for this.
* Removed commented out references to same in edsm and inara.
2022-12-31 16:49:29 +00:00
Athanasius f2de70bad6 core plugins: Use nametowidget() to find system/station widgets
As we're experimenting with per-plugin frames up a level `parent.children`
would need to be `parent.parent.children`, but this way it will Just Work
without knowledge of the hierarchy.
2022-12-31 16:27:22 +00:00
Athanasius 3f91e57c7c plugins/eddb: Fix journal_entry() and new_data types
plug.py does `dict(entry)` before calling a plugin's `journal_entry()`, so
`dict` is correct for `data`.  Thus also use that for `new_data`'s type.
2022-12-30 16:34:17 +00:00
aussig 41962663d8 Merge branch 'develop' into feature/847/capi-fleetcarrier 2022-12-24 08:21:18 +00:00
Athanasius 5e19d3e9aa plugins/eddn: No need for typing.(Dict|List) usage 2022-12-23 14:47:40 +00:00
Athanasius ce4a6ff898 plugins/eddn: Remove the 'default values' from should_retrn & new_data
In *this* case the variables *are* used in the scope so become bound, so
we can get away with bare type declaration.
2022-12-23 14:47:26 +00:00
Athanasius 2c11aef1be plugins/eddn: Use correct logging function & new_data typing
* `logger.INFO` will, at best, be a constant, it should be `logger.info()`.
* When we're not interested in the `new_data` 2nd part of the tuple from
  `killswitches.check_killswitch()` we can't use `_` as there's a potential
  class with the `l10n.py` injection of `_()` as a builtin.

  And you can't declare types withing first-use in a return-tuple. So, declare
  them on their own lines, with throwaway default values instead.
2022-12-23 14:47:25 +00:00
Athanasius e66bae090b plugins/inara: Minor typing fixes 2022-12-23 14:47:24 +00:00
Athanasius 71cbfb8358 plugins/edsm: Lots of type fixing, inc. conditionals where None is possible 2022-12-23 14:47:23 +00:00
Athanasius ca233a40a8 plugins/coriolis: Minor type fixes. 2022-12-23 14:47:22 +00:00
Athanasius 26b12f5b14 plugins/inara, plug.py: Minor typing fixes 2022-12-23 14:47:18 +00:00
aussig 3e295db061 Typing of return values from killswitch.check_killswitch() 2022-12-22 17:39:20 +00:00
Athanasius 868c1d8e57 docs: Fix up references to setup.py to be to Build-exe-and-msi.py 2022-12-20 16:51:58 +00:00
Athanasius ba68397b3f CAPI killswitches: endpoint killswitches & eddn export ones too
* Added `capi.request.<endpoint>` killswitches at appropriate call points.
* Added `eddn.capi_export.<type>` killswitches.  This allows for killing
  just the EDDN export of such CAPI-derived data, without stopping the actual
  queries, as other plugins/functionality might still have harmless use of
  the data.
* PLUGINS.md: Actually describe the contents of `data` passed to plugins, and
  point out it might not always contain market or shipyard data.  This is
  not only because of the new killswitches, but could already have happened
  if the station/port docked at didn't have the services.
* Some misc typing cleanups.
2022-12-16 15:06:01 +00:00
Athanasius e245a75e61 EDMC: Get -n working again
* eddn: Don't schedule `queue_check_and_send()` if EDMC_NO_UI.
* `export_(commodites|outfitting|shipyard)` lost the `is_odyssey` argument
 in 556ace5306 .
* EDDNSender: Helper `set_ui_status()` in which the check for EDMC_NO_UI
  is performed.  Used in `send_message()`.  In the EDMC_NO_UI case it will
  INFO log the text instead.
2022-12-14 11:15:20 +00:00
Athanasius 0915bad95d CAPI/EDDN: Enable sending of Legacy data
As we already took some care in the EDDN code we can just make
`cmdr_data_legacy()` call through to `cmdr_data()`.
2022-12-08 12:10:15 +00:00
Athanasius 38c2f19474 eddn: Suppress "converted file" for legacy if no file
This was a total brainfart, `finally:` is never what was wanted here.
So, just `return` if `FileNotFoundError`.
2022-12-05 16:40:44 +00:00
Athanasius 6bd48a163c eddn: Ensure CAPI-sourced messages have uploaderID set
If no 'live' Journal events yet, plugins/eddn won't have had an event to set
this from.
2022-12-05 15:53:27 +00:00
Athanasius a6f9a31fd9 plugins/edsy: flake8 and mypy pass 2022-12-04 16:20:08 +00:00
Athanasius ba81d95c1e plugins/edsm: Align comments and docstrings with plugins/eddb 2022-12-04 16:12:58 +00:00
Athanasius 73c4bcfcc7 plugins/eddb: flake8 & mypy now clean
* Converted to `class This` paradigm.
2022-12-04 15:57:09 +00:00
Athanasius 62ed12eba3 plugins/eddb: flake8 pass 2022-12-04 15:36:00 +00:00
Athanasius abe13176e7 EDSM: Timed latch for notifying about Legacy galaxy data
This avoids the spam from EDSM itself objecting to the passed gameversion.
We don't even send anything but Live data now.
2022-12-01 18:00:47 +00:00
Athanasius db4f59dd16 Inara: Remove the "update 14 date passed?" check
- We're now past there and no-one should expect that messing with their clock
  will bypass this check.
2022-12-01 17:43:31 +00:00
Athanasius b4c4e44cb7 eddn/CAPI: Use a common function for game_version strings
* This did, however, remind me that the `data` passed into `cmdr_data()`
  is an amalgam of `/profile`, `/market` and `/shipyard` queries.

  This means that the data.source_endpoint is **not correct for all of
  the data and its use**.  As such I had to pass 'hard coded' values into
  the function from the various CAPI export functions.  They know what it
  is they're exporting.

* As this reminded me that "CAPI `data` is actually a `CAPIDATA`", I've
  documented that in PLUGINS.md, but with a dire warning against relying on
  any of the extra properties.
2022-12-01 16:42:06 +00:00
Athanasius b40d3b889f CAPI: Use CAPI-Live-<endpoint> game_version for market & shipyard 2022-12-01 16:42:05 +00:00
Athanasius 4a8b5ed4b6 Merge pull request #1735 from EDCD/fix/1732/inara-do-not-send-empty-required
Inara: Drop various combat messages if empty opponentName
2022-12-01 16:41:32 +00:00
Athanasius 26413177a6 Inara: Also check opponentName on EscapeInterdiction
And sprinkly comments around giving a reason for the checks.
2022-12-01 13:45:10 +00:00
Athanasius aac660fb05 Inara: Also catch empty opponentName for Interdict*ion* 2022-12-01 13:37:56 +00:00