add timeslot chooser

This commit is contained in:
2022-11-28 18:00:10 +01:00
parent 339ce8ee1a
commit adfcaf3701

22
main.py
View File

@ -79,10 +79,29 @@ class MainWindow(Gtk.Window):
self.calendar = Gtk.Calendar()
self.calendar.connect("day-selected", self.on_date_picked)
self.timeslots = Gtk.ListBox()
for slot in ["09:00", "15:00", "21:00"]:
print(slot)
row = Gtk.ListBoxRow()
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
row.add(hbox)
time_label = Gtk.Label(label=slot, xalign=0)
hbox.pack_start(time_label, True, True, 0)
hbox.pack_start(Gtk.CheckButton(), False, True, 0)
self.timeslots.add(row)
self.synthesize_button = Gtk.Button(label="synthesize")
self.listen_button = Gtk.Button(label="listen")
self.clear_button = Gtk.Button(label="clear")
self.save_button = Gtk.Button(label="save")
self.save_button.connect("clicked", self.on_transmission_saved)
# we need to put the buttons in a sizegroup to make the synthesize button the same length as the rest
self.right_sizegroup = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
self.right_sizegroup.add_widget(self.synthesize_button)
self.right_sizegroup.add_widget(self.listen_button)
self.right_sizegroup.add_widget(self.clear_button)
self.right_sizegroup.add_widget(self.save_button)
######################### organise objects ###################################
@ -106,8 +125,9 @@ class MainWindow(Gtk.Window):
self.right_box.pack_start(self.date_time_box, True, True, pad)
self.date_time_box.pack_start(self.calendar, True, True, 0)
self.date_time_box.pack_start(self.timeslots, True, True, 0)
self.right_box.pack_start(self.synthesize_listen_box, False, True, pad)
self.right_box.pack_start(self.synthesize_listen_box, False, True, 0)
self.synthesize_listen_box.pack_start(self.synthesize_button, True, True, 0)
self.synthesize_listen_box.pack_start(self.listen_button, True, True, 0)