Thread Python - Erstellung einer Config (1 answers)
Opened by YAPD at 2021-07-26 16:51

hlubenow
 2021-07-29 23:30
#193462 #193462
User since
2009-02-22
875 Artikel
BenutzerIn
[default_avatar]
So würde - halbwegs- ein Schuh draus:
Code (python): (dl )
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()

View full thread Python - Erstellung einer Config