Fixed vessel change code in native gui

This commit is contained in:
thooge committed 2026-11-12 19:34:59 +01:00
1 parent 09387280fc
commit db74fb6970
16 files changed
+192 -33

No files matched your search

+26
View File
@@ -49,6 +49,8 @@ class EquipmentView(View):
# subscribe to data change events
self.context.subscribe("dd_ecat_modified", self.category_modified)
self.context.subscribe("company_modified", self.company_modified)
self.context.subscribe("vessel_modified", self.vessel_modified)
def get_list_row(self):
return (
@@ -89,6 +91,11 @@ class EquipmentView(View):
def on_page_activated(self):
print("Equipment activated")
def vessel_modified(self, eventtype, data):
self.tree['equipment'].get_selection().unselect_all()
self.load_list()
self.topwidget.set_visible_child(self.box['equipment'])
def category_modified(self, eventtype, data):
self.dd_category[data[0]] = data[1]
lst = self.combo['category'].get_model()
@@ -103,6 +110,25 @@ class EquipmentView(View):
# not implemented
pass
def company_modified(self, eventtype, data):
if data[1] == 1:
# supplier
self.dd_supplier[data[0]] = data[2]
lst = self.combo['supplier'].get_model()
elif data[1] == 2:
# manufacturer
self.dd_manufacturer[data[0]] = data[2]
lst = self.combo['manufacturer'].get_model()
else:
# all other
return
if eventtype == self.context.EVENT_UPD:
for row in lst:
if row[0] == data[0]:
row[1] = data[2]
elif eventtype == self.context.EVENT_ADD:
lst.append((data[0], data[2]))
def clear_record(self):
self.equip.clear()
self.entry['name'].set_text('')