feat(config): impelemt save and load to GUI
This commit is contained in:
		
							parent
							
								
									f34d37a9d6
								
							
						
					
					
						commit
						65fe131006
					
				
					 1 changed files with 14 additions and 9 deletions
				
			
		|  | @ -317,27 +317,24 @@ class ED_LRR(Ui_ED_LRR): | |||
|         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_pp.setCurrentText(path) | ||||
|                 self.inp_systems_dest_dl.addItem(path) | ||||
|             else: | ||||
|                 cfg["history.systems_path"].remove(path) | ||||
|             self.inp_systems_dest_dl.setCurrentText(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_pp.setCurrentText(path) | ||||
|                 self.inp_bodies_dest_dl.addItem(path) | ||||
|             else: | ||||
|                 cfg["history.bodies_path"].remove(path) | ||||
|             self.inp_bodies_dest_dl.setCurrentText(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_sys_lst.setCurrentText(path) | ||||
|                 self.inp_out_pp.addItem(path) | ||||
|             else: | ||||
|                 cfg["history.stars_csv_path"].remove(path) | ||||
|             self.inp_out_pp.setCurrentText(path) | ||||
|         return | ||||
| 
 | ||||
|     def log(self, *args): | ||||
|  | @ -608,6 +605,14 @@ class ED_LRR(Ui_ED_LRR): | |||
|         ) | ||||
| 
 | ||||
|     def handle_close(self): | ||||
|         for key in [ | ||||
|             "history.stars_csv_path", | ||||
|             "history.bodies_path", | ||||
|             "history.systems_path", | ||||
|         ]: | ||||
|             for path in cfg[key][:]: | ||||
|                 if not os.path.isfile(path): | ||||
|                     cfg[key].remove(path) | ||||
|         cfg.write() | ||||
|         print("BYEEEEEE!") | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue