ungana

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README

commit fe8e791733bf0aa3ea86d970230488f92af6fb92
parent 603ad22c40c6d39ddd2a84b184d2a0b59e22560a
Author: lash <dev@holbrook.no>
Date:   Sun, 31 Aug 2025 03:56:57 +0100

GUI hello world set field value

Diffstat:
Mgui/base.py | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/gui/base.py b/gui/base.py @@ -15,6 +15,7 @@ class MainWindow(Gtk.ApplicationWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.cal = None self.box_main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.set_child(self.box_main) @@ -29,6 +30,7 @@ class MainWindow(Gtk.ApplicationWindow): title = Gtk.Label(label="Summary") self.box_main.append(title) entry = Gtk.Entry() + self.entry_summary = entry self.box_main.append(entry) title = Gtk.Label(label="Description") @@ -46,20 +48,26 @@ class MainWindow(Gtk.ApplicationWindow): entry = Gtk.Entry(placeholder_text="") self.box_main.append(entry) + def load(self, fp): + self.cal = ICalManager() + self.cal.load_ical_file(fp) + ev = self.cal.get_first_event(self.cal.calendar) + self.entry_summary.set_text(ev.get('summary')) + + class Ungana(Adw.Application): - def __init__(self, *args, **kwargs): + def __init__(self, initial_calendar=None, *args, **kwargs): super().__init__(**kwargs) + self.file = initial_calendar self.win = None self.connect('activate', self.on_activate) def on_activate(self, app): logg.debug("activate") self.win = MainWindow(application=app) + self.win.load(self.file) self.win.present() -cal = ICalManager() -cal.load_ical_file(sys.argv[1]) -print(cal.get_all_events(cal.calendar)) -app = Ungana(application_id="org.defalsify.ungana") +app = Ungana(application_id="org.defalsify.ungana", initial_calendar=sys.argv[1]) app.run(None)