コード例 #1
0
	def exit(self, screen, mainInterface):
		screen.deleteWidget("ExitCO")
		screen.deleteWidget("ScrollCO")
		screen.deleteWidget("CityOptionBG")
		mainInterface.cityOptions = None
		import BugOptions
		BugOptions.getOptions(mainInterface.CityOpt._id).write()
コード例 #2
0
	def setLogFilePath(self, LogFilePath, bSaveToOptions=False):
		if (bSaveToOptions):
			AutologOpt.setFilePath(LogFilePath)
			BugOptions.write()
		if (not LogFilePath or LogFilePath == "Default"):
			LogFilePath = BugPath.findOrMakeDir("Autolog")
		self.LogFilePath = LogFilePath
		self.updateLogFile()
コード例 #3
0
ファイル: autolog.py プロジェクト: tarjintor/Civ4-K-Mod
 def setLogFilePath(self, LogFilePath, bSaveToOptions=False):
     if (bSaveToOptions):
         AutologOpt.setFilePath(LogFilePath)
         BugOptions.write()
     if (not LogFilePath or LogFilePath == "Default"):
         LogFilePath = BugPath.findOrMakeDir("Autolog")
     self.LogFilePath = LogFilePath
     self.updateLogFile()
コード例 #4
0
ファイル: autolog.py プロジェクト: trym-b/Caveman2Cosmos
	def setLogFilePath(self, LogFilePath, bSaveToOptions=False):
		if bSaveToOptions:
			AutologOpt.setFilePath(LogFilePath)
			BugOptions.write()
		if not LogFilePath or LogFilePath == "Default":
			LogFilePath = SP.joinModDir("Autolog")
		if not os.path.isdir(LogFilePath):
			os.makedirs(LogFilePath)
		self.LogFilePath = LogFilePath
		self.updateLogFile()
コード例 #5
0
ファイル: RevDCM.py プロジェクト: markourm/fall
def resetOptions():
	revDCMoptions = BugOptions.getOptions("RevDCM").options
	RevolutionOptions = BugOptions.getOptions("Revolution").options
	ActionOptions = BugOptions.getOptions("Actions").options
	for i in range(len(revDCMoptions)):
		revDCMoptions[i].resetValue()
	for i in range(len(RevolutionOptions)):
		RevolutionOptions[i].resetValue()
	for i in range(len(ActionOptions)):
		ActionOptions[i].resetValue()
	
	setXMLOptionsfromIniFile()
	RevDCMOpt.setReset(false)
コード例 #6
0
def resetOptions():
    revDCMoptions = BugOptions.getOptions("RevDCM").options
    RevolutionOptions = BugOptions.getOptions("Revolution").options
    ActionOptions = BugOptions.getOptions("Actions").options
    for i in range(len(revDCMoptions)):
        revDCMoptions[i].resetValue()
    for i in range(len(RevolutionOptions)):
        RevolutionOptions[i].resetValue()
    for i in range(len(ActionOptions)):
        ActionOptions[i].resetValue()

    setXMLOptionsfromIniFile()
    RevDCMOpt.setReset(False)
コード例 #7
0
    def _createParameterizedAccessorPair(self,
                                         optionId,
                                         getter=None,
                                         setter=None,
                                         values=None):
        'createParameterizedAccessorPair'
        optionId = BugOptions.qualify(self._id, optionId)
        if getter:
            if values is None:

                def get_fun(*args):
                    'getter for plain option'
                    option = self._getOption(optionId % args)
                    if option.isColor():
                        return option.getColor()
                    return option.getValue()
            else:

                def get_fun(*args):
                    'getter for option in values'
                    option = self._getOption(optionId % args)
                    return option.getValue() in values

            setattr(self, getter, get_fun)

        if setter:

            def set_fun(value, *args):
                'setter for option'
                option = self._getOption(optionId % args)
                option.setValue(value)

            setattr(self, setter, set_fun)
コード例 #8
0
def resetOptions():
    import BugOptions
    ANewDawnoptions = BugOptions.getOptions("DiplomacySettings").options
    for option in ANewDawnoptions:
        option.resetValue()
    setXMLOptionsfromIniFile()
    BugCore.game.RoMSettings.setRoMReset(False)
コード例 #9
0
def resetOptions():
    import BugOptions
    ANewDawnoptions = BugOptions.getOptions("RoMSettings").options
    for i in range(len(ANewDawnoptions)):
        ANewDawnoptions[i].resetValue()
    setXMLOptionsfromIniFile()
    ANewDawnOpt.setRoMReset(False)
コード例 #10
0
    def _createParameterizedAccessorPair(self,
                                         id,
                                         getter=None,
                                         setter=None,
                                         values=None):
        id = BugOptions.qualify(self._id, id)
        if getter:
            if values is None:

                def get(*args):
                    option = self._getOption(id % args)
                    if option.isColor():
                        return option.getColor()
                    else:
                        return option.getValue()
            else:

                def get(*args):
                    option = self._getOption(id % args)
                    return option.getValue() in values

            setattr(self, getter, get)

        if setter:

            def set(value, *args):
                option = self._getOption(id % args)
                option.setValue(value)

            setattr(self, setter, set)
コード例 #11
0
ファイル: BugInit.py プロジェクト: trym-b/Caveman2Cosmos
def init():
    """Performs the one-time initialization of the BUG core and all mods."""
    global g_initDone
    print "BugInit.init"
    if g_initDone:
        print "BugInit.init - already complete"
        return True

    BugOptions.initUserSettings()

    loadMod("init")
    import BugCore
    BugCore.initDone()

    callInits()

    g_initDone = True
    CyGlobalContext().setIsBug()

    return True
コード例 #12
0
ファイル: BugConfig.py プロジェクト: hardtimes1966/modxml
	def __init__(self, game=None, attrs=None):
		if game is None:
			game = BugCore.game
		self.game = game
		self.eventManager = CvEventInterface.getEventManager()
		self.options = BugOptions.getOptions()
		self.optionsScreen = CvScreensInterface.getBugOptionsScreen()
		
		self.attrs = attrs
		self.mod = None
		self.iniFile = None
		self.section = None
		self.option = None
		self.screen = None
		self.symbol = None
コード例 #13
0
ファイル: BugCore.py プロジェクト: AP-ML/DTM
	def _createParameterizedAccessorPair(self, id, getter=None, setter=None, values=None):
		id = BugOptions.qualify(self._id, id)
		if getter:
			if values is None:
				def get(*args):
					option = self._getOption(id % args)
					if option.isColor():
						return option.getColor()
					else:
						return option.getValue()
			else:
				def get(*args):
					option = self._getOption(id % args)
					return option.getValue() in values
			setattr(self, getter, get)
		
		if setter:
			def set(value, *args):
				option = self._getOption(id % args)
				option.setValue(value)
			setattr(self, setter, set)
コード例 #14
0
	def __init__(self):
		self.iScreenHeight = 50
		self.options = BugOptions.getOptions()
		self.tabs = []
		self.reopen = False
コード例 #15
0
ファイル: BugCore.py プロジェクト: AP-ML/DTM
	def qualify(self, id):
		return BugOptions.qualify(self._id, id)
コード例 #16
0
## Base class for all tabs in the BUG Options Screen.
##
## Copyright (c) 2007 The BUG Mod.
##
## Author: EmperorFool

import BugOptions
import BugUtil

## Constants

CHECKBOX_INDENT = 2

## Globals

g_options = BugOptions.getOptions()

## Class


class BugOptionsTab:
    """
	Provides an API for building a single tab on the BUG Options Screen by placing UI controls.
	"""
    def __init__(self, name, title):
        self.name = name
        self.tab = self.name + "Tab"

        self.title = title
        self.translated = False
コード例 #17
0
## Base class for all tabs in the BUG Options Screen.
##
## Copyright (c) 2007 The BUG Mod.
##
## Author: EmperorFool

import BugOptions
import BugUtil

## Constants

CHECKBOX_INDENT = 2

## Globals

g_options = BugOptions.getOptions()

## Class

class BugOptionsTab:
	"""
	Provides an API for building a single tab on the BUG Options Screen by placing UI controls.
	"""
	
	def __init__(self, name, title):
		self.name = name
		self.tab = self.name + "Tab"
		
		self.title = title
		self.translated = False
		
コード例 #18
0
def resetOptions():
	AutomatedOptions = BugOptions.getOptions("AutomatedSettings").options
	for i in range(len(AutomatedOptions)):
		AutomatedOptions[i].resetValue()
	setXMLOptionsfromIniFile()
	AutomatedOptions.setReset(False)
コード例 #19
0
def resetOptions():
	ANewDawnoptions = BugOptions.getOptions("DiplomacySettings").options
	for i in range(len(ANewDawnoptions)):
		ANewDawnoptions[i].resetValue()
	setXMLOptionsfromIniFile()
	BugCore.game.RoMSettings.setRoMReset(false)
コード例 #20
0
def resetOptions():
	revDCMoptions = BugOptions.getOptions("RevDCM").options
	for i in range(len(revDCMoptions)):
		revDCMoptions[i].resetValue()
	setXMLOptionsfromIniFile()
	RevDCMOpt.setReset(false)
コード例 #21
0
ファイル: SevoPediaUtil.py プロジェクト: tarjintor/Civ4-K-Mod
## SevoPediaUtil
##
## Creates unsaved options for Sevopedia when it's accessed before BUG initializes.
##
## Copyright (c) 2008 The BUG Mod.
##
## Author: EmperorFool

import BugCore
import BugOptions
import BugUtil

AdvisorOpt = BugCore.game.Advisors
enabledOption = None
sortOption = None

if not AdvisorOpt._hasOption("Sevopedia"):
	BugUtil.debug("BUG: creating stub Sevopedia option")
	enabledOption = BugOptions.UnsavedOption(AdvisorOpt, BugOptions.qualify(AdvisorOpt._getID(), "Sevopedia"), "boolean", False)
	AdvisorOpt._addOption(enabledOption)

if not AdvisorOpt._hasOption("SevopediaSortItemList"):
	BugUtil.debug("BUG: creating stub Sevopedia Sort option")
	sortOption = BugOptions.UnsavedOption(AdvisorOpt, BugOptions.qualify(AdvisorOpt._getID(), "SevopediaSortItemList"), "boolean", True)
	AdvisorOpt._addOption(sortOption)
コード例 #22
0
 def __init__(self):
     import BugOptions
     self.iScreenHeight = 50
     self.options = BugOptions.getOptions()
     self.tabs = []
     self.reopen = False
コード例 #23
0
 def qualify(self, qual_id):
     "Returns a fully qualified option ID by inserting the mod's ID if necessary."
     return BugOptions.qualify(self._id, qual_id)
コード例 #24
0
 def qualify(self, id):
     return BugOptions.qualify(self._id, id)
コード例 #25
0
ファイル: BugDll.py プロジェクト: AP-ML/DTM
def castOptionValue(func, id, default):
	try:
		return func(BugOptions.getOption(id).getValue())
	except:
		return default
コード例 #26
0
ファイル: autolog.py プロジェクト: tarjintor/Civ4-K-Mod
 def setLogFileName(self, LogFileName, bSaveToOptions=False):
     if (bSaveToOptions):
         AutologOpt.setFileName(LogFileName)
         BugOptions.write()
     self.LogFileName = LogFileName
     self.updateLogFile()
コード例 #27
0
def init():
    global g_options, g_screen
    import BugOptions
    g_options = BugOptions.getOptions()
コード例 #28
0
	def setLogFileName(self, LogFileName, bSaveToOptions=False):
		if (bSaveToOptions):
			AutologOpt.setFileName(LogFileName)
			BugOptions.write()
		self.LogFileName = LogFileName
		self.updateLogFile()
コード例 #29
0
def setXMLOptionsfromIniFile():
	print "Initializing Automated Settings"
	AutomatedOptions = BugOptions.getOptions("AutomatedSettings").options
	for i in range(len(AutomatedOptions)):
		if AutomatedOptions[i].getKey() != "Reset":
			AutomatedOptions[i].doDirties()
コード例 #30
0
ファイル: BugDll.py プロジェクト: macaurther/DOCUSA
def castOptionValue(func, id, default):
    try:
        return func(BugOptions.getOption(id).getValue())
    except:
        return default
コード例 #31
0
def resetOptions():
	ANewDawnoptions = BugOptions.getOptions("RoMSettings").options
	for i in range(len(ANewDawnoptions)):
		ANewDawnoptions[i].resetValue()
	setXMLOptionsfromIniFile()
	ANewDawnOpt.setRoMReset(False)