Work on native gui. Display records and add missing tasks and measurements.

This commit is contained in:
2026-09-30 16:18:44 +02:00
parent c3109b9d2a
commit 131af7d9e7
45 changed files with 6043 additions and 1966 deletions
+35 -1
View File
@@ -5,6 +5,7 @@ from gi.repository import Gtk
from .view import View
from yms import gtkutils, combobox, treeview
from yms.lookup import Dropdown
from yms.model import cable
class CablesView(View):
@@ -36,6 +37,9 @@ class CablesView(View):
treeview.add_column(self.tree['cables'], _('Condition'), 2)
self.tree['cables'].set_model(self.lst_cables)
self.dd_type = self.context.lookup.dropdown(Dropdown.CABLE_TYPE)
self.dd_tech = self.context.lookup.dropdown(Dropdown.CABLE_TECHNAME)
# buttons on list page
def on_but_new_clicked(self, widget):
self.topwidget.set_visible_child(self.box['cable_edit'])
@@ -44,8 +48,20 @@ class CablesView(View):
self.topwidget.set_visible_child(self.box['cable_edit'])
def on_but_detail_clicked(self, widget):
cableid = treeview.get_value(self.tree['cables'], 0)
if not cableid:
return
self.cable.load(cableid)
self.display_record()
self.topwidget.set_visible_child(self.box['cable_detail'])
self.button['close'].grab_focus()
def on_tvw_cables_row_activated(self, widget, path, column):
cableid = treeview.get_value(widget, 0)
self.cable.load(cableid)
self.display_record()
self.topwidget.set_visible_child(self.box['cable_detail'])
# buttons on detail page
# edit2 uses edit callback
def on_but_close_clicked(self, widget):
@@ -62,7 +78,25 @@ class CablesView(View):
self.topwidget.set_visible_child(self.box['cables'])
def display_record(self):
pass
self.label['name'].set_text(self.cable.cablename)
self.label['type'].set_text(self.dd_type[self.cable.cabletype])
if self.cable.techname:
self.label['techname'].set_text(self.dd_tech[self.cable.techname])
else:
self.label['techname'].set_text('')
self.label['length'].set_text(self.format_int(self.cable.length))
self.label['conductors'].set_text(self.format_int(self.cable.conductors))
self.label['diameter'].set_text(self.format_float(self.cable.diameter, 1))
self.label['xsection'].set_text(self.format_float(self.cable.xsection, 1))
self.label['weight'].set_text(self.format_float(self.cable.weight))
if self.cable.color:
self.label['color'].set_markup(f'#{self.cable.color} <span foreground="#{self.cable.color}">●</span>')
else:
self.label['color'].set_text('')
self.label['supplier'].set_text(str(self.cable.supplier))
self.label['manufacturer'].set_text(str(self.cable.manufacturer))
self.label['condition'].set_text(self.cable.cablecond)
self.label['remarks'].set_text(self.cable.remarks or '')
def edit_record(self):
pass