Commit 44181d5d authored by Michael Rudolf's avatar Michael Rudolf
Browse files

Hopefully fixed a bug when creating default config

parent a199b3aa
......@@ -3,7 +3,7 @@
# @Author: M. Rudolf, M. Warsitzka
# @Date: 2019-02-20 12:00:00
# @Last Modified by: M. Rudolf
# @Last Modified time: 2020-05-18 13:18:56
# @Last Modified time: 2020-05-20 14:08:53
"""
RST_pick_GUI.py
......@@ -355,7 +355,6 @@ class RST_pick_GUI(tk.Tk):
pfit, perr, name_fit = rfnc.vst_analysis(exp)
rfnc.plotVST(path_out, exp, pfit, perr, name_fit)
# ======= Exit if 'exit on processing' is selected =====
if self.quit_onprc.get() == 1:
sys.exit(0)
......@@ -386,11 +385,34 @@ class RST_pick_GUI(tk.Tk):
text=self.cfg['units'][item[0]])
opt_dlg.label_unit.grid(column=2, row=i + 1, sticky='w')
def set_data(self):
''' Set contents of fields and variables according to config '''
self.projectname.set(self.cfg['paths']['projectname'])
self.path_in.set(self.cfg['paths']['path_in'])
self.path_out.set(self.cfg['paths']['path_out'])
self.path_cfg.set(self.cfg['paths']['path_cfg'])
self.plot_ts.set(self.cfg.getint('options', 'plot_ts'))
self.save_ts.set(self.cfg.getint('options', 'save_ts'))
self.rst.set(self.cfg.getint('options', 'rst'))
self.rev_pick.set(self.cfg.getint('options', 'rev_pick'))
self.is_VST.set(self.cfg.getint('options', 'is_VST'))
self.quit_onprc.set(self.cfg.getint('options', 'quit_onprc'))
# Read parameters and store them as a dictionary of StringVars
# This automatically links them to changes made in the Options dialog.
for item in self.cfg['parameters'].items():
self.params[item[0]] = tk.StringVar()
self.params[item[0]].set(item[1])
def refresh_entries_from_cfg(self, path=None, init=False):
"""Refresh entries from config file"""
if init:
try:
self.cfg.read(self.path_cfg.get())
c = self.cfg.read(self.path_cfg.get())
if not(c):
self.create_default_config()
self.cfg.read(self.path_cfg.get())
print('created default config')
print('read default config')
except:
self.create_default_config()
......@@ -409,23 +431,8 @@ class RST_pick_GUI(tk.Tk):
self.cfg.read(self.path_cfg.get())
print('created project config')
# Set contents of fields and variables according to config
self.projectname.set(self.cfg['paths']['projectname'])
self.path_in.set(self.cfg['paths']['path_in'])
self.path_out.set(self.cfg['paths']['path_out'])
self.path_cfg.set(self.cfg['paths']['path_cfg'])
self.set_data()
self.plot_ts.set(self.cfg.getint('options', 'plot_ts'))
self.save_ts.set(self.cfg.getint('options', 'save_ts'))
self.rst.set(self.cfg.getint('options', 'rst'))
self.rev_pick.set(self.cfg.getint('options', 'rev_pick'))
self.is_VST.set(self.cfg.getint('options', 'is_VST'))
self.quit_onprc.set(self.cfg.getint('options', 'quit_onprc'))
# Read parameters and store them as a dictionary of StringVars
# This automatically links them to changes made in the Options dialog.
for item in self.cfg['parameters'].items():
self.params[item[0]] = tk.StringVar()
self.params[item[0]].set(item[1])
def create_default_config(self, path=None):
"""Creates default config in the given path"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment