def handle(self, element, module, function, immediate, dll): immediate = self.isTrue(immediate) func = BugUtil.getFunction(module, function, True, *element.args, **element.kwargs) if immediate: func() else: BugInit.addInit(module, func)
def handle(self, element, module, function, immediate, dll): immediate = self.isTrue(immediate) dll = BugDll.decode(dll) if self.isDllOkay(element, dll): func = BugUtil.getFunction(module, function, True, *element.args, **element.kwargs) if immediate: func() else: BugInit.addInit(module, func) else: BugUtil.info("BugConfig - ignoring <%s> %s.%s, requires dll version %s", element.tag, module, function, self.resolveDll(element, dll))
def initBug(): """Called once after Civ has initialized its data structures.""" global g_initDone if not g_initDone: import BugInit if BugInit.init(): g_initDone = True
def initAfterReload(): """ Initialize BUG and fires PythonReloaded event after reloading Python modules while game is still running. The first time this module is loaded after the game launches, the global context is not yet ready, and thus BUG cannot be initialized. When the Python modules are reloaded after being changed, however, this will reinitialize BUG and the main interface. """ import BugInit if BugInit.init(): try: import CvScreensInterface CvScreensInterface.reinitMainInterface() except: import BugUtil BugUtil.error("BugInit - failure rebuilding main interface after reloading Python modules") getEventManager().fireEvent("PythonReloaded") import CvMainInterface #added Sephi mainInterface = CvMainInterface.CvMainInterface() mainInterface.initState() # initialize BUG after Python modules have been reloaded initAfterReload()
def init(): """ Checks for the presence of the BUG DLL and grabs its Python API version if found. """ try: if gc.isBull(): global IS_PRESENT, VERSION IS_PRESENT = True VERSION = gc.getBullApiVersion() BugUtil.info("BugDll - %s %s, API version %d", gc.getBullName(), gc.getBullVersion(), VERSION) if hasattr(CyGlobalContext, "setIsBug"): import BugInit BugInit.addInit("setIsBug", setIsBug) else: BugUtil.debug("BugDll - setIsBug() not found") except: BugUtil.debug("BugDll - BULL not present")
def initAfterReload(): """ Initialize BUG and fires PythonReloaded event after reloading Python modules while game is still running. The first time this module is loaded after the game launches, the global context is not yet ready, and thus BUG cannot be initialized. When the Python modules are reloaded after being changed, however, this will reinitialize BUG and the main interface. """ import BugInit BugInit.init() try: import CvScreensInterface CvScreensInterface.reinitMainInterface() except: import BugUtil BugUtil.error( "BugInit - failure rebuilding main interface after reloading Python modules" ) eventManager.fireEvent("PythonReloaded")
def _handleInitBugEvent(self, eventType, argsList): """Initializes BUG before handling event normally. """ import BugInit BugInit.init() self._handleDefaultEvent(eventType, argsList)
def handle(self, element, name): BugUtil.debug("BugConfig - loading mod file %s", name) BugInit.loadMod(name)
def forceBUGModuleInit(argsList): import BugInit BugInit.init()
def createInit(self, module, function="init", immediate=False, args=(), kwargs={}, attrs=None): func = BugUtil.getFunction(module, function, *args, **kwargs) if immediate: func() else: BugInit.addInit(module, func)
def loadMod(self, name): BugInit.loadMod(name)