1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-19 18:37:39 +03:00

4972 Commits

Author SHA1 Message Date
Athanasius
e4055530b4
theme: The very start of actually using defined constants for themes 2022-12-05 10:49:05 +00:00
Athanasius
4cea8fa34f
github/push-checks: Align flake8 with what's working in pr-checks 2022-12-04 16:55:45 +00:00
Athanasius
486fb6b7e6
github/pr-checks: We provide flake8 filenames, so lose the '.' 2022-12-04 16:50:21 +00:00
Athanasius
5c704e9932
github/pr-checks: Remove stray echo from prior testing 2022-12-04 16:49:02 +00:00
Athanasius
ccdfd9a4fa
scripts/killswitch_test: One flake8 issue fixed 2022-12-04 16:42:12 +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
19114fdc3a
config/linux: Remove unused TYPE_CHECKING import 2022-12-04 15:15:14 +00:00
Athanasius
c5a2943966
util_ships.py: Add required blank line before function 2022-12-04 15:14:31 +00:00
Athanasius
04145146d7
update.py: Finaly mypy pass
* It's possible the `xml` code could be changed to make types work.  But
  the code works, ignore types on those calls.
2022-12-04 15:12:46 +00:00
Athanasius
74ebba20b4
update.py: Remove unused 'global root' & some more typing
`global root` was never removed after `self.root` became a thing.
2022-12-04 15:08:38 +00:00
Athanasius
e419e6dca0
update.py: Technically Updater.root can be None, so check this
The only current users of the code that blindly uses `self.root` are for
the GUI application, but let's add the checks anyway.
2022-12-04 14:56:58 +00:00
Athanasius
3358babe00
EDMarketConnector: Move tk 'status' Label to its own section 2022-12-04 14:55:22 +00:00
Athanasius
2ac055e8f0
update.py: Yes, we have to use .nametowidget()
'status' is a child of 'edmarketconnector', not of `self.root`.  And if
we were to do `self.root.children['edmarketconnector'].children['status']`
then we might as well use `.nametowidget()`.
2022-12-04 14:49:51 +00:00
Athanasius
eab2f35360
update.py: Minor whitespace correction 2022-12-04 14:43:00 +00:00
Athanasius
3cc9aed724
EDMarketConnector: Updated for update.py function renames 2022-12-04 14:35:49 +00:00
Athanasius
eefb56c2c0
update.py: Check appcast version is correct platform 2022-12-04 14:30:37 +00:00
Athanasius
b38044928a
update.py: Now passes flake8
**BUG FOUND**
The code in `Updater.check_appcast()` assumes that
`semantic_version.SimpleSpec.select()` will say "5.6.1 is an upgrade for
this 5.6.0".  But it doesn't.  It's looking for *matches*.

So this needs to be a proper loop/compare *and* should only take into account
options *for the current platform*.
2022-12-04 14:23:53 +00:00
Athanasius
b57a8f99ae
ttkHyperlinkLabel: Now passing flake8 & mypy
* `openurl()` - Don't pass `None` as second parameter to `QueryValueEx()`.
  Passing `''` was tested as still working.
2022-12-03 21:04:50 +00:00
Athanasius
e280d6c283
ttkHyperlinklabel.py: Initial flake8 pass (and some mypy)
This fixes an apparently harmless bug in the `openurl()` function defined
in this module (it's not part of the class).

1. On `win32` lookup the user setting for opening HTTPS URLs.
2. If that doesn't look like IE or Edge...
3. Set `cls` to the value for that.
4. Now look up the 'use this command' for *that* ...
5. And if it doesn't have `iexplore` in it...
6. Use `subprocess.Popen()` to invoke that browser with the given URL.

The problem is that step 6 still tries to use `buf.value`.  But `buf` is
no longer present as it was from before 5989acd0d3263e54429ff99769ff73a20476d863
changed over to `winreg`.  It should be just `value` from the winreg
calls.

That exception is then caught and ignored, and it ends up just running
`webbrowser.open(url)` anyway.

To be honest, this feels like we should just make this an unconditional
call to `webbrowser.open(url)` now, given apparently no-one's complained
about it always actually using that not working for them.  Given Edge is
Chrome-based now, and any supported OS should have Edge, Chrome or Firefox
(OK, maybe Safari and some others) as the HTTPS browser, I don't see this
being an issue.
2022-12-03 18:21:16 +00:00
Athanasius
0dbbb38821
theme.py: Just use 'dict' style configuration of widgets
It turns out that you don't need to call `.configure(keyword=...)` on tk
widgets.  You can just treat them as a dict with the available option as
a key.

This neatly gets rid of the type hint issues.
2022-12-03 17:50:47 +00:00
Athanasius
8728234625
theme.py: mypy pass
mypy/typeshed still doesn't like 'generic' tk arguments on things like
.configure(), so lots of `# type: ignore` used for those.
2022-12-03 17:36:10 +00:00
Athanasius
cc8e0bfd27
theme.py: flake8 pass
Conversion from %-format to f-string means an `assert ..., string`` is now
a condition and a `raise AssertionError(string)`.  The problem being that
f-string gets evaluated before the assert, but in this case the things the
f-string relies on are only there if the assert triggers.
2022-12-03 16:59:39 +00:00
Athanasius
c9555cce66
td.py: Further re-factoring to pass flake8 checks
The output of this was confirmed the 'same' as from before this work:

 1. Generate the output.
 2. `cut -c 1-68` to a copy.
 3. diff those files.

This is necessary so as to not have 'every' line be different due to the
timestamp on it.
2022-12-03 16:27:22 +00:00
Athanasius
ca98549f68
td: A start on flake8 passing
To avoid overly long lines this is splitting things into separate `h.write()`
calls, and making temporary variables for even some of those.
2022-12-03 16:13:01 +00:00
Athanasius
5edde547fa
shipyard.py: flake8/mypy & conver to use csv module 2022-12-03 15:43:33 +00:00
Athanasius
0d2505ea48
protocol.py: mypy pass
* 'type: ignore' some ctypes operations on variables.
* Use `c_long(<value>)` on some returns.  The ctypes types do work that way
  as constructors.
* Fix the BAseHTTPHandler.log_request() types to match superclass.
2022-12-03 15:13:59 +00:00
Athanasius
bb2bf53647
protocol.py: flake8 pass
This is flake8 objecting to the "initialised later" `protocolhandler`.
2022-12-03 14:51:54 +00:00
Athanasius
a0c73a5c71
plug.py: flake8 & mypy pass 2022-12-03 14:48:50 +00:00
Athanasius
1f21c7fae4
plug.py: Only type annotation coverage to go in flake8 2022-12-03 14:10:09 +00:00
Athanasius
3247fb805c
plug.py: Further docstring fixes 2022-12-03 14:05:59 +00:00
Athanasius
413b2f06f8
plug.py: Some docstrings, change to plugin loading
* Plugin loading: Avoid using .format()
2022-12-03 14:03:47 +00:00
Athanasius
8628efa0a1
github/pr-/push-checks: Attempt non-diff flake8 checks
* flake8 6.0.0 dropped support for, the broken, --diff.
* We want to only run against python files.  We will have 'git diff's for
  other types of files.
* Uses 'git diff -z', 'grep -z -Z' and 'xargs -0' so as to pass NUL-terminated
  strings around to avoid "special characters in path/filenames" issues.
2022-12-03 13:52:29 +00:00
Athanasius
514f3fac8a
myNotebook.py: Now passes flake8 & mypy
* Typed `master` to each `__init__()`.
* Having to `# type: ignore` the base class for the classes which are
  "tk on darwin, else ttk" as this 'dynamic' type confuses mypy.

  See the comment on `class Frame` for a suggested proper fix, which will
  be more work.
2022-12-03 12:16:44 +00:00
Athanasius
84860607d7
myNotebook.py: Add file and class docstrings 2022-12-03 12:09:45 +00:00
Athanasius
485a1e3bb4
loadout.py: flake8 & mypy pass
* Catch if an empty string (or other not-None Falsey value) is passed in.
* Use pathlib for constructed filename.
2022-12-03 12:01:26 +00:00
Athanasius
37ca1c3c19
journal_lock: Remove un-needed noqa 2022-12-03 11:32:02 +00:00
Athanasius
116986837e
develop: post-release appversion = 5.6.2-alpha0 2022-12-02 12:54:02 +00:00
Athanasius
dd4a178a67
Release 5.6.1: appversion & changelog Release/5.6.1 2022-12-02 12:12:32 +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
7a64351d2f
Merge pull request #1736 from EDCD/fix/1733/capi-legacy-vs-live
Improve CAPI code for Legacy/Live split
2022-12-01 17:37:24 +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
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
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
0ecc3309e4
Merge pull request #1731 from EDCD/fix/1730/inara-legacy-warn-only-if-sending
Only warn about Inara/Live data only if configured to send on Legacy.
2022-12-01 16:40:39 +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