1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from Config import *
class Power_Manager:
PM_Power_Supplies = { }
def __init__( Self ):
Self.CFG = Config( )
def Initialize_Power( Self ):
CFG = Self.CFG
Config_Entries = CFG.Config_Loader( )
print( "Config Mode :" , Config_Entries[ "Home" ] )
PM = Power_Manager( )
PM.Initialize_Power( )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
class Config:
CFG_Config_Entries = { }
CFG_Debug_Modus = "No"
CFG_Home = "C:\Testumgebung"
def __init__( Self ):
print( "TEST" )
Self.Home = "Standard"
def Config_Loader( Self ):
print( "Loading Config Entries ..." )
Config_Entries = { "Home" : Config.CFG_Home ,
"Debug_Mode" : Config.CFG_Debug_Modus }
import Defaults
DS = Defaults.Defaults( Self )
Defaults_Entries = DS.Load_Defaults( )
Config_Entries.update( Defaults_Entries )
return Config_Entries
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#!/usr/bin/python # coding: utf-8 import os class PowerManager: def __init__(self): self.pm_power_supplies = {} self.cfg = Config() self.config_entries = self.cfg.getConfigEntries() print("Config Mode :" , self.config_entries["Home"]) class Config: def __init__(self): self.cfg_config_entries = {} self.cfg_debug_modus = "no" self.cfg_home = "c:\testumgebung" self.home = "Standard" print("TEST") def getConfigEntries(self): print( "Loading Config Entries ..." ) self.config_entries = {"Home" : self.cfg_home , "Debug_Mode" : self.cfg_debug_modus } """ Keine Ahnung, was Du hier importierst, oder was das werden soll: import Defaults DS = Defaults.Defaults( self ) Defaults_Entries = DS.Load_Defaults( ) Config_Entries.update( Defaults_Entries ) """ return self.config_entries pm = PowerManager()