Пример #1
0
 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)
Пример #2
0
	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))
Пример #3
0
	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))
Пример #4
0
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
Пример #5
0
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()
Пример #6
0
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")
Пример #7
0
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")
Пример #8
0
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)
Пример #10
0
    def _handleInitBugEvent(self, eventType, argsList):
        """Initializes BUG before handling event normally.
		"""
        import BugInit
        BugInit.init()
        self._handleDefaultEvent(eventType, argsList)
Пример #11
0
	def handle(self, element, name):
		BugUtil.debug("BugConfig - loading mod file %s", name)
		BugInit.loadMod(name)
Пример #12
0
def forceBUGModuleInit(argsList):
    import BugInit
    BugInit.init()
Пример #13
0
	def handle(self, element, name):
		BugUtil.debug("BugConfig - loading mod file %s", name)
		BugInit.loadMod(name)
Пример #14
0
	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)
Пример #15
0
	def loadMod(self, name):
		BugInit.loadMod(name)