malo čiščenji, mali refactor (self.label -> text_display)

This commit is contained in:
2026-03-23 13:26:51 +01:00
parent da06ef25a0
commit 1008b26960
2 changed files with 21 additions and 21 deletions

View File

@@ -129,7 +129,7 @@ class SongProjector:
font_weight = "bold" if self.settings.get("font_bold", False) else "normal" font_weight = "bold" if self.settings.get("font_bold", False) else "normal"
self.label = tk.Label( self.display_text = tk.Label(
self.color_frame, self.color_frame,
text="", text="",
bg=self.settings["bg_color"], bg=self.settings["bg_color"],
@@ -138,7 +138,7 @@ class SongProjector:
wraplength=color_width, wraplength=color_width,
justify="center" justify="center"
) )
self.label.pack(expand=True) self.display_text.pack(expand=True)
right_edge_x = int((screen_width - color_width) / 2 + color_width) right_edge_x = int((screen_width - color_width) / 2 + color_width)
@@ -238,7 +238,7 @@ class SongProjector:
if len(line) <= approx_chars_per_line: if len(line) <= approx_chars_per_line:
return [line] return [line]
# Potrebno število podvrstic # Potrebno število pod-vrstic
n_sub = math.ceil(len(line) / approx_chars_per_line) n_sub = math.ceil(len(line) / approx_chars_per_line)
words = line.split() words = line.split()
@@ -298,8 +298,8 @@ class SongProjector:
# Ponastavitev izgleda barvnega območja # Ponastavitev izgleda barvnega območja
self.color_frame.config(bg=self.settings["bg_color"], width=self.color_width, height=self.screen_height) self.color_frame.config(bg=self.settings["bg_color"], width=self.color_width, height=self.screen_height)
self.color_frame.place(relx=0.5, rely=0.5, anchor="center") self.color_frame.place(relx=0.5, rely=0.5, anchor="center")
self.label.config(bg=self.settings["bg_color"], fg=self.settings["fg_color"]) self.display_text.config(bg=self.settings["bg_color"], fg=self.settings["fg_color"])
self.label.pack(expand=True) self.display_text.pack(expand=True)
# Posebni ukazi # Posebni ukazi
if self.song_number == "9999": if self.song_number == "9999":
@@ -364,7 +364,7 @@ class SongProjector:
approx_line_count = 1 if is_blank else math.ceil((approx_line_length * avg_char_width) / wraplength) approx_line_count = 1 if is_blank else math.ceil((approx_line_length * avg_char_width) / wraplength)
needed_height = self.line_height * approx_line_count needed_height = self.line_height * approx_line_count
# Prazna vrstica več kot 1krat pomeni nova kitica ⇒ nova stran # Prazna vrstica več kot 1-krat pomeni nova kitica ⇒ nova stran
if blank_line_count >= 2: if blank_line_count >= 2:
if current_page_lines: if current_page_lines:
pages.append("\n".join(current_page_lines).strip()) pages.append("\n".join(current_page_lines).strip())
@@ -406,7 +406,7 @@ class SongProjector:
self.song_number_last = self.song_number self.song_number_last = self.song_number
self.show_page() self.show_page()
else: else:
self.label.config(text="") self.display_text.config(text="")
self.pages = [] self.pages = []
self.current_page_index = 0 self.current_page_index = 0
self.waiting_for_song = True self.waiting_for_song = True
@@ -414,7 +414,7 @@ class SongProjector:
self.song_info_label.config(text=self.song_number_last) self.song_info_label.config(text=self.song_number_last)
self.song_info_label.lift() self.song_info_label.lift()
except Exception as e: except Exception as e:
self.label.config(text=f"Napaka: {e}") self.display_text.config(text=f"Napaka: {e}")
finally: finally:
self.song_number = "" self.song_number = ""
@@ -426,7 +426,7 @@ class SongProjector:
text = self.pages[self.current_page_index] text = self.pages[self.current_page_index]
if self.all_caps_mode: if self.all_caps_mode:
text = text.upper() text = text.upper()
self.label.config(text=text) self.display_text.config(text=text)
if self.settings.get("show_song_info", False): if self.settings.get("show_song_info", False):
current_page = self.current_page_index + 1 current_page = self.current_page_index + 1
total_pages = len(self.pages) total_pages = len(self.pages)
@@ -457,8 +457,8 @@ class SongProjector:
self.current_page_index = 0 self.current_page_index = 0
self.waiting_for_song = True self.waiting_for_song = True
self.label.config(text="") self.display_text.config(text="")
self.label.pack_forget() self.display_text.pack_forget()
self.color_frame.config(bg="black", width=self.color_width, height=self.screen_height) self.color_frame.config(bg="black", width=self.color_width, height=self.screen_height)
self.color_frame.place(relx=0.5, rely=0.5, anchor="center") self.color_frame.place(relx=0.5, rely=0.5, anchor="center")
self.song_info_label.config(text="") self.song_info_label.config(text="")
@@ -503,10 +503,10 @@ class SongProjector:
query = self.search_entry.get().strip() query = self.search_entry.get().strip()
self.search_label.destroy() self.search_label.destroy()
self.search_entry.destroy() self.search_entry.destroy()
self.label.pack(expand=True) self.display_text.pack(expand=True)
if not query: if not query:
self.label.config(text="(Prazno iskanje)") self.display_text.config(text="(Prazno iskanje)")
return return
try: try:
@@ -516,14 +516,14 @@ class SongProjector:
) )
matched = self.cursor.fetchall() matched = self.cursor.fetchall()
except Exception as e: except Exception as e:
self.label.config(text=f"Napaka pri iskanju: {e}") self.display_text.config(text=f"Napaka pri iskanju: {e}")
return return
if matched: if matched:
found = "\n".join(f"{sid}: {title}" for sid, title in matched) found = "\n".join(f"{sid}: {title}" for sid, title in matched)
self.label.config(text=found) self.display_text.config(text=found)
else: else:
self.label.config(text="Ni zadetkov.") self.display_text.config(text="Ni zadetkov.")
# ------------------------------------------------------ # ------------------------------------------------------
# Posodobitev baze pesmi # Posodobitev baze pesmi
@@ -533,13 +533,13 @@ class SongProjector:
if not url: if not url:
msg = "URL za posodobitev ni nastavljen v settings.json." msg = "URL za posodobitev ni nastavljen v settings.json."
print(msg) print(msg)
self.label.config(text=msg) self.display_text.config(text=msg)
self.song_number = "" self.song_number = ""
return return
msg = f"Prenašam posodobitev iz: {url}..." msg = f"Prenašam posodobitev iz: {url}..."
print(msg) print(msg)
self.label.config(text=msg) self.display_text.config(text=msg)
self.root.update() self.root.update()
temp_db_path = None temp_db_path = None
@@ -584,12 +584,12 @@ class SongProjector:
final_msg = f"Posodobitev uspešna! Posodobljenih/dodanih {upsert_count} pesmi." final_msg = f"Posodobitev uspešna! Posodobljenih/dodanih {upsert_count} pesmi."
print(final_msg) print(final_msg)
self.label.config(text=final_msg) self.display_text.config(text=final_msg)
except Exception as e: except Exception as e:
error_msg = f"Napaka pri posodobitvi: {e}" error_msg = f"Napaka pri posodobitvi: {e}"
print(error_msg) print(error_msg)
self.label.config(text=error_msg) self.display_text.config(text=error_msg)
finally: finally:
if temp_db_path and os.path.exists(temp_db_path): if temp_db_path and os.path.exists(temp_db_path):
try: try:

View File

@@ -28,7 +28,7 @@
} }
body { body {
font-family: 'Times New Roman', serif; font-family: 'Noto Sans', sans-serif;
background-color: #0a0a0a; background-color: #0a0a0a;
color: #ffffff; color: #ffffff;
min-height: var(--container-min-h); min-height: var(--container-min-h);