Beispiel #1
0
 def __init__(self, appName_: str):
     # app名称
     self.appName: str = appName_[0:-3]
     self.mainPath: str = os.path.realpath(
         os.path.join(os.path.realpath(__file__), os.pardir, os.pardir,
                      os.pardir, os.pardir))
     self.resPath: str = os.path.realpath(
         os.path.join(self.mainPath, self.appName, "res"))
     # 当前的base继承类有那些
     self.runtimeObjectInfoDict: dict = {}
     # 当前的base继承类有多少
     self.baseCount: int = 0
     # 获取 当前App 的 ServiceManager
     self.sm = pyUtils.getObjectByClassPath(
         self.appName + ("." + self.appName + "ServiceManager") * 2, self)
     self.info = Info(self.sm)
     self.consts = Consts(self.sm)
     self.sm.create()
     self.info.create()
     self.consts.create()
     # 创建 App 状态集合
     self.appState = self.sm.serviceProvider.getAppStateObject(self.appName)
     self.appState.create()
     # 相互关联
     self.main = None
Beispiel #2
0
 def getServiceSubObject(self, serviceObject_: BaseService, subClassName_: str):
     # 通过 APP名.app.services.服务名.文件夹名.类文件名.类名 这个类路径,创建一个实例对象
     # 所属 app 名称,转换为路径
     _servicePath = serviceObject_.app.appName + ".app.services"
     # 服务名称,转换成 路径 前缀
     _serviceClassPath = _servicePath + "." + serviceObject_.className
     # 服务所在路径下,取得对象的 文件夹名.类文件名.类名
     _serviceSubClassPath = _serviceClassPath + ("." + subClassName_) * 3
     # 创建对象
     try:
         _serviceSubObject = pyUtils.getObjectByClassPath(_serviceSubClassPath, serviceObject_)
         return _serviceSubObject
     except Exception as _err:
         print(serviceObject_.className + " 没有子服务 " + subClassName_ + "\n" + str(_err.args))
Beispiel #3
0
 def getAppStateObject(self, appName_):
     _appStatePath = appName_ + ("." + appName_ + "AppState") * 2
     _appStateObject = pyUtils.getObjectByClassPath(_appStatePath, self.sm)
     # _appStateObject.fullClassPath = _appStatePath  # 变更完整路径名
     return _appStateObject
Beispiel #4
0
 def getServiceObject(self, appName_, className_):
     _servicePath = appName_ + ".app.services"
     _serviceClassPath = _servicePath + ("." + className_) * 3
     _serviceObject = pyUtils.getObjectByClassPath(_serviceClassPath, self.sm)
     # _serviceObject.fullClassPath = _serviceClassPath  # 变更完整路径名
     return _serviceObject
Beispiel #5
0
 def getUtilsObject(self, className_):
     _utilsPath = "base.supports.utils"
     _utilsClassPath = _utilsPath + ("." + className_) * 2
     _utilsObject = pyUtils.getObjectByClassPath(_utilsClassPath, self.sm)
     # _utilsObject.fullClassPath = _utilsClassPath  # 变更完整路径名
     return _utilsObject
Beispiel #6
0
 def getBaseObject(self, className_):
     _basePath = "base.app.services.base"
     _baseClassPath = _basePath + ("." + className_) * 3
     _baseObject = pyUtils.getObjectByClassPath(_baseClassPath, self.sm)
     # _baseObject.fullClassPath = _baseClassPath  # 变更完整路径名
     return _baseObject