feat(config): finish integrating new configuration system

This commit is contained in:
Daniel S. 2019-09-28 19:29:11 +02:00
parent 93f655c7ce
commit a8d6a32799

View file

@ -79,7 +79,7 @@ class Job(QObject):
return self.job.start()
def cancel(self):
self.job.terminate()
self.job.terminate()
self.job = None
def __bool__(self):
@ -88,7 +88,7 @@ class Job(QObject):
@property
def done(self):
if self.job:
return (self.job.is_alive() == False) and (self.job.queue.empty())
return (self.job.is_alive() == False) and (self.job.queue.empty())
return True
def interval(self):
@ -261,24 +261,45 @@ class ED_LRR(Ui_ED_LRR):
return fileName
def set_sys_lst(self, path):
if path not in cfg["history.out_path"]:
cfg["history.out_path"].append(path)
self.inp_sys_lst.addItem(path)
self.inp_out_pp.addItem(path)
self.inp_sys_lst.setCurrentText(path)
self.inp_out_pp.setCurrentText(path)
if path not in cfg["history.stars_csv_path"]:
cfg["history.stars_csv_path"].append(path)
self.update_dropdowns()
def set_bodies_file(self, path):
if path not in cfg["history.bodies_path"]:
cfg["history.bodies_path"].append(path)
self.inp_bodies_pp.addItem(path)
self.update_dropdowns()
def set_systems_file(self, path):
if path not in cfg["history.systems_path"]:
cfg["history.systems_path"].append(path)
self.inp_systems_pp.addItem(path)
self.update_dropdowns()
def update_dropdowns(self):
self.inp_systems_pp.clear()
self.inp_systems_dest_dl.clear()
for path in cfg["history.systems_path"][:]:
if os.path.isfile(path):
self.inp_systems_pp.addItem(path)
self.inp_systems_dest_dl.addItem(path)
else:
cfg["history.systems_path"].remove(path)
self.inp_bodies_pp.clear()
self.inp_bodies_dest_dl.clear()
for path in cfg["history.bodies_path"][:]:
if os.path.isfile(path):
self.inp_bodies_pp.addItem(path)
self.inp_bodies_dest_dl.addItem(path)
else:
cfg["history.bodies_path"].remove(path)
self.inp_sys_lst.clear()
self.inp_out_pp.clear()
for path in cfg["history.stars_csv_path"]:
if os.path.isfile(path):
self.inp_sys_lst.addItem(path)
self.inp_out_pp.addItem(path)
else:
cfg["history.stars_csv_path"].remove(path)
return
def log(self, *args):
@ -335,7 +356,7 @@ class ED_LRR(Ui_ED_LRR):
return ret
def error(self, msg):
QMessageBox.critical(self.main_window, "ERROR!", msg)
QMessageBox.critical(self.main_window, "ED_LRR Error", msg)
def get_sys_list(self):
if not self.inp_sys_lst.currentText():
@ -518,8 +539,6 @@ class ED_LRR(Ui_ED_LRR):
def setup_signals(self):
self.btn_download.clicked.connect(self.run_download)
self.inp_systems_dest_dl.setCurrentText(r"D:\devel\rust\ed_lrr_gui\DL\s.json")
self.inp_bodies_dest_dl.setCurrentText(r"D:\devel\rust\ed_lrr_gui\DL\b.json")
self.set_greedyness(self.sld_greedyness.value())
self.cmb_mode.currentTextChanged.connect(self.set_route_mode)
self.rd_comp.toggled.connect(self.set_comp_mode)
@ -529,7 +548,6 @@ class ED_LRR(Ui_ED_LRR):
self.btn_add.clicked.connect(self.add_system)
self.btn_rm.clicked.connect(self.remove_system)
self.chk_permute.stateChanged.connect(self.update_permute_chk)
self.btn_search.clicked.connect(self.resolve_systems)
self.btn_out_browse_pp.clicked.connect(
lambda: self.get_save_file("CSV File (*.csv)", self.set_sys_lst)
)
@ -551,7 +569,7 @@ class ED_LRR(Ui_ED_LRR):
)
def handle_close(self):
cfg.sync()
cfg.write()
print("BYEEEEEE!")
def setup_styles(self, win, app):