Native gui usable for data editing. Lots of fixes and improvenemts
This commit is contained in:
1 parent
a6abdaa614
commit
09387280fc
52 files changed
+1579
-294
No files matched your search
@@ -58,7 +58,7 @@ from yms.view.status import StatusView
|
||||
|
||||
__author__ = "Thomas Hooge"
|
||||
__copyright__ = "Copyright 2024-2026"
|
||||
__version__ = "0.2.2"
|
||||
__version__ = "0.3"
|
||||
__email__ = "thomas@hoogi.de"
|
||||
__status__ = "Development"
|
||||
|
||||
@@ -75,6 +75,7 @@ class AppContext:
|
||||
}
|
||||
|
||||
# mapping between PHP and Python
|
||||
# TODO week, month and quarter formats
|
||||
datefmt_map = {
|
||||
'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
|
||||
@@ -86,6 +87,12 @@ class AppContext:
|
||||
'Y/m/d': ('%Y/%m/%d', 'YYYY/MM/DD') # Japan / China
|
||||
}
|
||||
|
||||
# Publish / Subscribe event variants
|
||||
EVENT_GENERIC = 0
|
||||
EVENT_ADD = 1
|
||||
EVENT_DEL = 2
|
||||
EVENT_UPD = 3
|
||||
|
||||
def __init__(self):
|
||||
self.__version__ = __version__
|
||||
self.db = None
|
||||
@@ -114,25 +121,19 @@ class AppContext:
|
||||
sql = "SELECT valstr FROM settings WHERE userid=0 AND sno=2"
|
||||
self.db.cur.execute(sql)
|
||||
row = self.db.cur.fetchone()
|
||||
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: date format mapping missing ({})".format(row[0]))
|
||||
if row and row[0]:
|
||||
self.datefmt = row[0]
|
||||
else:
|
||||
# perhaps create missing record here?
|
||||
pass
|
||||
print("No dateformat setting found")
|
||||
self.lookup.load()
|
||||
self.init_scanner()
|
||||
|
||||
def subscribe(self, event, callback):
|
||||
self.callbacks.setdefault(event, []).append(callback)
|
||||
|
||||
def publish(self, event, data=None):
|
||||
def publish(self, event, eventtype, data=None):
|
||||
for callback in self.callbacks.get(event, []):
|
||||
callback(data)
|
||||
callback(eventtype, data)
|
||||
|
||||
def init_scanner(self):
|
||||
self.scan_enabled = False
|
||||
@@ -168,6 +169,8 @@ class AppContext:
|
||||
return ""
|
||||
|
||||
def get_datefmt(self):
|
||||
# TODO take precision into account
|
||||
# day, week, month, quarter
|
||||
return self.datefmt_map[self.datefmt][0]
|
||||
|
||||
def get_datefmt_placeholder(self):
|
||||
@@ -262,7 +265,8 @@ class Frontend:
|
||||
Table.TAGS: "tags"
|
||||
}
|
||||
# execute method from module
|
||||
self.modules[modulemap[row[0]]].load_list()
|
||||
if row[0] in modulemap:
|
||||
self.modules[modulemap[row[0]]].load_list()
|
||||
|
||||
self.db_poll_ts = self.db.get_timestamp()
|
||||
return True
|
||||
|
||||
Reference in new issue
Block a user