More work on native gui. Make data editable.
This commit is contained in:
1 parent
5641e1706f
commit
7aa5d2af3b
43 files changed
+2686
-1037
No files matched your search
@@ -15,6 +15,7 @@ Configuration file located at ~/.config/ymsgui.conf:
|
||||
|
||||
[Documents]
|
||||
basepath = /var/local/lib/yms
|
||||
scanner = off
|
||||
|
||||
[Data]
|
||||
shapedir = /usr/local/share/yms/shapes
|
||||
@@ -69,7 +70,8 @@ class AppContext:
|
||||
'db': 'yms',
|
||||
'user': 'yms',
|
||||
'docpath': '/var/local/lib/yms',
|
||||
'shapedir': '/usr/local/share/yms/shapes'
|
||||
'shapedir': '/usr/local/share/yms/shapes',
|
||||
'scanner': 'off'
|
||||
}
|
||||
|
||||
# mapping between PHP and Python
|
||||
@@ -115,7 +117,7 @@ class AppContext:
|
||||
print(row[0])
|
||||
except KeyError:
|
||||
# almost impossible case where db value is not in mapping
|
||||
print("internal error: date format mapping missing")
|
||||
print("internal error: date format mapping missing ({})".format(row[0]))
|
||||
else:
|
||||
# perhaps create missing record here?
|
||||
pass
|
||||
@@ -135,6 +137,15 @@ class Frontend:
|
||||
self.initializing = True
|
||||
self.context = context
|
||||
self.db = context.db
|
||||
|
||||
css = Gtk.CssProvider()
|
||||
css.load_from_path("yms/style.css")
|
||||
Gtk.StyleContext.add_provider_for_screen(
|
||||
Gdk.Screen.get_default(),
|
||||
css,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
)
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(context.textdomain)
|
||||
ui_path = os.path.join(context.ui_path)
|
||||
@@ -228,7 +239,8 @@ def create_config(cfg, cfgfile):
|
||||
fh.write('user = {}\n'.format(cfg['user']))
|
||||
fh.write('pass = changeme!\n\n')
|
||||
fh.write('[Documents]\n')
|
||||
fh.write('basepath = {}\n\n'.format(cfg['docpath']))
|
||||
fh.write('basepath = {}\n'.format(cfg['docpath']))
|
||||
fh.write('scanner = {}\n\n'.format(cfg['scanner']))
|
||||
fh.write('[Data]\n')
|
||||
fh.write('shapedir = {}\n'.format(cfg['shapedir']))
|
||||
# secure configuration
|
||||
@@ -265,6 +277,8 @@ if __name__ == "__main__":
|
||||
context.cfg['pass'] = config.get('DB', 'pass')
|
||||
connected = db.connect(context.cfg['user'], context.cfg['pass'])
|
||||
if connected:
|
||||
# TODO check database schema version
|
||||
schema_required = 1
|
||||
context.load()
|
||||
# check if shapedir exists
|
||||
context.cfg['shapedir'] = config.get('Data', 'shapedir')
|
||||
|
||||
Reference in new issue
Block a user