Programmname "obp60v" umgesetzt. Konfigurationshandling verbessert
This commit is contained in:
		
							parent
							
								
									bae459c4d4
								
							
						
					
					
						commit
						b06d88d0ec
					
				|  | @ -1,3 +1,4 @@ | |||
| *~ | ||||
| __pycache__ | ||||
| nmea2000 | ||||
| obp60v.conf | ||||
|  |  | |||
							
								
								
									
										8
									
								
								INSTALL
								
								
								
								
							
							
						
						
									
										8
									
								
								INSTALL
								
								
								
								
							|  | @ -13,13 +13,15 @@ OBP60v-Verzeichnis installiert werden: | |||
|   cd OBP60v | ||||
|   ln -s ../nmea2000 . | ||||
| 
 | ||||
| Das Programm wird über eine Konfigurationsdatei obp60.conf im gleichen | ||||
| Das Programm wird über eine Konfigurationsdatei obp60v.conf im gleichen | ||||
| Verzeichnis wie das Hauptprogramm gesteuert. Die Konfiguration wird | ||||
| einmalig beim Programmstart eingelesen. | ||||
| einmalig beim Programmstart eingelesen. Dazu kann die Vorlage kopiert | ||||
| werden: | ||||
|   cp obp60v.conf-sample obp60v.conf | ||||
| 
 | ||||
| Die Schriftarten aus dem fonts-Verzeichnis müssen in /usr/local/share/fonts | ||||
| abgelegt werden. | ||||
| 
 | ||||
| Meßdaten werden im Homeverzeichnis unter  ~/.local/lib/obp60 gespeichert. | ||||
| Meßdaten werden im Homeverzeichnis unter  ~/.local/lib/obp60v gespeichert. | ||||
| Dies betrifft momentan Luftdruckmessungen mit dem BME280. | ||||
| Das Verzeichnis wird automatisch angelegt. | ||||
|  |  | |||
|  | @ -3,9 +3,9 @@ systemname = OBP60v | |||
| loglevel = 3 | ||||
| deviceid = 100 | ||||
| simulation = on | ||||
| histpath = ~/.local/lib/obp60 | ||||
| guistyle = fullscreen | ||||
| mouseptr = off | ||||
| histpath = ~/.local/lib/obp60v | ||||
| guistyle = default | ||||
| mouseptr = on | ||||
| 
 | ||||
| [gui] | ||||
| win_x = -1 | ||||
|  | @ -1,7 +1,7 @@ | |||
| #!/usr/bin/env python | ||||
| 
 | ||||
| """ | ||||
| Virtuelles Multifunktionsgerät | ||||
| Virtuelles Multifunktionsgerät OBP60v | ||||
| 
 | ||||
| Zwei Displayvarianten | ||||
|   1. Fliegendes OBP60 auf großem Bildschirm. 400x300 Display | ||||
|  | @ -109,7 +109,7 @@ __email__ = "thomas@hoogi.de" | |||
| __status__ = "Development" | ||||
| 
 | ||||
| cfg = { | ||||
|     'cfgfile': 'obp60.conf', | ||||
|     'cfgfile': 'obp60v.conf', | ||||
|     'imgpath': os.path.join(sys.path[0], 'images'), | ||||
|     'deviceid': 100, | ||||
|     'manufcode': 2046,  # Open Boat Projects (OBP) | ||||
|  | @ -606,7 +606,10 @@ if __name__ == "__main__": | |||
| 
 | ||||
|     # Basiskonfiguration aus Datei lesen | ||||
|     config = configparser.ConfigParser() | ||||
|     config.read(os.path.join(sys.path[0], cfg['cfgfile'])) | ||||
|     ret = config.read(os.path.join(sys.path[0], cfg['cfgfile'])) | ||||
|     if len(ret) == 0: | ||||
|         print("Konfigurationsdatei '{}' konnte nicht gelesen werden!".format(cfg['cfgfile'])) | ||||
|         sys.exit(1) | ||||
|     cfg['_config'] = config # Objekt zum späteren schreiben | ||||
|     cfg['deviceid'] = config.getint('system', 'deviceid') | ||||
|     cfg['simulation'] = config.getboolean('system', 'simulation') | ||||
		Loading…
	
		Reference in New Issue