done for now

This commit is contained in:
nihilazo 2020-09-22 17:09:17 +01:00
parent 0e5264e917
commit 52e9117229

View File

@ -60,6 +60,7 @@ class CalendarWindow(Gtk.ApplicationWindow):
self.calendar = Gtk.Calendar() self.calendar = Gtk.Calendar()
self.calendar.fill = True self.calendar.fill = True
self.calendar.expand = True self.calendar.expand = True
self.calendar.set_size_request(400,400)
self.calendar_box.add(self.calendar) self.calendar_box.add(self.calendar)
self.calendar_box.add(Gtk.Label(label="PlaceHolder")) self.calendar_box.add(Gtk.Label(label="PlaceHolder"))
self.main_box = Gtk.Paned(orientation=Gtk.Orientation.HORIZONTAL) # Box containing the list view and cal/buttons self.main_box = Gtk.Paned(orientation=Gtk.Orientation.HORIZONTAL) # Box containing the list view and cal/buttons
@ -70,7 +71,6 @@ class CalendarWindow(Gtk.ApplicationWindow):
self.calendar.connect("day_selected",self._on_day_selected) self.calendar.connect("day_selected",self._on_day_selected)
def _on_day_selected(self,calendar): def _on_day_selected(self,calendar):
print("day selected")
calendar_date = calendar.get_date() calendar_date = calendar.get_date()
date = datetime.date(calendar_date.year,calendar_date.month+1,calendar_date.day) date = datetime.date(calendar_date.year,calendar_date.month+1,calendar_date.day)
self.header_bar.set_subtitle(date.isoformat()) self.header_bar.set_subtitle(date.isoformat())
@ -78,9 +78,7 @@ class CalendarWindow(Gtk.ApplicationWindow):
def populate_day(self,date): def populate_day(self,date):
print(date)
for c in self.event_list.get_children(): for c in self.event_list.get_children():
print(c)
c.destroy() c.destroy()
events = parse_event_list(get_event_list(date)) events = parse_event_list(get_event_list(date))
sorted_events = sorted(events, key=lambda k: k['start']) sorted_events = sorted(events, key=lambda k: k['start'])
@ -94,6 +92,7 @@ class EventRow(Gtk.ListBoxRow):
super().__init__() super().__init__()
self.description_label = Gtk.Label(label=event['description']) self.description_label = Gtk.Label(label=event['description'])
self.box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) self.box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.box.padding = 20
if event['type'] != 'event': if event['type'] != 'event':
timespan = f"{event['start'].strftime('%H:%M')} - {event['end'].strftime('%H:%M')}" timespan = f"{event['start'].strftime('%H:%M')} - {event['end'].strftime('%H:%M')}"
self.timespan_label = Gtk.Label(label=timespan) self.timespan_label = Gtk.Label(label=timespan)