More work on native gui. Make data editable.

This commit is contained in:
thooge committed 2026-10-29 18:59:21 +01:00
1 parent 5641e1706f
commit 7aa5d2af3b
43 files changed
+2686 -1037

No files matched your search

+25 -18
View File
@@ -16,7 +16,7 @@ Dropdowns, Database enums and Table numbers
"""
class Dropdown(IntEnum):
HULL_TYPE = 1
VESSEL_TYPE = 1
COMPANY_TYPE = 2
STORAGE_TYPE = 3
EQUIPMENT_CATEGORY = 4
@@ -33,51 +33,51 @@ class Dropdown(IntEnum):
MEASUREMENT_CATEGORY = 15
DropdownDeps = {
Dropdown.HULL_TYPE: (
# unused
Dropdown.VESSEL_TYPE: (
('vessel', 'vtype')
),
Dropdown.COMPANY_TYPE: (
('company', 'comptype'),
('company', 'comptype2')
),
Dropdown.STORAGE_TYPE: (
('storage', 'stype'),
('storage', 'stype')
),
Dropdown.EQUIPMENT_CATEGORY: (
('equipment', 'ecat'),
('equipment', 'ecat')
),
Dropdown.PROVISION_CATEGORY: (
('provisions', 'provcat'),
('provisions', 'provcat')
),
Dropdown.PROVISION_UNIT: (
('provisions', 'unit'),
('provisions', 'unit')
),
Dropdown.FUSE_TYPE: (
('fuse', 'ftype'),
('fuse', 'ftype')
),
Dropdown.UNIT: (
('measurement', 'unit'),
('measurement', 'unit')
),
Dropdown.BOX_TYPE: (
('box', 'boxtype'),
('box', 'boxtype')
),
Dropdown.FUSE_BLOCK: (
('fuse', 'location'),
('fuse', 'location')
),
Dropdown.CABLE_TYPE: (
('cable', 'cabletype'),
('cable', 'cabletype')
),
Dropdown.CABLE_TECHNAME: (
('cable', 'techname'),
('cable', 'techname')
),
Dropdown.INVENTORY_CATEGORY: (
('inventory', 'invcat'),
('inventory', 'invcat')
),
Dropdown.BBN_VESSELDATA: (
#unused
),
Dropdown.MEASUREMENT_CATEGORY: (
('measurement', 'mcat'),
('measurement', 'mcat')
)
}
@@ -88,7 +88,7 @@ class Table(IntEnum):
STORAGE = (4, "storage")
BOXES = (5, "boxes")
EQUIPMENT = (6, "equipment")
#INVENTORY = (7, "inventory")
INVENTORY = (7, "inventory")
PROJECTS = (8, "projects")
CABLES = (9, "cables")
FUSES = (10, "fuses")
@@ -114,6 +114,7 @@ class Lookup:
def _load_enums(self):
"""
enums and sets
translation via gettext from db schema
"""
db_enums = {
@@ -223,7 +224,10 @@ class Lookup:
)
self.db.cur.execute(sql, (vid,))
for row in self.db.cur.fetchall():
storagelist[row[0]] = "{} ({}) - {}".format(row[1], row[2], row[3])
if row[3]:
storagelist[row[0]] = "{} ({}) - {}".format(row[1], row[2], row[3])
else:
storagelist[row[0]] = "{} ({})".format(row[1], row[2])
return storagelist
def box(self, vid):
@@ -236,7 +240,10 @@ class Lookup:
)
self.db.cur.execute(sql, (vid,))
for row in self.db.cur.fetchall():
boxlist[row[0]] = "{} - {}".format(row[1], row[2])
if row[2]:
boxlist[row[0]] = "{} - {}".format(row[1], row[2])
else:
boxlist[row[0]] = row[1]
return boxlist
def equipment(self, vid):