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.
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.
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.
This adds a try/except around a bunch of .configure() calls on widgets.
Yes, sure, this could then leave the widget in question in a broken state,
but at least our entire UI won't fall flat on its face.
If we use the last configured value then the width of the Scale bar
changes as per the user's last setting, even though they might not have
yet restarted for all the rest of the UI to resize.
EDMC.py would break due to an import chain that ends up in theme. Theme
does a whole bunch of work to setup our GUI for EDMarketConnector.py,
but it does this on any import, which will fail spectacularly if there
is either no DISPLAY var set or no X11 libs available on our machine at
all (as a sidenote this means it probably also breaks on a wholly
wayland install).
This fixes the issue by adding a check for an environment variable on
import of theme. This can and WILL break if the env var is set and
EDMarketConnector.py is used, but if you do that its your own fault.
The added exception at least means we don't then segmentation fault in
the next line, but it also means we then hit another exception later
in the main loop as we try to create the main Tk window.
Hopefully the exception messages will be clear enough to the user.
closes#500
First pass utilising 'futurize' to do most of the work.
There's an issue with ur'\"' in l10n.py which I'm not sure how to
properly fix.
This now has errors when hitting the 'Update' button.