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()
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()
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()
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)
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)
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)
def resetOptions(): import BugOptions ANewDawnoptions = BugOptions.getOptions("DiplomacySettings").options for option in ANewDawnoptions: option.resetValue() setXMLOptionsfromIniFile() BugCore.game.RoMSettings.setRoMReset(False)
def resetOptions(): import BugOptions ANewDawnoptions = BugOptions.getOptions("RoMSettings").options for i in range(len(ANewDawnoptions)): ANewDawnoptions[i].resetValue() setXMLOptionsfromIniFile() ANewDawnOpt.setRoMReset(False)
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)
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
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
def __init__(self): self.iScreenHeight = 50 self.options = BugOptions.getOptions() self.tabs = [] self.reopen = False
def qualify(self, id): return BugOptions.qualify(self._id, id)
## 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
def resetOptions(): AutomatedOptions = BugOptions.getOptions("AutomatedSettings").options for i in range(len(AutomatedOptions)): AutomatedOptions[i].resetValue() setXMLOptionsfromIniFile() AutomatedOptions.setReset(False)
def resetOptions(): ANewDawnoptions = BugOptions.getOptions("DiplomacySettings").options for i in range(len(ANewDawnoptions)): ANewDawnoptions[i].resetValue() setXMLOptionsfromIniFile() BugCore.game.RoMSettings.setRoMReset(false)
def resetOptions(): revDCMoptions = BugOptions.getOptions("RevDCM").options for i in range(len(revDCMoptions)): revDCMoptions[i].resetValue() setXMLOptionsfromIniFile() RevDCMOpt.setReset(false)
## 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)
def __init__(self): import BugOptions self.iScreenHeight = 50 self.options = BugOptions.getOptions() self.tabs = [] self.reopen = False
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)
def castOptionValue(func, id, default): try: return func(BugOptions.getOption(id).getValue()) except: return default
def setLogFileName(self, LogFileName, bSaveToOptions=False): if (bSaveToOptions): AutologOpt.setFileName(LogFileName) BugOptions.write() self.LogFileName = LogFileName self.updateLogFile()
def init(): global g_options, g_screen import BugOptions g_options = BugOptions.getOptions()
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()
def resetOptions(): ANewDawnoptions = BugOptions.getOptions("RoMSettings").options for i in range(len(ANewDawnoptions)): ANewDawnoptions[i].resetValue() setXMLOptionsfromIniFile() ANewDawnOpt.setRoMReset(False)