Work on native gui. Display records and add missing tasks and measurements.
This commit is contained in:
+75
-14
@@ -21,6 +21,58 @@ class Dropdown:
|
||||
FUSE_BLOCK = 10
|
||||
CABLE_TYPE = 11
|
||||
CABLE_TECHNAME = 12
|
||||
INVENTORY_CATEGORY = 13
|
||||
BBN_VESSELDATA = 14
|
||||
MEASUREMENT_CATEGORY = 15
|
||||
|
||||
Dependencies = {
|
||||
HULL_TYPE: (
|
||||
# unused
|
||||
),
|
||||
COMPANY_TYPE: (
|
||||
('company', 'comptype'),
|
||||
('company', 'comptype2')
|
||||
),
|
||||
STORAGE_TYPE: (
|
||||
('storage', 'stype'),
|
||||
),
|
||||
EQUIPMENT_CATEGORY: (
|
||||
('equipment', 'ecat'),
|
||||
),
|
||||
PROVISION_CATEGORY: (
|
||||
('provisions', 'provcat'),
|
||||
),
|
||||
PROVISION_UNIT: (
|
||||
('provisions', 'unit'),
|
||||
),
|
||||
FUSE_TYPE: (
|
||||
('fuse', 'ftype'),
|
||||
),
|
||||
UNIT: (
|
||||
('measurement', 'unit'),
|
||||
),
|
||||
BOX_TYPE: (
|
||||
('box', 'boxtype'),
|
||||
),
|
||||
FUSE_BLOCK: (
|
||||
('fuse', 'location'),
|
||||
),
|
||||
CABLE_TYPE: (
|
||||
('cable', 'cabletype'),
|
||||
),
|
||||
CABLE_TECHNAME: (
|
||||
('cable', 'techname'),
|
||||
),
|
||||
INVENTORY_CATEGORY: (
|
||||
('inventory', 'invcat'),
|
||||
),
|
||||
BBN_VESSELDATA: (
|
||||
#unused
|
||||
),
|
||||
MEASUREMENT_CATEGORY: (
|
||||
('measurement', 'mcat'),
|
||||
)
|
||||
}
|
||||
|
||||
class Lookup:
|
||||
|
||||
@@ -38,27 +90,28 @@ class Lookup:
|
||||
TODO translation via gettext needed
|
||||
"""
|
||||
db_enums = {
|
||||
'user.role': ('user', 'role'),
|
||||
'dropdown.flags': ('dropdown', 'flags'),
|
||||
'vessel.vtype': ('vessel', 'vtype'),
|
||||
'storage.capaunit': ('storage', 'capaunit'),
|
||||
'tagref.objtype': ('tagref', 'objtype'),
|
||||
'inventory.conttype': ('inventory', 'conttype'),
|
||||
'inventory.invcond': ('inventory', 'invcond'),
|
||||
'cable.cablecond': ('cable', 'cablecond'),
|
||||
'measurement.accuracy': ('measurement', 'accuracy'),
|
||||
'checkitem.checkresult': ('checkitem', 'checkresult'),
|
||||
'checklist.clstate': ('checklist', 'clstate'),
|
||||
'company.flags': ('company', 'flags'),
|
||||
'docref.reftype': ('docref', 'reftype'),
|
||||
'document.doctype': ('document', 'doctype'),
|
||||
'document.roleaccess': ('document', 'roleaccess'),
|
||||
'docref.reftype': ('docref', 'reftype'),
|
||||
'dropdown.flags': ('dropdown', 'flags'),
|
||||
'inventory.conttype': ('inventory', 'conttype'),
|
||||
'inventory.invcond': ('inventory', 'invcond'),
|
||||
'maintenance.maintstate': ('maintenance', 'maintstate'),
|
||||
'measurement.accuracy': ('measurement', 'accuracy'),
|
||||
'note.notetype': ('note', 'notetype'),
|
||||
'project.projstate': ('project', 'projstate'),
|
||||
'signalk.datatype': ('signalk', 'datatype'),
|
||||
'signalk.objtype': ('signalk', 'objtype'),
|
||||
'storage.capaunit': ('storage', 'capaunit'),
|
||||
'tagref.objtype': ('tagref', 'objtype'),
|
||||
'task.priority': ('task', 'priority'),
|
||||
'task.taskstate': ('task', 'taskstate'),
|
||||
'note.notetype': ('note', 'notetype'),
|
||||
'checklist.clstate': ('checklist', 'clstate'),
|
||||
'checkitem.checkresult': ('checkitem', 'checkresult'),
|
||||
'signalk.objtype': ('signalk', 'objtype'),
|
||||
'signalk.datatype': ('signalk', 'datatype')
|
||||
'user.role': ('user', 'role'),
|
||||
'vessel.vtype': ('vessel', 'vtype')
|
||||
}
|
||||
for key, (table, column) in db_enums.items():
|
||||
self._enums[key] = self.db.load_enum(table, column)
|
||||
@@ -83,6 +136,14 @@ class Lookup:
|
||||
def dropdown(self, ddid):
|
||||
return self._dropdowns[ddid]
|
||||
|
||||
def user(self):
|
||||
userlist = {}
|
||||
sql = "SELECT userid, displayname FROM user ORDER BY displayname"
|
||||
self.db.cur.execute(sql)
|
||||
for row in self.db.cur.fetchall():
|
||||
userlist[row[0]] = row[1]
|
||||
return userlist
|
||||
|
||||
def refresh(self):
|
||||
# TODO ugly hack please improve
|
||||
self._load_dropdowns()
|
||||
|
||||
Reference in New Issue
Block a user