36 lines
843 B
Python
36 lines
843 B
Python
# SPDX-License-Identifier: WTFPL
|
|
|
|
from .dbrecord import DbRecord
|
|
from yms.lookup import Table
|
|
|
|
# names for fixed dropdown values
|
|
GENERIC = 0
|
|
TANK = 1
|
|
EXT = 2
|
|
|
|
class Storage(DbRecord):
|
|
|
|
table = "storage"
|
|
pk_field = "sid"
|
|
pk_is_auto = True
|
|
fields = ('sid', 'vid', 'sname', 'stype', 'capacity', 'capaunit',
|
|
'x', 'y', 'z', 'wx', 'wy', 'wz', 'angle', 'color', 'remarks')
|
|
|
|
def __init__(self, db, sid=None):
|
|
super().__init__(db, sid)
|
|
self.title = _("Storage({})")
|
|
|
|
def save(self, commit=True):
|
|
if not super().save(Table.STORAGE):
|
|
return False
|
|
if commit:
|
|
try:
|
|
self.conn.commit()
|
|
except mariadb.Error as e:
|
|
return False
|
|
return True
|
|
|
|
def delete(self):
|
|
# there must be no associated data!
|
|
pass
|