Beispiel #1
0
def reinitMainInterface():
    print "reinitMainInterface"
    global mainInterface
    mainInterface = CvMainInterface.CvMainInterface()
    mainInterface.interfaceScreen()
Beispiel #2
0
    def draw(self, screen):
        """Sorts and draws the scoreboard right-to-left, bottom-to-top."""
        timer = BugUtil.Timer("scores")
        self.hide(screen)
        self.assignRanks()
        self.gatherVassals()
        self.sort()
        interface = CyInterface()
        xResolution = screen.getXResolution()
        yResolution = screen.getYResolution()

        x = xResolution - 12  # start here and shift left with each column
        if (interface.getShowInterface() == InterfaceVisibility.INTERFACE_SHOW
                or interface.isInAdvancedStart()):
            y = yResolution - 206
        else:
            y = yResolution - 88
        totalWidth = 0
        height = ScoreOpt.getLineHeight()
        techIconSize = ScoreOpt.getResearchIconSize()

        # CCV - Position of Scores - START
        offset = 0
        if (CvMainInterface.CvMainInterface().checkScrollingScoreboard() ==
                True):
            offset = height
# CCV - Position of Scores - END

        defaultSpacing = ScoreOpt.getDefaultSpacing()
        spacing = defaultSpacing
        format = re.findall(
            '(-?[0-9]+|[^0-9])',
            ScoreOpt.getDisplayOrder().replace(' ', '').upper())
        format.reverse()
        for k in format:
            if k == '-':
                spacing = 0
                continue
            if k[0] in string.digits or k[0] == '-':
                spacing = int(k)
                continue
            if (not columnsByKey.has_key(k)):
                spacing = defaultSpacing
                continue
            column = columnsByKey[k]
            c = column.id
            if (not self._anyHas[c]):
                spacing = defaultSpacing
                continue
            type = column.type
            if (c == RESEARCH and not ScoreOpt.isShowResearchIcons()):
                # switch SPECIAL research icon to DYNAMIC name
                type = DYNAMIC

            if (type == SKIP):
                spacing = defaultSpacing
                continue

            elif (type == FIXED):
                width = column.width
                value = column.text
                x -= spacing
                for p, playerScore in enumerate(self._playerScores):
                    if (playerScore.has(c) and playerScore.value(c)):
                        name = "ScoreText%d-%d" % (p, c)
                        widget = playerScore.widget(c)
                        if widget is None:
                            if (playerScore.value(ALIVE)):
                                widget = (WidgetTypes.WIDGET_CONTACT_CIV,
                                          playerScore.getID(), -1)
                            else:
                                widget = (WidgetTypes.WIDGET_GENERAL, -1, -1)
# CCV - Position of Scores - START
                        screen.setText(name, "Background", value,
                                       CvUtil.FONT_RIGHT_JUSTIFY, x,
                                       y - p * height - offset, Z_DEPTH,
                                       FontTypes.SMALL_FONT, *widget)
                        # CCV - Position of Scores - END
                        screen.show(name)
                x -= width
                totalWidth += width + spacing
                spacing = defaultSpacing

            elif (type == DYNAMIC):
                width = 0
                for playerScore in self._playerScores:
                    if (playerScore.has(c)):
                        value = playerScore.value(c)
                        if (c == NAME and playerScore.isVassal()
                                and ScoreOpt.isGroupVassals()):
                            if (ScoreOpt.isLeftAlignName()):
                                value = VASSAL_PREFIX + value
                            else:
                                value += VASSAL_POSTFIX
                        newWidth = interface.determineWidth(value)
                        if (newWidth > width):
                            width = newWidth
                if (width == 0):
                    spacing = defaultSpacing
                    continue
                x -= spacing
                for p, playerScore in enumerate(self._playerScores):
                    if (playerScore.has(c)):
                        name = "ScoreText%d-%d" % (p, c)
                        value = playerScore.value(c)
                        if (c == NAME and playerScore.isVassal()
                                and ScoreOpt.isGroupVassals()):
                            if (ScoreOpt.isLeftAlignName()):
                                value = VASSAL_PREFIX + value
                            else:
                                value += VASSAL_POSTFIX
                        align = CvUtil.FONT_RIGHT_JUSTIFY
                        adjustX = 0
                        if (c == NAME):
                            name = "ScoreText%d" % p
                            if (ScoreOpt.isLeftAlignName()):
                                align = CvUtil.FONT_LEFT_JUSTIFY
                                adjustX = width
                        widget = playerScore.widget(c)
                        if widget is None:
                            if (playerScore.value(ALIVE)):
                                widget = (WidgetTypes.WIDGET_CONTACT_CIV,
                                          playerScore.getID(), -1)
                            else:
                                widget = (WidgetTypes.WIDGET_GENERAL, -1, -1)
# CCV - Position of Scores - START
                        screen.setText(name, "Background", value, align,
                                       x - adjustX, y - p * height - offset,
                                       Z_DEPTH, FontTypes.SMALL_FONT, *widget)
                        # CCV - Position of Scores - END
                        screen.show(name)
                x -= width
                totalWidth += width + spacing
                spacing = defaultSpacing

            else:  # SPECIAL
                if (c == RESEARCH):
                    x -= spacing
                    for p, playerScore in enumerate(self._playerScores):
                        if (playerScore.has(c)):
                            tech = playerScore.value(c)
                            name = "ScoreTech%d" % p
                            info = gc.getTechInfo(tech)
                            # CCV - Position of Scores - START
                            screen.addDDSGFC(
                                name, info.getButton(), x - techIconSize,
                                y - p * height - offset + 2, techIconSize,
                                techIconSize,
                                WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, tech,
                                -1)
# CCV - Position of Scores - END
                    x -= techIconSize
                    totalWidth += techIconSize + spacing
                    spacing = defaultSpacing

        for playerScore in self._playerScores:
            interface.checkFlashReset(playerScore.getID())

        if (interface.getShowInterface() == InterfaceVisibility.INTERFACE_SHOW
                or interface.isInAdvancedStart()):
            y = yResolution - 186
        else:
            y = yResolution - 68


# CCV - Position of Scores - START
        y = y - offset
        # CCV - Position of Scores - END

        screen.setPanelSize("ScoreBackground", xResolution - 21 - totalWidth,
                            y - (height * self.size()) - 4, totalWidth + 12,
                            (height * self.size()) + 8)
        screen.show("ScoreBackground")
        timer.log()
Beispiel #3
0
                print UserProfile.getProfileFileName(i)
            print "Current profile: " + UserProfile.getProfileName()
            szRes = UserProfile.getResolutionString(
                UserProfile.getResolution())
            szRes = szRes.split(" x ")
            SR.x = int(szRes[0])
            SR.y = int(szRes[1])
            print "Resolution: %dx%d" % (SR.x, SR.y)
            SR.calibrate()
    print "SCREEN %s TURNED ON" % (argsList[0])
    g_iScreenActive = argsList[0]


#diplomacyScreen = CvDiplomacy.CvDiplomacy()

mainInterface = CvMainInterface.CvMainInterface()


def showMainInterface():
    print "showMainInterface"
    mainInterface.interfaceScreen()


def reinitMainInterface():
    print "reinitMainInterface"
    global mainInterface
    mainInterface = CvMainInterface.CvMainInterface()
    mainInterface.interfaceScreen()


def numPlotListButtons():
Beispiel #4
0
    "COLOR_DARK_GREY",
    "COLOR_GREY",
    "COLOR_LIGHT_GREY",
    "COLOR_RED",
    "COLOR_GREEN",
    "COLOR_BLUE",
    "COLOR_CYAN",
    "COLOR_YELLOW",
    "COLOR_MAGENTA",
]

gOptionDict = {}
#	"": {'Section': "", 'Key': "", 'Default': True},

gOptionSetFunction = {
    "Civ Name": CvMainInterface.CvMainInterface(),
    "Master Name": CvMainInterface.CvMainInterface(),
    "City Info Panel": CityInfoPanelPS.CityInfoPanelPS(),
    "Diplomacy Attitude": CvDiplomacyInterface,
    "Combat Experience Counter": CvMainInterface.CvMainInterface(),
    "Game Turn Bar": CvMainInterface.CvMainInterface(),
    "Great Person Bar": CvMainInterface.CvMainInterface(),
    "Winamp GUI": CvMainInterface.CvMainInterface(),
    "Unit Statistics Mod": USsetOption,
    "Trade Resource Panel": TradeResourcePanel.TradeResourcePanel(),
    "Dead Civ Scoreboard Mod": CvMainInterface.CvMainInterface(),
    "City Pending Growth": Civ4lerts.Civ4lertsOption(),
    "City Pending Unhealthy": Civ4lerts.Civ4lertsOption(),
    "City Pending Angry": Civ4lerts.Civ4lertsOption(),
    "City Growth": Civ4lerts.Civ4lertsOption(),
    "City Growth Unhealthy": Civ4lerts.Civ4lertsOption(),