Skip to content

Commit 285a4e0

Browse files
author
marci
committed
refactor: Verbesserung der Schriftartkonfiguration und Syntax-Hervorhebung
- Umstellung der Schriftartkonfiguration im FontSettingsDialog auf ein Tupel für bessere Lesbarkeit. - Anpassung der Schriftart für Kommentare, Strings, Operatoren und Zahlen in der Syntax-Hervorhebung auf "bold", um die Sichtbarkeit zu erhöhen. - Aktualisierung der Schriftartkonfiguration im BashScriptEditor zur Unterstützung von fetter Schrift. Diese Änderungen verbessern die Lesbarkeit und Benutzererfahrung im Editor.
1 parent c650587 commit 285a4e0

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

bash_script_maker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def __init__(self, parent, editor):
3030
self.editor = editor
3131

3232
# Aktuelle Schriftart ermitteln
33-
current_font_family, current_font_size = editor.base_font
33+
font_tuple = editor.base_font
34+
current_font_family = font_tuple[0]
35+
current_font_size = font_tuple[1]
3436

3537
# UI Elemente
3638
container = ttk.Frame(self, padding=15)

syntax_highlighter.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def configure_tags(self):
589589
# Kommentare
590590
self.tag_configs["comments"] = {
591591
"foreground": sol_base01,
592-
"font": ("Courier", 10, "italic"),
592+
"font": ("Courier", 10, "italic bold"),
593593
}
594594
self.text_widget.tag_configure("comments", **self.tag_configs["comments"])
595595

@@ -601,7 +601,10 @@ def configure_tags(self):
601601
self.text_widget.tag_configure("shebang", **self.tag_configs["shebang"])
602602

603603
# Strings
604-
self.tag_configs["strings"] = {"foreground": sol_orange}
604+
self.tag_configs["strings"] = {
605+
"foreground": sol_orange,
606+
"font": ("Courier", 10, "bold"),
607+
}
605608
self.text_widget.tag_configure("strings", **self.tag_configs["strings"])
606609

607610
# Variablen
@@ -619,11 +622,17 @@ def configure_tags(self):
619622
self.text_widget.tag_configure("commands", **self.tag_configs["commands"])
620623

621624
# Operatoren
622-
self.tag_configs["operators"] = {"foreground": sol_magenta}
625+
self.tag_configs["operators"] = {
626+
"foreground": sol_magenta,
627+
"font": ("Courier", 10, "bold"),
628+
}
623629
self.text_widget.tag_configure("operators", **self.tag_configs["operators"])
624630

625631
# Zahlen
626-
self.tag_configs["numbers"] = {"foreground": sol_orange}
632+
self.tag_configs["numbers"] = {
633+
"foreground": sol_orange,
634+
"font": ("Courier", 10, "bold"),
635+
}
627636
self.text_widget.tag_configure("numbers", **self.tag_configs["numbers"])
628637

629638
# Klammern
@@ -680,7 +689,7 @@ def __init__(self, parent, **kwargs):
680689
self.tab_size = 4 # 4 Leerzeichen pro Tab
681690

682691
# Konfigurationen an das zugrundeliegende Text-Widget via kwargs weitergeben
683-
kwargs.setdefault("font", ("Courier", 10))
692+
kwargs.setdefault("font", ("Courier", 10, "bold"))
684693
self.base_font = kwargs.get("font")
685694
kwargs.setdefault("tabs", (f"{self.tab_size}c",))
686695

@@ -772,7 +781,7 @@ def create_context_menu(self):
772781

773782
def update_font(self, font_family, font_size):
774783
"""Aktualisiert die Schriftart des Editors."""
775-
new_font = (font_family, font_size)
784+
new_font = (font_family, font_size, "bold")
776785
self.text.config(font=new_font)
777786
# Sorge dafür, dass die Syntax-Tags die neue Schriftgröße übernehmen, aber ihre Stile beibehalten
778787
for tag_name, config in self.highlighter.tag_configs.items():

0 commit comments

Comments
 (0)