Unfortunately we can't name the plugin ones, as that's entirely up to their
`plugin_app()` code, and widget names can't be changed after creation.
NB: Each `plugin_hr_X` frame is `grid()`'d to be *before* the plugin in
question, despite being listed *after* in:
>>> self.w.children['edmarketconnector'].children
Typing this as `update.Updater | None` and having the check
`if self.updater is not None:` causes the menu entry to not even get added,
because `import update` was coming later.
I can't recall why that import/setup was later, but I might be about to find
out again....
In testing the *first* hit on this does have `monitor.cmdr` set, but neither
`monitor.system` or `monitor.station`. So:
1. Allow those to be `None` in the function signature,
2. Guard against only `monitor.cmdr` being falsey before the call.
3. Move the `if err:` to the same scope.
Technically `theme.startup_ui_scale` should be `float` to match with
`default_ui_scale` from tkinter, but we store it in the config as `int`,
so go with that.
Also, the killswitch popup ends up un-themed *anyway*, so don't even call
`theme.apply()`. That function expects a `tk.Tk` not, `Toplevel`, and
doesn't even do anything for a `Toplevel` anyway.
* When PyCharm made a mess I accidentally undid two renames in
EDMarketConnector.py...
* ... but one of those actually *does* need to only close the session. So
made a new Session.close() that performs only the closing, with
Session.reinit_session() now utilising that.
* 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.
* New CL arge `--killswitches-file`. This needs to reference a file either
with an absolute path, or relative to the CWD of the process.
* Internally if the argument is provided it is prefixed with `"file:"` in
order to actually be loaded. This is because `requests` doesn't have an
adapter for `file:` URLs.
* Also fixes a visual bug with reporting of active killswitches. The entire
SingleKill object was used instead of just its `reason` property. mypy
type checks caught this.
It can be `tk.NORMAL` or `tk.DISABLED`. Why `True` was ever used I don't
know, possibly relying on undefined behaviour.
However, those 'types' end up as `Literal['normal']` and `Literal['disabled']`
and the only way to declare a Union of those is to be explicit with the
actual strings. tk.(NORMAL|DISABLED) are not a types.
* Renames `plug.notify_newdata()` to the more precise `notify_capidata()`.
* If CAPI data was from SERVER_LEGACY, then use plugin `cmdr_data_legacy()`
instead of `cmdr_data()`.
* Move it later, after CLI args processing. This would allow for a magic
'override' this, providing a key or similar.
* Correct text 'XAthan' to 'Athan' in 'win32' check.
* If `git_branch != 'develop'` check if `-alpha0` is in the app version.
Such version strings are never in any pre-release or release.
This has been relying on knowledge of the magic numbers for far too long.
As part of this, remove all the obfuscating "oh, default is 0, and we want
that or any other theme, so treat this like a boolean" nonsense.
Also, stop assuming that "> 1" is a synonym for "transparent theme". Just
Do The Equality Check.
* This is *temporary* pending properly implementing utilising the Legacy
CAPI host.
* Check in the EDMarketConnector.EDApp.capi_request_data() function *and*
also in some companion.session functions. But not absolutely all possible
entry points because we'll be undoing it when we implement Legacy support.
This *is* sufficient for the current core code entry points. If any plugin
is invoking its own CAPI requests, well it shouldn't be.
This flag controls whether commodity, outfitting or shipyard schema messages
are sent. Thus 'MKT' ('market') is misleading. Rename it so the intent when
used is clear.