Fixes for webgui and more native gui development
This commit is contained in:
@@ -37,9 +37,11 @@ from yms import database
|
||||
from yms import gtkutils, combobox, treeview
|
||||
from yms.model import user
|
||||
from yms.model import vessel
|
||||
from yms.lookup import Lookup
|
||||
|
||||
from yms.view.base import BaseView
|
||||
from yms.view.storage import StorageView
|
||||
from yms.view.boxes import BoxesView
|
||||
from yms.view.equipment import EquipmentView
|
||||
from yms.view.inventory import InventoryView
|
||||
from yms.view.provisions import ProvisionsView
|
||||
@@ -57,17 +59,20 @@ class AppContext:
|
||||
'host': 'localhost',
|
||||
'db': 'yms',
|
||||
'user': 'yms',
|
||||
'docpath': '/var/local/yms',
|
||||
'docpath': '/var/local/lib/yms',
|
||||
'shapedir': '/usr/local/share/yms/shapes'
|
||||
}
|
||||
|
||||
# mapping between PHP and Python
|
||||
datefmt_map = {
|
||||
'Y-m-d': '%Y.%m.%d',
|
||||
'Y/m/d': '%Y/%m/%d',
|
||||
'd.m.Y': '%d.%m.%Y',
|
||||
'd/m/Y': '%d/%m/%Y',
|
||||
'm-d-Y': '%m.%d.%Y'
|
||||
'Y-m-d': '%Y-%m-%d', # ISO / international / technical
|
||||
'd.m.Y': '%d.%m.%Y', # Germany / Central & Northern Europe
|
||||
'd/m/Y': '%d/%m/%Y', # UK / France / Spain / Italy / Australia / NZ
|
||||
'd-m-Y': '%d-%m-%Y', # Netherlands / Denmark / Belgium
|
||||
'd M Y': '%d %b %Y', # nautical documents / logbooks / unambiguous
|
||||
'm.d.Y': '%m.%d.%Y', # USA
|
||||
'm/d/Y': '%m/%d/%Y', # USA
|
||||
'Y/m/d': '%Y/%m/%d' # Japan / China
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
@@ -80,6 +85,7 @@ class AppContext:
|
||||
|
||||
def set_db(self, db):
|
||||
self.db = db
|
||||
self.lookup = Lookup(db)
|
||||
|
||||
def load(self):
|
||||
self.user = user.User(db, 0)
|
||||
@@ -97,6 +103,7 @@ class AppContext:
|
||||
else:
|
||||
# perhaps create missing record here?
|
||||
pass
|
||||
self.lookup.load()
|
||||
|
||||
def get_sharepath(self):
|
||||
path = os.path.realpath(__file__)
|
||||
@@ -113,6 +120,7 @@ class Frontend:
|
||||
self.modules = {
|
||||
"base": BaseView(context),
|
||||
"storage": StorageView(context),
|
||||
"box": BoxesView(context),
|
||||
"equipment": EquipmentView(context),
|
||||
"inventory": InventoryView(context),
|
||||
"provisions": ProvisionsView(context),
|
||||
@@ -195,6 +203,7 @@ if __name__ == "__main__":
|
||||
context.cfg['host'] = config.get('DB', 'host')
|
||||
context.cfg['db'] = config.get('DB', 'db')
|
||||
db = database.Database(context.cfg['host'], context.cfg['db'])
|
||||
context.set_db(db)
|
||||
connected = False
|
||||
if context.cfg['host'] == 'socket':
|
||||
connected = db.connect_local()
|
||||
@@ -203,7 +212,6 @@ if __name__ == "__main__":
|
||||
context.cfg['pass'] = config.get('DB', 'pass')
|
||||
connected = db.connect(context.cfg['user'], context.cfg['pass'])
|
||||
if connected:
|
||||
context.set_db(db)
|
||||
context.load()
|
||||
# check if shapedir exists
|
||||
context.cfg['shapedir'] = config.get('Data', 'shapedir')
|
||||
|
||||
Reference in New Issue
Block a user