Add clock
This commit is contained in:
parent
0433dee8c1
commit
85c0a60ec4
2 changed files with 18 additions and 0 deletions
lazy_player
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
|
@ -101,6 +102,14 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
left_box.set_valign(Gtk.Align.START)
|
left_box.set_valign(Gtk.Align.START)
|
||||||
left_box.set_halign(Gtk.Align.FILL)
|
left_box.set_halign(Gtk.Align.FILL)
|
||||||
|
|
||||||
|
# Create digital clock
|
||||||
|
self.clock_label = Gtk.Label()
|
||||||
|
self.clock_label.set_name("digital-clock")
|
||||||
|
self.clock_label.set_halign(Gtk.Align.CENTER)
|
||||||
|
self.clock_label.set_valign(Gtk.Align.CENTER)
|
||||||
|
self.clock_label.set_text(datetime.now().strftime("%H:%M"))
|
||||||
|
left_box.append(self.clock_label)
|
||||||
|
|
||||||
# Create image widget for thumbnail
|
# Create image widget for thumbnail
|
||||||
self.thumbnail_image = Gtk.Picture()
|
self.thumbnail_image = Gtk.Picture()
|
||||||
self.thumbnail_image.set_name("thumbnail-image")
|
self.thumbnail_image.set_name("thumbnail-image")
|
||||||
|
@ -445,6 +454,8 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
def _on_tick(self, widget: Gtk.Widget, frame_clock: Gdk.FrameClock, data: Any) -> bool:
|
def _on_tick(self, widget: Gtk.Widget, frame_clock: Gdk.FrameClock, data: Any) -> bool:
|
||||||
current_time = frame_clock.get_frame_time() / 1_000_000
|
current_time = frame_clock.get_frame_time() / 1_000_000
|
||||||
|
|
||||||
|
self.clock_label.set_text(datetime.now().strftime("%H:%M"))
|
||||||
|
|
||||||
if current_time >= self.overlay_hide_time:
|
if current_time >= self.overlay_hide_time:
|
||||||
self.overlay_label.set_visible(False)
|
self.overlay_label.set_visible(False)
|
||||||
|
|
||||||
|
|
|
@ -37,3 +37,10 @@ listview > row {
|
||||||
#thumbnail-image {
|
#thumbnail-image {
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#digital-clock {
|
||||||
|
color: white;
|
||||||
|
font-size: 48px;
|
||||||
|
font-family: monospace;
|
||||||
|
margin: 12px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue