1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-16 09:10:35 +03:00

Merge pull request #693 from EDCD/enhancement/515-ui-scaling

Change UI tk.Scale() to use integers to avoid locale issues.
This commit is contained in:
Athanasius 2020-09-10 17:11:50 +01:00 committed by GitHub
commit 95100ad586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 21 deletions

View File

@ -1038,7 +1038,7 @@ argv[0]: {sys.argv[0]}
exec_prefix: {sys.exec_prefix}
executable: {sys.executable}
sys.path: {sys.path}'''
)
)
# TODO: unittests in place of these
# logger.debug('Test from __main__')
@ -1056,13 +1056,13 @@ sys.path: {sys.path}'''
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 = '0.0'
config.set('ui_scaling', ui_scaling)
ui_scale = config.getint('ui_scale')
if not ui_scale:
ui_scale = 0
config.set('ui_scale', ui_scale)
theme.default_ui_scale = root.tk.call('tk', 'scaling')
if ui_scaling != '0.0':
root.tk.call('tk', 'scaling', float(ui_scaling))
if ui_scale != 0:
root.tk.call('tk', 'scaling', float(ui_scale) / 100.0)
app = AppWindow(root)
def messagebox_not_py3():

View File

@ -527,10 +527,10 @@
"{APP} needs permission to use shortcuts" = "{APP} needs permission to use shortcuts";
/* Label for 'UI Scaling' option [prefs.py] */
"UI Scaling" = "UI Scaling";
"UI Scale Percentage" = "UI Scale Percentage";
/* Text describing that value '0.0' means 'default' [prefs.py] */
"0.0 means Default" = "0.0 means Default";
/* Text describing that value '0' means 'default', and changes require a restart [prefs.py] */
"0 means Default{CR}Restart Required for{CR}changes to take effect!" = "0 means Default{CR}Restart Required for{CR}changes to take effect!";
/* Label for user configured level of logging [prefs.py] */
"Log Level" = "Log Level";

View File

@ -340,21 +340,24 @@ class PreferencesDialog(tk.Toplevel):
# UI Scaling
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)
self.ui_scaling = tk.DoubleVar()
self.ui_scaling.set(float(config.get('ui_scaling')))
nb.Label(themeframe, text=_('UI Scale Percentage')).grid(row=23, padx=PADX, pady=2*PADY, sticky=tk.W)
self.ui_scale = tk.IntVar()
self.ui_scale.set(config.getint('ui_scale'))
self.uiscale_bar = tk.Scale(
themeframe,
variable=self.ui_scaling,
variable=self.ui_scale,
orient=tk.HORIZONTAL,
length=300,
from_=0.0,
to=4.0,
tickinterval=0.5,
resolution=0.1,
from_=0,
to=400,
tickinterval=50,
resolution=10,
)
self.uiscale_bar.grid(row=23, column=1, sticky=tk.W)
self.ui_scaling_defaultis = nb.Label(themeframe, text=_('0.0 means Default')).grid(row=23, column=3, padx=PADX, pady=2*PADY, sticky=tk.E)
self.ui_scaling_defaultis = nb.Label(
themeframe,
text=_('0 means Default{CR}Restart Required for{CR}changes to take effect!')
).grid(row=23, column=3, padx=PADX, pady=2*PADY, sticky=tk.E)
# Always on top
ttk.Separator(themeframe, orient=tk.HORIZONTAL).grid(columnspan=3, padx=PADX, pady=PADY*4, sticky=tk.EW)
@ -648,8 +651,7 @@ 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', str(self.ui_scaling.get()))
# self.tk.call('tk', 'scaling', self.ui_scaling.get())
config.set('ui_scale', self.ui_scale.get())
config.set('always_ontop', self.always_ontop.get())
config.set('theme', self.theme.get())
config.set('dark_text', self.theme_colors[0])