1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-20 10:57:37 +03:00

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.
This commit is contained in:
Athanasius 2022-12-22 17:25:13 +00:00
parent 4de83747f8
commit eaaa6fead0
No known key found for this signature in database
GPG Key ID: 772697E181BB2767
2 changed files with 6 additions and 3 deletions

View File

@ -2089,10 +2089,13 @@ sys.path: {sys.path}'''
if not ui_scale:
ui_scale = 100
config.set('ui_scale', ui_scale)
theme.default_ui_scale = root.tk.call('tk', 'scaling')
logger.trace_if('tk', f'Default tk scaling = {theme.default_ui_scale}')
theme.startup_ui_scale = ui_scale
root.tk.call('tk', 'scaling', theme.default_ui_scale * float(ui_scale) / 100.0)
if theme.default_ui_scale is not None:
root.tk.call('tk', 'scaling', theme.default_ui_scale * float(ui_scale) / 100.0)
app = AppWindow(root)
def messagebox_not_py3():

View File

@ -137,8 +137,8 @@ class _Theme(object):
self.widgets_pair: List = []
self.defaults: Dict = {}
self.current: Dict = {}
self.default_ui_scale = None # None == not yet known
self.startup_ui_scale = None
self.default_ui_scale: float | None = None # None == not yet known
self.startup_ui_scale: int | None = None
def register(self, widget: tk.Widget | tk.BitmapImage) -> None: # noqa: CCR001, C901
# Note widget and children for later application of a theme. Note if