Še malo šminke (št. pesmi) in 9900 za prikaz istega preko tipkovnice. #9
This commit is contained in:
46
projector.py
46
projector.py
@@ -343,6 +343,9 @@ class SongProjector:
|
||||
elif self.song_number == "9901":
|
||||
self.update_songs_database()
|
||||
return
|
||||
elif self.song_number == "9900":
|
||||
self.show_app_info_tkinter()
|
||||
return
|
||||
try:
|
||||
song_id = int(self.song_number)
|
||||
self.cursor.execute("SELECT lyrics FROM songs WHERE id=?", (song_id,))
|
||||
@@ -717,6 +720,49 @@ class SongProjector:
|
||||
except Exception as e:
|
||||
print(f"Napaka pri pošiljanju ntfy obvestila: {e}")
|
||||
|
||||
# ------------------------------------------------------
|
||||
# Prikaži informacije o aplikaciji v Tkinter oknu
|
||||
# ------------------------------------------------------
|
||||
def show_app_info_tkinter(self):
|
||||
"""Prikaže informacije o aplikaciji v glavnem oknu (ukaz 9900)."""
|
||||
try:
|
||||
with open('appinfo.json', 'r', encoding='utf-8') as f:
|
||||
info = json.load(f)
|
||||
|
||||
self.cursor.execute("SELECT COUNT(*) FROM songs")
|
||||
count = self.cursor.fetchone()[0]
|
||||
|
||||
authors = ", ".join(info.get("authors", []))
|
||||
|
||||
display_text = (
|
||||
f"{info.get('name', 'Projekcija')}\n"
|
||||
f"Verzija: {info.get('version', 'neznana')}\n\n"
|
||||
f"{info.get('description', '')}\n\n"
|
||||
f"Avtorji: {authors}\n\n"
|
||||
f"Število pesmi v bazi: {count}"
|
||||
)
|
||||
|
||||
# Ponastavitev izgleda barvnega območja za prikaz informacij
|
||||
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.display_text.config(bg=self.settings["bg_color"], fg=self.settings["fg_color"], text=display_text)
|
||||
self.display_text.pack(expand=True)
|
||||
|
||||
# self.song_number_last = "9900"
|
||||
self.song_info_label.config(text="Informacije o programu")
|
||||
self.song_info_label.lift()
|
||||
|
||||
self.pages = []
|
||||
self.current_page_index = 0
|
||||
self.waiting_for_song = True
|
||||
|
||||
notify_clients()
|
||||
|
||||
except Exception as e:
|
||||
self.display_text.config(text=f"Napaka pri branju informacij: {e}")
|
||||
finally:
|
||||
self.song_number = ""
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Zagon aplikacije
|
||||
# ----------------------------------------------------------
|
||||
|
||||
@@ -207,6 +207,13 @@ def get_app_info():
|
||||
# appinfo.json je v korenskem imeniku projekta
|
||||
with open('appinfo.json', 'r', encoding='utf-8') as f:
|
||||
info = json.load(f)
|
||||
|
||||
# Dodaj število pesmi v bazi
|
||||
if _projector_app is not None:
|
||||
_projector_app.cursor.execute("SELECT COUNT(*) FROM songs")
|
||||
count = _projector_app.cursor.fetchone()[0]
|
||||
info['song_count'] = count
|
||||
|
||||
return jsonify(info)
|
||||
except Exception as e:
|
||||
return jsonify({'error': str(e)}), 500
|
||||
|
||||
@@ -362,6 +362,11 @@ async function openAbout() {
|
||||
document.getElementById('about-name').textContent = data.name;
|
||||
document.getElementById('about-version').textContent = 'Verzija ' + data.version;
|
||||
document.getElementById('about-description').textContent = data.description;
|
||||
|
||||
// Dodaj število pesmi
|
||||
if (data.song_count !== undefined) {
|
||||
document.getElementById('about-description').innerHTML += `<br><br>Število pesmi v bazi: <strong>${data.song_count}</strong>`;
|
||||
}
|
||||
|
||||
const authorsList = document.getElementById('about-authors');
|
||||
authorsList.innerHTML = '';
|
||||
|
||||
Reference in New Issue
Block a user