* 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.
* 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.
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').
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.
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.
* 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).
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.