Work on native gui

This commit is contained in:
2025-11-07 14:42:05 +01:00
parent d5d754d596
commit e80a0688cc
3 changed files with 38 additions and 2 deletions
+12 -1
View File
@@ -88,13 +88,24 @@ def messagebox(messagetext, symbol=None, title=None, parent=None):
md.run()
md.destroy()
def create_config(cfgfile):
# create inital config file
with open(cfgfile, 'w') as fh:
fh.write('[DB]\n')
fh.write('host = localhost\n')
fh.write('db = yms\n')
fh.write('user = yms\n')
fh.write('pass = geheim\n')
if __name__ == "__main__":
locale.setlocale(locale.LC_ALL, '')
gettext.bindtextdomain('ymsgui', 'locale')
gettext.textdomain('ymsgui')
_ = gettext.gettext
config = configparser.ConfigParser()
if not config.read(os.path.expanduser(cfg['cfgfile'])):
cfgfile = os.path.expanduser(cfg['cfgfile'])
if not config.read(cfgfile):
create_config(cfgfile)
messagebox(_("Configuration file not found"), title="YMS")
else:
cfg['host'] = config.get('DB', 'host')