|  |  |  | @ -15,9 +15,7 @@ class Manager(): | 
			
		
	
		
			
				
					|  |  |  |  |     def __init__(self): | 
			
		
	
		
			
				
					|  |  |  |  |         self.manager_id = gen_id() | 
			
		
	
		
			
				
					|  |  |  |  |         self.devices = [] | 
			
		
	
		
			
				
					|  |  |  |  |         self.config = {} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         self.import_config_file() | 
			
		
	
		
			
				
					|  |  |  |  |         self.config = self.import_config_file() | 
			
		
	
		
			
				
					|  |  |  |  |         self.construct_from_config() | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     def add_device(self, name, resolution): #add parameters for Device class constructor | 
			
		
	
	
		
			
				
					|  |  |  | @ -36,8 +34,7 @@ class Manager(): | 
			
		
	
		
			
				
					|  |  |  |  |             config = toml.load(os.path.join(mydir, 'config.toml')) | 
			
		
	
		
			
				
					|  |  |  |  |             #config = convert(uni_config) | 
			
		
	
		
			
				
					|  |  |  |  |             restored_data = restore(config) | 
			
		
	
		
			
				
					|  |  |  |  |             self.config = restored_data | 
			
		
	
		
			
				
					|  |  |  |  |             self.devices = self.config['devices'] | 
			
		
	
		
			
				
					|  |  |  |  |             return restored_data | 
			
		
	
		
			
				
					|  |  |  |  |         except: | 
			
		
	
		
			
				
					|  |  |  |  |             return None | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
	
		
			
				
					|  |  |  | @ -48,6 +45,12 @@ class Manager(): | 
			
		
	
		
			
				
					|  |  |  |  |         with open(path, "w+") as config_file: | 
			
		
	
		
			
				
					|  |  |  |  |             config_file.write(toml.dumps({'devices': preserved_data})) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     def construct_from_config(self): | 
			
		
	
		
			
				
					|  |  |  |  |         try: | 
			
		
	
		
			
				
					|  |  |  |  |             self.devices = self.config['devices'] | 
			
		
	
		
			
				
					|  |  |  |  |         except: | 
			
		
	
		
			
				
					|  |  |  |  |             return None | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     #def update_config(self, new_config_tuple): | 
			
		
	
		
			
				
					|  |  |  |  |     #    new_device_list = [] | 
			
		
	
		
			
				
					|  |  |  |  |     #    for dev in devices: | 
			
		
	
	
		
			
				
					|  |  |  | @ -64,14 +67,7 @@ class Manager(): | 
			
		
	
		
			
				
					|  |  |  |  |     def clear_layout(self, device): | 
			
		
	
		
			
				
					|  |  |  |  |         device.layout = {} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     def construct_from_config(self): | 
			
		
	
		
			
				
					|  |  |  |  |         try: | 
			
		
	
		
			
				
					|  |  |  |  |             for confdev in self.config.devices: | 
			
		
	
		
			
				
					|  |  |  |  |                 dev = Device(confdev.name, confdev.resolution, confdev.device_id) | 
			
		
	
		
			
				
					|  |  |  |  |                 #for cwidg in dev.widgets: ###add code to construct widgets as well | 
			
		
	
		
			
				
					|  |  |  |  |                 self.devices.append(dev) | 
			
		
	
		
			
				
					|  |  |  |  |         except: | 
			
		
	
		
			
				
					|  |  |  |  |             return None | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | @preservable | 
			
		
	
		
			
				
					|  |  |  |  | class Device(): | 
			
		
	
	
		
			
				
					|  |  |  | @ -91,10 +87,9 @@ class Device(): | 
			
		
	
		
			
				
					|  |  |  |  |         #generated | 
			
		
	
		
			
				
					|  |  |  |  |         self.device_image = None | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | class Layout(): | 
			
		
	
		
			
				
					|  |  |  |  |     # Layout class to contain a layout and functions to manipulate that layout. | 
			
		
	
		
			
				
					|  |  |  |  |     def __init__(self): | 
			
		
	
		
			
				
					|  |  |  |  |         self.layout = {} | 
			
		
	
		
			
				
					|  |  |  |  | #@preservable | 
			
		
	
		
			
				
					|  |  |  |  | #class Widget(): | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | # Global Functions | 
			
		
	
	
		
			
				
					|  |  |  | 
 |