本文整理汇总了Python中BugDll.widget方法的典型用法代码示例。如果您正苦于以下问题:Python BugDll.widget方法的具体用法?Python BugDll.widget怎么用?Python BugDll.widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BugDll
的用法示例。
在下文中一共展示了BugDll.widget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawContents
# 需要导入模块: import BugDll [as 别名]
# 或者: from BugDll import widget [as 别名]
def drawContents(self):
self.deleteAllWidgets()
# Create a new screen, called FinanceAdvisor, using the file FinanceAdvisor.py for input
screen = self.getScreen()
player = gc.getPlayer(self.iActiveLeader)
numCities = player.getNumCities()
totalUnitCost = player.calculateUnitCost()
totalUnitSupply = player.calculateUnitSupply()
totalMaintenance = player.getTotalMaintenance()
totalCivicUpkeep = player.getCivicUpkeep([], False)
totalPreInflatedCosts = player.calculatePreInflatedCosts()
totalInflatedCosts = player.calculateInflatedCosts()
goldCommerce = player.getCommerceRate(CommerceTypes.COMMERCE_GOLD)
if not player.isCommerceFlexible(CommerceTypes.COMMERCE_RESEARCH):
goldCommerce += player.calculateBaseNetResearch()
gold = player.getGold()
goldFromCivs = player.getGoldPerTurn()
goldPerTurn = player.calculateGoldRate()
szTreasuryPanel = self.getNextWidgetName()
screen.addPanel(
szTreasuryPanel,
u"",
"",
True,
True,
self.X_SLIDERS,
self.Y_TREASURY,
self.X_EXPENSES + self.PANE_WIDTH - self.X_SLIDERS,
self.H_TREASURY,
PanelStyles.PANEL_STYLE_MAIN,
)
szText = localText.getText("TXT_KEY_FINANCIAL_ADVISOR_TREASURY", (gold,)).upper()
if gold < 0:
if goldPerTurn != 0:
if gold + goldPerTurn >= 0:
szText += BugUtil.getText("TXT_KEY_MISC_POS_GOLD_PER_TURN", goldPerTurn)
elif goldPerTurn >= 0:
szText += BugUtil.getText("TXT_KEY_MISC_POS_WARNING_GOLD_PER_TURN", goldPerTurn)
else:
szText += BugUtil.getText("TXT_KEY_MISC_NEG_GOLD_PER_TURN", goldPerTurn)
else:
if goldPerTurn != 0:
if goldPerTurn >= 0:
szText += BugUtil.getText("TXT_KEY_MISC_POS_GOLD_PER_TURN", goldPerTurn)
elif gold + goldPerTurn >= 0:
szText += BugUtil.getText("TXT_KEY_MISC_NEG_WARNING_GOLD_PER_TURN", goldPerTurn)
else:
szText += BugUtil.getText("TXT_KEY_MISC_NEG_GOLD_PER_TURN", goldPerTurn)
screen.setLabel(
self.getNextWidgetName(),
szTreasuryPanel,
u"<font=4>" + szText + u"</font>",
CvUtil.FONT_CENTER_JUSTIFY,
(self.X_SLIDERS + self.PANE_WIDTH + self.X_EXPENSES) / 2,
self.Y_TREASURY + self.H_TREASURY / 2 - self.Y_SPACING / 2,
self.Z_CONTROLS,
FontTypes.TITLE_FONT,
WidgetTypes.WIDGET_HELP_FINANCE_GOLD_RESERVE,
-1,
-1,
)
szCommercePanel = self.getNextWidgetName()
screen.addPanel(
szCommercePanel,
u"",
"",
True,
True,
self.X_SLIDERS,
self.Y_LOCATION,
self.PANE_WIDTH,
self.PANE_HEIGHT,
PanelStyles.PANEL_STYLE_MAIN,
)
screen.setLabel(
self.getNextWidgetName(),
"Background",
u"<font=3>" + localText.getText("TXT_KEY_CONCEPT_COMMERCE", ()).upper() + u"</font>",
CvUtil.FONT_CENTER_JUSTIFY,
self.X_SLIDERS + self.PANE_WIDTH / 2,
self.Y_LOCATION + self.TEXT_MARGIN,
self.Z_CONTROLS + self.DZ,
FontTypes.GAME_FONT,
WidgetTypes.WIDGET_GENERAL,
-1,
-1,
)
szIncomePanel = self.getNextWidgetName()
screen.addPanel(
szIncomePanel,
u"",
"",
#.........这里部分代码省略.........
示例2: setTrade
# 需要导入模块: import BugDll [as 别名]
# 或者: from BugDll import widget [as 别名]
def setTrade(self):
self._set(TRADE, True,
BugDll.widget("WIDGET_TRADE_ROUTES", self._activePlayer, self._currPlayerScore.getID(),
*self._getContactWidget()))