Skip to content

Commit 14be56f

Browse files
committed
Improve scalling support
1 parent 24472ab commit 14be56f

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

dialogs/customize_shortcut.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ def show(shortcut_type: str, path: str):
1010

1111
window = custom_ui.Toplevel()
1212
window.title(strings.lang.customize_shortcut)
13-
window.configure(padx = 16)
13+
window.configure(padx = preferences.get_scaled_value(16))
1414

1515
use_folder_icon = tk.BooleanVar(value = True)
1616

1717
shortcut_info = ttk.Frame(window)
18-
shortcut_info.pack(fill = "x", expand = True, pady = (16, 0))
18+
shortcut_info.pack(fill = "x", expand = True, pady = (preferences.get_scaled_value(16), 0))
1919

20-
icon_canvas = tk.Canvas(shortcut_info, width = 32, height = 32, bd = 0, highlightthickness = 0, background = custom_ui.colors.bg)
20+
icon_canvas = tk.Canvas(
21+
shortcut_info, width = preferences.get_scaled_value(32), height = preferences.get_scaled_value(32), bd = 0,
22+
highlightthickness = 0, background = custom_ui.colors.bg
23+
)
2124
icon_canvas.pack(side = "left")
2225

2326
def update_icon(icon_path: str, icon_index: int = 0):
@@ -34,7 +37,7 @@ def update_icon(icon_path: str, icon_index: int = 0):
3437

3538
name_rame = tk.Frame(shortcut_info, highlightbackground = custom_ui.colors.entry_bd, highlightcolor = custom_ui.colors.entry_focus,
3639
highlightthickness = 1)
37-
name_rame.pack(anchor = "w", padx = (16, 0), side = "left")
40+
name_rame.pack(anchor = "w", padx = (preferences.get_scaled_value(16), 0), side = "left")
3841

3942
name = tk.Entry(name_rame, width = 50, background = custom_ui.colors.entry_bg,
4043
foreground = custom_ui.colors.fg, border = 0, highlightthickness = 2,
@@ -57,10 +60,10 @@ def show_change_icon_btn():
5760
update_icon("C:/Windows/System32/shell32.dll", 4)
5861

5962
if shortcut_type == "folder":
60-
custom_ui.Checkbutton(window, text = strings.lang.use_folder_icon, variable = use_folder_icon, command = show_change_icon_btn).pack(pady = (8, 0), anchor = "w")
63+
custom_ui.Checkbutton(window, text = strings.lang.use_folder_icon, variable = use_folder_icon, command = show_change_icon_btn).pack(pady = (preferences.get_scaled_value(8), 0), anchor = "w")
6164

6265
buttons = ttk.Frame(window)
63-
buttons.pack(pady = 16, fill = "x", expand = True)
66+
buttons.pack(pady = preferences.get_scaled_value(16), fill = "x", expand = True)
6467

6568
def change_icon():
6669
shortcut_icon, shortcut_icon_index = icon.pick_icon(window)
@@ -80,8 +83,8 @@ def create_shortcut():
8083
if shortcut_type == "folder": shortcut.create_folder_shortcut(path, shortcut_name, shortcut_icon, shortcut_icon_index)
8184
else: shortcut.create_file_shortcut(path, shortcut_name, shortcut_icon, shortcut_icon_index)
8285

83-
ok_btn = custom_ui.Button(buttons, text = strings.lang.ok, default = "active", command = create_shortcut).pack(side = "right", padx = (8, 0))
84-
cancel_btn = custom_ui.Button(buttons, text = strings.lang.cancel, command = window.destroy).pack(side = "right")
86+
custom_ui.Button(buttons, text = strings.lang.ok, default = "active", command = create_shortcut).pack(side = "right", padx = (preferences.get_scaled_value(8), 0))
87+
custom_ui.Button(buttons, text = strings.lang.cancel, command = window.destroy).pack(side = "right")
8588

8689
if shortcut_type == "folder": show_change_icon_btn()
8790
else: update_icon("C:/Windows/System32/shell32.dll", 0)

dialogs/separator_wizard.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
def show():
66
window = custom_ui.Toplevel()
77
window.title(strings.lang.pin_separator)
8-
window.iconbitmap(preferences.internal + "icon.ico")
9-
window.configure(padx = 14, pady = 8)
8+
window.configure(padx = preferences.get_scaled_value(14), pady = preferences.get_scaled_value(8))
109

1110
separator_type = tk.StringVar(value = "vertical")
1211

1312
ttk.Label(window, text = strings.lang.pin_separator, font = ("Segoe UI Semibold", 17)).pack(anchor = "w")
14-
ttk.Label(window, text = strings.lang.choose_a_separator_type).pack(anchor = "w", pady = 8)
13+
ttk.Label(window, text = strings.lang.choose_a_separator_type).pack(anchor = "w", pady = preferences.get_scaled_value(8))
1514

1615
separator_types = ttk.Frame(window)
17-
separator_types.pack(pady = 8)
16+
separator_types.pack(pady = preferences.get_scaled_value(8))
1817

1918
separator_vertical = tk.PhotoImage(file = preferences.internal + "separators/preview/separator_vertical.png")
2019
separator_horizontal = tk.PhotoImage(file = preferences.internal + "separators/preview/separator_horizontal.png")
@@ -24,21 +23,23 @@ def create_vertical_separator_shortcut(): window.destroy(); shortcut.create_sepa
2423
def create_horizontal_separator_shortcut(): window.destroy(); shortcut.create_separator_shortcut("horizontal")
2524
def create_transparent_separator_shortcut(): window.destroy(); shortcut.create_separator_shortcut("transparent")
2625

27-
vertical = custom_ui.Button(separator_types, width = 100, image = separator_vertical, compound = "top",
26+
vertical = custom_ui.Button(separator_types, width = preferences.get_scaled_value(100), image = separator_vertical, compound = "top",
2827
text = strings.lang.vertical_line, command = create_vertical_separator_shortcut)
2928
vertical.pack(side = "left")
30-
vertical.configure(pady = 8)
29+
vertical.image = separator_vertical
30+
vertical.configure(pady = preferences.get_scaled_value(8))
3131

32-
horizontal = custom_ui.Button(separator_types, width = 100, image = separator_horizontal, compound = "top",
32+
horizontal = custom_ui.Button(separator_types, width = preferences.get_scaled_value(100), image = separator_horizontal, compound = "top",
3333
text = strings.lang.horizontal_line, command = create_horizontal_separator_shortcut)
34-
horizontal.pack(side = "left", padx = (8, 0))
35-
horizontal.configure(pady = 8)
34+
horizontal.pack(side = "left", padx = (preferences.get_scaled_value(8), 0))
35+
horizontal.image = separator_horizontal
36+
horizontal.configure(pady = preferences.get_scaled_value(8))
3637

37-
transparent_b = custom_ui.Button(separator_types, width = 100, image = transparent, compound = "top",
38+
transparent_b = custom_ui.Button(separator_types, width = preferences.get_scaled_value(100), image = transparent, compound = "top",
3839
text = strings.lang.transparent, command = create_transparent_separator_shortcut)
39-
transparent_b.pack(side = "left", padx = (8, 0))
40-
transparent_b.configure(pady = 8)
40+
transparent_b.pack(side = "left", padx = (preferences.get_scaled_value(8), 0))
41+
transparent_b.image = transparent
42+
transparent_b.configure(pady = preferences.get_scaled_value(8))
4143

4244
window.focus_set()
43-
window.resizable(False, False)
44-
window.mainloop()
45+
window.resizable(False, False)

main.pyw

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import tkinter as tk, subprocess, shutil, custom_ui, tktooltip, strings
2+
from tkinter import ttk, filedialog
23
from dialogs import separator_wizard, customize_shortcut, about, change_language, change_theme
34
from utils import preferences
4-
from tkinter import ttk, filedialog
55

66
window = custom_ui.App()
77
window.title("Files & Folders on Taskbar")
@@ -81,18 +81,18 @@ def draw_ui():
8181
custom_ui.CommandLink(window, title = strings.lang.a_folder, description = strings.lang.folder_desc, command = lambda: browse("folder")).pack(fill = "x", expand = True)
8282
custom_ui.CommandLink(window, title = strings.lang.a_separator, description = strings.lang.separator_desc, command = separator_wizard.show).pack(fill = "x", expand = True)
8383

84-
settings = ttk.Frame(window, height = 26)
85-
settings.pack(anchor = "w", pady = (20, 2), fill = "x")
84+
settings = ttk.Frame(window, height = preferences.get_scaled_value(26))
85+
settings.pack(anchor = "w", pady = (preferences.get_scaled_value(20), preferences.get_scaled_value(2)), fill = "x")
8686
settings.pack_propagate(False)
8787

8888
language = custom_ui.Toolbutton(settings, text = "\ue774", link = True, icononly = True, anchor = "n", command = change_app_language, font = ("Segoe UI", 12))
8989
language.pack(anchor = "nw", side = "left")
9090

9191
theme = custom_ui.Toolbutton(settings, text = "\ue771", link = True, icononly = True, anchor = "n", command = change_app_theme, font = ("Segoe UI", 12))
92-
theme.pack(anchor = "nw", side = "left", padx = (4, 0))
92+
theme.pack(anchor = "nw", side = "left", padx = (preferences.get_scaled_value(4), 0))
9393

9494
about_app = custom_ui.Toolbutton(settings, text = "\ue946", link = True, icononly = True, anchor = "n", command = about.show, font = ("Segoe UI", 13))
95-
about_app.pack(anchor = "nw", side = "left", padx = (4, 0))
95+
about_app.pack(anchor = "nw", side = "left", padx = (preferences.get_scaled_value(4), 0))
9696

9797
tktooltip.ToolTip(language, strings.lang.change_language, follow = False, delay = 1)
9898
tktooltip.ToolTip(theme, strings.lang.change_theme, follow = False, delay = 1)

0 commit comments

Comments
 (0)