Esempio n. 1
0
 def ApplyAttributes(self, attributes):
     PanelBase.ApplyAttributes(self, attributes)
     btnDataList = self.GetButtonDataList()
     self.ConstructButtons(btnDataList)
     self.SetPanelHeight(btnDataList)
     self.SetPanelWidth()
     MouseTargetObject(self)
Esempio n. 2
0
    def _ConstructUI(self):
        mainArea = self.GetMainArea()
        mainArea.clipChildren = True
        infoContainer = Container(parent=mainArea, align=uiconst.TOLEFT_NOPUSH, width=260, padding=6)
        if not SLOT_SHOW_MOUSEOVER_INFO:
            self.activeInfo = ActiveAchievementInfo(parent=infoContainer, achievementGroupID=sm.GetService('achievementSvc').GetActiveAchievementGroupID())
            MouseTargetObject(self.activeInfo)
        self.legendInfo = AchievementTreeLegend(parent=mainArea, align=uiconst.BOTTOMRIGHT, left=10, top=26)
        settingControl = OpportunitiesSettingsMenu(parent=mainArea, align=uiconst.TOPRIGHT, left=6, top=6)
        treeClipper = Container(parent=mainArea, padding=4, clipChildren=True)
        treeClipper._OnSizeChange_NoBlock = self.OnTreeClipperSizeChanged
        self.achievementTree = AchievementTree(parent=treeClipper, treeMargin=(infoContainer.width,
         0,
         0,
         0))
        connections = set()
        for i, achievementGroup in enumerate(GetAchievementGroups()):
            column, row = achievementGroup.treePosition
            self.achievementTree.AddSlot(column, row, achievementGroup.groupID)
            for toGroupID in achievementGroup.groupConnections:
                connections.add((achievementGroup.groupID, toGroupID))

        for groupID1, groupID2 in connections:
            self.achievementTree.AddConnection(groupID1, groupID2)

        self.achievementTree.UpdateTreePositions()
        self.achievementTree.UpdateTreeState()
        self.achievementTree.ShowBackgroundGrid()
        self.achievementTree.LoadRegisteredPosition()
Esempio n. 3
0
 def ApplyAttributes(self, attributes):
     TooltipPersistentPanel.ApplyAttributes(self, attributes)
     self.align = uiconst.ABSOLUTE
     self.rowsByItemIDs = {}
     uicore.uilib.RegisterForTriuiEvents(uiconst.UI_MOUSEDOWN,
                                         self.OnGlobalMouseDown)
     MouseTargetObject(self)
Esempio n. 4
0
    def _LoadTooltipPanel(self, owner, showInstant=False):
        tooltipPanelClassInfo = getattr(owner, 'tooltipPanelClassInfo', None)
        if not tooltipPanelClassInfo and hasattr(owner,
                                                 'GetTooltipPanelClassInfo'):
            tooltipPanelClassInfo = owner.GetTooltipPanelClassInfo()
        tooltipLoadFunction = getattr(owner, 'LoadTooltipPanel', None)
        panelLoaded = LOAD_NOTLOADED
        if tooltipLoadFunction or tooltipPanelClassInfo:
            if tooltipPanelClassInfo:
                tooltipPanel = tooltipPanelClassInfo.CreateTooltip(
                    parent=uicore.layer.menu, owner=owner, idx=0)
            else:
                tooltipPanel = TooltipPanel(parent=uicore.layer.menu,
                                            owner=owner,
                                            idx=0,
                                            state=uiconst.UI_DISABLED)
                tooltipPanel.columns = 1
                tooltipPanel.margin = 0
                tooltipPanel.cellPadding = 0
                tooltipPanel.cellSpacing = 0
            preTooltipPanel = self.tooltipPanel
            self.tooltipPanel = tooltipPanel
            if tooltipPanelClassInfo:
                tooltipPanel.LoadTooltip()
            else:
                try:
                    owner.LoadTooltipPanel(tooltipPanel, owner)
                except:
                    tooltipPanel.Close()
                    raise

            if owner.destroyed or tooltipPanel.destroyed:
                return LOAD_ABORTED
            if len(tooltipPanel.children):
                panelLoaded = LOAD_LOADED
                if preTooltipPanel and not (preTooltipPanel.destroyed
                                            or preTooltipPanel.beingDestroyed):
                    FadeOutPanelAndClose(preTooltipPanel,
                                         duration=FADEOUT_FAST)
                self._CloseTooltipHint()
                if showInstant:
                    tooltipPanel.opacity = 1.0
                if tooltipPanel.pickState == uiconst.TR2_SPS_ON:
                    MouseTargetObject(tooltipPanel)
                uthread.new(tooltipPanel.ShowPanel, owner)
            else:
                tooltipPanel.Close()
                self.tooltipPanel = None
        return panelLoaded
Esempio n. 5
0
    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        megaMenuOptions = attributes.megaMenuOptions
        self.categoryInfo = attributes.categoryInfo
        self.openingButtonClass = attributes.openingButtonClass
        buttonContainer = Container(parent=self,
                                    name='buttonContainer',
                                    align=uiconst.TOTOP,
                                    height=50)
        navigationButton = self.openingButtonClass(
            parent=buttonContainer,
            categoryInfo=self.categoryInfo,
            state=uiconst.UI_NORMAL)
        Frame(
            bgParent=navigationButton,
            frameConst=('res:/UI/Texture/Shared/menuButtonBackground_Top.png',
                        17, -16))
        buttonContainer.height = navigationButton.height
        layoutGridCont = Container(name='layoutGridCont', parent=self)
        numSubgroups = len(megaMenuOptions)
        myLayoutGrid = LayoutGrid(parent=layoutGridCont,
                                  columns=numSubgroups,
                                  state=uiconst.UI_NORMAL)
        MouseTargetObject(myLayoutGrid)
        Frame(bgParent=myLayoutGrid,
              frameConst=('res:/UI/Texture/Shared/menuBackground.png', 17,
                          -16))
        for eachColumnInfo in megaMenuOptions:
            column = MegaMenuColumn(columnInfo=eachColumnInfo)
            myLayoutGrid.AddCell(cellObject=column)

        al, at, aw, ah = myLayoutGrid.GetAbsolute()
        self.height = myLayoutGrid.height + buttonContainer.height
        self.width = myLayoutGrid.width
        self.updateThread = AutoTimer(100, self.UpdateMegaMenu)
        uicore.uilib.RegisterForTriuiEvents(uiconst.UI_MOUSEUP,
                                            self.OnGlobalMouseUp)
Esempio n. 6
0
 def ApplyAttributes(self, attributes):
     DropDownMenuCore.ApplyAttributes(self, attributes)
     MouseTargetObject(self)