1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

UI Scaling: Implement a 'default' option

* If no ui_scaling yet set, set it to 'default'.
* 'default' added to dropdown choices.

Note that you still need an application restart for this to take effect.
This commit is contained in:
Athanasius 2020-09-08 12:27:57 +01:00
parent ea53a60596
commit 1850354b8d
2 changed files with 9 additions and 4 deletions

View File

@ -1048,6 +1048,12 @@ if __name__ == "__main__":
Translations.install(config.get('language') or None) # Can generate errors so wait til log set up
root = tk.Tk(className=appname.lower())
ui_scaling = config.get('ui_scaling')
if not ui_scaling:
ui_scaling = 'default'
config.set('ui_scaling', ui_scaling)
if ui_scaling != 'default':
root.tk.call('tk', 'scaling', ui_scaling)
app = AppWindow(root)
def messagebox_not_py3():

View File

@ -342,10 +342,8 @@ class PreferencesDialog(tk.Toplevel):
ttk.Separator(themeframe, orient=tk.HORIZONTAL).grid(columnspan=4, padx=PADX, pady=PADY*4, sticky=tk.EW)
nb.Label(themeframe, text=_('UI Scaling')).grid(row = 23, padx=PADX, pady=2*PADY, sticky=tk.W) # Select UI scaling
ui_scaling = config.get('ui_scaling')
if not ui_scaling:
ui_scaling = 1.0
self.ui_scaling = tk.StringVar(value=ui_scaling)
ui_scales = ( 0.5, 1.0, 1.5, 2.0, 3.0, 4.0)
ui_scales = ( 'default', 0.5, 1.0, 1.5, 2.0, 3.0, 4.0)
self.uiscale_dropdown = nb.OptionMenu(themeframe, self.ui_scaling, self.ui_scaling.get(), *ui_scales)
self.uiscale_dropdown.configure(width=15)
self.uiscale_dropdown.grid(row=23, column=1, sticky=tk.W)
@ -642,11 +640,12 @@ class PreferencesDialog(tk.Toplevel):
config.set('language', lang_codes.get(self.lang.get()) or '')
Translations.install(config.get('language') or None)
config.set('ui_scaling', self.ui_scaling.get())
#self.tk.call('tk', 'scaling', self.ui_scaling.get())
config.set('always_ontop', self.always_ontop.get())
config.set('theme', self.theme.get())
config.set('dark_text', self.theme_colors[0])
config.set('dark_highlight', self.theme_colors[1])
#self.tk.call('tk', 'scaling', 2.0)
theme.apply(self.parent)
# Notify