methods back in wirepy as functions "theme dark and light"

This commit is contained in:
Désiré Werner Menrath 2025-04-25 16:19:36 +02:00
parent 67ff24f0b6
commit f9ecd54e0a
5 changed files with 34 additions and 31 deletions

3
.idea/dictionaries/project.xml generated Normal file
View File

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="project" />
</component>

5
.idea/workspace.xml generated
View File

@ -5,7 +5,8 @@
</component>
<component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment=" - Update Translate Files">
<change beforePath="$PROJECT_DIR$/wirepy.py" beforeDir="false" afterPath="$PROJECT_DIR$/wirepy.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cls_mth_fc.py" beforeDir="false" afterPath="$PROJECT_DIR$/cls_mth_fc.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -60,7 +61,7 @@
"Shell Script.run_as.executor": "Run",
"git-widget-placeholder": "21-04-2025-new-tooltip",
"last_opened_file_path": "/home/punix/Pyapps/wire-py",
"settings.editor.selected.configurable": "reference.settingsdialog.IDE.editor.colors"
"settings.editor.selected.configurable": "ml.llm.LLMConfigurable"
}
}]]></component>
<component name="RecentsManager">

View File

@ -136,32 +136,6 @@ class LxTools(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def theme_change_light(self, file=None):
"""
Set light theme
"""
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
self.tk.call("set_theme", "light")
with open(file, "r", encoding="utf-8") as theme_set2:
lines3 = theme_set2.readlines()
lines3[3] = "light\n"
with open(file, "w", encoding="utf-8") as theme_set2:
theme_set2.writelines(lines3)
self.color_label()
def theme_change_dark(self, file=None):
"""
Set dark theme
"""
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
self.tk.call("set_theme", "dark")
with open(file, "r", encoding="utf-8") as theme_set2:
lines4 = theme_set2.readlines()
lines4[3] = "dark\n"
with open(file, "w", encoding="utf-8") as theme_set2:
theme_set2.writelines(lines4)
self.color_label()
@staticmethod
def uos():
"""
@ -282,7 +256,6 @@ class LxTools(tk.Tk):
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGHUP, signal_handler)
class GiteaUpdate:
"""
Calling download requests the download URL of the running script,

View File

@ -133,6 +133,32 @@ class FrameWidgets(ttk.Frame):
with open(set_file, "w", encoding="utf-8") as set_f2:
set_f2.writelines(lines2)
def theme_change_light():
"""
Set light theme
"""
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
self.tk.call("set_theme", "light")
with open(set_file, "r", encoding="utf-8") as theme_set2:
lines3 = theme_set2.readlines()
lines3[3] = "light\n"
with open(set_file, "w", encoding="utf-8") as theme_set2:
theme_set2.writelines(lines3)
self.color_label()
def theme_change_dark():
"""
Set dark theme
"""
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
self.tk.call("set_theme", "dark")
with open(set_file, "r", encoding="utf-8") as theme_set2:
lines4 = theme_set2.readlines()
lines4[3] = "dark\n"
with open(set_file, "w", encoding="utf-8") as theme_set2:
theme_set2.writelines(lines4)
self.color_label()
def tooltip():
"""
Set True or False in file
@ -197,8 +223,8 @@ class FrameWidgets(ttk.Frame):
self.settings.add_checkbutton(
label=_("Disable Tooltips"), command=tooltip, variable=set_tip
)
self.settings.add_command(label=_("Light"), command=lambda: LxTools.theme_change_light(self, set_file))
self.settings.add_command(label=_("Dark"), command=lambda: LxTools.theme_change_dark(self, set_file))
self.settings.add_command(label=_("Light"), command=theme_change_light)
self.settings.add_command(label=_("Dark"), command=theme_change_dark)
# About BTN Menu / Label
self.about_btn = ttk.Button(