malo čiščenji, mali refactor (self.label -> text_display)
This commit is contained in:
40
projector.py
40
projector.py
@@ -129,7 +129,7 @@ class SongProjector:
|
||||
|
||||
font_weight = "bold" if self.settings.get("font_bold", False) else "normal"
|
||||
|
||||
self.label = tk.Label(
|
||||
self.display_text = tk.Label(
|
||||
self.color_frame,
|
||||
text="",
|
||||
bg=self.settings["bg_color"],
|
||||
@@ -138,7 +138,7 @@ class SongProjector:
|
||||
wraplength=color_width,
|
||||
justify="center"
|
||||
)
|
||||
self.label.pack(expand=True)
|
||||
self.display_text.pack(expand=True)
|
||||
|
||||
right_edge_x = int((screen_width - color_width) / 2 + color_width)
|
||||
|
||||
@@ -238,7 +238,7 @@ class SongProjector:
|
||||
if len(line) <= approx_chars_per_line:
|
||||
return [line]
|
||||
|
||||
# Potrebno število pod‑vrstic
|
||||
# Potrebno število pod-vrstic
|
||||
n_sub = math.ceil(len(line) / approx_chars_per_line)
|
||||
|
||||
words = line.split()
|
||||
@@ -298,8 +298,8 @@ class SongProjector:
|
||||
# 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.place(relx=0.5, rely=0.5, anchor="center")
|
||||
self.label.config(bg=self.settings["bg_color"], fg=self.settings["fg_color"])
|
||||
self.label.pack(expand=True)
|
||||
self.display_text.config(bg=self.settings["bg_color"], fg=self.settings["fg_color"])
|
||||
self.display_text.pack(expand=True)
|
||||
|
||||
# Posebni ukazi
|
||||
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)
|
||||
needed_height = self.line_height * approx_line_count
|
||||
|
||||
# Prazna vrstica več kot 1‑krat pomeni nova kitica ⇒ nova stran
|
||||
# Prazna vrstica več kot 1-krat pomeni nova kitica ⇒ nova stran
|
||||
if blank_line_count >= 2:
|
||||
if current_page_lines:
|
||||
pages.append("\n".join(current_page_lines).strip())
|
||||
@@ -406,7 +406,7 @@ class SongProjector:
|
||||
self.song_number_last = self.song_number
|
||||
self.show_page()
|
||||
else:
|
||||
self.label.config(text="")
|
||||
self.display_text.config(text="")
|
||||
self.pages = []
|
||||
self.current_page_index = 0
|
||||
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.lift()
|
||||
except Exception as e:
|
||||
self.label.config(text=f"Napaka: {e}")
|
||||
self.display_text.config(text=f"Napaka: {e}")
|
||||
finally:
|
||||
self.song_number = ""
|
||||
|
||||
@@ -426,7 +426,7 @@ class SongProjector:
|
||||
text = self.pages[self.current_page_index]
|
||||
if self.all_caps_mode:
|
||||
text = text.upper()
|
||||
self.label.config(text=text)
|
||||
self.display_text.config(text=text)
|
||||
if self.settings.get("show_song_info", False):
|
||||
current_page = self.current_page_index + 1
|
||||
total_pages = len(self.pages)
|
||||
@@ -457,8 +457,8 @@ class SongProjector:
|
||||
self.current_page_index = 0
|
||||
self.waiting_for_song = True
|
||||
|
||||
self.label.config(text="")
|
||||
self.label.pack_forget()
|
||||
self.display_text.config(text="")
|
||||
self.display_text.pack_forget()
|
||||
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.song_info_label.config(text="")
|
||||
@@ -503,10 +503,10 @@ class SongProjector:
|
||||
query = self.search_entry.get().strip()
|
||||
self.search_label.destroy()
|
||||
self.search_entry.destroy()
|
||||
self.label.pack(expand=True)
|
||||
self.display_text.pack(expand=True)
|
||||
|
||||
if not query:
|
||||
self.label.config(text="(Prazno iskanje)")
|
||||
self.display_text.config(text="(Prazno iskanje)")
|
||||
return
|
||||
|
||||
try:
|
||||
@@ -516,14 +516,14 @@ class SongProjector:
|
||||
)
|
||||
matched = self.cursor.fetchall()
|
||||
except Exception as e:
|
||||
self.label.config(text=f"Napaka pri iskanju: {e}")
|
||||
self.display_text.config(text=f"Napaka pri iskanju: {e}")
|
||||
return
|
||||
|
||||
if matched:
|
||||
found = "\n".join(f"{sid}: {title}" for sid, title in matched)
|
||||
self.label.config(text=found)
|
||||
self.display_text.config(text=found)
|
||||
else:
|
||||
self.label.config(text="Ni zadetkov.")
|
||||
self.display_text.config(text="Ni zadetkov.")
|
||||
|
||||
# ------------------------------------------------------
|
||||
# Posodobitev baze pesmi
|
||||
@@ -533,13 +533,13 @@ class SongProjector:
|
||||
if not url:
|
||||
msg = "URL za posodobitev ni nastavljen v settings.json."
|
||||
print(msg)
|
||||
self.label.config(text=msg)
|
||||
self.display_text.config(text=msg)
|
||||
self.song_number = ""
|
||||
return
|
||||
|
||||
msg = f"Prenašam posodobitev iz: {url}..."
|
||||
print(msg)
|
||||
self.label.config(text=msg)
|
||||
self.display_text.config(text=msg)
|
||||
self.root.update()
|
||||
|
||||
temp_db_path = None
|
||||
@@ -584,12 +584,12 @@ class SongProjector:
|
||||
|
||||
final_msg = f"Posodobitev uspešna! Posodobljenih/dodanih {upsert_count} pesmi."
|
||||
print(final_msg)
|
||||
self.label.config(text=final_msg)
|
||||
self.display_text.config(text=final_msg)
|
||||
|
||||
except Exception as e:
|
||||
error_msg = f"Napaka pri posodobitvi: {e}"
|
||||
print(error_msg)
|
||||
self.label.config(text=error_msg)
|
||||
self.display_text.config(text=error_msg)
|
||||
finally:
|
||||
if temp_db_path and os.path.exists(temp_db_path):
|
||||
try:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Times New Roman', serif;
|
||||
font-family: 'Noto Sans', sans-serif;
|
||||
background-color: #0a0a0a;
|
||||
color: #ffffff;
|
||||
min-height: var(--container-min-h);
|
||||
|
||||
Reference in New Issue
Block a user