コード例 #1
0
ファイル: MapFinder.py プロジェクト: NikNaks/Civ4-K-Mod
def getCountsText():
    return u"%s %d, %s %d" % (
        BugUtil.getPlainText("TXT_KEY_MAPFINDER_TOTAL_MAPS"),
        iRegenCount,
        BugUtil.getPlainText("TXT_KEY_MAPFINDER_TOTAL_SAVES"),
        iSavedCount,
    )
コード例 #2
0
ファイル: BugHelp.py プロジェクト: civ4-mp/CloseToHome
def launch(argsList=None):
    """
    Opens the mod's help file or web page externally if it can be found or displays an error alert.
    
    On Windows this opens the compiled HTML help file (CHM).
    On Mac this opens a browser window to the online help file.
    """
    if BugPath.isMac():
        sLang = ["ENG", "ENG", "DEU", "ITA", "ENG"]
        url = "http://civ4bug.sourceforge.net/BUGModHelp/%s/index.htm" % sLang[CyGame().getCurrentLanguage()]
        try:
            import webbrowser
            showLaunchMessage()
            webbrowser.open(url, new=1, autoraise=1)
            return True
        except:
            showErrorAlert(BugUtil.getPlainText("TXT_KEY_BUG_HELP_CANNOT_OPEN_BROWSER_TITLE"), 
                    BugUtil.getText("TXT_KEY_BUG_HELP_CANNOT_OPEN_BROWSER_BODY", (url,)))       
    else:
        sLang = ["ENG", "FRA", "DEU", "ITA", "ESP"]
        name = "BUG Mod Help-%s.chm" % (sLang[CyGame().getCurrentLanguage()])
        file = BugPath.findInfoFile(name)
        if file:
            import os
            message = BugUtil.getPlainText("TXT_KEY_BUG_HELP_OPENING")
            CyInterface().addImmediateMessage(message, "")
            os.startfile(file)
            return True
        else:
            showErrorAlert(BugUtil.getPlainText("TXT_KEY_BUG_HELP_MISSING_TITLE"), 
                    BugUtil.getText("TXT_KEY_BUG_HELP_MISSING_BODY", (name,)))
    return False
コード例 #3
0
 def __eventUnitRenameBegin(self, argsList):
     header = localText.getText(
         "TXT_KEY_UNIT_NAME_EM_HEADER_1",
         ())  #BugUtil.getPlainText("TXT_KEY_REMINDER_HEADER")
     #~ header = "Unit Name Testing (cancel to quit)"  #BugUtil.getPlainText("TXT_KEY_REMINDER_HEADER")
     prompt = self.Prompt  #"Enter a rename convention"   #BugUtil.getPlainText("TXT_KEY_REMINDER_PROMPT")
     ok = BugUtil.getPlainText("TXT_KEY_MAIN_MENU_OK")
     cancel = BugUtil.getPlainText("TXT_KEY_POPUP_CANCEL")
     popup = PyPopup.PyPopup(RENAME_EVENT_ID,
                             EventContextTypes.EVENTCONTEXT_SELF)
     popup.setHeaderString(header)
     popup.setBodyString(prompt)
     popup.createPythonEditBox(
         self.UnitNameConv,
         "Enter the unit name convention that you want to test.", 0)
     #		popup.createPythonCheckBoxes(1, 0)
     #		popup.setPythonCheckBoxText(0, "Check to increment counters", "Note: if checked, units named in-game commence from counter used in testing.", 0)
     popup.addButton(
         localText.getText("TXT_KEY_UNIT_NAME_EM_DONT_INCREMENT_COUNTER",
                           ()))
     popup.addButton(
         localText.getText("TXT_KEY_UNIT_NAME_EM_INCREMENT_COUNTER", ()))
     #~ popup.addButton("Ok, don't increment counter")
     #~ popup.addButton("Ok, increment counter")
     popup.addButton(cancel)
     popup.launch(False, PopupStates.POPUPSTATE_IMMEDIATE)
コード例 #4
0
	def _getGameYear(self):
		zturn = gc.getGame().getGameTurn() + 1
		zyear = gc.getGame().getTurnYear(zturn)
		if (zyear < 0):
			return str(-zyear) + BugUtil.getPlainText("TXT_KEY_AUTOLOG_BC")
		else:
			return str(zyear) + BugUtil.getPlainText("TXT_KEY_AUTOLOG_AD")
コード例 #5
0
def launch(argsList=None):
	"""
	Opens the mod's help file or web page externally if it can be found or displays an error alert.
	
	On Windows this opens the compiled HTML help file (CHM).
	On Mac this opens a browser window to the online help file.
	"""
	if BugPath.isMac():
		sLang = ["ENG", "ENG", "DEU", "ITA", "ENG"]
		url = "http://civ4bug.sourceforge.net/BUGModHelp/%s/index.htm" % sLang[CyGame().getCurrentLanguage()]
		try:
			import webbrowser
			showLaunchMessage()
			webbrowser.open(url, new=1, autoraise=1)
			return True
		except:
			showErrorAlert(BugUtil.getPlainText("TXT_KEY_BUG_HELP_CANNOT_OPEN_BROWSER_TITLE"), 
					BugUtil.getText("TXT_KEY_BUG_HELP_CANNOT_OPEN_BROWSER_BODY", (url,)))		
	else:
		sLang = ["ENG", "FRA", "DEU", "ITA", "ESP"]
		name = "BUG Mod Help-%s.chm" % (sLang[CyGame().getCurrentLanguage()])
		file = BugPath.findInfoFile(name)
		if file:
			import os
			message = BugUtil.getPlainText("TXT_KEY_BUG_HELP_OPENING")
			CyInterface().addImmediateMessage(message, "")
			os.startfile(file)
			return True
		else:
			showErrorAlert(BugUtil.getPlainText("TXT_KEY_BUG_HELP_MISSING_TITLE"), 
					BugUtil.getText("TXT_KEY_BUG_HELP_MISSING_BODY", (name,)))
	return False
コード例 #6
0
    def fillTable(self, screen, table, eYield, eTileType):
        """Fills the given GFC table control with the chosen yield values."""
        self.iRow = 0
        # Tiles
        iTotal = self.getYield(eYield, eTileType)
        self.appendTable(screen, table, False, BugUtil.getText(
            LABEL_KEYS[eTileType], (self.tileCounts[eTileType],)), eYield, iTotal)

        # Trade
        for eType in (DOMESTIC_TRADE, FOREIGN_TRADE):
            iValue = self.getYield(eYield, eType)
            if iValue != 0:
                self.appendTable(screen, table, False, BugUtil.getPlainText(
                    LABEL_KEYS[eType]), eYield, iValue, TradeUtil.isFractionalTrade())
        iValue = self.getYield(eYield, DOMESTIC_TRADE) + self.getYield(eYield, FOREIGN_TRADE)
        if TradeUtil.isFractionalTrade():
            iValue //= 100
        iTotal += iValue

        # Buildings, Corporations, Specialists
        for eType in (BUILDINGS, CORPORATIONS, SPECIALISTS):
            iValue = self.getYield(eYield, eType)
            if iValue != 0:
                iTotal += iValue
                self.appendTable(screen, table, False, BugUtil.getPlainText(LABEL_KEYS[eType]), eYield, iValue)

        # Subtotal and Base Modifiers
        iModifier = self.getYield(eYield, BASE_MODIFIER)
        if iModifier != 0:
            # Subtotal
            self.appendTableTotal(screen, table, eYield, iTotal)
            #self.appendTable(screen, table, True, BugUtil.getPlainText("TXT_KEY_CONCEPT_SUBTOTAL"), eYield, iTotal)
            # Modifier
            iValue = (iTotal * (iModifier + 100) // 100) - iTotal
            iSubtotal = iTotal + iValue
            self.appendTable(screen, table, False, BugUtil.getText(
                "TXT_KEY_CONCEPT_BASE_MODIFIER", (iModifier,)), eYield, iValue)
        else:
            iSubtotal = iTotal

        # Subtotal and Production Modifiers
        if eYield == YieldTypes.YIELD_PRODUCTION and self.iProductionModifier != 0:
            # Subtotal
            self.appendTableTotal(screen, table, eYield, iSubtotal)
            #self.appendTable(screen, table, True, BugUtil.getPlainText("TXT_KEY_CONCEPT_SUBTOTAL"), eYield, iSubtotal)
            # Total
            iTotal = iTotal * (iModifier + self.iProductionModifier + 100) // 100
            # Modifier
            iValue = iTotal - iSubtotal
            self.appendTable(screen, table, False, BugUtil.getText("TXT_KEY_CONCEPT_PRODUCTION_MODIFIER",
                             (self.sModifierDetail, self.iProductionModifier)), eYield, iValue)
        else:
            iTotal = iSubtotal

        # Total
        self.appendTableTotal(screen, table, eYield, iTotal)
コード例 #7
0
	def addButton (self, screen, panel, name, callback, title=None, tooltip=None):
		key = "TXT_KEY_BUG_OPTBUTTON_" + name.upper()
		title = BugUtil.getPlainText(key, title)
		tooltip = BugUtil.getPlainText(key + "_HOVER", tooltip)
		if (title):
			button = name + "_Button"
			screen.attachButton(panel, button, title, self.callbackIFace, callback, button)
			if (tooltip):
				screen.setToolTip(button, tooltip)
			return button
		return None
コード例 #8
0
ファイル: BugOptions.py プロジェクト: AP-ML/DTM
	def translate(self):
		if self.isStringList():
			if self.valuesXmlKey:
				list = BugUtil.getPlainText(self.valuesXmlKey + "_LIST")
			else:
				list = BugUtil.getPlainText(self.xmlKey + "_LIST")
			if list:
				self.displayValues = list.split("|")
			else:
				self.displayValues = self.values
		super(BaseListOption, self).translate()
コード例 #9
0
ファイル: BugOptions.py プロジェクト: tj41172/Caveman2Cosmos
	def translate(self):
		if self.isStringList():
			if self.valuesXmlKey:
				list = BugUtil.getPlainText(self.valuesXmlKey + "_LIST")
			else:
				list = BugUtil.getPlainText(self.xmlKey + "_LIST")
			if list:
				self.displayValues = list.split("|")
			else:
				self.displayValues = self.values
		super(BaseListOption, self).translate()
コード例 #10
0
 def addButton (self, screen, panel, name, callback, title=None, tooltip=None):
     key = "TXT_KEY_BUG_OPTBUTTON_" + name.upper()
     title = BugUtil.getPlainText(key, title)
     tooltip = BugUtil.getPlainText(key + "_HOVER", tooltip)
     if (title):
         button = name + "_Button"
         screen.attachButton(panel, button, title, self.callbackIFace, callback, button)
         if (tooltip):
             screen.setToolTip(button, tooltip)
         return button
     return None
コード例 #11
0
ファイル: RawYields.py プロジェクト: AP-ML/DTM
	def fillTable(self, screen, table, eYield, eTileType):
		"""Fills the given GFC table control with the chosen yield values."""
		self.iRow = 0
		# Tiles
		iTotal = self.getYield(eYield, eTileType)
		self.appendTable(screen, table, False, BugUtil.getText(LABEL_KEYS[eTileType], (self.tileCounts[eTileType],)), eYield, iTotal)
		
		# Trade
		for eType in (DOMESTIC_TRADE, FOREIGN_TRADE):
			iValue = self.getYield(eYield, eType)
			if iValue != 0:
				self.appendTable(screen, table, False, BugUtil.getPlainText(LABEL_KEYS[eType]), eYield, iValue, TradeUtil.isFractionalTrade())
		iValue = self.getYield(eYield, DOMESTIC_TRADE) + self.getYield(eYield, FOREIGN_TRADE)
		if TradeUtil.isFractionalTrade():
			iValue //= 100
		iTotal += iValue
		
		# Buildings, Corporations, Specialists
		for eType in (BUILDINGS, CORPORATIONS, SPECIALISTS):
			iValue = self.getYield(eYield, eType)
			if iValue != 0:
				iTotal += iValue
				self.appendTable(screen, table, False, BugUtil.getPlainText(LABEL_KEYS[eType]), eYield, iValue)
		
		# Subtotal and Base Modifiers
		iModifier = self.getYield(eYield, BASE_MODIFIER)
		if iModifier != 0:
			# Subtotal
			self.appendTableTotal(screen, table, eYield, iTotal)
			#self.appendTable(screen, table, True, BugUtil.getPlainText("TXT_KEY_CONCEPT_SUBTOTAL"), eYield, iTotal)
			# Modifier
			iValue = (iTotal * (iModifier + 100) // 100) - iTotal
			iSubtotal = iTotal + iValue
			self.appendTable(screen, table, False, BugUtil.getText("TXT_KEY_CONCEPT_BASE_MODIFIER", (iModifier,)), eYield, iValue)
		else:
			iSubtotal = iTotal
		
		# Subtotal and Production Modifiers
		if eYield == YieldTypes.YIELD_PRODUCTION and self.iProductionModifier != 0:
			# Subtotal
			self.appendTableTotal(screen, table, eYield, iSubtotal)
			#self.appendTable(screen, table, True, BugUtil.getPlainText("TXT_KEY_CONCEPT_SUBTOTAL"), eYield, iSubtotal)
			# Total
			iTotal = iTotal * (iModifier + self.iProductionModifier + 100) // 100
			# Modifier
			iValue = iTotal - iSubtotal
			self.appendTable(screen, table, False, BugUtil.getText("TXT_KEY_CONCEPT_PRODUCTION_MODIFIER", (self.sModifierDetail, self.iProductionModifier)), eYield, iValue)
		else:
			iTotal = iSubtotal
		
		# Total
		self.appendTableTotal(screen, table, eYield, iTotal)
コード例 #12
0
	def __eventReminderStoreBegin(self, argsList):
		header = BugUtil.getPlainText("TXT_KEY_REMINDER_HEADER")
		prompt = BugUtil.getPlainText("TXT_KEY_REMINDER_PROMPT")
		ok = BugUtil.getPlainText("TXT_KEY_MAIN_MENU_OK")
		cancel = BugUtil.getPlainText("TXT_KEY_POPUP_CANCEL")
		popup = PyPopup.PyPopup(STORE_EVENT_ID, EventContextTypes.EVENTCONTEXT_SELF)
		popup.setHeaderString(header)
		popup.setBodyString(prompt)
		popup.createSpinBox(0, "", 1, 1, 1500, 0)
		popup.createEditBox("", 1)
		popup.addButton(ok)
		popup.addButton(cancel)
		popup.launch(False, PopupStates.POPUPSTATE_IMMEDIATE)
コード例 #13
0
 def __eventReminderStoreBegin(self, argsList):
     header = BugUtil.getPlainText("TXT_KEY_REMINDER_HEADER")
     prompt = BugUtil.getPlainText("TXT_KEY_REMINDER_PROMPT")
     ok = BugUtil.getPlainText("TXT_KEY_MAIN_MENU_OK")
     cancel = BugUtil.getPlainText("TXT_KEY_POPUP_CANCEL")
     popup = PyPopup.PyPopup(STORE_EVENT_ID,
                             EventContextTypes.EVENTCONTEXT_SELF)
     popup.setHeaderString(header)
     popup.setBodyString(prompt)
     popup.createSpinBox(0, "", 1, 1, 1500, 0)
     popup.createEditBox("", 1)
     popup.addButton(ok)
     popup.addButton(cancel)
     popup.launch(False, PopupStates.POPUPSTATE_IMMEDIATE)
コード例 #14
0
	def __eventUnitRenameBegin(self, argsList):
		header = "Unit Name Testing (cancel to quit)"  #BugUtil.getPlainText("TXT_KEY_REMINDER_HEADER")
		prompt = self.Prompt   #"Enter a rename convention"   #BugUtil.getPlainText("TXT_KEY_REMINDER_PROMPT")
		ok = BugUtil.getPlainText("TXT_KEY_MAIN_MENU_OK")
		cancel = BugUtil.getPlainText("TXT_KEY_POPUP_CANCEL")
		popup = PyPopup.PyPopup(RENAME_EVENT_ID, EventContextTypes.EVENTCONTEXT_SELF)
		popup.setHeaderString(header)
		popup.setBodyString(prompt)
		popup.createPythonEditBox(self.UnitNameConv, "Enter the unit name convention that you want to test.", 0)
#		popup.createPythonCheckBoxes(1, 0)
#		popup.setPythonCheckBoxText(0, "Check to increment counters", "Note: if checked, units named in-game commence from counter used in testing.", 0)
		popup.addButton("Ok, don't increment counter")
		popup.addButton("Ok, increment counter")
		popup.addButton(cancel)
		popup.launch(False, PopupStates.POPUPSTATE_IMMEDIATE)
コード例 #15
0
ファイル: TriggerEvent.py プロジェクト: dharkness/civ4bullai
def showChooseEventPopup(argsList):
    if getEventManager().bAllowCheats:
        ePlayer = PlayerUtil.getActivePlayerID()
        popupInfo = CyPopupInfo()
        popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
        popupInfo.setText(BugUtil.getPlainText("TXT_KEY_POPUP_SELECT_EVENT"))
        popupInfo.setData1(ePlayer)
        popupInfo.setOnClickedPythonCallback("triggerRandomEvent")
        for i in range(gc.getNumEventTriggerInfos()):
            info = gc.getEventTriggerInfo(i)
            name = info.getType().replace("EVENTTRIGGER_",
                                          "").replace("_", " ").title()
            popupInfo.addPythonButton(name, "")
        popupInfo.addPythonButton(BugUtil.getPlainText("TXT_KEY_POPUP_CANCEL"),
                                  "")
        popupInfo.addPopup(ePlayer)
コード例 #16
0
ファイル: MapFinder.py プロジェクト: NikNaks/Civ4-K-Mod
def regenerate():
    if canRegenerate():
        if CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_SHOW:
            CyInterface().setShowInterface(InterfaceVisibility.INTERFACE_SHOW)
        BugUtil.alert(BugUtil.getPlainText("TXT_KEY_MAPFINDER_REGNERATING"))
        # must defer to allow alert to appear
        BugUtil.deferCall(regenerateForReal)
コード例 #17
0
def getHoverText(eWidgetType, iData1, iData2, bOption):
    city, iTurns = getDisplayCity()
    if not city:
        # no rate or progress in any city and no city selected
        return BugUtil.getText(
            "TXT_KEY_MISC_GREAT_PERSON",
            (0, PlayerUtil.getActivePlayer().greatPeopleThreshold(False)))
    iThreshold = gc.getPlayer(city.getOwner()).greatPeopleThreshold(False)
    iProgress = city.getGreatPeopleProgress()
    iRate = city.getGreatPeopleRate()
    szText = BugUtil.colorText(city.getName(), "COLOR_HIGHLIGHT_TEXT")
    szText += u"\n"
    szText += BugUtil.getText("TXT_KEY_MISC_GREAT_PERSON",
                              (iProgress, iThreshold))
    if iRate > 0:
        szText += u"\n%d%s%s " % (iRate, g_gpIcon,
                                  BugUtil.getPlainText("TXT_KEY_PER_TURN"))
        szText += BugUtil.getText("INTERFACE_CITY_TURNS", (iTurns, ))

    percents = calcPercentages(city)
    if percents:
        percents.sort()
        percents.reverse()
        szText += u"\n"
        for iPercent, iUnit in percents:
            #           iUnit = getUnitType(gpType)
            szText += u"\n%s%s - %d%%" % (getUnitIcon(
                iUnit), gc.getUnitInfo(iUnit).getDescription(), iPercent)
    return szText
コード例 #18
0
ファイル: DiplomacyUtil.py プロジェクト: macaurther/DOCUSA
def isWillingToTalk(playerOrID, toPlayerOrID):
	"""
	Returns True if <player> is willing to talk to <toPlayer>.
	
	- Every player is willing to talk to themselves
	- All human players are willing to talk
	- Uses BUG DLL if present, otherwise scans attitude hover text
	  for "Refuses to Talk!!!" in the current language
	
	Note: This function does not check if the two players can make contact.
	"""
	playerID, player = PlayerUtil.getPlayerAndID(playerOrID)
	toPlayerID = PlayerUtil.getPlayerID(toPlayerOrID)
	if playerID == toPlayerID or player.isHuman():
		# all players talk to themselves, and all humans talk
		return True
	if BugDll.isPresent():
		return player.AI_isWillingToTalk(toPlayerID)
	else:
		hover = AttitudeUtil.getAttitudeString(playerID, toPlayerID)
		if hover:
			return (hover.find(BugUtil.getPlainText("TXT_KEY_MISC_REFUSES_TO_TALK")) == -1)
		else:
			# haven't met yet
			return False
コード例 #19
0
ファイル: DiplomacyUtil.py プロジェクト: AP-ML/DTM
def isWillingToTalk(playerOrID, toPlayerOrID):
	"""
	Returns True if <player> is willing to talk to <toPlayer>.
	
	- Every player is willing to talk to themselves
	- All human players are willing to talk
	- Uses BUG DLL if present, otherwise scans attitude hover text
	  for "Refuses to Talk!!!" in the current language
	
	Note: This function does not check if the two players can make contact.
	"""
	playerID, player = PlayerUtil.getPlayerAndID(playerOrID)
	toPlayerID = PlayerUtil.getPlayerID(toPlayerOrID)
	if playerID == toPlayerID or player.isHuman():
		# all players talk to themselves, and all humans talk
		return True
	if BugDll.isPresent():
		return player.AI_isWillingToTalk(toPlayerID)
	else:
		hover = AttitudeUtil.getAttitudeString(playerID, toPlayerID)
		if hover:
			return (hover.find(BugUtil.getPlainText("TXT_KEY_MISC_REFUSES_TO_TALK")) == -1)
		else:
			# haven't met yet
			return False
コード例 #20
0
ファイル: UnitGrouper.py プロジェクト: civ4-mp/CloseToHome
 def __init__(self, grouping, key, title):
     self.grouping = grouping
     self.key = key
     if title.startswith("TXT_KEY_"):
         self.title = BugUtil.getPlainText(title)
     else:
         self.title = title
コード例 #21
0
ファイル: UnitGrouper.py プロジェクト: markourm/fall
	def __init__(self, grouping, key, title):
		self.grouping = grouping
		self.key = key
		if title.startswith("TXT_KEY_"):
			self.title = BugUtil.getPlainText(title)
		else:
			self.title = title
コード例 #22
0
ファイル: MapFinder.py プロジェクト: NikNaks/Civ4-K-Mod
def finderSave():
    MapFinderStatusScreen.setStatus(BugUtil.getPlainText("TXT_KEY_MAPFINDER_SAVING"))
    # must delay long enough to allow unrevealed tiles to disappear before taking the screenshot
    delay = options.getSaveDelay()
    if delay < MINIMUM_SAVE_DELAY:
        delay = MINIMUM_SAVE_DELAY
    BugUtil.deferCall(save, delay)
コード例 #23
0
def getHoverText(eWidgetType, iData1, iData2, bOption):
    city, iTurns = getDisplayCity()
    if (not city):
        # no rate or progress in any city and no city selected
        return BugUtil.getText(
            "TXT_KEY_MISC_GREAT_PERSON",
            (0, PlayerUtil.getActivePlayer().greatPeopleThreshold(False)))
    iThreshold = gc.getPlayer(city.getOwner()).greatPeopleThreshold(False)
    iProgress = city.getGreatPeopleProgress()
    iRate = city.getGreatPeopleRate()
    #szText = BugUtil.colorText(city.getName(), "COLOR_HIGHLIGHT_TEXT")
    # advc.004: Don't color the city (I don't think this matches the overall color scheme of the game)
    szText = city.getName()
    szText += u"\n"
    szText += BugUtil.getText("TXT_KEY_MISC_GREAT_PERSON",
                              (iProgress, iThreshold))
    if (iRate > 0):
        szText += u"\n%d%s%s " % (iRate, g_gpIcon,
                                  BugUtil.getPlainText("TXT_KEY_PER_TURN"))
        szText += BugUtil.getText("INTERFACE_CITY_TURNS", (iTurns, ))

    percents = calcPercentages(city)
    if (len(percents) > 0):
        percents.sort()
        percents.reverse()
        #szText += u"\n" advc.004: No empty line between total rate and percentages
        for iPercent, iUnit in percents:
            #			iUnit = getUnitType(gpType)
            szText += u"\n%s%s - %d%%" % (getUnitIcon(
                iUnit), gc.getUnitInfo(iUnit).getDescription(), iPercent)
    return szText
コード例 #24
0
def stop():
    global bActive
    bActive = False
    MapFinderStatusScreen.hide()
    restoreInterface()
    BugUtil.alert(
        BugUtil.getPlainText("TXT_KEY_MAPFINDER_STOPPED") + " - " +
        getCountsText())
コード例 #25
0
def finderSave():
    MapFinderStatusScreen.setStatus(
        BugUtil.getPlainText("TXT_KEY_MAPFINDER_SAVING"))
    # must delay long enough to allow unrevealed tiles to disappear before taking the screenshot
    delay = options.getSaveDelay()
    if delay < MINIMUM_SAVE_DELAY:
        delay = MINIMUM_SAVE_DELAY
    BugUtil.deferCall(save, delay)
コード例 #26
0
def regenerate():
    if canRegenerate():
        if CyInterface().getShowInterface(
        ) != InterfaceVisibility.INTERFACE_SHOW:
            CyInterface().setShowInterface(InterfaceVisibility.INTERFACE_SHOW)
        BugUtil.alert(BugUtil.getPlainText("TXT_KEY_MAPFINDER_REGNERATING"))
        # must defer to allow alert to appear
        BugUtil.deferCall(regenerateForReal)
コード例 #27
0
ファイル: MapFinder.py プロジェクト: NikNaks/Civ4-K-Mod
def doStop(argsList=None):
    try:
        if bActive:
            stop()
        else:
            BugUtil.alert(BugUtil.getPlainText("TXT_KEY_MAPFINDER_NOT_RUNNING"))
    except MapFinderError, e:
        e.display()
コード例 #28
0
 def showReminders(self, endOfTurn):
     global g_turnReminderTexts
     # <advc.127> Don't show reminder during Auto Play
     if gc.getPlayer(PlayerUtil.getActivePlayerID()).isHumanDisabled():
         return  # </advc.127>
     thisTurn = gc.getGame().getGameTurn()
     if (endOfTurn):
         prompt = BugUtil.getPlainText("TXT_KEY_REMIND_NEXT_TURN_PROMPT")
         eventId = RECALL_AGAIN_EVENT_ID
     else:
         g_turnReminderTexts = ""
         prompt = BugUtil.getPlainText("TXT_KEY_REMIND_END_TURN_PROMPT")
         eventId = RECALL_EVENT_ID
     yes = BugUtil.getPlainText("TXT_KEY_POPUP_YES")
     no = BugUtil.getPlainText("TXT_KEY_POPUP_NO")
     queue = self.reminders.get(PlayerUtil.getActivePlayerID())
     while (not queue.isEmpty()):
         nextTurn = queue.nextTurn()
         if (nextTurn > thisTurn):
             break
         elif (nextTurn < thisTurn):
             # invalid (lost) reminder
             reminder = queue.pop()
             BugUtil.warn("Reminder - skipped turn %d: %s", reminder.turn,
                          reminder.message)
         else:
             self.reminder = queue.pop()
             if (g_autolog.isLogging() and ReminderOpt.isAutolog()):
                 g_autolog.writeLog("Reminder: %s" % self.reminder.message)
             if (not endOfTurn):
                 if (g_turnReminderTexts):
                     g_turnReminderTexts += ", "
                 g_turnReminderTexts += self.reminder.message
             if (ReminderOpt.isShowMessage()):
                 CyInterface().addMessage(PlayerUtil.getActivePlayerID(),
                                          True, 10, self.reminder.message,
                                          None, 0, None, ColorTypes(8), 0,
                                          0, False, False)
             if (ReminderOpt.isShowPopup()):
                 popup = PyPopup.PyPopup(
                     eventId, EventContextTypes.EVENTCONTEXT_SELF)
                 popup.setHeaderString(self.reminder.message)
                 popup.setBodyString(prompt)
                 popup.addButton(yes)
                 popup.addButton(no)
                 popup.launch(False)
コード例 #29
0
    def createMainPanel(self, screen):
        "Creates and returns the options tab panel with Exit and Help buttons"
        # VBox with two blocks: scrolling control panel and Exit button with separator
        vbox = self.name + "VBox"
        screen.attachVBox(self.tab, vbox)

        # scrollpane
        scrollpane = self.name + "Scroll"
        screen.attachScrollPanel(vbox, scrollpane)
        screen.setLayoutFlag(scrollpane, "LAYOUT_SIZE_HEXPANDING")
        screen.setLayoutFlag(scrollpane, "LAYOUT_SIZE_VEXPANDING")

        # panel for option controls
        panel = self.name + "Panel"
        screen.attachPanel(scrollpane, panel)
        screen.setStyle(panel, "Panel_Tan15_Style")
        screen.setLayoutFlag(panel, "LAYOUT_SIZE_HPREFERREDEXPANDING")
        screen.setLayoutFlag(panel, "LAYOUT_SIZE_VPREFERREDEXPANDING")

        # panel for Help and Exit buttons
        screen.attachHSeparator(vbox, "RM_ExitSeparator")
        exitPanel = self.name + "ExitBox"
        screen.attachHBox(vbox, exitPanel)
        screen.setLayoutFlag(exitPanel, "LAYOUT_HCENTER")

        # Help button
        title = BugUtil.getPlainText("TXT_KEY_BUG_OPTBUTTON_HELP", "Help")
        hover = BugUtil.getPlainText(
            "TXT_KEY_BUG_OPTBUTTON_HELP_HOVER",
            "Opens the help file. You can hit Shift-F1 from the main interface."
        )
        helpButton = self.name + "Help"
        self.addButton(screen, exitPanel, helpButton,
                       "handleBugHelpButtonInput", title, hover)

        self.addSpacer(screen, exitPanel, exitPanel)

        # Exit button
        title = BugUtil.getPlainText("TXT_KEY_PEDIA_SCREEN_EXIT", "Exit")
        hover = BugUtil.getPlainText("TXT_KEY_BUG_OPTBUTTON_EXIT_HOVER",
                                     "Exits the BUG Options screen.")
        exitButton = self.name + "Exit"
        self.addButton(screen, exitPanel, exitButton,
                       "handleBugExitButtonInput", title, hover)

        return panel
コード例 #30
0
ファイル: UnitGrouper.py プロジェクト: markourm/fall
	def __init__(self, key, title):
		self.index = None
		self.key = key
		if title.startswith("TXT_KEY_"):
			self.title = BugUtil.getPlainText(title)
		else:
			self.title = title
		self.groups = {}
コード例 #31
0
ファイル: UnitGrouper.py プロジェクト: civ4-mp/CloseToHome
 def __init__(self, key, title):
     self.index = None
     self.key = key
     if title.startswith("TXT_KEY_"):
         self.title = BugUtil.getPlainText(title)
     else:
         self.title = title
     self.groups = {}
コード例 #32
0
ファイル: BugOptions.py プロジェクト: tj41172/Caveman2Cosmos
	def fillComments(self):
		self.config.clearInitialComment()
		self.config.addInitialComment(self.id)
		self.config.addInitialComment("")
		self.config.addInitialComment(BugUtil.getPlainText("TXT_KEY_BUG_CREATED_BY_HEADER"))
		self.config.addInitialComment()
		defaultHeader = BugUtil.getPlainText("TXT_KEY_BUG_DEFAULT") + ": "
		for option in self.options:
			if not option.isParameterized():
				section = self.getSection(option.getSection())
				key = option.getKey()
				section.clearKeyComments(key)
				section.addKeyComment(key)
				for line in option.getTooltip().splitlines():
					section.addKeyComment(key, line)
				section.addKeyComment(key, defaultHeader + str(option.getDefault()))
				section.addKeyComment(key)
		self.config.addFinalComment()
コード例 #33
0
 def interfaceScreen(self):
     "Initial creation of the screen"
     title = BugUtil.getPlainText("TXT_KEY_BUG_OPT_TITLE", "C2C Options")
     self.pTabControl = CyGTabCtrl(title, False, False)
     self.pTabControl.setModal(1)
     self.pTabControl.setSize(950, 715)
     self.pTabControl.setControlsExpanding(False)
     self.pTabControl.setColumnLength(self.iScreenHeight)
     self.createTabs()
コード例 #34
0
def doStop(argsList=None):
    try:
        if bActive:
            stop()
        else:
            BugUtil.alert(
                BugUtil.getPlainText("TXT_KEY_MAPFINDER_NOT_RUNNING"))
    except MapFinderError, e:
        e.display()
コード例 #35
0
ファイル: BugHelp.py プロジェクト: hardtimes1966/modxml
def launch():
	"Opens the mod's help file externally if it can be found or displays an error alert"
	sLang = ["ENG", "FRA", "DEU", "ITA", "ESP"]
	name = "BUG Mod Help-%s.chm" % (sLang[CyGame().getCurrentLanguage()])
	file = findIniFile(name)
	if file:
		message = BugUtil.getPlainText("TXT_KEY_BUG_HELP_OPENING")
		CyInterface().addImmediateMessage(message, "")
		os.startfile(file)
		return True
	else:
		title = BugUtil.getPlainText("TXT_KEY_BUG_HELP_MISSING_TITLE")
		body = BugUtil.getText("TXT_KEY_BUG_HELP_MISSING_BODY", (name,))
		popup = PyPopup.PyPopup()
		popup.setHeaderString(title)
		popup.setBodyString(body)
		popup.launch()
		return False
コード例 #36
0
ファイル: MapFinder.py プロジェクト: NikNaks/Civ4-K-Mod
def doStart(argsList=None):
    try:
        if not bActive:
            start()
        else:
            BugUtil.alert(BugUtil.getPlainText("TXT_KEY_MAPFINDER_ALREADY_RUNNING"))
    except MapFinderError, e:
        MapFinderStatusScreen.hide()
        e.display()
コード例 #37
0
ファイル: MapFinder.py プロジェクト: NikNaks/Civ4-K-Mod
def finderCanRegenerate():
    if bActive:
        try:
            if canRegenerate():
                MapFinderStatusScreen.setStatus(BugUtil.getPlainText("TXT_KEY_MAPFINDER_REGNERATING"))
                # must defer to allow screen to update
                BugUtil.deferCall(finderRegenerate)
        except MapFinderError, e:
            e.display()
            stop()
コード例 #38
0
ファイル: BugOptions.py プロジェクト: AP-ML/DTM
	def fillComments(self):
		print dir(self.config)
		self.config.clearInitialComment()
		self.config.addInitialComment(self.id)
		self.config.addInitialComment("")
		self.config.addInitialComment(BugUtil.getPlainText("TXT_KEY_BUG_CREATED_BY_HEADER"))
		self.config.addInitialComment()
		defaultHeader = BugUtil.getPlainText("TXT_KEY_BUG_DEFAULT") + ": "
		for option in self.options:
			if not option.isParameterized():
				section = self.getSection(option.getSection())
				key = option.getKey()
				section.clearKeyComments(key)
				section.addKeyComment(key)
				for line in option.getTooltip().splitlines():
					section.addKeyComment(key, line)
				section.addKeyComment(key, defaultHeader + str(option.getDefault()))
				section.addKeyComment(key)
		self.config.addFinalComment()
コード例 #39
0
	def start(self):
		self.writeMsg("")
		self.writeMsg("Logging by " + CvModName.getDisplayNameAndVersion() + " (" + CvModName.getCivNameAndVersion() + ")")
		self.writeMsg("------------------------------------------------")
		zcurrturn = gc.getGame().getElapsedGameTurns() + AutologOpt.get4000BCTurn()
		zmaxturn = gc.getGame().getMaxTurns()
		zyear = gc.getGame().getGameTurnYear()
		if (zyear < 0):
			zyear = str(-zyear) + BugUtil.getPlainText("TXT_KEY_AUTOLOG_BC")
		else:
			zyear = str(zyear) + BugUtil.getPlainText("TXT_KEY_AUTOLOG_AD")
		zCurrDateTime = time.strftime("%d-%b-%Y %H:%M:%S")
		if (zmaxturn == 0):
			zsTurn = "%i" % (zcurrturn)
		else:
			zsTurn = "%i/%i" % (zcurrturn, zmaxturn)
		message = BugUtil.getText("TXT_KEY_AUTOLOG_TURN", (zsTurn, zyear, zCurrDateTime))
		self.writeMsg(message, vBold=True, vUnderline=True)
		self.bStarted = True
コード例 #40
0
def doStart(argsList=None):
    try:
        if not bActive:
            start()
        else:
            BugUtil.alert(
                BugUtil.getPlainText("TXT_KEY_MAPFINDER_ALREADY_RUNNING"))
    except MapFinderError, e:
        MapFinderStatusScreen.hide()
        e.display()
コード例 #41
0
ファイル: AttitudeUtil.py プロジェクト: hardtimes1966/modxml
def initModifiers (argsList=None):
	""" Creates the dictionary that maps strings to modifier keys. """
	global MODIFIER_STRING_TO_KEY
	MODIFIER_STRING_TO_KEY = {}
	for sKey in ATTITUDE_MODIFIERS:
		sStr = BugUtil.getPlainText(sKey, "NONE")
		if (sStr != "NONE"):
			# These modifier strings should contain the '%d: ' prefix
			# so we need to extract just the portion in quotes.
			pMatch = re.match(u"^.*(\".+\")", sStr, re.UNICODE)
			if (pMatch):
				MODIFIER_STRING_TO_KEY[unicode(pMatch.group(1))] = sKey
	for iMemType in range(MemoryTypes.NUM_MEMORY_TYPES):
		sKey = str(gc.getMemoryInfo(iMemType).getTextKey())
		sStr = BugUtil.getPlainText(sKey, "NONE")
		if (sStr != "NONE"):
			# These modifier strings have no extra text and so
			# we can use them directly
			MODIFIER_STRING_TO_KEY[unicode(sStr)] = sKey
コード例 #42
0
def initModifiers(argsList=None):
    """ Creates the dictionary that maps strings to modifier keys. """
    global MODIFIER_STRING_TO_KEY
    MODIFIER_STRING_TO_KEY = {}
    for sKey in ATTITUDE_MODIFIERS:
        sStr = BugUtil.getPlainText(sKey, "NONE")
        if (sStr != "NONE"):
            # These modifier strings should contain the '%d: ' prefix
            # so we need to extract just the portion in quotes.
            pMatch = re.match(u"^.*(\".+\")", sStr, re.UNICODE)
            if (pMatch):
                MODIFIER_STRING_TO_KEY[unicode(pMatch.group(1))] = sKey
    for iMemType in xrange(MemoryTypes.NUM_MEMORY_TYPES):
        sKey = str(gc.getMemoryInfo(iMemType).getTextKey())
        sStr = BugUtil.getPlainText(sKey, "NONE")
        if (sStr != "NONE"):
            # These modifier strings have no extra text and so
            # we can use them directly
            MODIFIER_STRING_TO_KEY[unicode(sStr)] = sKey
コード例 #43
0
def finderCanRegenerate():
    if bActive:
        try:
            if canRegenerate():
                MapFinderStatusScreen.setStatus(
                    BugUtil.getPlainText("TXT_KEY_MAPFINDER_REGNERATING"))
                # must defer to allow screen to update
                BugUtil.deferCall(finderRegenerate)
        except MapFinderError, e:
            e.display()
            stop()
コード例 #44
0
ファイル: BugOptionsTab.py プロジェクト: hardtimes1966/modxml
	def addLabel (self, screen, panel, name, title=None, tooltip=None):
		key = "TXT_KEY_BUG_OPTLABEL_" + name.upper()
		title = BugUtil.getPlainText(key, title)
		#tooltip = BugUtil.getPlainText(key + "_HOVER", tooltip)
		if (title):
			label = name + "_Label"
			screen.attachLabel(panel, label, title)
			screen.setControlFlag(label, "CF_LABEL_DEFAULTSIZE")
			#if (tooltip):
			#	screen.setToolTip(label, tooltip)
			return label
		return None
コード例 #45
0
	def createMainPanel (self, screen):
		"Creates and returns the options tab panel with Exit and Help buttons"
		# VBox with two blocks: scrolling control panel and Exit button with separator
		vbox = self.name + "VBox"
		screen.attachVBox(self.tab, vbox)		
		
		# scrollpane
		scrollpane = self.name + "Scroll"
		screen.attachScrollPanel(vbox, scrollpane)
		screen.setLayoutFlag(scrollpane, "LAYOUT_SIZE_HEXPANDING")
		screen.setLayoutFlag(scrollpane, "LAYOUT_SIZE_VEXPANDING")
		
		# panel for option controls
		panel = self.name + "Panel"
		screen.attachPanel(scrollpane, panel)
		screen.setStyle(panel, "Panel_Tan15_Style")
		screen.setLayoutFlag(panel, "LAYOUT_SIZE_HPREFERREDEXPANDING")
		screen.setLayoutFlag(panel, "LAYOUT_SIZE_VPREFERREDEXPANDING")
		
		# panel for Help and Exit buttons
		screen.attachHSeparator(vbox, "RM_ExitSeparator")
		exitPanel = self.name + "ExitBox"
		screen.attachHBox(vbox, exitPanel)
		screen.setLayoutFlag(exitPanel, "LAYOUT_HCENTER")
		
		# Help button
		title = BugUtil.getPlainText("TXT_KEY_BUG_OPTBUTTON_HELP", "Help")
		hover = BugUtil.getPlainText("TXT_KEY_BUG_OPTBUTTON_HELP_HOVER", "Opens the help file. You can hit Shift-F1 from the main interface.")
		helpButton = self.name + "Help"
		self.addButton(screen, exitPanel, helpButton, "handleBugHelpButtonInput", title, hover)
		
		self.addSpacer(screen, exitPanel, exitPanel)
		
		# Exit button
		title = BugUtil.getPlainText("TXT_KEY_PEDIA_SCREEN_EXIT", "Exit")
		hover = BugUtil.getPlainText("TXT_KEY_BUG_OPTBUTTON_EXIT_HOVER", "Exits the BUG Options screen.")
		exitButton = self.name + "Exit"
		self.addButton(screen, exitPanel, exitButton, "handleBugExitButtonInput", title, hover)
		
		return panel
コード例 #46
0
ファイル: BugOptions.py プロジェクト: AP-ML/DTM
	def translate(self):
		self.title = BugUtil.getPlainText(self.xmlKey + "_TEXT", self.title)
		self.tooltip = BugUtil.getPlainText(self.xmlKey + "_HOVER", self.tooltip)
		if self.isDll():
			if BugDll.isVersion(self.dll):
				self.tooltip = RE_DLL_ALL_TAGS.sub("", self.tooltip)
			else:
				if not BugDll.isPresent():
					dllText = BugUtil.getPlainText("TXT_KEY_BULL_REQUIRED")
				else:
					dllText = BugUtil.getPlainText("TXT_KEY_BULL_REQUIRED_NEWER")
				if self.tooltip.find("[DLL") >= 0:
					self.tooltip = RE_DLL_START_END_TAGS.sub("", self.tooltip)
					self.tooltip = RE_DLL_MSG_TAG.sub(dllText, self.tooltip)
				else:
					self.tooltip += "\n" + dllText
		elif self.tooltip.find("[DLL") >= 0:
			if not BugDll.isPresent():
				# no DLL, ignore all minimum versions and use standard error message
				self.tooltip = RE_DLL_START_END_TAGS.sub("", self.tooltip)
				self.tooltip = RE_DLL_MSG_TAG.sub(BugUtil.getPlainText("TXT_KEY_BULL_REQUIRED"), self.tooltip)
			else:
				dllText = BugUtil.getPlainText("TXT_KEY_BULL_REQUIRED_NEWER")
				def repl(matchobj):
					try:
						if BugDll.isVersion(int(matchobj.group(1))):
							return ""
						else:
							return RE_DLL_MSG_TAG.sub(dllText, matchobj.group(2))
					except:
						# invalid version
						return ""
				self.tooltip = RE_DLL_CAPTURE_VERSION_MESSAGE.sub(repl, self.tooltip)
		self.translated = True
コード例 #47
0
	def showReminders(self, endOfTurn):
		global g_turnReminderTexts
		thisTurn = gc.getGame().getGameTurn()
		if (endOfTurn):
			prompt = BugUtil.getPlainText("TXT_KEY_REMIND_NEXT_TURN_PROMPT")
			eventId = RECALL_AGAIN_EVENT_ID
		else:
			g_turnReminderTexts = ""
			prompt = BugUtil.getPlainText("TXT_KEY_REMIND_END_TURN_PROMPT")
			eventId = RECALL_EVENT_ID
		yes = BugUtil.getPlainText("TXT_KEY_POPUP_YES")
		no = BugUtil.getPlainText("TXT_KEY_POPUP_NO")
		queue = self.reminders.get(PlayerUtil.getActivePlayerID())
		while (not queue.isEmpty()):
			nextTurn = queue.nextTurn()
			if (nextTurn > thisTurn):
				break
			elif (nextTurn < thisTurn):
				# invalid (lost) reminder
				reminder = queue.pop()
				BugUtil.warn("Reminder - skipped turn %d: %s", reminder.turn, reminder.message)
			else:
				self.reminder = queue.pop()
				if (g_autolog.isLogging() and ReminderOpt.isAutolog()):
					g_autolog.writeLog("Reminder: %s" % self.reminder.message)
				if (not endOfTurn):
					if (g_turnReminderTexts):
						g_turnReminderTexts += ", "
					g_turnReminderTexts += self.reminder.message
				if (ReminderOpt.isShowMessage()):
					CyInterface().addMessage(PlayerUtil.getActivePlayerID(), True, 10, self.reminder.message, 
											 None, 0, None, ColorTypes(8), 0, 0, False, False)
				if (ReminderOpt.isShowPopup()):
					popup = PyPopup.PyPopup(eventId, EventContextTypes.EVENTCONTEXT_SELF)
					popup.setHeaderString(self.reminder.message)
					popup.setBodyString(prompt)
					popup.addButton(yes)
					popup.addButton(no)
					popup.launch(False)
コード例 #48
0
ファイル: autolog.py プロジェクト: tarjintor/Civ4-K-Mod
 def start(self):
     self.writeMsg("")
     self.writeMsg("Logging by " + CvModName.getDisplayNameAndVersion() +
                   " (" + CvModName.getCivNameAndVersion() + ")")
     self.writeMsg("------------------------------------------------")
     zcurrturn = gc.getGame().getElapsedGameTurns(
     ) + AutologOpt.get4000BCTurn()
     zmaxturn = gc.getGame().getMaxTurns()
     zyear = gc.getGame().getGameTurnYear()
     if (zyear < 0):
         zyear = str(-zyear) + BugUtil.getPlainText("TXT_KEY_AUTOLOG_BC")
     else:
         zyear = str(zyear) + BugUtil.getPlainText("TXT_KEY_AUTOLOG_AD")
     zCurrDateTime = time.strftime("%d-%b-%Y %H:%M:%S")
     if (zmaxturn == 0):
         zsTurn = "%i" % (zcurrturn)
     else:
         zsTurn = "%i/%i" % (zcurrturn, zmaxturn)
     message = BugUtil.getText("TXT_KEY_AUTOLOG_TURN",
                               (zsTurn, zyear, zCurrDateTime))
     self.writeMsg(message, vBold=True, vUnderline=True)
     self.bStarted = True
コード例 #49
0
	def interfaceScreen(self):
		"Initial creation of the screen"
		title = BugUtil.getPlainText("TXT_KEY_BUG_OPT_TITLE", "BUG Mod Options")
		self.pTabControl = CyGTabCtrl(title, False, False)
		self.pTabControl.setModal(1)
		self.pTabControl.setSize(950, 715)
		self.pTabControl.setControlsExpanding(False)
		self.pTabControl.setColumnLength(self.iScreenHeight)
		
		if self.options.isLoaded():
			self.createTabs()
		else:
			BugErrorOptionsTab.BugErrorOptionsTab(self).create(self.pTabControl)
コード例 #50
0
	def interfaceScreen(self):
		"Initial creation of the screen"
		title = BugUtil.getPlainText("TXT_KEY_BUG_OPT_TITLE", "BUG Mod Options")
		self.pTabControl = CyGTabCtrl(title, False, False)
		self.pTabControl.setModal(1)
		self.pTabControl.setSize(900, 705)
		self.pTabControl.setControlsExpanding(False)
		self.pTabControl.setColumnLength(self.iScreenHeight)
		
		if self.options.isLoaded():
			self.createTabs()
		else:
			BugErrorOptionsTab.BugErrorOptionsTab(self).create(self.pTabControl)
コード例 #51
0
	def drawPanel(self, screen):
		screen.addPanel(self.MAIN_PANEL_ID, u"", u"", True, False, 
					self.MAIN_PANEL_X, self.MAIN_PANEL_Y, self.MAIN_PANEL_W, self.MAIN_PANEL_H, PanelStyles.PANEL_STYLE_HUD_HELP)
		
		x = self.MAIN_PANEL_X + self.MARGIN_X
		y = self.MAIN_PANEL_Y + self.MARGIN_Y
		z = -0.3
		screen.setLabel("TitleLabel", self.MAIN_PANEL_ID, BugUtil.getPlainText("TXT_KEY_MAPFINDER_SCREEN_TITLE"), CvUtil.FONT_CENTER_JUSTIFY,
					self.MAIN_PANEL_X + self.MAIN_PANEL_W / 2, y, z, FontTypes.SMALL_FONT, 
					WidgetTypes.WIDGET_GENERAL, -1, -1)
		y += self.LINE_HEIGHT + self.MARGIN_Y
		
		screen.setLabel("RegenLabel", self.MAIN_PANEL_ID, BugUtil.getPlainText("TXT_KEY_MAPFINDER_TOTAL_MAPS"), CvUtil.FONT_LEFT_JUSTIFY,
					x, y, z, FontTypes.SMALL_FONT, 
					WidgetTypes.WIDGET_GENERAL, -1, -1)
		y += self.LINE_HEIGHT
		screen.setLabel("SaveLabel", self.MAIN_PANEL_ID, BugUtil.getPlainText("TXT_KEY_MAPFINDER_TOTAL_SAVES"), CvUtil.FONT_LEFT_JUSTIFY,
					x, y, z, FontTypes.SMALL_FONT, 
					WidgetTypes.WIDGET_GENERAL, -1, -1)
		
		y = self.MAIN_PANEL_Y + self.MAIN_PANEL_H - self.MARGIN_Y - self.LINE_HEIGHT
		screen.setLabel("StopMsgLabel", self.MAIN_PANEL_ID, BugUtil.getPlainText("TXT_KEY_MAPFINDER_STOP_SHORTCUT"), CvUtil.FONT_CENTER_JUSTIFY,
					self.MAIN_PANEL_X + self.MAIN_PANEL_W / 2, y, z, FontTypes.SMALL_FONT, 
					WidgetTypes.WIDGET_GENERAL, -1, -1)
コード例 #52
0
ファイル: ColorUtil.py プロジェクト: AP-ML/DTM
def createColors(argsList=None):
	for key in COLOR_KEYS:
		type = gc.getInfoTypeForString(key)
		if (type >= 0):
			info = gc.getColorInfo(type)
			if (info):
				name = BugUtil.getPlainText("TXT_KEY_" + key, "")
				if (not name):
					name = key.replace("COLOR_", "").replace("_", " ").title()
				COLOR_TYPES.append(type)
				COLOR_DISPLAY_NAMES.append(name)
				color = (len(COLORS), type, key, name)
				COLORS.append(color)
				COLORS_BY_TYPE[type] = color
				COLORS_BY_KEY[key] = color
				TYPES_BY_KEY[key] = type
コード例 #53
0
def createColors(argsList=None):
	for key in COLOR_KEYS:
		type = gc.getInfoTypeForString(key)
		if (type >= 0):
			info = gc.getColorInfo(type)
			if (info):
				name = BugUtil.getPlainText("TXT_KEY_" + key, "")
				if (not name):
					name = key.replace("COLOR_", "").replace("_", " ").title()
				COLOR_TYPES.append(type)
				COLOR_DISPLAY_NAMES.append(name)
				color = (len(COLORS), type, key, name)
				COLORS.append(color)
				COLORS_BY_TYPE[type] = color
				COLORS_BY_KEY[key] = color
				TYPES_BY_KEY[key] = type
コード例 #54
0
 def addLabel (self, screen, panel, name, title=None, tooltip=None, spacer=False):
     key = "TXT_KEY_BUG_OPTLABEL_" + name.upper()
     title = BugUtil.getPlainText(key, title)
     #tooltip = BugUtil.getPlainText(key + "_HOVER", tooltip)
     if spacer:
         hbox = name + "HBox"
         screen.attachHBox(panel, hbox)
         #screen.setLayoutFlag(box, "LAYOUT_SIZE_HPREFERREDEXPANDING")
         self.addSpacer(screen, hbox, hbox, CHECKBOX_INDENT)
         panel = hbox
     if title:
         label = name + "_Label"
         screen.attachLabel(panel, label, title)
         screen.setControlFlag(label, "CF_LABEL_DEFAULTSIZE")
         #if (tooltip):
         #   screen.setToolTip(label, tooltip)
         return label
     return None
コード例 #55
0
	def addLabel (self, screen, panel, name, title=None, tooltip=None, spacer=False):
		key = "TXT_KEY_BUG_OPTLABEL_" + name.upper()
		title = BugUtil.getPlainText(key, title)
		#tooltip = BugUtil.getPlainText(key + "_HOVER", tooltip)
		if spacer:
			hbox = name + "HBox"
			screen.attachHBox(panel, hbox)
			#screen.setLayoutFlag(box, "LAYOUT_SIZE_HPREFERREDEXPANDING")
			self.addSpacer(screen, hbox, hbox, CHECKBOX_INDENT)
			panel = hbox
		if (title):
			label = name + "_Label"
			screen.attachLabel(panel, label, title)
			screen.setControlFlag(label, "CF_LABEL_DEFAULTSIZE")
			#if (tooltip):
			#	screen.setToolTip(label, tooltip)
			return label
		return None
コード例 #56
0
    def interfaceScreen(self):
        "Initial creation of the screen"
        title = BugUtil.getPlainText("TXT_KEY_BUG_OPT_TITLE",
                                     "BUG Mod Options")
        self.pTabControl = CyGTabCtrl(title, False, False)
        self.pTabControl.setModal(1)
        screen = CyGInterfaceScreen("MainInterface",
                                    CvScreenEnums.MAIN_INTERFACE)
        resolutionWidth = screen.getXResolution()
        # resolutionHeigth = screen.getYResolution()
        self.pTabControl.setSize(resolutionWidth - 60, 750)
        # self.pTabControl.setSize(1000, 750)
        self.pTabControl.setControlsExpanding(False)
        self.pTabControl.setColumnLength(self.iScreenHeight)

        if self.options.isLoaded():
            self.createTabs()
        else:
            BugErrorOptionsTab.BugErrorOptionsTab(self).create(
                self.pTabControl)
コード例 #57
0
ファイル: GPUtil.py プロジェクト: AP-ML/DTM
def getHoverText(eWidgetType, iData1, iData2, bOption):
	city, iTurns = getDisplayCity()
	if (not city):
		# no rate or progress in any city and no city selected
		return BugUtil.getText("TXT_KEY_MISC_GREAT_PERSON", (0, PlayerUtil.getActivePlayer().greatPeopleThreshold(False)))
	iThreshold = gc.getPlayer(city.getOwner()).greatPeopleThreshold(False)
	iProgress = city.getGreatPeopleProgress()
	iRate = city.getGreatPeopleRate()
	szText = BugUtil.colorText(city.getName(), "COLOR_HIGHLIGHT_TEXT")
	szText += u"\n"
	szText += BugUtil.getText("TXT_KEY_MISC_GREAT_PERSON", (iProgress, iThreshold))
	if (iRate > 0):
		szText += u"\n%d%s%s " % (iRate, g_gpIcon, BugUtil.getPlainText("TXT_KEY_PER_TURN"))
		szText += BugUtil.getText("INTERFACE_CITY_TURNS", (iTurns,))
	
	percents = calcPercentages(city)
	if (len(percents) > 0):
		percents.sort()
		percents.reverse()
		szText += u"\n"
		for iPercent, iUnit in percents:
#			iUnit = getUnitType(gpType)
			szText += u"\n%s%s - %d%%" % (getUnitIcon(iUnit), gc.getUnitInfo(iUnit).getDescription(), iPercent)
	return szText
コード例 #58
0
def setWidgetHelpXml(widget, key):
	"""
	Assigns the XML <key> to be used to lookup the translated hover text for <widget>.
	"""
	_setWidgetHelp(widget, "XML", lambda *ignored: BugUtil.getPlainText(key))