Ejemplo n.º 1
0
class OptionItemGui(DirectFrame):
    Width = PiratesGuiGlobals.OptionItemWidth
    Height = PiratesGuiGlobals.OptionItemHeight
    TOPLEVEL_GUI_FILE = 'models/gui/toplevel_gui'
    CHAR_GUI_FILE = 'models/gui/char_gui'

    def __init__(self,
                 item,
                 parent=None,
                 textScale=None,
                 itemHeight=None,
                 frameColor=(0.1, 0.1, 1, 0.08),
                 titleWrapLen=None,
                 **kw):
        if itemHeight == None:
            itemHeight = OptionItemGui.Height
        optiondefs = (('state', DGG.NORMAL, None), ('frameColor', frameColor,
                                                    None),
                      ('borderWidth', PiratesGuiGlobals.BorderWidth,
                       None), ('frameSize', (0.0, OptionItemGui.Width, 0.0,
                                             itemHeight), None))
        self.defineoptions(kw, optiondefs)
        DirectFrame.__init__(self, parent)
        self.initialiseoptions(OptionItemGui)
        self.textScale = 0.04
        if textScale:
            self.textScale = textScale
        self.item = item
        self.value = ''
        self.optionUI = None
        self.selectedItem = None
        self.borderFrame = None
        self.optionType = None
        self.titleWrapLen = titleWrapLen
        return

    def setup(self):
        self.optionType = self.item['ValueType']
        self._createIface()

    def destroy(self):
        self._destroyIface()
        DirectFrame.destroy(self)
        self.ignoreAll()

    def _createIface(self):
        self._createLabel()
        self._createOptionEntry()

    def _createLabel(self):
        if self.optionType == PiratesGuiGlobals.UIItemType_Choice:
            self.titleWrapLen = None
        textFg = PiratesGuiGlobals.TextFG1
        self.descText = DirectLabel(parent=self,
                                    relief=None,
                                    text=self.item['Text'] + ':',
                                    text_align=TextNode.ALeft,
                                    text_scale=self.textScale,
                                    text_fg=textFg,
                                    text_shadow=PiratesGuiGlobals.TextShadow,
                                    text_wordwrap=self.titleWrapLen,
                                    textMayChange=1,
                                    pos=(0, 0, self.getHeight() / 2))
        return

    def _createOptionEntry(self):
        if self.optionType == PiratesGuiGlobals.UIItemType_Label:
            self.optionUI = DirectLabel(
                parent=self,
                relief=None,
                text=str(self.item['Value']),
                text_align=TextNode.ALeft,
                text_scale=self.textScale,
                text_shadow=PiratesGuiGlobals.TextShadow,
                textMayChange=1,
                pos=(0.3, 0, self.getHeight() / 2))
        elif self.optionType == PiratesGuiGlobals.UIItemType_Choice:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            check_on = lookoutUI.find('**/lookout_submit')
            check_off = lookoutUI.find('**/lookout_submit_disabled')
            if self.value == '':
                self.value = 0
            self.optionItems = DirectCheckButton(parent=self,
                                                 scale=0.05,
                                                 indicatorValue=self.value,
                                                 boxImageScale=4,
                                                 command=self.itemChecked,
                                                 pos=(0.78, 0,
                                                      self.getHeight() / 2))
        elif self.optionType == PiratesGuiGlobals.UIItemType_ListItem:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            charUI = loader.loadModel(self.CHAR_GUI_FILE)
            charGui_slider = charUI.find('**/chargui_slider_large')
            charGui_slider_thumb = charUI.find('**/chargui_slider_node')
            self.optionItems = ListFrame(0.4,
                                         None,
                                         'blah',
                                         self,
                                         frameColor=(0, 0, 0, 0))
            self.optionItems.itemBuffer = 0.008
            self.optionItems.setup()
            self.optionUI = DirectScrolledFrame(
                parent=self,
                frameSize=(0, 0.45, 0, 0.3),
                relief=DGG.GROOVE,
                state=DGG.NORMAL,
                frameColor=(0, 0, 0, 0),
                borderWidth=PiratesGuiGlobals.BorderWidth,
                canvasSize=(0, 0.38, 0, self.optionItems['frameSize'][3]),
                verticalScroll_frameColor=(0, 0, 0, 0),
                verticalScroll_thumb_frameColor=(0, 0, 0, 0),
                verticalScroll_incButton_frameColor=(0, 0, 0, 0),
                verticalScroll_decButton_frameColor=(0, 0, 0, 0),
                verticalScroll_image=charGui_slider,
                verticalScroll_image_scale=(0.12, 1, 0.28),
                verticalScroll_image_pos=(0.4195, 0, 0.15),
                verticalScroll_image_hpr=(0, 0, 90),
                verticalScroll_frameSize=(0, PiratesGuiGlobals.ScrollbarSize,
                                          0, OptionItemGui.Height * 3),
                verticalScroll_thumb_image=charGui_slider_thumb,
                verticalScroll_thumb_image_scale=(0.35, 0.35, 0.35),
                sortOrder=5,
                pos=(0.3, 0, self.getHeight() / 2 - 0.15))
            self.optionUI.guiItem.getVerticalSlider().clearLeftButton()
            self.optionUI.guiItem.getVerticalSlider().clearRightButton()
            self.optionUI.guiItem.getVerticalSlider().setRange(-1, 1)
            self.optionUI.guiItem.getHorizontalSlider().clearLeftButton()
            self.optionUI.guiItem.getHorizontalSlider().clearRightButton()
            self.optionUI.guiItem.getHorizontalSlider().setRange(-1, 1)
            self.createFrame()
            self.optionItems.reparentTo(self.optionUI.getCanvas())
        return

    def getItemChangeMsg(self):
        return self.taskName('gameTypeChanged')

    def getItemList(self):
        itemList = []
        for currValue in self.item['Values']:
            itemList.append({
                'Type': 'Literal',
                'Text': str(currValue),
                'Value': currValue
            })

        return itemList

    def createNewItem(self,
                      item,
                      parent,
                      itemType=None,
                      columnWidths=[],
                      color=None):
        newItem = ButtonListItem(item,
                                 0.08,
                                 0.38,
                                 parent,
                                 parentList=self,
                                 txtColor=color,
                                 pressEffect=False,
                                 image=GuiButton.GuiButton.genericButton,
                                 frameColor=(0, 0, 0, 0),
                                 textScale=0.05)
        newItem.setup()
        return newItem

    def _destroyIface(self):
        self.removeFrame()
        self.descText.destroy()
        del self.descText
        if self.optionUI:
            self.optionUI.destroy()
            del self.optionUI

    def _handleItemChange(self):
        self._destroyIface()
        self._createIface()

    def itemSelect(self, item):
        for currItem in self.optionItems.items:
            currItem.setSelected(False)

        item.setSelected(True)
        self.selectedItem = item

    def itemChecked(self, status):
        self.value = status

    def getOptionValuePair(self):
        option = self.item['Option']
        value = self.value
        if self.selectedItem:
            value = self.selectedItem.value
        return [str(option), str(value)]

    def createFrame(self):
        self.removeFrame()
        self.borderFrame = BorderFrame(parent=self,
                                       pos=(0.5, 0, 0.15),
                                       scale=(0.57, 1, 0.33))
        self.borderFrame.setBackgroundVisible(False)

    def removeFrame(self):
        if self.borderFrame:
            self.borderFrame.removeNode()
            self.borderFrame = None
        return
Ejemplo n.º 2
0
class LookoutListItem(ButtonListItem.ButtonListItem):
    def __init__(self,
                 itemInfo,
                 imageTexCardName,
                 itemHeight,
                 itemWidth,
                 parent=None,
                 parentList=None,
                 textScale=None,
                 txtColor=None,
                 wantFrame=False,
                 **kw):
        ButtonListItem.ButtonListItem.__init__(self, itemInfo, itemHeight,
                                               itemWidth, parent, parentList,
                                               textScale, txtColor, **None)
        self.initialiseoptions(LookoutListItem)
        lookoutUI = loader.loadModel(imageTexCardName)
        iconImage = itemInfo.get('Icon')
        self.imageRef = None
        if iconImage:
            self.imageRef = lookoutUI.find('**/' + iconImage)

        self.descText = itemInfo.get('Desc')
        self.title = None
        self.desc = None
        self.icon = None
        self.activityListBorderFrame = None
        self.wantFrame = wantFrame
        self.bind(DGG.ENTER, self.mouseEnter)
        self.bind(DGG.EXIT, self.mouseLeave)

    def _createIface(self):
        xOff = 0.02
        wordwrap = 20
        yOff = 0.065000000000000002
        if self.imageRef:
            self.icon = OnscreenImage(image=self.imageRef,
                                      pos=(0.10000000000000001, 0,
                                           0.082000000000000003),
                                      scale=(0.59999999999999998,
                                             0.59999999999999998,
                                             0.59999999999999998),
                                      parent=self)
            xOff = 0.20000000000000001
            wordwrap = 15

        if self.descText:
            self.desc = DirectLabel(parent=self,
                                    state=DGG.DISABLED,
                                    relief=None,
                                    text=self.descText,
                                    text_align=TextNode.ALeft,
                                    text_scale=0.029999999999999999,
                                    text_fg=PiratesGuiGlobals.TextFG1,
                                    text_shadow=PiratesGuiGlobals.TextShadow,
                                    text_wordwrap=wordwrap,
                                    textMayChange=1,
                                    pos=(xOff + 0.01, 0, 0.055))
            yOff = 0.095000000000000001

        self.title = DirectLabel(parent=self,
                                 state=DGG.DISABLED,
                                 relief=None,
                                 text=self.item,
                                 text_align=TextNode.ALeft,
                                 text_scale=0.070000000000000007,
                                 text_fg=PiratesGuiGlobals.TextFG1,
                                 text_shadow=PiratesGuiGlobals.TextShadow,
                                 textMayChange=1,
                                 pos=(xOff, 0, yOff))
        if self.wantFrame:
            self.createListFrame()

    def _destroyIface(self):
        if self.icon:
            self.icon.removeNode()
            self.icon = None

        if self.title:
            self.title.removeNode()
            self.title = None

        if self.desc:
            self.desc.removeNode()
            self.desc = None

    def _handleItemChange(self):
        self._destroyIface()
        self._createIface()

    def setSelected(self, selected):
        self.selected = selected
        return None
        if selected:
            print 'selected'
            self.createListFrame()
        else:
            self.clearListFrame()

    def createListFrame(self):
        self.clearListFrame()
        self.activityListBorderFrame = BorderFrame(
            parent=self,
            pos=(0.375, 0, 0.082000000000000003),
            scale=(0.75, 1, 0.16500000000000001),
            borderScale=0.20000000000000001)
        self.activityListBorderFrame.setBackgroundVisible(False)
        self.activityListBorderFrame.setColorScale(0.40000000000000002,
                                                   0.40000000000000002,
                                                   0.40000000000000002, 1)

    def clearListFrame(self):
        if self.activityListBorderFrame:
            self.activityListBorderFrame.removeNode()
            self.activityListBorderFrame = None

    def mouseEnter(self, event):
        if self.wantFrame == False:
            self.createListFrame()

        if self.activityListBorderFrame:
            self.activityListBorderFrame.setColorScale(1, 1, 1, 1)
            self.activityListBorderFrame['borderScale'] = 0.25

    def mouseLeave(self, event):
        if self.wantFrame and self.activityListBorderFrame:
            self.activityListBorderFrame.setColorScale(0.40000000000000002,
                                                       0.40000000000000002,
                                                       0.40000000000000002, 1)
            self.activityListBorderFrame['borderScale'] = 0.20000000000000001
        else:
            self.clearListFrame()
Ejemplo n.º 3
0
class LookoutRequestLVL2(DirectFrame, InventoryRequestGameType):
    def __init__(self, name, titleTextScale=None, itemList=None, parentPanel=None):
        self.width = PiratesGuiGlobals.LookoutRequestLVL2Width
        self.height = PiratesGuiGlobals.LookoutRequestLVL2Height
        DirectFrame.__init__(
            self,
            relief=None,
            state=DGG.DISABLED,
            frameColor=PiratesGuiGlobals.FrameColor,
            borderWidth=PiratesGuiGlobals.BorderWidth,
            frameSize=(0, self.width, 0, self.height),
        )
        self.initialiseoptions(LookoutRequestLVL2)
        InventoryRequestGameType.__init__(self)
        self.parentPanel = parentPanel
        self.name = name
        if itemList:
            self.itemList = itemList
        else:
            self.notify.warning("no itemList provied, displaying default parlor game types")
            self.itemList = [
                {
                    "Text": GameTypeGlobals.getGameTypeString(PiratesGlobals.GAME_STYLE_BLACKJACK, "style"),
                    "Value": PiratesGlobals.GAME_STYLE_BLACKJACK,
                },
                {
                    "Text": GameTypeGlobals.getGameTypeString(PiratesGlobals.GAME_STYLE_POKER, "style"),
                    "Value": PiratesGlobals.GAME_STYLE_POKER,
                },
            ]
        self.activityListItems = ListFrame(0.80000000000000004, None, "blah", self, frameColor=(0, 0, 0, 0))
        self.activityListItems.setup()
        if self.parentPanel.UI_VERSION == 0:
            size = (0, 0.81999999999999995, 0, 0.45000000000000001)
            pos = (0.14999999999999999, 0, 0.55000000000000004)
        else:
            size = (0, 0.81999999999999995, 0, 0.75)
            pos = (0.14999999999999999, 0, 0.20000000000000001)
        self.activityList = DirectScrolledFrame(
            parent=self,
            frameSize=size,
            relief=DGG.GROOVE,
            state=DGG.NORMAL,
            frameColor=(0, 0, 0, 0),
            borderWidth=PiratesGuiGlobals.BorderWidth,
            canvasSize=(0, 0.69999999999999996, 0, self.activityListItems["frameSize"][3]),
            verticalScroll_frameColor=PiratesGuiGlobals.ScrollbarColor,
            verticalScroll_borderWidth=(0.0074999999999999997, 0.0074999999999999997),
            verticalScroll_frameSize=(0, PiratesGuiGlobals.ScrollbarSize, 0, self.height),
            verticalScroll_thumb_frameColor=PiratesGuiGlobals.ButtonColor2,
            verticalScroll_incButton_frameColor=PiratesGuiGlobals.ButtonColor2,
            verticalScroll_decButton_frameColor=PiratesGuiGlobals.ButtonColor2,
            sortOrder=5,
            pos=pos,
        )
        if self.parentPanel.UI_VERSION == 0:
            self.createListFrame(self.activityList)

        self.activityListItems.reparentTo(self.activityList.getCanvas())
        self.selectedItem = None
        self.optionsPanel = None
        self.optionsButton = None
        self.rankingDisplay = DirectLabel(
            parent=self.getParent(),
            relief=None,
            text="Ranking",
            text_align=TextNode.ALeft,
            text_scale=0.050000000000000003,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1,
            pos=(0.28999999999999998, 0, -0.55000000000000004),
        )
        self.rankingDisplay.hide()
        self.setParentPanel(parentPanel)
        self.storedOptions = {}
        self.customOptions = {}

    def createListFrame(self, list, lookoutUI=None):
        self.activityListBorderFrame = BorderFrame(
            parent=list, pos=(0.40000000000000002, 0, 0.25), scale=(0.80000000000000004, 1, 0.45000000000000001)
        )
        self.activityListBorderFrame.setBackgroundVisible(False)

    def createOptionsButton(self, lookoutUI=None, parentInfo=None):
        if lookoutUI == None:
            lookoutUI = loader.loadModel("models/gui/lookout_gui")

        if parentInfo == None:
            parent = self.parentPanel
            buttonPos = (0.42999999999999999, 0, 0.14999999999999999)
            buttonScale = 0.29999999999999999
        else:
            parent = parentInfo.get("parent")
            buttonPos = parentInfo.get("pos", (0.42999999999999999, 0, 0.14999999999999999))
            buttonScale = parentInfo.get("scale", 0.29999999999999999)
        (optionsButton, optionsButtonText) = self.parentPanel.createButtonAndText(
            imageInfo={
                "parent": parent,
                "textureCard": lookoutUI,
                "imageName": "lookout_option",
                "buttonPos": buttonPos,
                "buttonScale": buttonScale,
                "clickCommand": lambda param=parent: self.optionsClick(param),
            },
            textInfo=PLocalizer.Options,
        )
        if parentInfo == None:
            buttonParent = self
        else:
            buttonParent = parent
        buttonParent.optionsButton = optionsButton
        buttonParent.optionsButtonText = optionsButtonText
        if self.parentPanel.submitButton:
            self.parentPanel.submitButton["state"] = DGG.DISABLED

    def setParentPanel(self, parentPanel):
        self.parentPanel = parentPanel

    def hide(self):
        self.activityList.hide()
        if self.optionsButton:
            self.optionsButton.hide()

        if self.rankingDisplay:
            self.rankingDisplay.hide()

    def show(self):
        self.activityList.show()

        def gotOptions(itemList):
            if itemList and len(itemList) > 0 and self.optionsButton:
                self.optionsButton.hide()

        itemList = self.determineLvl3ItemList(self.selectedItem, gotOptions)

    def destroy(self):
        self.selectedItem = None
        self.parentPanel = None
        if self.activityList:
            self.activityList.destroy()
            self.activityList = None

        if self.activityListItems:
            self.activityListItems.destroy()
            self.activityListItems = None

        if self.optionsButton:
            self.optionsButton.destroy()
            self.optionsButton = None

        if self.optionsPanel:
            self.optionsPanel.destroy()
            self.optionsPanel = None

        if self.rankingDisplay:
            self.rankingDisplay.destroy()

        DirectFrame.destroy(self)
        self.cancelAllInventoryRequests()

    def getItemChangeMsg(self):
        return self.taskName("gameTypeChanged")

    def getItemList(self):
        return self.itemList

    def createNewItem(self, item, parent, itemType=None, columnWidths=[], color=None):
        if self.parentPanel.UI_VERSION == 0:
            newItem = ButtonListItem(
                item,
                0.080000000000000002,
                0.75,
                parent,
                parentList=self,
                txtColor=color,
                pressEffect=False,
                frameColor=(0, 0, 0, 0),
            )
        else:
            newItem = LookoutListItem(
                item,
                self.parentPanel.TOPLEVEL_GUI_FILE,
                0.16,
                0.75,
                parent,
                parentList=self,
                txtColor=color,
                pressEffect=False,
                frameColor=(0, 0, 0, 0),
                wantFrame=True,
            )
            if self.parentPanel.invited == None:

                def gotOptions(itemList):
                    if itemList and len(itemList) > 0:
                        parentInfo = {
                            "parent": newItem,
                            "pos": (0.67500000000000004, 0, 0.105),
                            "scale": 0.17999999999999999,
                        }
                        self.createOptionsButton(parentInfo=parentInfo)

                self.determineLvl3ItemList(newItem, gotOptions)

        newItem.setup()
        if item["Value"] == PiratesGlobals.CREW_STYLE_FIND_A_CREW:
            if (
                localAvatar.guiMgr.crewHUD.crew
                and localAvatar.guiMgr.crewHUD.startACrewState
                or localAvatar.guiMgr.crewHUD.joinACrewStatusPVP
            ):
                newItem["state"] = DGG.DISABLED
                newItem.title["text_fg"] = PiratesGuiGlobals.TextFG9
                newItem.desc["text_fg"] = PiratesGuiGlobals.TextFG9

        if item["Value"] == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS:
            if (
                not (localAvatar.guiMgr.crewHUD.crew)
                or DistributedBandMember.DistributedBandMember.IsLocalAvatarHeadOfBand() == 0
            ):
                newItem["state"] = DGG.DISABLED
                newItem.title["text_fg"] = PiratesGuiGlobals.TextFG9
                newItem.desc["text_fg"] = PiratesGuiGlobals.TextFG9

            if localAvatar.guiMgr.crewHUD.startACrewState:
                newItem["state"] = DGG.NORMAL
                newItem.title["text_fg"] = PiratesGuiGlobals.TextFG1
                newItem.desc["text_fg"] = PiratesGuiGlobals.TextFG1

        if item["Value"] == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            if (
                localAvatar.guiMgr.crewHUD.crew
                and localAvatar.guiMgr.crewHUD.startACrewState
                or localAvatar.guiMgr.crewHUD.joinACrewStatus
            ):
                newItem["state"] = DGG.DISABLED
                newItem.title["text_fg"] = PiratesGuiGlobals.TextFG9
                newItem.desc["text_fg"] = PiratesGuiGlobals.TextFG9

        if item["Value"] == PiratesGlobals.GAME_STYLE_TM_BLACK_PEARL:
            newItem.title["text_scale"] = PiratesGuiGlobals.TextScaleTitleSmall

        return newItem

    def determineLvl3ItemList(self, item, callback=None):
        availItems = []
        if item == None:
            return availItems

        gameType = self.parentPanel.getSelectedValue()

        def optionsReceived(options):
            if options:
                optionKeys = options.keys()
                for currOption in optionKeys:
                    if options[currOption][0] == PiratesGuiGlobals.UIItemType_Hidden or options.get("execute"):
                        continue

                    availItems.append(
                        {
                            "Text": GameTypeGlobals.getGameTypeString(currOption, "option"),
                            "Option": currOption,
                            "Values": options[currOption][1],
                            "Value": options[currOption][1][0],
                            "ValueType": options[currOption][0],
                        }
                    )

            if callback:
                callback(availItems)

        self.getGameOptions(gameType, item.value, optionsReceived)
        return availItems

    def itemSelect(self, item):
        if (
            item.value == PiratesGlobals.CREW_STYLE_FIND_A_CREW
            and item.value == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS
            or item.value == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW
        ):
            self.toggleAICrewLookout(item.value)
            return None

        for currItem in self.activityListItems.items:
            currItem.setSelected(False)

        item.setSelected(True)
        self.selectedItem = item
        categoryName = GameTypeGlobals.getGameTypeString(self.selectedItem.value, "style")
        invCat = GameTypeGlobals.getGameTypeRanking(self.selectedItem.value)
        inv = base.localAvatar.getInventory()
        if inv:
            playerRank = inv.getStackQuantity(invCat)
            self.rankingDisplay["text"] = "%s : %d" % (categoryName, playerRank)
            self.rankingDisplay.show()

        if self.parentPanel.submitButton == None:
            self.parentPanel.submitRequest()

    def optionsClick(self, selectedItem):
        if self.optionsPanel:
            self.optionsPanel.destroy()
            self.optionsPanel = None

        def gotOptions(itemList):
            if itemList and len(itemList) > 0:
                self.optionsPanel = LookoutRequestLVL3(
                    PLocalizer.LookoutOptionsTitle,
                    titleTextScale=0.050000000000000003,
                    itemList=itemList,
                    optionsFor=selectedItem.value,
                )
                self.optionsPanel.reparentTo(self.parentPanel)
                self.optionsPanel.setPos(0, 0, 0)
                self.optionsPanel.setParentPanel(self)
                gameTypeStr = GameTypeGlobals.getGameTypeString(selectedItem.value, "style")
                self.optionsPanel.show(gameTypeStr, selectedItem)
                if self.optionsButton:
                    self.optionsButton.hide()

                self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_OPT_MODE)

        self.determineLvl3ItemList(selectedItem, gotOptions)

    def optionsClose(self):
        self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_TYPE_MODE)
        if self.parentPanel.deleteWhenClosed:
            self.optionsPanel.destroy()
            self.optionsPanel.removeNode()
            self.optionsPanel = None
        else:
            self.optionsPanel.hide()
        self.rankingDisplay.hide()
        if self.optionsButton:
            self.optionsButton.show()

    def itemSelectByValue(self, itemValue=None):
        itemToSelect = None
        if itemValue == None:
            if len(self.activityListItems.items) > 0:
                itemToSelect = self.activityListItems.items[0]

        else:
            for currItem in self.activityListItems.items:
                print "checking item with value %s" % currItem.value
                if currItem.value == itemValue:
                    itemToSelect = currItem
                    break
                    continue

        if itemToSelect:
            self.itemSelect(itemToSelect)

    def addCustomOptions(self, gameType, optionPairs):
        currOptions = self.customOptions.get(gameType)
        if currOptions == None:
            self.customOptions[gameType] = optionPairs
            return None

        for currOptionPair in optionPairs:
            for currOption in currOptions:
                if currOption[0] == currOptionPair[0]:
                    currOption[1] = currOptionPair[1]
                    continue
                    continue

            currOptions.append(currOptionPair)

    def getCustomOptions(self, gameType, clear=False):
        options = self.customOptions.get(gameType, [])
        if clear and len(options) > 0:
            del self.customOptions[gameType]

        return options

    def getAllGameOptions(self, gameType, clear=False):
        if self.optionsPanel:
            options = self.optionsPanel.getGameOptions(gameType, clear)
        else:
            options = []
        customOptions = self.getCustomOptions(gameType, clear)
        return options + customOptions

    def toggleAICrewLookout(self, itemType):
        if itemType == PiratesGlobals.CREW_STYLE_FIND_A_CREW:
            localAvatar.guiMgr.crewHUD.toggleAvatarLookout()

        if itemType == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS:
            localAvatar.guiMgr.crewHUD.toggleCrewLookout()

        if itemType == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            localAvatar.guiMgr.crewHUD.toggleAvatarLookoutPVP()

        localAvatar.guiMgr.lookoutPage.close()
class OptionItemGui(DirectFrame):
    Width = PiratesGuiGlobals.OptionItemWidth
    Height = PiratesGuiGlobals.OptionItemHeight
    TOPLEVEL_GUI_FILE = 'models/gui/toplevel_gui'
    CHAR_GUI_FILE = 'models/gui/char_gui'
    
    def __init__(self, item, parent = None, textScale = None, itemHeight = None, frameColor = (0.10000000000000001, 0.10000000000000001, 1, 0.080000000000000002), titleWrapLen = None, **kw):
        if itemHeight == None:
            itemHeight = OptionItemGui.Height
        
        optiondefs = (('state', DGG.NORMAL, None), ('frameColor', frameColor, None), ('borderWidth', PiratesGuiGlobals.BorderWidth, None), ('frameSize', (0.0, OptionItemGui.Width, 0.0, itemHeight), None))
        self.defineoptions(kw, optiondefs)
        DirectFrame.__init__(self, parent)
        self.initialiseoptions(OptionItemGui)
        self.textScale = 0.040000000000000001
        if textScale:
            self.textScale = textScale
        
        self.item = item
        self.value = ''
        self.optionUI = None
        self.selectedItem = None
        self.borderFrame = None
        self.optionType = None
        self.titleWrapLen = titleWrapLen

    
    def setup(self):
        self.optionType = self.item['ValueType']
        self._createIface()

    
    def destroy(self):
        self._destroyIface()
        DirectFrame.destroy(self)
        self.ignoreAll()

    
    def _createIface(self):
        self._createLabel()
        self._createOptionEntry()

    
    def _createLabel(self):
        if self.optionType == PiratesGuiGlobals.UIItemType_Choice:
            self.titleWrapLen = None
        
        textFg = PiratesGuiGlobals.TextFG1
        self.descText = DirectLabel(parent = self, relief = None, text = self.item['Text'] + ':', text_align = TextNode.ALeft, text_scale = self.textScale, text_fg = textFg, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = self.titleWrapLen, textMayChange = 1, pos = (0, 0, self.getHeight() / 2))

    
    def _createOptionEntry(self):
        if self.optionType == PiratesGuiGlobals.UIItemType_Label:
            self.optionUI = DirectLabel(parent = self, relief = None, text = str(self.item['Value']), text_align = TextNode.ALeft, text_scale = self.textScale, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.29999999999999999, 0, self.getHeight() / 2))
        elif self.optionType == PiratesGuiGlobals.UIItemType_Choice:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            check_on = lookoutUI.find('**/lookout_submit')
            check_off = lookoutUI.find('**/lookout_submit_disabled')
            if self.value == '':
                self.value = 0
            
            self.optionItems = DirectCheckButton(parent = self, scale = 0.050000000000000003, indicatorValue = self.value, boxImageScale = 4, command = self.itemChecked, pos = (0.78000000000000003, 0, self.getHeight() / 2))
        elif self.optionType == PiratesGuiGlobals.UIItemType_ListItem:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
            charUI = loader.loadModel(self.CHAR_GUI_FILE)
            charGui_slider = charUI.find('**/chargui_slider_large')
            charGui_slider_thumb = charUI.find('**/chargui_slider_node')
            self.optionItems = ListFrame(0.40000000000000002, None, 'blah', self, frameColor = (0, 0, 0, 0))
            self.optionItems.itemBuffer = 0.0080000000000000002
            self.optionItems.setup()
            self.optionUI = DirectScrolledFrame(parent = self, frameSize = (0, 0.45000000000000001, 0, 0.29999999999999999), relief = DGG.GROOVE, state = DGG.NORMAL, frameColor = (0, 0, 0, 0), borderWidth = PiratesGuiGlobals.BorderWidth, canvasSize = (0, 0.38, 0, self.optionItems['frameSize'][3]), verticalScroll_frameColor = (0, 0, 0, 0), verticalScroll_thumb_frameColor = (0, 0, 0, 0), verticalScroll_incButton_frameColor = (0, 0, 0, 0), verticalScroll_decButton_frameColor = (0, 0, 0, 0), verticalScroll_image = charGui_slider, verticalScroll_image_scale = (0.12, 1, 0.28000000000000003), verticalScroll_image_pos = (0.41949999999999998, 0, 0.14999999999999999), verticalScroll_image_hpr = (0, 0, 90), verticalScroll_frameSize = (0, PiratesGuiGlobals.ScrollbarSize, 0, OptionItemGui.Height * 3), verticalScroll_thumb_image = charGui_slider_thumb, verticalScroll_thumb_image_scale = (0.34999999999999998, 0.34999999999999998, 0.34999999999999998), sortOrder = 5, pos = (0.29999999999999999, 0, self.getHeight() / 2 - 0.14999999999999999))
            self.optionUI.guiItem.getVerticalSlider().clearLeftButton()
            self.optionUI.guiItem.getVerticalSlider().clearRightButton()
            self.optionUI.guiItem.getVerticalSlider().setRange(-1, 1)
            self.optionUI.guiItem.getHorizontalSlider().clearLeftButton()
            self.optionUI.guiItem.getHorizontalSlider().clearRightButton()
            self.optionUI.guiItem.getHorizontalSlider().setRange(-1, 1)
            self.createFrame()
            self.optionItems.reparentTo(self.optionUI.getCanvas())
        

    
    def getItemChangeMsg(self):
        return self.taskName('gameTypeChanged')

    
    def getItemList(self):
        itemList = []
        for currValue in self.item['Values']:
            itemList.append({
                'Type': 'Literal',
                'Text': str(currValue),
                'Value': currValue })
        
        return itemList

    
    def createNewItem(self, item, parent, itemType = None, columnWidths = [], color = None):
        newItem = ButtonListItem(item, 0.080000000000000002, 0.38, parent, parentList = self, txtColor = color, pressEffect = False, image = GuiButton.GuiButton.genericButton, frameColor = (0, 0, 0, 0), textScale = 0.050000000000000003)
        newItem.setup()
        return newItem

    
    def _destroyIface(self):
        self.removeFrame()
        self.descText.destroy()
        del self.descText
        if self.optionUI:
            self.optionUI.destroy()
            del self.optionUI
        

    
    def _handleItemChange(self):
        self._destroyIface()
        self._createIface()

    
    def itemSelect(self, item):
        for currItem in self.optionItems.items:
            currItem.setSelected(False)
        
        item.setSelected(True)
        self.selectedItem = item

    
    def itemChecked(self, status):
        self.value = status

    
    def getOptionValuePair(self):
        option = self.item['Option']
        value = self.value
        if self.selectedItem:
            value = self.selectedItem.value
        
        return [
            str(option),
            str(value)]

    
    def createFrame(self):
        self.removeFrame()
        self.borderFrame = BorderFrame(parent = self, pos = (0.5, 0, 0.14999999999999999), scale = (0.56999999999999995, 1, 0.33000000000000002))
        self.borderFrame.setBackgroundVisible(False)

    
    def removeFrame(self):
        if self.borderFrame:
            self.borderFrame.removeNode()
            self.borderFrame = None
Ejemplo n.º 5
0
class LookoutRequestLVL2(DirectFrame, InventoryRequestGameType):
    
    def __init__(self, name, titleTextScale = None, itemList = None, parentPanel = None):
        self.width = PiratesGuiGlobals.LookoutRequestLVL2Width
        self.height = PiratesGuiGlobals.LookoutRequestLVL2Height
        DirectFrame.__init__(self, relief = None, state = DGG.DISABLED, frameColor = PiratesGuiGlobals.FrameColor, borderWidth = PiratesGuiGlobals.BorderWidth, frameSize = (0, self.width, 0, self.height))
        self.initialiseoptions(LookoutRequestLVL2)
        InventoryRequestGameType.__init__(self)
        self.parentPanel = parentPanel
        self.name = name
        if itemList:
            self.itemList = itemList
        else:
            self.notify.warning('no itemList provied, displaying default parlor game types')
            self.itemList = [
                {
                    'Text': GameTypeGlobals.getGameTypeString(PiratesGlobals.GAME_STYLE_BLACKJACK, 'style'),
                    'Value': PiratesGlobals.GAME_STYLE_BLACKJACK },
                {
                    'Text': GameTypeGlobals.getGameTypeString(PiratesGlobals.GAME_STYLE_POKER, 'style'),
                    'Value': PiratesGlobals.GAME_STYLE_POKER }]
        self.activityListItems = ListFrame(0.80000000000000004, None, 'blah', self, frameColor = (0, 0, 0, 0))
        self.activityListItems.setup()
        if self.parentPanel.UI_VERSION == 0:
            size = (0, 0.81999999999999995, 0, 0.45000000000000001)
            pos = (0.14999999999999999, 0, 0.55000000000000004)
        else:
            size = (0, 0.81999999999999995, 0, 0.75)
            pos = (0.14999999999999999, 0, 0.20000000000000001)
        self.activityList = DirectScrolledFrame(parent = self, frameSize = size, relief = DGG.GROOVE, state = DGG.NORMAL, frameColor = (0, 0, 0, 0), borderWidth = PiratesGuiGlobals.BorderWidth, canvasSize = (0, 0.69999999999999996, 0, self.activityListItems['frameSize'][3]), verticalScroll_frameColor = PiratesGuiGlobals.ScrollbarColor, verticalScroll_borderWidth = (0.0074999999999999997, 0.0074999999999999997), verticalScroll_frameSize = (0, PiratesGuiGlobals.ScrollbarSize, 0, self.height), verticalScroll_thumb_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_incButton_frameColor = PiratesGuiGlobals.ButtonColor2, verticalScroll_decButton_frameColor = PiratesGuiGlobals.ButtonColor2, sortOrder = 5, pos = pos)
        if self.parentPanel.UI_VERSION == 0:
            self.createListFrame(self.activityList)
        
        self.activityListItems.reparentTo(self.activityList.getCanvas())
        self.selectedItem = None
        self.optionsPanel = None
        self.optionsButton = None
        self.rankingDisplay = DirectLabel(parent = self.getParent(), relief = None, text = 'Ranking', text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.28999999999999998, 0, -0.55000000000000004))
        self.rankingDisplay.hide()
        self.setParentPanel(parentPanel)
        self.storedOptions = { }
        self.customOptions = { }

    
    def createListFrame(self, list, lookoutUI = None):
        self.activityListBorderFrame = BorderFrame(parent = list, pos = (0.40000000000000002, 0, 0.25), scale = (0.80000000000000004, 1, 0.45000000000000001))
        self.activityListBorderFrame.setBackgroundVisible(False)

    
    def createOptionsButton(self, lookoutUI = None, parentInfo = None):
        if lookoutUI == None:
            lookoutUI = loader.loadModel('models/gui/lookout_gui')
        
        if parentInfo == None:
            parent = self.parentPanel
            buttonPos = (0.42999999999999999, 0, 0.14999999999999999)
            buttonScale = 0.29999999999999999
        else:
            parent = parentInfo.get('parent')
            buttonPos = parentInfo.get('pos', (0.42999999999999999, 0, 0.14999999999999999))
            buttonScale = parentInfo.get('scale', 0.29999999999999999)
        (optionsButton, optionsButtonText) = self.parentPanel.createButtonAndText(imageInfo = {
            'parent': parent,
            'textureCard': lookoutUI,
            'imageName': 'lookout_option',
            'buttonPos': buttonPos,
            'buttonScale': buttonScale,
            'clickCommand': lambda param = parent: self.optionsClick(param) }, textInfo = PLocalizer.Options)
        if parentInfo == None:
            buttonParent = self
        else:
            buttonParent = parent
        buttonParent.optionsButton = optionsButton
        buttonParent.optionsButtonText = optionsButtonText
        if self.parentPanel.submitButton:
            self.parentPanel.submitButton['state'] = DGG.DISABLED
        

    
    def setParentPanel(self, parentPanel):
        self.parentPanel = parentPanel

    
    def hide(self):
        self.activityList.hide()
        if self.optionsButton:
            self.optionsButton.hide()
        
        if self.rankingDisplay:
            self.rankingDisplay.hide()
        

    
    def show(self):
        self.activityList.show()
        
        def gotOptions(itemList):
            if itemList and len(itemList) > 0 and self.optionsButton:
                self.optionsButton.hide()
            

        itemList = self.determineLvl3ItemList(self.selectedItem, gotOptions)

    
    def destroy(self):
        self.selectedItem = None
        self.parentPanel = None
        if self.activityList:
            self.activityList.destroy()
            self.activityList = None
        
        if self.activityListItems:
            self.activityListItems.destroy()
            self.activityListItems = None
        
        if self.optionsButton:
            self.optionsButton.destroy()
            self.optionsButton = None
        
        if self.optionsPanel:
            self.optionsPanel.destroy()
            self.optionsPanel = None
        
        if self.rankingDisplay:
            self.rankingDisplay.destroy()
        
        DirectFrame.destroy(self)
        self.cancelAllInventoryRequests()

    
    def getItemChangeMsg(self):
        return self.taskName('gameTypeChanged')

    
    def getItemList(self):
        return self.itemList

    
    def createNewItem(self, item, parent, itemType = None, columnWidths = [], color = None):
        if self.parentPanel.UI_VERSION == 0:
            newItem = ButtonListItem(item, 0.080000000000000002, 0.75, parent, parentList = self, txtColor = color, pressEffect = False, frameColor = (0, 0, 0, 0))
        else:
            newItem = LookoutListItem(item, self.parentPanel.TOPLEVEL_GUI_FILE, 0.16, 0.75, parent, parentList = self, txtColor = color, pressEffect = False, frameColor = (0, 0, 0, 0), wantFrame = True)
            if self.parentPanel.invited == None:
                
                def gotOptions(itemList):
                    if itemList and len(itemList) > 0:
                        parentInfo = {
                            'parent': newItem,
                            'pos': (0.67500000000000004, 0, 0.105),
                            'scale': 0.17999999999999999 }
                        self.createOptionsButton(parentInfo = parentInfo)
                    

                self.determineLvl3ItemList(newItem, gotOptions)
            
        newItem.setup()
        if item['Value'] == PiratesGlobals.CREW_STYLE_FIND_A_CREW:
            if localAvatar.guiMgr.crewHUD.crew and localAvatar.guiMgr.crewHUD.startACrewState or localAvatar.guiMgr.crewHUD.joinACrewStatusPVP:
                newItem['state'] = DGG.DISABLED
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG9
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG9
            
        
        if item['Value'] == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS:
            if not (localAvatar.guiMgr.crewHUD.crew) or DistributedBandMember.DistributedBandMember.IsLocalAvatarHeadOfBand() == 0:
                newItem['state'] = DGG.DISABLED
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG9
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG9
            
            if localAvatar.guiMgr.crewHUD.startACrewState:
                newItem['state'] = DGG.NORMAL
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG1
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG1
            
        
        if item['Value'] == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            if localAvatar.guiMgr.crewHUD.crew and localAvatar.guiMgr.crewHUD.startACrewState or localAvatar.guiMgr.crewHUD.joinACrewStatus:
                newItem['state'] = DGG.DISABLED
                newItem.title['text_fg'] = PiratesGuiGlobals.TextFG9
                newItem.desc['text_fg'] = PiratesGuiGlobals.TextFG9
            
        
        if item['Value'] == PiratesGlobals.GAME_STYLE_TM_BLACK_PEARL:
            newItem.title['text_scale'] = PiratesGuiGlobals.TextScaleTitleSmall
        
        return newItem

    
    def determineLvl3ItemList(self, item, callback = None):
        availItems = []
        if item == None:
            return availItems
        
        gameType = self.parentPanel.getSelectedValue()
        
        def optionsReceived(options):
            if options:
                optionKeys = options.keys()
                for currOption in optionKeys:
                    if options[currOption][0] == PiratesGuiGlobals.UIItemType_Hidden or options.get('execute'):
                        continue
                    
                    availItems.append({
                        'Text': GameTypeGlobals.getGameTypeString(currOption, 'option'),
                        'Option': currOption,
                        'Values': options[currOption][1],
                        'Value': options[currOption][1][0],
                        'ValueType': options[currOption][0] })
                
            
            if callback:
                callback(availItems)
            

        self.getGameOptions(gameType, item.value, optionsReceived)
        return availItems

    
    def itemSelect(self, item):
        if item.value == PiratesGlobals.CREW_STYLE_FIND_A_CREW and item.value == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS or item.value == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            self.toggleAICrewLookout(item.value)
            return None
        
        for currItem in self.activityListItems.items:
            currItem.setSelected(False)
        
        item.setSelected(True)
        self.selectedItem = item
        categoryName = GameTypeGlobals.getGameTypeString(self.selectedItem.value, 'style')
        invCat = GameTypeGlobals.getGameTypeRanking(self.selectedItem.value)
        inv = base.localAvatar.getInventory()
        if inv:
            playerRank = inv.getStackQuantity(invCat)
            self.rankingDisplay['text'] = '%s : %d' % (categoryName, playerRank)
            self.rankingDisplay.show()
        
        if self.parentPanel.submitButton == None:
            self.parentPanel.submitRequest()
        

    
    def optionsClick(self, selectedItem):
        if self.optionsPanel:
            self.optionsPanel.destroy()
            self.optionsPanel = None
        
        
        def gotOptions(itemList):
            if itemList and len(itemList) > 0:
                self.optionsPanel = LookoutRequestLVL3(PLocalizer.LookoutOptionsTitle, titleTextScale = 0.050000000000000003, itemList = itemList, optionsFor = selectedItem.value)
                self.optionsPanel.reparentTo(self.parentPanel)
                self.optionsPanel.setPos(0, 0, 0)
                self.optionsPanel.setParentPanel(self)
                gameTypeStr = GameTypeGlobals.getGameTypeString(selectedItem.value, 'style')
                self.optionsPanel.show(gameTypeStr, selectedItem)
                if self.optionsButton:
                    self.optionsButton.hide()
                
                self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_OPT_MODE)
            

        self.determineLvl3ItemList(selectedItem, gotOptions)

    
    def optionsClose(self):
        self.parentPanel.updateMode(PiratesGuiGlobals.REQUEST_TYPE_MODE)
        if self.parentPanel.deleteWhenClosed:
            self.optionsPanel.destroy()
            self.optionsPanel.removeNode()
            self.optionsPanel = None
        else:
            self.optionsPanel.hide()
        self.rankingDisplay.hide()
        if self.optionsButton:
            self.optionsButton.show()
        

    
    def itemSelectByValue(self, itemValue = None):
        itemToSelect = None
        if itemValue == None:
            if len(self.activityListItems.items) > 0:
                itemToSelect = self.activityListItems.items[0]
            
        else:
            for currItem in self.activityListItems.items:
                print 'checking item with value %s' % currItem.value
                if currItem.value == itemValue:
                    itemToSelect = currItem
                    break
                    continue
            
        if itemToSelect:
            self.itemSelect(itemToSelect)
        

    
    def addCustomOptions(self, gameType, optionPairs):
        currOptions = self.customOptions.get(gameType)
        if currOptions == None:
            self.customOptions[gameType] = optionPairs
            return None
        
        for currOptionPair in optionPairs:
            for currOption in currOptions:
                if currOption[0] == currOptionPair[0]:
                    currOption[1] = currOptionPair[1]
                    continue
                    continue
            
            currOptions.append(currOptionPair)
        

    
    def getCustomOptions(self, gameType, clear = False):
        options = self.customOptions.get(gameType, [])
        if clear and len(options) > 0:
            del self.customOptions[gameType]
        
        return options

    
    def getAllGameOptions(self, gameType, clear = False):
        if self.optionsPanel:
            options = self.optionsPanel.getGameOptions(gameType, clear)
        else:
            options = []
        customOptions = self.getCustomOptions(gameType, clear)
        return options + customOptions

    
    def toggleAICrewLookout(self, itemType):
        if itemType == PiratesGlobals.CREW_STYLE_FIND_A_CREW:
            localAvatar.guiMgr.crewHUD.toggleAvatarLookout()
        
        if itemType == PiratesGlobals.CREW_STYLE_RECRUIT_MEMBERS:
            localAvatar.guiMgr.crewHUD.toggleCrewLookout()
        
        if itemType == PiratesGlobals.CREW_STYLE_FIND_A_PVP_CREW:
            localAvatar.guiMgr.crewHUD.toggleAvatarLookoutPVP()
        
        localAvatar.guiMgr.lookoutPage.close()
Ejemplo n.º 6
0
class LookoutListItem(ButtonListItem.ButtonListItem):
    
    def __init__(self, itemInfo, imageTexCardName, itemHeight, itemWidth, parent = None, parentList = None, textScale = None, txtColor = None, wantFrame = False, **kw):
        ButtonListItem.ButtonListItem.__init__(self, itemInfo, itemHeight, itemWidth, parent, parentList, textScale, txtColor, **kw)
        self.initialiseoptions(LookoutListItem)
        lookoutUI = loader.loadModel(imageTexCardName)
        iconImage = itemInfo.get('Icon')
        self.imageRef = None
        if iconImage:
            self.imageRef = lookoutUI.find('**/' + iconImage)
        
        self.descText = itemInfo.get('Desc')
        self.title = None
        self.desc = None
        self.icon = None
        self.activityListBorderFrame = None
        self.wantFrame = wantFrame
        self.bind(DGG.ENTER, self.mouseEnter)
        self.bind(DGG.EXIT, self.mouseLeave)

    
    def _createIface(self):
        xOff = 0.02
        wordwrap = 20
        yOff = 0.065000000000000002
        if self.imageRef:
            self.icon = OnscreenImage(image = self.imageRef, pos = (0.10000000000000001, 0, 0.082000000000000003), scale = (0.59999999999999998, 0.59999999999999998, 0.59999999999999998), parent = self)
            xOff = 0.20000000000000001
            wordwrap = 15
        
        if self.descText:
            self.desc = DirectLabel(parent = self, state = DGG.DISABLED, relief = None, text = self.descText, text_align = TextNode.ALeft, text_scale = 0.029999999999999999, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = wordwrap, textMayChange = 1, pos = (xOff + 0.01, 0, 0.055))
            yOff = 0.095000000000000001
        
        self.title = DirectLabel(parent = self, state = DGG.DISABLED, relief = None, text = self.item, text_align = TextNode.ALeft, text_scale = 0.070000000000000007, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (xOff, 0, yOff))
        if self.wantFrame:
            self.createListFrame()
        

    
    def _destroyIface(self):
        if self.icon:
            self.icon.removeNode()
            self.icon = None
        
        if self.title:
            self.title.removeNode()
            self.title = None
        
        if self.desc:
            self.desc.removeNode()
            self.desc = None
        

    
    def _handleItemChange(self):
        self._destroyIface()
        self._createIface()

    
    def setSelected(self, selected):
        self.selected = selected
        return None
        if selected:
            print 'selected'
            self.createListFrame()
        else:
            self.clearListFrame()

    
    def createListFrame(self):
        self.clearListFrame()
        self.activityListBorderFrame = BorderFrame(parent = self, pos = (0.375, 0, 0.082000000000000003), scale = (0.75, 1, 0.16500000000000001), borderScale = 0.20000000000000001)
        self.activityListBorderFrame.setBackgroundVisible(False)
        self.activityListBorderFrame.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1)

    
    def clearListFrame(self):
        if self.activityListBorderFrame:
            self.activityListBorderFrame.removeNode()
            self.activityListBorderFrame = None
        

    
    def mouseEnter(self, event):
        if self.wantFrame == False:
            self.createListFrame()
        
        if self.activityListBorderFrame:
            self.activityListBorderFrame.setColorScale(1, 1, 1, 1)
            self.activityListBorderFrame['borderScale'] = 0.25
        

    
    def mouseLeave(self, event):
        if self.wantFrame and self.activityListBorderFrame:
            self.activityListBorderFrame.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1)
            self.activityListBorderFrame['borderScale'] = 0.20000000000000001
        else:
            self.clearListFrame()