We're passing around *either* tk.Widget *or* tk.BitmapImage in places, but
tk.BitmapImage really isn't the same. It doesn't have some functions, can't
be treated as a Dict etc.
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.
'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()`.
**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*.
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.
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.
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.
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.
* '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.