当前位置: 首页>>代码示例>>Python>>正文


Python BugDll.widget方法代码示例

本文整理汇总了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"",
            "",
#.........这里部分代码省略.........
开发者ID:DarkLunaPhantom,项目名称:civ4ffplus,代码行数:103,代码来源:BugFinanceAdvisor.py

示例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()))
开发者ID:Alrik2002,项目名称:Civ4-MMod,代码行数:6,代码来源:Scoreboard.py


注:本文中的BugDll.widget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。