Oppdaterte GUIen til å bruke event klassen

This commit is contained in:
Trygve 2022-03-06 21:38:19 +01:00
parent 13949303a5
commit 8888a52ff2

View File

@ -138,23 +138,24 @@ class MainWindow(Gtk.ApplicationWindow):
if response == Gtk.ResponseType.ACCEPT: if response == Gtk.ResponseType.ACCEPT:
file = dialog.get_file() file = dialog.get_file()
filename = file.get_path() filename = file.get_path()
courses = otime.courses_from_ttime_conf(ttime_cnf_file) event = otime.event(0, 'NoName')
o_classes = otime.classes_from_ttime_conf(ttime_cnf_file, courses) event.import_ttime_cnf(ttime_cnf_file)
runners = otime.ttime_db_to_class(ttime_db_file, o_classes) event.import_ttime_db(ttime_db_file)
otime.ttime_mtr_to_class(mtr_file, runners) event.import_mtr_file(mtr_file)
otime.gen_xml_result(runners, o_classes).write(filename) event.match_runners_cards()
event.get_xml_res().write(filename)
runners_ok = [] runners_ok = 0
for n in runners: for n in event.runners:
if n.status() == 'OK': if n.status() == 'OK':
runners_ok.append(n) runners_ok += 1
runners_dsq = [] runners_dsq = 0
for n in runners: for n in event.runners:
if n.status() == 'Disqualified': if n.status() == 'Disqualified':
runners_dsq.append(n) runners_dsq += 1
self.text_buffer.set_text(f'Antall påmeldte: {len(runners)} \nAntall godkjente: {len(runners_ok)} \nAntall dsq: {len(runners_dsq)}') self.text_buffer.set_text(f'Antall påmeldte: {len(event.runners)} \nAntall godkjente: {runners_ok} \nAntall dsq: {runners_dsq}')
self.save_toast = Adw.Toast.new('Fil lagra i: '+filename) self.save_toast = Adw.Toast.new('Fil lagra i: '+filename)
self.save_toast.set_timeout(8) self.save_toast.set_timeout(8)