Native gui usable for data editing. Lots of fixes and improvenemts

This commit is contained in:
thooge committed 2026-11-11 18:58:02 +01:00
1 parent a6abdaa614
commit 09387280fc
52 files changed
+1579 -294

No files matched your search

+21 -6
View File
@@ -44,6 +44,21 @@ class MaintenanceView(View):
self.entry['completion'].set_placeholder_text(context.get_datefmt_placeholder())
self.dt_completion = DatePicker(self.entry['completion'], self.button['completion'], context.get_datefmt())
def get_list_row(self):
return (
self.maint.maintid,
self.maint.activities,
self.dd_equipment.get(self.maint.eid, ''),
self.maint.remarks
)
def add_row(self):
treeiter = self.lst_maintenance.append(self.get_list_row())
self.tree['maintenance'].get_selection().select_iter(treeiter)
def refresh_row(self):
treeview.set_row_values(self.tree['maintenance'], self.get_list_row())
def load_list(self):
selected_id = treeview.get_value(self.tree['maintenance'])
self.lst_maintenance.clear()
@@ -81,7 +96,7 @@ class MaintenanceView(View):
self.label['series'].set_text(str(self.maint.series))
self.label['interval'].set_text(self.format_int(self.maint.interval_hours))
self.label['last'].set_text(self.format_int(self.maint.last_hours))
self.label['plandate'].set_text(self.format_date(self.maint.plan_date))
self.label['plandate'].set_text(self.format_date(self.maint.plan_date, self.maint.plan_precision))
self.label['completion'].set_text(self.format_date(self.maint.completion_date))
self.label['status'].set_text(self.maint.maintstate)
self.label['remarks'].set_text(self.maint.remarks or '')
@@ -118,6 +133,7 @@ class MaintenanceView(View):
self.maint.plan_date = parse(self.entry['plandate'].get_text(), dayfirst=True)
except ValueError:
self.maint.plan_date = None
self.maint.plan_precision = combobox.get_list_value(self.combo['plan_precision'])
try:
self.maint.completion_date = parse(self.entry['completion'].get_text(), dayfirst=True)
except ValueError:
@@ -180,10 +196,7 @@ class MaintenanceView(View):
if not self.entry['activities'].get_text().strip():
# TODO error marker
return
if not self.save_record():
pass
if not self.record_lock('maintenance', self.maint.maintid):
return
self.save_record()
print(self.maint)
if not self.maint.save():
print("Save error")
@@ -192,8 +205,10 @@ class MaintenanceView(View):
return
self.record_unlock()
if self.newrecord:
self.load_list()
self.add_row()
self.newrecord = False
else:
self.refresh_row()
self.display_record()
self.topwidget.set_visible_child(self.box['maint_detail'])