## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import ScreenInput
import CvScreenEnums
# globals
gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()
class Forgetful:
def __init__(self):
self.iForgetfulType = 0
def interfaceScreen(self):
screen = CyGInterfaceScreen("ForgetfulScreen", CvScreenEnums.FORGETFUL_SCREEN)
self.nTableWidth = 770
self.nScreenWidth = self.nTableWidth + 40
self.nScreenHeight = screen.getYResolution()
self.nTableHeight = self.nScreenHeight - 120
screen.setRenderInterfaceOnly(True)
screen.setDimensions(screen.getXResolution()/2 - self.nScreenWidth/2, 0, self.nScreenWidth, self.nScreenHeight)
screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)
# Here we set the background widget and exit button, and we show the screen
screen.addPanel( "ForgetfulBG", u"", u"", False, True, 0, 0, self.nScreenWidth, self.nScreenHeight, PanelStyles.PANEL_STYLE_MAIN )
screen.setText("ForgetfulExit", "Background", u"<font=4b>" + localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()).upper() + "</font>", CvUtil.FONT_RIGHT_JUSTIFY, self.nScreenWidth - 25, self.nScreenHeight - 50, -0.1, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1 )
szDropdownName = "ForgetfulType"
screen.addDropDownBoxGFC(szDropdownName, 20, 20, 180, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_UNIT", ()), 0, 0, 0 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_BUILDING", ()), 1, 1, 1 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_PROMOTION", ()), 2, 2, 2 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_TECH", ()), 3, 3, 3 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_BONUS", ()), 4, 4, 4 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_TERRAIN", ()), 5, 5, 5 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_FEATURE", ()), 6, 6, 6 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_IMPROVEMENT", ()), 7, 7, 7 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_SPECIALIST", ()), 8, 8, 8 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_UNIT_COMBAT", ()), 9, 9, 9 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_CIV", ()), 10, 10, 10 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_LEADER", ()), 11, 11, 11 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_RELIGION", ()), 12, 12, 12 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_CONCEPT_CORPORATIONS", ()), 13, 13, 13 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_CIVIC", ()), 14, 14, 14 == self.iForgetfulType)
screen.addPullDownString(szDropdownName, CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_PROJECT", ()), 15, 15, 15 == self.iForgetfulType)
# Build the table
screen.addTableControlGFC("ForgetfulTable", 4, 20, 60, self.nTableWidth, self.nTableHeight, True, False, 24, 24, TableStyles.TABLE_STYLE_STANDARD )[COLOR="RoyalBlue"][/COLOR]
screen.setTableColumnHeader("ForgetfulTable", 0, "ID", 50)
screen.setTableColumnHeader("ForgetfulTable", 1, localText.getText("TXT_KEY_DOMESTIC_ADVISOR_NAME", ()).upper(), 250)
screen.setTableColumnHeader("ForgetfulTable", 2, "TYPE", 350)
screen.setTableColumnHeader("ForgetfulTable", 3, "GRAPHICAL", 100)
screen.enableSort("ForgetfulTable")
self.drawTable("ForgetfulTable")
def drawTable(self, Table):
screen = CyGInterfaceScreen("ForgetfulScreen", CvScreenEnums.FORGETFUL_SCREEN)
## Units ##
if self.iForgetfulType == 0:
for item in xrange(gc.getNumUnitInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getUnitInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Buildings ##
elif self.iForgetfulType == 1:
for item in xrange(gc.getNumBuildingInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getBuildingInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Promotions ##
elif self.iForgetfulType == 2:
for item in xrange(gc.getNumPromotionInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getPromotionInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROMOTION, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROMOTION, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Techs ##
elif self.iForgetfulType == 3:
for item in xrange(gc.getNumTechInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getTechInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Bonuses ##
elif self.iForgetfulType == 4:
for item in xrange(gc.getNumBonusInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getBonusInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Terrains ##
elif self.iForgetfulType == 5:
for item in xrange(gc.getNumTerrainInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getTerrainInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_TERRAIN, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_TERRAIN, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Features ##
elif self.iForgetfulType == 6:
for item in xrange(gc.getNumFeatureInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getFeatureInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_FEATURE, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_FEATURE, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Improvements ##
elif self.iForgetfulType == 7:
for item in xrange(gc.getNumImprovementInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getImprovementInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_IMPROVEMENT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_IMPROVEMENT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Specialists ##
elif self.iForgetfulType == 8:
for item in xrange(gc.getNumSpecialistInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getSpecialistInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_SPECIALIST, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_SPECIALIST, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Unit Combats ##
elif self.iForgetfulType == 9:
for item in xrange(gc.getNumUnitCombatInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getUnitCombatInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT_COMBAT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT_COMBAT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Civilizations ##
elif self.iForgetfulType == 10:
for item in xrange(gc.getNumCivilizationInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getCivilizationInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIV, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIV, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Leaders ##
elif self.iForgetfulType == 11:
for item in xrange(gc.getNumLeaderHeadInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getLeaderHeadInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Religions ##
elif self.iForgetfulType == 12:
for item in xrange(gc.getNumReligionInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getReligionInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_RELIGION, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_RELIGION, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Corporations ##
elif self.iForgetfulType == 13:
for item in xrange(gc.getNumCorporationInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getCorporationInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_CORPORATION, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_CORPORATION, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Civics ##
elif self.iForgetfulType == 14:
for item in xrange(gc.getNumCivicInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getCivicInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIVIC, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIVIC, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
## Projects ##
elif self.iForgetfulType == 15:
for item in xrange(gc.getNumProjectInfos()):
screen.appendTableRow(Table)
ItemInfo = gc.getProjectInfo(item)
screen.setTableInt(Table, 0, item, str(item), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 1, item, ItemInfo.getDescription(), ItemInfo.getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 2, item, ItemInfo.getType(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, item, 1, CvUtil.FONT_LEFT_JUSTIFY)
screen.setTableText(Table, 3, item, str(ItemInfo.isGraphicalOnly()), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
def handleInput (self, inputClass):
if (inputClass.getFunctionName() == "ForgetfulType"):
self.handlePlatyForgetfulTypeCB(inputClass.getData())
return 0
def handlePlatyForgetfulTypeCB ( self, argsList ) :
self.iForgetfulType = int(argsList)
self.interfaceScreen()
return
def update(self, fDelta):
return 1