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

659 Commits

Author SHA1 Message Date
Athanasius
596df0f987
CAPI 'Save Raw Data': Add '.' between system and station names in filename
It's apparently *always* just mushed them together, but that's really crap.
2023-01-10 11:49:58 +00:00
aussig
c6ec7cc362 Add some string localisations and improve lang comments. 2023-01-03 15:07:52 +00:00
Athanasius
7d4118738b
Add some missing LANG comments, as per script output 2023-01-03 11:46:27 +00:00
Athanasius
a4cd407b89
Add Help > Troubleshooting / Report A Bug 2023-01-03 11:39:47 +00:00
Athanasius
7bfeb5ec62
Actually uncomment plugin_frame.columnconfigure(1, weight=1)
It had been commented to test that it made a difference.
2023-01-02 14:05:07 +00:00
Athanasius
61ad75d52a
Configure per-plugin Frame the same as main Frame
It was observed that some text in the EDMC-Canonn plugin was wrapping in
this branch when the same text doesn't in `develop.  So, tweaked the
plugin_frame setup to match the main UI frame setup:

* `tk.NSEW` not `tk.EW` - didn't fix the problem, but we should match this.
* `.columnconfigure(1, weight=1)` - this actually fixed the problem.
2023-01-02 13:02:22 +00:00
Athanasius
963b115e0e
UI: Name the extra 'alternate' frames: titlebar and menubar
These are used in the non-default themes, as the OS ones are hidden and
replaced by them.

They're created after the rest of the main UI, so come last in the 'children'
list.
2022-12-31 17:12:29 +00:00
Athanasius
a842ce28c6
UI: Create a per-plugin frame in the main UI
* This means all actual plugin UI will be children of this frame, rather than
  the main frame.
2022-12-31 16:52:36 +00:00
Athanasius
ce1303e9e6
UI: Make a frame to hold each plugin's UI
NB: Currently breaks some core/internal plugin code, due to use of
`parent.children` and the like.  That will get addressed in subsequent
commits.
2022-12-31 16:16:52 +00:00
Athanasius
0705d56bb4
Properly name the main UI tk widgets
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
2022-12-31 16:08:39 +00:00
Athanasius
80e2aee6bb
updates: Add comment about 'early' import update working after all
Tested both under PyCharm debugging for 'internal', and py2exe-build .exe
for 'external'.  In both cases the 'Help' > 'Check for updates...' works.
2022-12-30 18:17:01 +00:00
Athanasius
ce4ae74434
update checks: Move setup of self.updater before menu entry
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....
2022-12-30 18:10:36 +00:00
aussig
933520c5af Switch to using a bool config value for fleetcarrier CAPI instead of int 2022-12-30 15:39:32 +00:00
aussig
4a2401983d Add preference for enabling / disabling CAPI fleetcarrier endpoint 2022-12-29 14:50:34 +00:00
aussig
1c39ca5eb9 Merge branch 'develop' into feature/847/capi-fleetcarrier 2022-12-24 10:38:22 +00:00
aussig
fc80d8ffd6 Revert "Fix for exceptions thrown on journal events"
This reverts commit 754367618ff273b94ae459544a7c73b86a182499.
2022-12-24 10:18:37 +00:00
Athanasius
81a8122c59
Indent if err: check after plugin dashboard invocation
Adding a mypy-make-happy conditional on the call above means `err` needs
to be inside that as well.
2022-12-24 10:15:41 +00:00
Athanasius
5d1eb9e3b1
Fix "could be None" conditional for call to plug.notify_journal_entry()
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.
2022-12-24 10:11:11 +00:00
aussig
754367618f Fix for exceptions thrown on journal events 2022-12-24 09:27:18 +00:00
aussig
41962663d8 Merge branch 'develop' into feature/847/capi-fleetcarrier 2022-12-24 08:21:18 +00:00
A_D
f94072a99e
EDMarketConnector.py: Guard platform specific func
Some callback functions are only used on windows, but defined for
everyone, this causes mypy to fail in fun ways.
2022-12-23 18:17:33 +02:00
Athanasius
b3719347e8
EDMarketConnector: No need for Typing.Dict 2022-12-23 14:47:35 +00:00
Athanasius
eaaa6fead0
Correctly type theme ui_scale variables
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.
2022-12-23 14:47:31 +00:00
Athanasius
4de83747f8
EDMarketConnector: More minor type fixes
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.
2022-12-23 14:47:30 +00:00
Athanasius
69d764c027
EDMarketConnector: More misc type fixes 2022-12-23 14:47:29 +00:00
Athanasius
e45a89d970
EDMarketConnector.py: Minor type fixes & ttkHyperlink.py too 2022-12-23 14:47:28 +00:00
aussig
3e295db061 Typing of return values from killswitch.check_killswitch() 2022-12-22 17:39:20 +00:00
aussig
9e17c46b25 Implement suggestions from PR #1773. 2022-12-22 16:21:42 +00:00
aussig
cb2a6b6995 Merge branch 'develop' into feature/847/capi-fleetcarrier 2022-12-22 15:32:17 +00:00
Athanasius
292b449cf6
Fix up companion.Session.close() refactor
* 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.
2022-12-22 09:15:16 +00:00
aussig
6ebdea1a6c Fleetcarrier CAPI now triggered by certain carrier journal events, and throttled on its own cooldown (15 mins) 2022-12-21 23:00:36 +00:00
aussig
8e5953408e Handling of /fleetcarrier CAPI endpoint and implementation of plugin callback function 2022-12-21 23:00:35 +00:00
aussig
eedf4febdf Initial implementation of CAPI /fleetcarrier endpoint 2022-12-21 23:00:35 +00:00
Athanasius
579c95024b
'develop only for devs': d'oh, re-allow Athan on Windows 2022-12-21 10:45:55 +00:00
Athanasius
8386487dc1
Tweak non-developer-running-develop check
This allows for someone running a custom branch, with working `git branch`,
even if it's an `-alpha0` version.
2022-12-20 17:58:38 +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
1cc4a9d0af
CAPI killswitches: 'capi.auth' now preventing all CAPI actions. 2022-12-16 14:17:00 +00:00
Athanasius
12ee3deb59
killswitches: Implement --killswitches-file CL arg
* 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.
2022-12-16 14:02:59 +00:00
Athanasius
ccdc187efa
CAPI: Remove 'safeties' preventing Legacy CAPI queries 2022-12-08 11:58:34 +00:00
Athanasius
75ee57939a
EDMarketConnector: Force type of ship_state
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.
2022-12-08 11:32:41 +00:00
Athanasius
b6fe115ea7
CAPI: Add support for plugin cmdr_data_legacy()
* 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()`.
2022-12-08 11:17:52 +00:00
Athanasius
0523e2289a
EDMarketConnector: Improve 'develop only for devs' check
* 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.
2022-12-08 10:51:31 +00:00
Athanasius
0d65adb77e
EDMarketConnector: Tweak 'only developers in develop' message 2022-12-07 20:10:41 +00:00
Athanasius
a69b271928
EDMarketConnector: Only developers should be running develop 2022-12-07 19:45:55 +00:00
Athanasius
62e285b52e
themes: Use defined constants for which theme throughout
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.
2022-12-05 15:57:15 +00:00
Athanasius
3358babe00
EDMarketConnector: Move tk 'status' Label to its own section 2022-12-04 14:55:22 +00:00
Athanasius
3cc9aed724
EDMarketConnector: Updated for update.py function renames 2022-12-04 14:35:49 +00:00
Athanasius
b40d3b889f
CAPI: Use CAPI-Live-<endpoint> game_version for market & shipyard 2022-12-01 16:42:05 +00:00
Athanasius
4b31b67042
CAPI: Only perform queries for Live galaxy.
* 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.
2022-12-01 16:42:04 +00:00
Athanasius
0d35f8874a
config/EDDN: Rename OUT_MKT_EDDN to OUT_EDDN_SEND_STATION_DATA
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.
2022-11-22 14:02:15 +00:00