本文整理汇总了Python中core.Core._afterInit方法的典型用法代码示例。如果您正苦于以下问题:Python Core._afterInit方法的具体用法?Python Core._afterInit怎么用?Python Core._afterInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.Core
的用法示例。
在下文中一共展示了Core._afterInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WinterApp
# 需要导入模块: from core import Core [as 别名]
# 或者: from core.Core import _afterInit [as 别名]
class WinterApp(object):
"""
Main non-gui application class
"""
__apiclass__ = WinterAPI
__pmclass__ = WinterPM
def getMethod(self, key, module='main'):
if not key.startswith('_'):
try:
if module == 'core':
return getattr(self.core, key)
elif module == 'main':
return getattr(self, key)
else:
return getattr(WinterPlugin.objects.get(name=module), key)
except Exception as e:
pass
return False
def __getitem__(self, key):
return self.getMethod('main', key)
def loadConfigs(self):
"""
Load configuration from file
"""
self.config = WinterConfig(open(self.api.CWD + 'config/main.cfg'))
self.p_config = WinterConfig(open(self.api.CWD + 'config/plugins.cfg'))
self.schema = WinterConfig(open(self.api.CWD + 'config/schema.cfg'))
def onSubsChange(self, key, value):
print('%s changed to %s' % (key, value))
def __init__(self):
self.api = self.__class__.__apiclass__()
global API
API = self.__class__.__apiclass__
self.loadConfigs()
self.api.config = self.config
self.api.ex = self.getMethod
self.beforeCore()
from core import Core
self.core = Core()
self.core.app = self
self.core._afterInit()
if self.config.options.plugins:
WinterPlugin()
self.pm = self.__class__.__pmclass__(self.p_config)
def beforeCore(self):
pass