Work on native gui
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user