def __init__(self, parent, displayType, **kw):
        DirectFrame.__init__(self, parent)
        self.renown = 0
        self.spendableRenown = 0
        self.renownTarget = 0
        self.renownBase = 0
        self.rank = 0
        self.rankIcon = None
        self.xShift = 0
        self.yShift = 0
        self.titleId = 0
        self.rankBox = None
        self.renownBox = None
        self.renownFrame = None
        self.renownMeter = None
        self.renownMeterText = None
        self.dummyFrame = None
        self.rankIcons = None
        self.iconsModel = None
        self.titleFrame = None
        self.renownSpendable = None
        self.displayType = displayType
        if self.displayType == SHIP_RENOWN_DISPLAY:
            self.titleMap = PLocalizer.PVPTitleSeaRanks
            self.renownName = PLocalizer.PVPInfamySea
            self.breakPoints = TitleGlobals.getBreakpoints(TitleGlobals.ShipPVPTitle)
            self.maxRank = TitleGlobals.getMaxRank(TitleGlobals.ShipPVPTitle)
            self.rankIcons = TitleGlobals.getIconList(TitleGlobals.ShipPVPTitle)
            self.iconsModel = loader.loadModel(TitleGlobals.getModelPath(TitleGlobals.ShipPVPTitle))
            self.iconImageScale = (0.12, 1, 0.12)
            self.titleId = TitleGlobals.ShipPVPTitle
        elif self.displayType == LAND_RENOWN_DISPLAY:
            self.titleMap = PLocalizer.PVPTitleLandRanks
            self.renownName = PLocalizer.PVPInfamyLand
            self.breakPoints = TitleGlobals.getBreakpoints(TitleGlobals.LandPVPTitle)
            self.maxRank = TitleGlobals.getMaxRank(TitleGlobals.LandPVPTitle)
            self.rankIcons = TitleGlobals.getIconList(TitleGlobals.LandPVPTitle)
            self.iconsModel = loader.loadModel(TitleGlobals.getModelPath(TitleGlobals.LandPVPTitle))
            self.iconImageScale = (0.12, 1, 0.12)
            self.titleId = TitleGlobals.LandPVPTitle
        else:
            self.titleMap = {
                0: 'Unknown' }
            self.renownName = '?'
            self.breakPoints = [
                0]
            self.maxRank = 0
            self.rankIcons = {
                0: 'sail_come_about' }
        if not self.iconsModel:
            self.iconsModel = loader.loadModel('models/textureCards/skillIcons')
            self.iconImageScale = (0.12, 1, 0.12)

        self.loadRank()
        self.loadRankIcon()
        self.loadGUI()
        self.setRenown(self.renown)
        self.accept('LocalAvatarInfamyUpdated', self.updateRank)
 def refresh(self):
     inv = localAvatar.getInventory()
     origRank = self.rank
     if inv:
         invType = TitleGlobals.getInventoryType(self.titleId)
         if self.titleId == TitleGlobals.ShipPVPTitle:
             self.expPoints = localAvatar.getInventory().getStackQuantity(InventoryType.PVPTotalInfamySea)
         elif self.titleId == TitleGlobals.LandPVPTitle:
             self.expPoints = localAvatar.getInventory().getStackQuantity(InventoryType.PVPTotalInfamyLand)
         elif invType:
             self.expPoints = inv.getStackQuantity(invType)
         else:
             self.expPoints = 0
             if self.titleId == TitleGlobals.FounderTitle and localAvatar.getFounder():
                 self.expPoints = 1
             
         self.rank = TitleGlobals.getRank(self.titleId, self.expPoints)
         self.maxRank = TitleGlobals.getMaxRank(self.titleId)
         self.expTarget = TitleGlobals.getBreakpoints(self.titleId)[min(self.rank + 1, self.maxRank)]
         self.expBase = TitleGlobals.getBreakpoints(self.titleId)[self.rank]
     
     if self.titleNameFrame:
         self.titleNameFrame['text'] = TitleGlobals.getTitleRankName(self.titleId, self.expPoints)
     
     if self.expMeter:
         value = 0
         if self.rank < self.maxRank and self.expTarget - self.expBase > 0:
             value = int((self.expPoints - self.expBase) * 100 / (self.expTarget - self.expBase))
         
         self.expMeter['value'] = value
     
     if self.expMeterText:
         if self.rank >= self.maxRank:
             self.expBase = 0
             self.expTarget = 0
         
         text = '0 / 0'
         if self.rank < self.maxRank and self.expTarget - self.expBase > 0:
             text = '%s / %s' % (self.expPoints - self.expBase, self.expTarget - self.expBase)
         
         self.expMeterText['text'] = text
     
     if self.iconFrame:
         icName = TitleGlobals.getIconName(self.titleId, self.rank)
         if icName:
             img = self.iconModel.find('**/' + icName)
         else:
             img = None
         self.iconFrame['image'] = img
         imgScale = TitleGlobals.getScale(self.titleId)
         self.iconFrame['image_scale'] = (0.065000000000000002 * imgScale, 1, 0.065000000000000002 * imgScale)
     
     titleOnOff = [
         PLocalizer.TitleOff,
         PLocalizer.TitleOn]
     if self.rank != origRank:
         if self.landActive:
             self.titlesPage.setLandActive(self.panelIndex, self.landActive)
         
         if self.seaActive:
             self.titlesPage.setSeaActive(self.panelIndex, self.seaActive)
         
     
     if self.rank == 0 or not Freebooter.getPaidStatus(localAvatar.doId):
         self.landButton.hide()
         self.seaButton.hide()
     else:
         self.landButton.show()
         self.seaButton.show()
    def refresh(self):
        inv = localAvatar.getInventory()
        origRank = self.rank
        if inv:
            invType = TitleGlobals.getInventoryType(self.titleId)
            if self.titleId == TitleGlobals.ShipPVPTitle:
                self.expPoints = localAvatar.getInventory().getStackQuantity(
                    InventoryType.PVPTotalInfamySea)
            elif self.titleId == TitleGlobals.LandPVPTitle:
                self.expPoints = localAvatar.getInventory().getStackQuantity(
                    InventoryType.PVPTotalInfamyLand)
            elif invType:
                self.expPoints = inv.getStackQuantity(invType)
            else:
                self.expPoints = 0
                if self.titleId == TitleGlobals.FounderTitle and localAvatar.getFounder(
                ):
                    self.expPoints = 1

            self.rank = TitleGlobals.getRank(self.titleId, self.expPoints)
            self.maxRank = TitleGlobals.getMaxRank(self.titleId)
            self.expTarget = TitleGlobals.getBreakpoints(self.titleId)[min(
                self.rank + 1, self.maxRank)]
            self.expBase = TitleGlobals.getBreakpoints(self.titleId)[self.rank]

        if self.titleNameFrame:
            self.titleNameFrame['text'] = TitleGlobals.getTitleRankName(
                self.titleId, self.expPoints)

        if self.expMeter:
            value = 0
            if self.rank < self.maxRank and self.expTarget - self.expBase > 0:
                value = int((self.expPoints - self.expBase) * 100 /
                            (self.expTarget - self.expBase))

            self.expMeter['value'] = value

        if self.expMeterText:
            if self.rank >= self.maxRank:
                self.expBase = 0
                self.expTarget = 0

            text = '0 / 0'
            if self.rank < self.maxRank and self.expTarget - self.expBase > 0:
                text = '%s / %s' % (self.expPoints - self.expBase,
                                    self.expTarget - self.expBase)

            self.expMeterText['text'] = text

        if self.iconFrame:
            icName = TitleGlobals.getIconName(self.titleId, self.rank)
            if icName:
                img = self.iconModel.find('**/' + icName)
            else:
                img = None
            self.iconFrame['image'] = img
            imgScale = TitleGlobals.getScale(self.titleId)
            self.iconFrame['image_scale'] = (0.065000000000000002 * imgScale,
                                             1,
                                             0.065000000000000002 * imgScale)

        titleOnOff = [PLocalizer.TitleOff, PLocalizer.TitleOn]
        if self.rank != origRank:
            if self.landActive:
                self.titlesPage.setLandActive(self.panelIndex, self.landActive)

            if self.seaActive:
                self.titlesPage.setSeaActive(self.panelIndex, self.seaActive)

        if self.rank == 0 or not Freebooter.getPaidStatus(localAvatar.doId):
            self.landButton.hide()
            self.seaButton.hide()
        else:
            self.landButton.show()
            self.seaButton.show()