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

Added UI transparency option

This commit is contained in:
A_D 2020-11-04 17:42:58 +02:00 committed by Athanasius
parent 281f66c7c1
commit ed7d79c2f7
2 changed files with 42 additions and 1 deletions

View File

@ -1598,6 +1598,13 @@ sys.path: {sys.path}'''
)
config.set('plugins_not_py3_last', int(time()))
# UI Transparency
ui_transparency = config.getint('ui_transparency')
if ui_transparency == 0:
ui_transparency = 100
root.wm_attributes('-alpha', ui_transparency / 100)
root.after(0, messagebox_not_py3)
root.mainloop()

View File

@ -739,9 +739,42 @@ class PreferencesDialog(tk.Toplevel):
text=_('100 means Default{CR}Restart Required for{CR}changes to take effect!')
).grid(column=3, padx=self.PADX, pady=2*self.PADY, sticky=tk.E, row=cur_row)
# Transparency slider
ttk.Separator(appearance_frame, orient=tk.HORIZONTAL).grid(
columnspan=4, padx=self.PADX, pady=self.PADY*4, sticky=tk.EW, row=row.get()
)
with row as cur_row:
nb.Label(appearance_frame, text="Main window transparency").grid(
padx=self.PADX, pady=self.PADY*2, sticky=tk.W, row=cur_row
)
self.transparency = tk.IntVar()
self.transparency.set(config.getint('ui_transparency') or 100) # Default to 100 for users
self.transparency_bar = tk.Scale(
appearance_frame,
variable=self.transparency,
orient=tk.HORIZONTAL,
length=300 * (float(theme.startup_ui_scale) / 100.0 * theme.default_ui_scale), # type: ignore # runtime
from_=100,
to=5,
tickinterval=10,
resolution=5,
command=lambda _: self.parent.wm_attributes("-alpha", self.transparency.get() / 100)
)
nb.Label(appearance_frame, text="100 means fully opaque.\nWindow is updated in real time").grid(
column=3,
padx=self.PADX,
pady=self.PADY*2,
sticky=tk.E,
row=cur_row
)
self.transparency_bar.grid(column=1, sticky=tk.W, row=cur_row)
# Always on top
ttk.Separator(appearance_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.PADY*4, sticky=tk.EW, row=row.get()
columnspan=4, padx=self.PADX, pady=self.PADY*4, sticky=tk.EW, row=row.get()
)
self.ontop_button = nb.Checkbutton(
@ -1122,6 +1155,7 @@ class PreferencesDialog(tk.Toplevel):
Translations.install(config.get_str('language', default=None)) # type: ignore # This sets self in weird ways.
config.set('ui_scale', self.ui_scale.get())
config.set('ui_transparency', self.transparency.get())
config.set('always_ontop', self.always_ontop.get())
config.set('theme', self.theme.get())
config.set('dark_text', self.theme_colors[0])