Commit Graph
5170 Commits
Author SHA1 Message Date
Athanasius ec90912d31 Build: Don't enforce any bit-ness of platform
Testing shows this branch works (after build) on both 32-bit and 64-bit.
2022-12-23 17:34:58 +00:00
Athanasius 08d28c6f3d protocol: Properly prototype GetMessageW & comment about 'exception'
* In trying to fix the return type 'exception' I first decided to properly
  prototype GetMessageW().
* But it turns out that you just can't get rid of that exception, so I just
  added a comment about it being harmless, because the functionality works
  as intended anyway.
2022-12-23 16:41:07 +00:00
Athanasius 7620bcdaaa Revert "TEMPORARY: Ignore venv-3.11_64 in LANG comment hook"
This reverts commit af785457ed.
2022-12-23 15:45:03 +00:00
Athanasius b678985fa6 github: windows-build: Use x64 versions of WinSparkle files 2022-12-23 15:45:02 +00:00
Athanasius 3a8f3d6297 Build: Switch to requiring 64-bit, not 32-bit, Python 2022-12-23 15:45:01 +00:00
Athanasius cdb61bcced stats.py: Checking CAPI lastStarport is un-necessary, as never used.
The `lastSystem` *is* however used, for the 'current ship not currently
docked' case.
2022-12-23 15:44:42 +00:00
Athanasius f9d384cc6d prefs.py: Comment why except OSError being thrown away (wine check) 2022-12-23 15:44:41 +00:00
Athanasius 12b77f696b prefs.py: Remove the now un-used ctypes imports/definitions 2022-12-23 15:44:40 +00:00
Athanasius 09ecdbb849 prefs.py: Always use tkinter.filedialog for Output File Location
* I can't even get this code to be problematic, with a folder containing
  unicode heart characters, on 64-bit Python 3.7.9 (Release/4.1.6 adjusted to
  not set UTF-8 locale), let alone on 64-bit Python 3.11 and this branch.

  So, just always use the tkinter dialog.  Bye-bye ctypes code which I just
  couldn't get to work under 64-bit Python.

* I *think* the issue with the ctypes code was that under 32-bit an 'int' and
  a pointer are the same size.

  'Raw' (not declaring types beforehand) the `SHBrowseForFolderW()` function
  causes ctypes to consider it returns an int.  This works on 32-bit.

  But on 64-bit that int is still 32-bits, but pointers are 64-bit, so ctypes
  ends up coercing/casting/truncating the returned pointer into an int,
  which than can't even be cast back to a pointer.

  Meanwhile, attempting to properly define the signature of the function
  has only lead to it crashing on invocation, despite being passed the same
  BROWSEINFOW structure, defined in the same manner.  This might be a matter
  of a type within it needing adjusting, but I was following the docs there.
2022-12-23 15:44:39 +00:00
Athanasius da530f135e prefs.py: Attempting to fix non-utf-8 case of "choose Output file location"
1. `SHGetPathFromIDListW` needing fixing, which was achieved, but...
2. ... then `SHBrowseForFolderW()` as-was returned `int` instead of a pointer
  to the correct structure.

Trying to fix 2 has proven intractable:

a. Trying to cast the `int` return just results in `exception: access violation
  reading <address>`.
b. Trying to define `SHBrowseForFolderW` properly, so it returns the correct
  type results in a *writing* access violation when called, despite passing
  the exact same data in as for the 'raw' call version.

So, this commit is a record, and I'm next going to try switching to
`IFileDialog` as recommended by the docs for `SHBrowseForFolderW` ('For
Windows Vista or later').
2022-12-23 15:44:38 +00:00
Athanasius f141fccd86 protocol.py: Change definition of DefWindowProcW to work on 64-bit
Given this is the form of definition in the official Python docs I'm
wondering if this only ever worked on 32-bit by accident.

So, it was nothing to do with the type needing to be changed for 64-bit.
The error:

    ctypes.ArgumentError: argument 4: <class 'OverflowError'>: int too long to convert

was a red herring in those terms.
2022-12-23 15:44:34 +00:00
Athanasius ee1df33cec TEMPORARY: Ignore venv-3.11_64 in LANG comment hook 2022-12-23 15:38:22 +00:00
Athanasius f6c6281ac2 Merge pull request #1780 from EDCD/enhancement/github/mypy-checks
mypy: Add script to run against all, and use in github/push-checks
2022-12-23 15:34:44 +00:00
Athanasius db956cd68b scripts/mypy-all: Add a little comment documentation 2022-12-23 15:32:09 +00:00
Athanasius 3d53b1a54d github/mypy: Specifically run for win32 platform 2022-12-23 15:24:45 +00:00
Athanasius 2315168b65 Merge branch 'enhancement/github/mypy-checks' of https://github.com/EDCD/EDMarketConnector into enhancement/github/mypy-checks 2022-12-23 15:20:58 +00:00
A_D 862565e955 github/push-checks: set mypy-all script to be +x 2022-12-23 17:18:56 +02:00
Athanasius e70b3c99f2 github/push-checks: Correct the job name, from build 2022-12-23 15:18:32 +00:00
Athanasius 8bacbf77ff github/push-checks: Run on any branch except main, stable, beta, releases 2022-12-23 15:11:56 +00:00
Athanasius 841ae2006e mypy: Add script to run against all, and use in github/push-checks 2022-12-23 15:06:47 +00:00
Athanasius 99858116e5 Merge pull request #1779 from EDCD/fix/mypy/all-files--again
Get all code passing `pre-commit run --all-files mypy`
2022-12-23 14:50:46 +00:00
Athanasius a499a22383 .mypy.ini: Set follow_imports explicitly to normal default
We'd been using `skip` because when we started with mypy next to nothing
passed it, and checking one file would spew errors with other files and it
just wasn't conducive to making at least *some* progress.

But now we should have every single file passing, so this is the right thing
to do.
2022-12-23 14:48:27 +00:00
Athanasius 90183554ef tests/journal_lock: Use proper pytest types in fixtures
When I last typed this I couldn't find any official way to type `pytest`
fixtures.  Perhaps that was before:

    https://docs.pytest.org/en/6.2.x/changelog.html#improvements

which now makes it clean and simple.
2022-12-23 14:48:26 +00:00
Athanasius 5064b10744 Bring in scripts/pip_rev_deps.py
* This finds the pip-installed modules that depend on the specified module.
  Handy for cleaning things up.
* Leads to needing types-pkg-resources for mypy (and via pre-commit).
2022-12-23 14:48:21 +00:00
Athanasius bc5cb48f8c stats.py: Remove usage of un-necessary typing types.
Dict, List, Optional
2022-12-23 14:47:41 +00:00
Athanasius 5e19d3e9aa plugins/eddn: No need for typing.(Dict|List) usage 2022-12-23 14:47:40 +00:00
Athanasius 8a7a0fdf9a hotkey/windows: Remove un-necessary u tagging of strings 2022-12-23 14:47:39 +00:00
Athanasius fe5f68763b docs/Releasing: Remove paste error 2022-12-23 14:47:38 +00:00
Athanasius 299b42c558 config/__init__: Remove use of typing.List 2022-12-23 14:47:37 +00:00
Athanasius 1e0d99a61f config/__init__: Remove use of typing.Union 2022-12-23 14:47:36 +00:00
Athanasius b3719347e8 EDMarketConnector: No need for Typing.Dict 2022-12-23 14:47:35 +00:00
Athanasius 5609b908fb ttkHyperlinkLabel: Remove un-used typing.Optional import 2022-12-23 14:47:34 +00:00
Athanasius 46d518986c hotkey/windows: Minor formatting cleanups 2022-12-23 14:47:33 +00:00
Athanasius 63a1337bed examples/click_counter: Minor type fixes. 2022-12-23 14:47:32 +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
Athanasius 37b054b3d3 Fix type of master passed to plug.load_plugins() 2022-12-23 14:47:27 +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 f4b150960c prefs.py & related files: Fix up mypy type checking
* Some trivial.
* As myNotebook.py's class is based on `ttk.Notebook`, typing changed to
  that.
2022-12-23 14:47:21 +00:00
Athanasius 3b0c7370cc hotkey: Make more of the windows methods abstract ones in parent
Without this mypy objects to calling them due to not being in the visible
AbstractKetkeyMgr type.
2022-12-23 14:47:20 +00:00
Athanasius 9e605d31c7 EDMC.py: Fix up other call to companion.session.station()
* Opening of latest journal file didn't match how done in monitor.py.
  This caused `str` instead of `bytes` being passed to `monitor.parse_entry()`.
* It was assuming pre-threaded return of data.  Now properly gets it from
  the queue.
2022-12-23 14:47:19 +00:00
Athanasius 26b12f5b14 plugins/inara, plug.py: Minor typing fixes 2022-12-23 14:47:18 +00:00
Athanasius fb065c5b78 collate.py: file paths/names should be pathlib.Path 2022-12-23 14:47:17 +00:00
Athanasius 95b442cf02 stats.py: Minor typing fixes. 2022-12-23 14:47:16 +00:00