Work on native gui. Display records and add missing tasks and measurements.
This commit is contained in:
@@ -48,6 +48,8 @@ from yms.view.inventory import InventoryView
|
||||
from yms.view.provisions import ProvisionsView
|
||||
from yms.view.maintenance import MaintenanceView
|
||||
from yms.view.projects import ProjectsView
|
||||
from yms.view.tasks import TasksView
|
||||
from yms.view.measurement import MeasurementView
|
||||
from yms.view.cables import CablesView
|
||||
from yms.view.fuses import FusesView
|
||||
from yms.view.documents import DocumentsView
|
||||
@@ -72,14 +74,14 @@ class AppContext:
|
||||
|
||||
# mapping between PHP and Python
|
||||
datefmt_map = {
|
||||
'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
|
||||
'Y-m-d': ('%Y-%m-%d', 'YYYY-MM-DD'), # ISO / international / technical
|
||||
'd.m.Y': ('%d.%m.%Y', 'DD.MM.YYYY'), # Germany / Central & Northern Europe
|
||||
'd/m/Y': ('%d/%m/%Y', 'DD/MM/YYYY'), # UK / France / Spain / Italy / Australia / NZ
|
||||
'd-m-Y': ('%d-%m-%Y', 'DD-MM-YYYY'), # Netherlands / Denmark / Belgium
|
||||
'd M Y': ('%d %b %Y', 'DD Mon YYYY'), # nautical documents / logbooks / unambiguous
|
||||
'm.d.Y': ('%m.%d.%Y', 'MM.DD.YYYY'), # USA
|
||||
'm/d/Y': ('%m/%d/%Y', 'MM/DD/YYYY'), # USA
|
||||
'Y/m/d': ('%Y/%m/%d', 'YYYY/MM/DD') # Japan / China
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
@@ -109,9 +111,10 @@ class AppContext:
|
||||
if row is not None:
|
||||
try:
|
||||
self.datefmt = self.datefmt_map[row[0]]
|
||||
print(row[0])
|
||||
except KeyError:
|
||||
# almost impossible case where db value is not in mapping
|
||||
print("internal error: format mapping missinf")
|
||||
print("internal error: date format mapping missing")
|
||||
else:
|
||||
# perhaps create missing record here?
|
||||
pass
|
||||
@@ -137,10 +140,12 @@ class Frontend:
|
||||
"equipment": EquipmentView(context),
|
||||
"inventory": InventoryView(context),
|
||||
"provisions": ProvisionsView(context),
|
||||
"measurement": MeasurementView(context),
|
||||
"cables": CablesView(context),
|
||||
"fuses": FusesView(context),
|
||||
"maintenance": MaintenanceView(context),
|
||||
"projects": ProjectsView(context),
|
||||
"tasks": TasksView(context),
|
||||
"documents": DocumentsView(context),
|
||||
"status": StatusView(context)
|
||||
}
|
||||
@@ -152,13 +157,11 @@ class Frontend:
|
||||
self.window = builder.get_object("wnd_main")
|
||||
self.notebook = builder.get_object("ntb_modules")
|
||||
for module in self.modules.values():
|
||||
self.notebook.append_page(module.topwidget, Gtk.Label(label=module.title))
|
||||
self.notebook.append_page(module.topwidget, Gtk.Label(label=module._title))
|
||||
|
||||
self.db_poll_ts = context.db.get_timestamp()
|
||||
GLib.timeout_add_seconds(30, self.db_change_poller)
|
||||
|
||||
print("Frontend initialized.")
|
||||
|
||||
def run(self):
|
||||
#self.label['vessel'].set_text(self._vessel.vesselname)
|
||||
self.window.show_all()
|
||||
@@ -195,14 +198,12 @@ def create_config(cfg, cfgfile):
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print("Startup sequence entered...")
|
||||
|
||||
context = AppContext()
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
gettext.bindtextdomain(context.textdomain, 'locale')
|
||||
gettext.textdomain(context.textdomain)
|
||||
gettext.install(context.textdomain)
|
||||
gettext.install(context.textdomain, 'locale')
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
cfgfile = os.path.expanduser(context.cfg['cfgfile'])
|
||||
|
||||
Reference in New Issue
Block a user