def hideSpecialists(self):
     screen = CyGInterfaceScreen("DomesticAdvisor",
                                 CvScreenEnums.DOMESTIC_ADVISOR)
     for i in xrange(gc.getNumSpecialistInfos()):
         if (gc.getSpecialistInfo(i).isVisible()):
             screen.hide("SpecialistImage" + str(i))
             screen.hide("SpecialistPlus" + str(i))
             screen.hide("SpecialistMinus" + str(i))
             screen.hide("SpecialistText" + str(i))
    def updateSpecialists(self):
        """ Function which shows the specialists."""
        screen = CyGInterfaceScreen("DomesticAdvisor",
                                    CvScreenEnums.DOMESTIC_ADVISOR)

        if (CyInterface().isOneCitySelected()):

            city = CyInterface().getHeadSelectedCity()
            nPopulation = city.getPopulation()
            nFreeSpecial = city.totalFreeSpecialists()

            for i in xrange(gc.getNumSpecialistInfos()):
                if (gc.getSpecialistInfo(i).isVisible()):
                    szName = "SpecialistImage" + str(i)
                    screen.show(szName)

                    szName = "SpecialistText" + str(i)
                    screen.setLabel(
                        szName, "Background",
                        str(city.getSpecialistCount(i)) + "/" +
                        str(city.getMaxSpecialistCount(i)),
                        CvUtil.FONT_LEFT_JUSTIFY, self.nFirstSpecialistX +
                        (self.nSpecialistDistance * i) + self.nSpecTextOffsetX,
                        self.nSpecialistY + self.nSpecTextOffsetY, 0,
                        FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1,
                        -1)
                    screen.show(szName)

                    # If the specialist is valid and we can increase it
                    szName = "SpecialistPlus" + str(i)
                    if (city.isSpecialistValid(i, 1)
                            and (city.getForceSpecialistCount(i) <
                                 (nPopulation + nFreeSpecial))):
                        screen.show(szName)
                    else:
                        screen.hide(szName)

                    # if we HAVE specialists already and they're not forced.
                    szName = "SpecialistMinus" + str(i)
                    if (city.getSpecialistCount(i) > 0
                            or city.getForceSpecialistCount(i) > 0):
                        screen.show(szName)
                    else:
                        screen.hide(szName)
        else:
            self.hideSpecialists()
    def drawSpecialists(self):
        screen = CyGInterfaceScreen("DomesticAdvisor",
                                    CvScreenEnums.DOMESTIC_ADVISOR)

        for i in xrange(gc.getNumSpecialistInfos()):
            if (gc.getSpecialistInfo(i).isVisible()):
                szName = "SpecialistImage" + str(i)
                screen.setImageButton(
                    szName,
                    gc.getSpecialistInfo(i).getTexture(),
                    self.nFirstSpecialistX + (self.nSpecialistDistance * i),
                    self.nSpecialistY, self.nSpecialistWidth,
                    self.nSpecialistLength, WidgetTypes.WIDGET_CITIZEN, i, -1)
                screen.hide(szName)

                szName = "SpecialistPlus" + str(i)
                screen.setButtonGFC(
                    szName, u"", "", self.nFirstSpecialistX +
                    (self.nSpecialistDistance * i) + self.nPlusOffsetX,
                    self.nSpecialistY + self.nPlusOffsetY, self.nPlusWidth,
                    self.nPlusHeight, WidgetTypes.WIDGET_CHANGE_SPECIALIST, i,
                    1, ButtonStyles.BUTTON_STYLE_CITY_PLUS)
                screen.hide(szName)

                szName = "SpecialistMinus" + str(i)
                screen.setButtonGFC(
                    szName, u"", "", self.nFirstSpecialistX +
                    (self.nSpecialistDistance * i) + self.nMinusOffsetX,
                    self.nSpecialistY + self.nMinusOffsetY, self.nMinusWidth,
                    self.nMinusHeight, WidgetTypes.WIDGET_CHANGE_SPECIALIST, i,
                    -1, ButtonStyles.BUTTON_STYLE_CITY_MINUS)
                screen.hide(szName)

                szName = "SpecialistText" + str(i)
                screen.setLabel(
                    szName, "Background", "", CvUtil.FONT_LEFT_JUSTIFY,
                    self.nFirstSpecialistX + (self.nSpecialistDistance * i) +
                    self.nSpecTextOffsetX,
                    self.nSpecialistY + self.nSpecTextOffsetY, 0,
                    FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.hide(szName)