コード例 #1
0
    def AddAttributeIcons(self, data):
        rowCont = Container(parent=self, align=uiconst.TOTOP, padTop=3)
        labelCont = Container(parent=rowCont,
                              align=uiconst.TOPLEFT,
                              height=TraitAttributeIcon.default_height,
                              width=40)
        text = localization.GetByLabel(
            'UI/InfoWindow/TraitWithoutNumber',
            color=util.Color.RGBtoHex(*COLOR_TEXT_HILITE),
            bonusText='')
        label = Label(parent=labelCont,
                      text=text,
                      align=uiconst.CENTERLEFT,
                      state=uiconst.UI_NORMAL,
                      color=COLOR_TEXT,
                      tabs=(40, ),
                      tabMargin=3)
        iconCont = FlowContainer(parent=rowCont,
                                 align=uiconst.TOTOP,
                                 padLeft=43,
                                 contentSpacing=(1, 1),
                                 autoHeight=True)
        old_OnSizeChange_NoBlock = iconCont._OnSizeChange_NoBlock

        def OnSizeChange_NoBlock_Hook(newWidth, newHeight):
            old_OnSizeChange_NoBlock(newWidth, newHeight)
            rowCont.height = newHeight

        iconCont._OnSizeChange_NoBlock = OnSizeChange_NoBlock_Hook
        for _, attributeID in data.iteritems():
            TraitAttributeIcon(parent=iconCont,
                               align=uiconst.NOALIGN,
                               attributeID=attributeID)
コード例 #2
0
ファイル: lobbyWnd.py プロジェクト: connoryang/1v1dec
 def _AddOfficePanel(self):
     self.officesPanel = Container(name=OFFICESPANEL,
                                   parent=self.sr.main,
                                   padding=const.defaultPadding)
     self.officesButtons = FlowContainer(name='officesButtons',
                                         align=uiconst.TOTOP,
                                         parent=self.officesPanel,
                                         contentSpacing=(4, 4),
                                         centerContent=True)
     self.officesScroll = Scroll(parent=self.officesPanel,
                                 padTop=const.defaultPadding)
コード例 #3
0
ファイル: podGuideUI.py プロジェクト: connoryang/1v1dec
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     Fill(bgParent=self, color=(1, 1, 1, 0.03))
     categories = attributes.categories
     self.callback = attributes.callback
     self.flowCont = FlowContainer(name='flowCont',
                                   parent=self,
                                   align=uiconst.TOBOTTOM,
                                   autoHeight=True,
                                   centerContent=True,
                                   contentSpacing=(10, 0))
     self.LoadCategories(categories)
コード例 #4
0
 def CreateBaseLayout(self):
     wholeWidthContainer = Container(parent=self,
                                     name='WholeWindowContainer',
                                     align=uiconst.TOALL)
     self.leftContainer = Container(parent=wholeWidthContainer,
                                    name='LeftSideBar',
                                    align=uiconst.TOLEFT)
     self.rightContainer = Container(parent=wholeWidthContainer,
                                     name='RightSideBar',
                                     align=uiconst.TORIGHT)
     self.contentContainer = Container(parent=wholeWidthContainer,
                                       name='Content',
                                       align=uiconst.TOLEFT)
     self.topContainer = ContainerAutoSize(name='Top Container',
                                           parent=self.contentContainer,
                                           align=uiconst.TOTOP)
     Fill(name='SlipUnderLayer',
          bgParent=self.topContainer,
          color=BACKGROUND_COLOR)
     self.headerContainer = Container(parent=self.topContainer,
                                      name='Header',
                                      align=uiconst.TOTOP,
                                      bgColor=HEADER_BG_COLOR,
                                      height=HEADER_HEIGHT,
                                      clipChildren=True)
     self.categoryContainer = Container(parent=self.topContainer,
                                        name='Categories',
                                        align=uiconst.TOTOP,
                                        height=CATEGORIES_HEIGHT,
                                        padTop=HEADER_PADDING,
                                        state=uiconst.UI_PICKCHILDREN)
     self.subCategoryContainer = Container(name='SubCategories',
                                           parent=self.topContainer,
                                           align=uiconst.TOTOP,
                                           padTop=HEADER_PADDING,
                                           bgColor=TAG_COLOR,
                                           state=uiconst.UI_PICKCHILDREN,
                                           clipChildren=True)
     self.subCategoryButtonContainer = FlowContainer(
         name='SubCategoryButtons',
         parent=self.subCategoryContainer,
         centerContent=True,
         align=uiconst.TOTOP,
         contentSpacing=(1, 0),
         state=uiconst.UI_PICKCHILDREN)
     self.filterContainer = Container(name='Filter',
                                      parent=self.contentContainer,
                                      align=uiconst.TOTOP,
                                      padTop=HEADER_PADDING,
                                      state=uiconst.UI_PICKCHILDREN,
                                      height=CATEGORIES_HEIGHT)
コード例 #5
0
ファイル: traits.py プロジェクト: connoryang/dec-eve-serenity
    def AddAttributeIcons(self, data):
        rowCont = Container(parent=self, align=uiconst.TOTOP, padTop=3)
        labelCont = Container(parent=rowCont, align=uiconst.TOPLEFT, height=TraitAttributeIcon.default_height, width=40)
        text = localization.GetByLabel('UI/InfoWindow/TraitWithoutNumber', color=util.Color.RGBtoHex(*COLOR_TEXT_HILITE), bonusText='')
        label = Label(parent=labelCont, text=text, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, color=COLOR_TEXT, tabs=(40,), tabMargin=3)
        iconCont = FlowContainer(parent=rowCont, align=uiconst.TOTOP, padLeft=43, contentSpacing=(1, 1), autoHeight=True)
        old_OnSizeChange_NoBlock = iconCont._OnSizeChange_NoBlock

        def OnSizeChange_NoBlock_Hook(newWidth, newHeight):
            old_OnSizeChange_NoBlock(newWidth, newHeight)
            rowCont.height = newHeight

        iconCont._OnSizeChange_NoBlock = OnSizeChange_NoBlock_Hook
        for _, attributeID in data.iteritems():
            TraitAttributeIcon(parent=iconCont, align=uiconst.NOALIGN, attributeID=attributeID)
コード例 #6
0
ファイル: leftPanel.py プロジェクト: connoryang/1v1dec
 def AddChargeFilterButtons(self):
     self.chargeFilterCont = FlowContainer(
         parent=self.filterCont,
         align=uiconst.TOTOP,
         contentAlignment=CONTENT_ALIGN_LEFT,
         padTop=4,
         contentSpacing=uiconst.BUTTONGROUPMARGIN)
コード例 #7
0
ファイル: pvptradewnd.py プロジェクト: connoryang/1v1dec
 def ApplyAttributes(self, attributes):
     uicontrols.Window.ApplyAttributes(self, attributes)
     self.tradeSession = attributes.tradeSession
     tradeItems = attributes.tradeItems
     self.tradedShips = []
     self.SetWndIcon()
     buttonParent = FlowContainer(name='buttonParent',
                                  parent=self.sr.main,
                                  align=uiconst.TOBOTTOM,
                                  padding=6,
                                  autoHeight=True,
                                  centerContent=True,
                                  contentSpacing=(6, 6))
     self.acceptButton = Button(
         parent=buttonParent,
         label=localization.GetByLabel('UI/PVPTrade/Accept'),
         func=self.OnClickAccept,
         align=uiconst.NOALIGN)
     Button(parent=buttonParent,
            label=localization.GetByLabel('UI/Common/Buttons/Cancel'),
            func=self.Cancel,
            align=uiconst.NOALIGN)
     sessionData = self.tradeSession.List()
     herID = sessionData.traders[not sessionData.traders.index(session.
                                                               charid)]
     self.sr.herinfo = cfg.eveowners.Get(herID)
     mainCont = uiprimitives.Container(name='mainCont', parent=self.sr.main)
     self.sr.my = my = invCont.PlayerTrade(
         parent=mainCont,
         align=uiconst.TOTOP_PROP,
         height=0.5,
         itemID=sessionData.tradeContainerID,
         ownerID=session.charid,
         tradeSession=self.tradeSession,
         state=uiconst.UI_PICKCHILDREN,
         tradeItems=tradeItems)
     self.sr.myAccept = my.acceptIcon
     self.sr.myMoney = my.moneyLabel
     self.sr.her = her = invCont.PlayerTrade(
         parent=mainCont,
         align=uiconst.TOTOP_PROP,
         height=0.5,
         itemID=sessionData.tradeContainerID,
         ownerID=herID,
         tradeSession=self.tradeSession,
         state=uiconst.UI_PICKCHILDREN)
     self.sr.herAccept = her.acceptIcon
     self.sr.herMoney = her.moneyLabel
     offerBtn = Button(
         parent=my.topCont,
         label=localization.GetByLabel('UI/PVPTrade/OfferMoney'),
         func=self.OnClickOfferMoney,
         args=None,
         idx=0,
         pos=(2, 2, 0, 0),
         align=uiconst.TOPRIGHT)
     self.sr.myIx = sessionData.traders.index(eve.session.charid)
     self.sr.herIx = sessionData.traders.index(herID)
     self.OnMoneyOffer([0, 0])
     self.SetCaption(self.GetWindowCaptionText())
コード例 #8
0
 def DrawLeftSide(self):
     self.sr.leftside = uiprimitives.Container(name='leftside', parent=self.sr.main, align=uiconst.TOLEFT, width=256)
     uiprimitives.Container(name='push', parent=self.sr.leftside, align=uiconst.TOTOP, height=6)
     self.sr.leftMainPanel = uiprimitives.Container(name='leftMainPanel', parent=self.sr.leftside, align=uiconst.TOALL, pos=(const.defaultPadding,
      0,
      const.defaultPadding,
      0))
     dummyParent = uiprimitives.Container(name='dummy', parent=self.sr.leftMainPanel, align=uiconst.TOALL, pos=(0, 0, 0, 0))
     ownerParent = uiprimitives.Container(name='ownerParent', parent=dummyParent, align=uiconst.TOTOP, height=20)
     uiprimitives.Container(name='push', parent=ownerParent, align=uiconst.TORIGHT, width=1)
     options = [(localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/PersonalFittings'), session.charid), (localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/CorporationFittings'), session.corpid)]
     selected = settings.user.ui.Get('savedFittingsCombo', None)
     if selected != session.charid and selected != session.corpid:
         selected = session.charid
     self.ownerID = selected
     self.sr.ownerCombo = uicontrols.Combo(label=None, parent=ownerParent, options=options, name='savedFittingsCombo', select=selected, callback=self.ChangeOwnerFilter, pos=(1, 1, 0, 0), align=uiconst.TOALL)
     searchContainer = uiprimitives.Container(name='searchContainer', parent=dummyParent, align=uiconst.TOTOP, top=const.defaultPadding, height=20)
     self.sr.searchTextField = uicontrols.SinglelineEdit(name='searchTextField', parent=searchContainer, align=uiconst.TOLEFT, width=160, maxLength=40, left=1)
     self.sr.searchTextField.OnReturn = self.Search
     self.sr.searchButton = uicontrols.Button(parent=searchContainer, label=localization.GetByLabel('UI/Common/Buttons/Search'), align=uiconst.CENTERRIGHT, func=self.Search)
     self.sr.scroll = uicontrols.Scroll(parent=dummyParent, align=uiconst.TOALL, padding=(0,
      const.defaultPadding,
      0,
      const.defaultPadding))
     self.sr.scroll.multiSelect = 0
     fitButtons = FlowContainer(name='buttonParent', parent=self.sr.leftside, align=uiconst.TOBOTTOM, padding=6, autoHeight=True, centerContent=True, contentSpacing=uiconst.BUTTONGROUPMARGIN, idx=0)
     self.exportButton = Button(parent=fitButtons, label=localization.GetByLabel('UI/Commands/Export'), func=self.ExportFittings, align=uiconst.NOALIGN)
     self.importButton = Button(parent=fitButtons, label=localization.GetByLabel('UI/Commands/Import'), func=self.ImportFittings, align=uiconst.NOALIGN)
     if boot.region != 'optic':
         self.importFromClipboardButton = Button(parent=fitButtons, label=localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/ImportFromClipboard'), func=sm.GetService('fittingSvc').ImportFittingFromClipboard, align=uiconst.NOALIGN)
         self.importFromClipboardButton.hint = localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/ImportFromClipboardHint')
     self.DrawFittings()
コード例 #9
0
    def Layout(self):
        self.ghostClip = Container(name='ghostClip',
                                   parent=self.clipCont,
                                   clipChildren=True)
        self.mainCont.SetParent(self.ghostClip)
        self.ghostCont = ContainerAutoSize(parent=self.clipCont,
                                           align=uiconst.TOPLEFT,
                                           alignMode=uiconst.TOPLEFT,
                                           clipChildren=True)
        self.ghostList = FlowContainer(parent=self.ghostCont,
                                       align=uiconst.TOPLEFT,
                                       width=ENTRY_EXPANDED_WIDTH,
                                       contentSpacing=(0, 4),
                                       idx=0)
        self.ghostShadow = GradientSprite(parent=self.ghostClip,
                                          align=uiconst.TOPLEFT,
                                          state=uiconst.UI_DISABLED,
                                          height=12,
                                          width=ENTRY_EXPANDED_WIDTH,
                                          rgbData=[(0, (0.0, 0.0, 0.0))],
                                          alphaData=[(0, 0.0), (0.8, 0.6),
                                                     (1, 1.0)],
                                          rotation=math.pi / 2,
                                          opacity=0.0,
                                          idx=0)

        def AutoSizeCallback():
            height = self.ghostList.height
            self.mainCont.padTop = -height
            self.ghostClip.padTop = height

        self.ghostCont.callback = AutoSizeCallback
コード例 #10
0
ファイル: podGuideUI.py プロジェクト: connoryang/1v1dec
class PodGuideNavigation(Container):
    clipChildren = True

    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        Fill(bgParent=self, color=(1, 1, 1, 0.03))
        categories = attributes.categories
        self.callback = attributes.callback
        self.flowCont = FlowContainer(name='flowCont',
                                      parent=self,
                                      align=uiconst.TOBOTTOM,
                                      autoHeight=True,
                                      centerContent=True,
                                      contentSpacing=(10, 0))
        self.LoadCategories(categories)

    def LoadCategories(self, categories, *args):
        self.flowCont.Flush()
        tempAllTerms = GetTerms()
        for eachCategorID, eachCategoryInfo in categories.iteritems():
            catInfo = eachCategoryInfo['categoryInfo']
            categoryNameID = catInfo.groupName
            categoryName = GetByMessageID(categoryNameID)
            megaMenuOptions = []
            for eachSubGroup in eachCategoryInfo.get('subgroups', []):
                groupNameID = eachSubGroup.groupName
                groupName = GetByMessageID(groupNameID)
                termsInGroup = tempAllTerms.get(eachSubGroup.groupID, [])
                termsInfoList = []
                for eachTerm in termsInGroup:
                    termTitleID = eachTerm.termTitleID
                    termName = GetByMessageID(termTitleID)
                    termsInfoList.append({
                        'text': termName,
                        'callback': self.callback,
                        'args': eachTerm.termID
                    })

                megaMenuGroup = {
                    'headerInfo': {
                        'groupName': groupName
                    },
                    'entryInfoList': termsInfoList
                }
                megaMenuOptions.append(megaMenuGroup)

            NavigationButtonInWindow(
                parent=self.flowCont,
                megaMenuOptions=megaMenuOptions,
                categoryInfo={'categoryName': categoryName})

    def Close(self, *args):
        Container.Close(self, *args)
        uicore.megaMenuManager.CloseMegaMenu()
コード例 #11
0
ファイル: leftPanel.py プロジェクト: connoryang/1v1dec
 def AddHardwareFilterButtons(self):
     self.hardwareFilterCont = FlowContainer(
         parent=self.filterCont,
         align=uiconst.TOTOP,
         contentAlignment=CONTENT_ALIGN_LEFT,
         padTop=4,
         contentSpacing=uiconst.BUTTONGROUPMARGIN)
     return AddHardwareButtons(self.hardwareFilterCont,
                               'fitting_filter_hardware_%s',
                               self.HardwareFilterClicked,
                               self.GetHardwareMenu,
                               hintFunc=self.GetFilterHint)
コード例 #12
0
 def LoadButtons(self, buttonData):
     buttonContainer = FlowContainer(parent=self.mainContent,
                                     align=uiconst.TOTOP,
                                     padTop=14,
                                     contentSpacing=(4, 4),
                                     contentAlignment=CONTENT_ALIGN_RIGHT)
     for label, func, args in buttonData:
         button = Button(parent=buttonContainer,
                         label=label,
                         func=func,
                         args=args,
                         align=uiconst.NOALIGN)
コード例 #13
0
ファイル: leftPanel.py プロジェクト: connoryang/1v1dec
 def AddFittingFilterButtons(self):
     self.fittingFilterCont = FlowContainer(
         name='fittingFilterCont',
         parent=self.filterCont,
         align=uiconst.TOTOP,
         contentAlignment=CONTENT_ALIGN_LEFT,
         padTop=4,
         contentSpacing=uiconst.BUTTONGROUPMARGIN)
     AddFittingFilterButtons(self.fittingFilterCont,
                             'fitting_filter_ship_%s',
                             self.FittingFilterClicked,
                             hintFunc=self.GetFilterHint)
コード例 #14
0
ファイル: lobbyWnd.py プロジェクト: connoryang/1v1dec
 def _AddStationServices(self):
     EveLabelMedium(text=GetByLabel('UI/Station/StationServices'),
                    align=uiconst.TOTOP,
                    parent=self.sr.main,
                    bold=True,
                    padding=(6, 6, 6, 0))
     self.serviceButtons = FlowContainer(name='serviceButtons',
                                         align=uiconst.TOTOP,
                                         parent=self.sr.main,
                                         contentSpacing=(BUTTONGAP,
                                                         BUTTONGAP),
                                         padding=(6, 6, 3, 6))
コード例 #15
0
ファイル: purchaseView.py プロジェクト: connoryang/1v1dec
 def ApplyAttributes(self, attributes):
     super(ActivatePromptPanel, self).ApplyAttributes(attributes)
     typeID = attributes.typeID
     onActivate = attributes.onActivate
     onCancel = attributes.onCancel
     VgsLabelMedium(parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/VirtualGoodsStore/Purchase/ActivationPurchaseSuccess'), center=True, top=10, padding=(10, 0, 10, 0))
     cont = ContainerAutoSize(parent=self, align=uiconst.TOTOP)
     OfferProductList(parent=cont, align=uiconst.CENTER, products=[(typeID, 1)])
     VgsLabelMedium(parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/VirtualGoodsStore/Purchase/ActivationQuestion'), center=True, top=10, padding=(10, 0, 10, 0))
     VgsLabelSmall(parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/VirtualGoodsStore/Purchase/ActivationQuestionDetails'), center=True, padding=(10, 0, 10, 0))
     buttonCont = FlowContainer(parent=self, align=uiconst.TOBOTTOM, contentAlignment=CONTENT_ALIGN_CENTER, padding=(0, 10, 0, 10), contentSpacing=(10, 10), idx=0)
     VgsBuyButton(parent=buttonCont, align=uiconst.NOALIGN, text=localization.GetByLabel('UI/VirtualGoodsStore/Purchase/DontActivate'), onClick=onCancel, color=(0.5, 0.5, 0.5, 1.0))
     VgsBuyButton(parent=buttonCont, align=uiconst.NOALIGN, text=localization.GetByLabel('UI/VirtualGoodsStore/Purchase/Activate'), onClick=onActivate, color=(0.255, 0.4, 0.545, 1.0))
コード例 #16
0
 def SetDoublePaneView(self, briefingHtml=None, objectiveHtml=None):
     if self.viewMode == 'DoublePaneView':
         if briefingHtml:
             self.LoadHTML(briefingHtml, 'briefingBrowser')
         if objectiveHtml:
             self.LoadHTML(objectiveHtml, 'objectiveBrowser')
         if self.buttonCache:
             uix.Flush(self.sr.rightPaneBottom)
             self._InsertButtons(self.buttonCache, self.sr.rightPaneBottom)
         return
     if briefingHtml:
         self.SetHTML(briefingHtml, 'briefingBrowser')
     if objectiveHtml:
         self.SetHTML(objectiveHtml, 'objectiveBrowser')
     uix.Flush(self.sr.main)
     self.sr.leftPane = uiprimitives.Container(name='leftPane',
                                               parent=self.sr.main,
                                               align=uiconst.TOLEFT,
                                               height=self.paneHeight,
                                               width=self.paneWidth,
                                               left=0,
                                               top=0)
     uiprimitives.Container(name='bottomBorder',
                            parent=self.sr.leftPane,
                            align=uiconst.TOBOTTOM,
                            height=1)
     self.sr.rightPane = uiprimitives.Container(name='rightPane',
                                                parent=self.sr.main,
                                                align=uiconst.TOALL,
                                                pos=(0, 0, 0, 0))
     uiprimitives.Line(parent=self.sr.rightPane, align=uiconst.TOLEFT)
     self.sr.rightPaneBottom = FlowContainer(
         name='rightPaneBottom',
         parent=self.sr.rightPane,
         align=uiconst.TOBOTTOM,
         contentSpacing=uiconst.BUTTONGROUPMARGIN,
         centerContent=True,
         padding=(6, 0, 6, 6))
     self.sr.rightPaneTop = uiprimitives.Container(name='rightPaneTop',
                                                   parent=self.sr.rightPane,
                                                   align=uiconst.TOALL,
                                                   pos=(0, 0, 0, 0))
     self.SetMinSize([self.windowWidth, self.windowHeight])
     self.LockWidth(self.windowWidth)
     self.viewMode = 'DoublePaneView'
     if self.buttonCache:
         self._InsertButtons(self.buttonCache, self.sr.rightPaneBottom)
     self.InitializeBrowsers()
     for browserName in self.htmlCache:
         self.LoadHTML(self.htmlCache[browserName], browserName)
コード例 #17
0
 def ConstructButtons(self):
     buttonParent = FlowContainer(name='buttonParent',
                                  parent=self.sr.main,
                                  align=uiconst.TOBOTTOM,
                                  padding=6,
                                  autoHeight=True,
                                  centerContent=True,
                                  contentSpacing=(6, 6))
     self.acceptButton = Button(parent=buttonParent,
                                label=GetByLabel('UI/PVPTrade/Accept'),
                                func=self.Accept,
                                align=uiconst.NOALIGN)
     Button(parent=buttonParent,
            label=GetByLabel('UI/Common/Buttons/Cancel'),
            func=self.Close,
            align=uiconst.NOALIGN)
     self.CanPlayerAcceptTrade()
コード例 #18
0
 def AddButtons(self):
     btnCont = FlowContainer(name='buttonParent',
                             parent=self.sr.main,
                             align=uiconst.TOBOTTOM,
                             padding=6,
                             autoHeight=True,
                             centerContent=True,
                             contentSpacing=uiconst.BUTTONGROUPMARGIN,
                             idx=0)
     text = GetByLabel(
         'UI/Fitting/FittingWindow/FittingManagement/FitShips', numToFit=1)
     self.fitBtn = Button(parent=btnCont,
                          label=text,
                          func=self.DoFitShips,
                          align=uiconst.NOALIGN)
     self.cancelBtn = Button(parent=btnCont,
                             label=GetByLabel('UI/Commands/Cancel'),
                             func=self.Cancel,
                             align=uiconst.NOALIGN)
コード例 #19
0
 def Load(self, node):
     Item.Load(self, node)
     buttonCont = FlowContainer(parent=self,
                                align=uiconst.CENTERRIGHT,
                                left=20,
                                width=200,
                                height=16,
                                contentAlignment=CONTENT_ALIGN_RIGHT,
                                contentSpacing=(4, 0))
     SkinMaterialBuyButtonAur(parent=buttonCont,
                              align=uiconst.NOALIGN,
                              typeID=self.typeID,
                              materialID=self.itemID,
                              logContext=node.logContext)
     SkinMaterialBuyButtonIsk(parent=buttonCont,
                              align=uiconst.NOALIGN,
                              typeID=self.typeID,
                              materialID=self.itemID,
                              logContext=node.logContext)
コード例 #20
0
 def SetSinglePaneView(self, briefingHtml=None):
     if self.viewMode == 'SinglePaneView':
         if briefingHtml:
             self.LoadHTML(briefingHtml, 'briefingBrowser')
         if self.buttonCache:
             uix.Flush(self.sr.rightPaneBottom)
             self._InsertButtons(self.buttonCache, self.sr.rightPaneBottom)
         return
     if briefingHtml:
         self.SetHTML(briefingHtml, 'briefingBrowser')
     uix.Flush(self.sr.main)
     self.sr.rightPaneBottom = FlowContainer(
         name='rightPaneBottom',
         parent=self.sr.main,
         align=uiconst.TOBOTTOM,
         contentSpacing=uiconst.BUTTONGROUPMARGIN,
         centerContent=True,
         padding=(6, 0, 6, 6))
     self.sr.leftPane = uiprimitives.Container(name='leftPane',
                                               parent=self.sr.main,
                                               align=uiconst.TOLEFT,
                                               height=self.paneHeight,
                                               width=self.paneWidth,
                                               left=0,
                                               top=0)
     self.sr.rightPaneTop = uiprimitives.Container(name='rightPaneTop',
                                                   parent=self.sr.main,
                                                   align=uiconst.TOALL,
                                                   pos=(0, 0, 0, 0))
     self.sr.rightPaneTop.state = uiconst.UI_HIDDEN
     self.SetMinSize([self.mainContainerWidth / 2 + 10, self.windowHeight])
     self.LockWidth(self.mainContainerWidth / 2 + 10)
     self.viewMode = 'SinglePaneView'
     if self.buttonCache:
         self._InsertButtons(self.buttonCache, self.sr.rightPaneBottom)
     self.InitializeBrowsers()
     if 'briefingBrowser' in self.htmlCache:
         self.LoadHTML(self.htmlCache['briefingBrowser'], 'briefingBrowser')
コード例 #21
0
 def CreateButtons(self):
     buttonCont = FlowContainer(name='SubCategoryButtons',
                                parent=self.sr.main,
                                centerContent=True,
                                align=uiconst.TOBOTTOM,
                                contentSpacing=(2, 1),
                                state=uiconst.UI_PICKCHILDREN,
                                padding=(0, 4, 0, 4))
     Button(parent=buttonCont,
            label='Roll out!!',
            func=self.StartBot,
            align=uiconst.NOALIGN,
            padding=2)
     Button(parent=buttonCont,
            label='Stop',
            func=self.StopBot,
            align=uiconst.NOALIGN,
            padding=2)
     Button(parent=buttonCont,
            label='Clear Log',
            func=self.ClearLogs,
            align=uiconst.NOALIGN,
            padding=2)
コード例 #22
0
 def ApplyAttributes(self, attributes):
     self.viewState = sm.GetService('viewState')
     if not settings.user.ui.Get('stationservicebtns', 1):
         minWidth = BIGBUTTONSIZE + (BIGBUTTONSIZE + BUTTONGAP) * 3 + 14
         minHeight = 495
     else:
         minWidth = SMALLBUTTONSIZE + (SMALLBUTTONSIZE + BUTTONGAP) * 5 + 10
         minHeight = 470
     self.default_minSize = (minWidth, minHeight)
     Window.ApplyAttributes(self, attributes)
     self.stationSvc = sm.GetService('station')
     self.guestScroll = None
     self.sr.serviceAccessCache = {}
     self.SetWndIcon(None)
     self.HideHeader()
     self.scope = 'station'
     self.MakeUnKillable()
     self.MakeUnstackable()
     self.SetTopparentHeight(0)
     main = self.sr.main
     main.clipChildren = True
     self.corpLogoParent = Container(name='corpLogoParent', align=uiconst.TOTOP, height=160, parent=main)
     self.corpName = CaptionLabel(parent=main, align=uiconst.TOTOP, name='corpName', uppercase=False)
     self.undockparent = Container(name='undockparent', align=uiconst.TOTOP, height=78, parent=main)
     self.AddCQButton(parent=self.undockparent)
     self.AddUndockButton(parent=self.undockparent)
     EveLabelMedium(text=localization.GetByLabel('UI/Station/StationServices'), align=uiconst.TOTOP, parent=main, bold=True, padding=(6, 6, 6, 0))
     self.serviceButtons = FlowContainer(name='serviceButtons', align=uiconst.TOTOP, parent=main, contentSpacing=(BUTTONGAP, BUTTONGAP), padding=(6, 6, 3, 6))
     btnGroup = ToggleButtonGroup(name='btnGroup', parent=main, align=uiconst.TOTOP, height=32, padding=(6, 6, 6, 6), idx=-1, callback=self.OnButtonGroupSelection)
     self.mainButtonGroup = btnGroup
     self.guestsPanel = Container(name=GUESTSPANEL, parent=main, padding=const.defaultPadding)
     self.quickFilter = QuickFilterEdit(name='quickFilterEdit', parent=self.guestsPanel)
     self.quickFilter.ReloadFunction = lambda : self.ShowGuests()
     self.guestScroll = BasicDynamicScroll(parent=self.guestsPanel, padTop=const.defaultPadding + self.quickFilter.height)
     guestSettingsMenu = UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=self.guestsPanel, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=18, height=18, iconSize=18)
     self.userType = settings.user.ui.Get('guestCondensedUserList', False)
     self.agentsPanel = Container(name=AGENTSPANEL, parent=main, padding=const.defaultPadding)
     self.agentFinderBtn = Button(label=localization.GetByLabel('UI/AgentFinder/AgentFinder'), parent=self.agentsPanel, align=uiconst.CENTERTOP, func=uicore.cmd.OpenAgentFinder)
     self.agentScroll = Scroll(parent=self.agentsPanel, padTop=const.defaultPadding + self.agentFinderBtn.height)
     self.officesPanel = Container(name=OFFICESPANEL, parent=main, padding=const.defaultPadding)
     self.officesButtons = FlowContainer(name='officesButtons', align=uiconst.TOTOP, parent=self.officesPanel, contentSpacing=(4, 4), centerContent=True)
     self.officesScroll = Scroll(parent=self.officesPanel, padTop=const.defaultPadding)
     agentsButton = btnGroup.AddButton(AGENTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Agents'), self.agentsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/AgentsTab_descrtiption'))
     agentsButton.name = 'stationInformationTabAgents'
     guestsButton = btnGroup.AddButton(GUESTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Guests'), self.guestsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/GuestsTab_description'))
     guestsButton.counter = CounterBox(parent=guestsButton, align=uiconst.TOPRIGHT, left=2, top=-5)
     self.guestsButton = guestsButton
     btnGroup.AddButton(OFFICESPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Offices'), self.officesPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/OfficesTab_description'))
     activePanel = settings.user.ui.Get('stationsLobbyTabs', AGENTSPANEL)
     if settings.char.windows.Get('dockshipsanditems', 0):
         self.inventoryPanel = Container(name=INVENTORYPANEL, parent=main)
         self.sr.shipsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding)
         self.sr.itemsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding)
         tabs = [[localization.GetByLabel('UI/Station/Ships'),
           self.sr.shipsContainer,
           self,
           'lobby_ships'], [localization.GetByLabel('UI/Station/Items'),
           self.sr.itemsContainer,
           self,
           'lobby_items']]
         self.inventoryTabs = TabGroup(name='inventoryPanel', parent=self.inventoryPanel, idx=0)
         self.inventoryTabs.Startup(tabs, 'lobbyInventoryPanel', autoselecttab=True, UIIDPrefix='lobbyInventoryPanelTab')
         self.invButton = btnGroup.AddButton(INVENTORYPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Hangars'), self.inventoryPanel, btnClass=LobbyToggleButtonGroupButton, hint='<b>%s</b><br>%s' % (localization.GetByLabel('Tooltips/StationServices/Hangars'), localization.GetByLabel('Tooltips/StationServices/Hangars_description')))
     elif activePanel == INVENTORYPANEL:
         activePanel = AGENTSPANEL
     btnGroup.SelectByID(activePanel)
     myDefaultView = 'hangar' if session.userid % 2 == 1 else 'station'
     curView = collections.namedtuple('FakeViewInfo', ['name'])(settings.user.ui.Get('defaultDockingView', myDefaultView))
     self.OnPrimaryViewChanged(curView, curView)
     self.LoadOwnerInfo()
     self.LoadServiceButtons()
     if self.destroyed:
         return
     sm.RegisterNotify(self)
     self.UpdateGuestTabText()
コード例 #23
0
class AurumStoreContainer(Container):
    default_name = 'AurumStoreContainer'
    default_state = uiconst.UI_NORMAL

    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        self.store = sm.GetService('vgsService').GetStore()
        self.tagsByCategoryId = {}
        self.selectedRootCategoryId = None
        self.selectedCategoryId = None
        self.activeTagsByRootCategoryId = {}
        self.page = None
        Fill(bgParent=self, color=BACKGROUND_COLOR)
        self.CreateRedeemingPanelLayout()
        self.CreateBaseLayout()
        self.CreateHeaderLayout()
        self.CreateContentLayout()
        self.SetFilterOptions()
        self.currentAurBalance = 0
        self._OnResize()

    def _OnResize(self, *args):
        top, left, width, height = self.GetAbsolute()
        contentWidth = min(MAX_CONTENT_WIDTH, width)
        self.leftContainer.width = (width - contentWidth) / 2
        self.contentContainer.width = contentWidth
        self.rightContainer.width = width - self.leftContainer.width - contentWidth
        self.redeemingPanel.width = width
        if hasattr(self, 'grid'):
            self.grid.SetParentWidth(self.contentContainer.width)
        self.SetSidebarContentMask()

    def CreateHeaderLayout(self):
        contentContainer = Container(parent=self.headerContainer,
                                     align=uiconst.TOTOP,
                                     height=CAPTION_HEIGHT,
                                     top=CAPTION_OFFSET)
        LogoHomeButton(parent=self.headerContainer,
                       align=uiconst.TOPLEFT,
                       onClick=self.OnClickHomeButton)
        ExitButton(
            parent=self.headerContainer,
            align=uiconst.TOPRIGHT,
            onClick=uicore.cmd.ToggleAurumStore,
            top=4,
            left=10,
            hint=localization.GetByLabel('UI/VirtualGoodsStore/ExitStore'))
        self.aurButton = HeaderBuyAurButton(parent=contentContainer,
                                            align=uiconst.TORIGHT,
                                            onClick=self._BuyAurum,
                                            padding=(4, 0, 4, 0),
                                            left=6)
        cont = Container(name='AurContainer',
                         parent=contentContainer,
                         align=uiconst.TORIGHT,
                         width=200,
                         padRight=8)
        self.aurLabel = AurLabelHeader(parent=cont,
                                       align=uiconst.CENTERRIGHT,
                                       height=32,
                                       amount=100,
                                       padTop=1)

    def _BuyAurum(self):
        sm.GetService('audio').SendUIEvent('store_aur')
        sm.GetService('viewState').GetView(
            ViewState.VirtualGoodsStore)._LogBuyAurum('TopButton')
        uicore.cmd.BuyAurumOnline()

    def SetSidebarContentMask(self):
        for container in (self.leftContainer, self.rightContainer):
            container.Flush()
            GradientSprite(name='OfferSlipGradient',
                           align=uiconst.TOTOP,
                           parent=container,
                           rgbData=((0.0, BACKGROUND_COLOR[:3]), ),
                           alphaData=((0.0, CONTENT_SLIP_UNDER_AREA_OPACITY),
                                      (0.5, 1.0), (1.0, 1.0)),
                           height=self.topContainer.height +
                           self.filterContainer.height + HEADER_PADDING,
                           rotation=math.pi / 2)

    def CreateBaseLayout(self):
        wholeWidthContainer = Container(parent=self,
                                        name='WholeWindowContainer',
                                        align=uiconst.TOALL)
        self.leftContainer = Container(parent=wholeWidthContainer,
                                       name='LeftSideBar',
                                       align=uiconst.TOLEFT)
        self.rightContainer = Container(parent=wholeWidthContainer,
                                        name='RightSideBar',
                                        align=uiconst.TORIGHT)
        self.contentContainer = Container(parent=wholeWidthContainer,
                                          name='Content',
                                          align=uiconst.TOLEFT)
        self.topContainer = ContainerAutoSize(name='Top Container',
                                              parent=self.contentContainer,
                                              align=uiconst.TOTOP)
        Fill(name='SlipUnderLayer',
             bgParent=self.topContainer,
             color=BACKGROUND_COLOR)
        self.headerContainer = Container(parent=self.topContainer,
                                         name='Header',
                                         align=uiconst.TOTOP,
                                         bgColor=HEADER_BG_COLOR,
                                         height=HEADER_HEIGHT,
                                         clipChildren=True)
        self.categoryContainer = Container(parent=self.topContainer,
                                           name='Categories',
                                           align=uiconst.TOTOP,
                                           height=CATEGORIES_HEIGHT,
                                           padTop=HEADER_PADDING,
                                           state=uiconst.UI_PICKCHILDREN)
        self.subCategoryContainer = Container(name='SubCategories',
                                              parent=self.topContainer,
                                              align=uiconst.TOTOP,
                                              padTop=HEADER_PADDING,
                                              bgColor=TAG_COLOR,
                                              state=uiconst.UI_PICKCHILDREN,
                                              clipChildren=True)
        self.subCategoryButtonContainer = FlowContainer(
            name='SubCategoryButtons',
            parent=self.subCategoryContainer,
            centerContent=True,
            align=uiconst.TOTOP,
            contentSpacing=(1, 0),
            state=uiconst.UI_PICKCHILDREN)
        self.filterContainer = Container(name='Filter',
                                         parent=self.contentContainer,
                                         align=uiconst.TOTOP,
                                         padTop=HEADER_PADDING,
                                         state=uiconst.UI_PICKCHILDREN,
                                         height=CATEGORIES_HEIGHT)

    def CreateContentLayout(self):
        self.contentScroll = OfferScrollContainer(parent=self.contentContainer,
                                                  align=uiconst.TOALL)
        self.banner = BannerReel(parent=self.contentScroll,
                                 align=uiconst.TOTOP,
                                 bannerWidth=MAX_CONTENT_WIDTH,
                                 bannerHeight=AD_HEIGHT)
        self.grid = OfferGrid(parent=self.contentScroll,
                              align=uiconst.TOTOP,
                              contentSpacing=(CONTENT_PADDING,
                                              CONTENT_PADDING),
                              padBottom=CONTENT_PADDING,
                              columns=OFFER_COLUMNS,
                              incrementSize=OFFER_COLUMNS)
        for x in xrange(4 * OFFER_COLUMNS):
            offer = VgsOffer(parent=self.grid,
                             width=MAX_OFFER_IMAGE_SIZE,
                             height=MAX_OFFER_IMAGE_SIZE,
                             align=uiconst.NOALIGN)

        self.contentScroll.RegisterContentLoader(self.grid)

    def CreateRedeemingPanelLayout(self):
        instructionText = '<url=localsvc:service=vgsService&method=ShowRedeemUI>%s</url>' % (
            localization.GetByLabel(
                'UI/RedeemWindow/ClickToInitiateRedeeming'), )
        self.redeemingPanel = RedeemPanel(
            parent=self,
            align=uiconst.TOBOTTOM,
            dragEnabled=False,
            instructionText=instructionText,
            redeemButtonBackgroundColor=REDEEM_BUTTON_BACKGROUND_COLOR,
            redeemButtonFillColor=REDEEM_BUTTON_FILL_COLOR)
        self.redeemingPanel.UpdateDisplay()

    def SelectCategory(self, categoryId):
        self.selectedRootCategoryId = categoryId
        for button in self.categoryButtons:
            if button.isActive and button.categoryId != categoryId:
                button.SetActive(False)

    def SelectSubCategory(self, subcategoryId):
        self.selectedCategoryId = subcategoryId
        for button in self.subcategoryButtons:
            if button.isActive and button.categoryId != subcategoryId:
                button.SetActive(False)

    def OnClickCategory(self, categoryId):
        self.LoadCategoryPage(categoryId)

    @RunThreadOnce(THREAD_KEY_LOAD_PAGE)
    def LoadCategoryPage(self, categoryId):
        if self.page == PAGE_CATEGORY and self.selectedRootCategoryId == categoryId and self.selectedCategoryId is None:
            return
        logger.debug('Loading category page: %s', categoryId)
        self.SelectCategory(categoryId)
        categoriesById = self.store.GetCategories()
        category = categoriesById[categoryId]
        subcategories = [
            categoriesById[subCatId] for subCatId in category.subcategories
        ]
        subcategories = localization.util.Sort(subcategories,
                                               key=lambda c: c.name)
        self.SetSubCategories(subcategories)
        self.SelectSubCategory(None)
        self.SetOffersAndTags(categoryId)
        self.page = PAGE_CATEGORY

    def OnClickSubCategory(self, subcategoryId):
        self.LoadSubCategoryPage(subcategoryId)

    @RunThreadOnce(THREAD_KEY_LOAD_PAGE)
    def LoadSubCategoryPage(self, subcategoryId):
        if self.page == PAGE_SUBCATEGORY and self.selectedCategoryId == subcategoryId:
            return
        logger.debug('Loading sub category page: %s', subcategoryId)
        self.selectedCategoryId = subcategoryId
        self.SetOffersAndTags(subcategoryId)
        self.SelectSubCategory(subcategoryId)
        self.page = PAGE_SUBCATEGORY

    def SetOffersAndTags(self, categoryId):
        tags = self.store.GetTagsByCategoryId(categoryId)
        self.SetFilterTags(tags)
        tagIds = self.filterBar.GetSelectedFilterTagIds()
        offers = self.store.GetFilteredOffers(categoryId, tagIds)
        self.HideBanner()
        self.SetOffers(offers)

    @RunThreadOnce(THREAD_KEY_LOAD_PAGE)
    def OnClickHomeButton(self):
        self.LoadLandingPage()

    def LoadLandingPage(self):
        logger.debug('LoadLandingPage')
        if self.page == PAGE_HOME:
            return
        logger.debug('Loading landing page')
        self._SetSubCategories(None)
        self.SelectCategory(None)
        self.SelectSubCategory(None)
        self.SetFilterTags([])
        self.ShowBanner()
        offers = self.store.GetOffers().values()
        self.SetOffers(offers)
        self.page = PAGE_HOME

    @RunThreadOnce('VGS.ShowBanner')
    def ShowBanner(self):
        if self.banner.HasBanners() and not self.banner.display:
            self.banner.top = 0
            self.banner.display = True
            self.SetSubCategories(None)
            uicore.animations.MoveInFromTop(self.banner,
                                            amount=self.banner.height,
                                            sleep=True)

    @RunThreadOnce('VGS.HideBanner')
    def HideBanner(self):
        uicore.animations.MoveOutTop(self.banner,
                                     amount=self.banner.height,
                                     sleep=True)
        self.banner.top = 0
        self.banner.display = False

    @postponeUntilFocus
    def SetAUR(self, amount):
        logger.debug('SetAUR %s', amount)
        uicore.animations.MorphScalar(
            self,
            'currentAurBalance',
            startVal=self.currentAurBalance,
            endVal=amount,
            curveType=uiconst.ANIM_SMOOTH,
            duration=1.5,
            callback=lambda: self.SetCurrentAurBalance(amount))

    def SetCurrentAurBalance(self, amount):
        self._currentAurBalance = amount
        self.aurLabel.SetAmount(self._currentAurBalance)

    def GetCurrentAurBalance(self):
        return self._currentAurBalance

    currentAurBalance = property(GetCurrentAurBalance, SetCurrentAurBalance)

    def SetCategories(self, categories):
        logger.debug('SetCategories %s', categories)
        self.categoryContainer.Flush()
        searchContainer = Container(name='SearchBox',
                                    parent=self.categoryContainer,
                                    width=SEARCH_BOX_WIDTH,
                                    align=uiconst.TORIGHT)
        categoryButtonsContainer = GridContainer(name='ButtonGrid',
                                                 parent=self.categoryContainer,
                                                 align=uiconst.TOALL,
                                                 columns=len(categories),
                                                 lines=1)
        tagById = self.store.GetTags()
        self.categoryButtons = []
        for category in categories:
            button = CategoryButton(parent=categoryButtonsContainer,
                                    categoryId=category.id,
                                    label=category.name,
                                    align=uiconst.TOALL,
                                    onClick=self.OnClickCategory,
                                    padRight=1)
            self.categoryButtons.append(button)
            tags = []
            for tagId in category.tagIds:
                tag = tagById.get(tagId)
                if tag:
                    tags.append(Tag(tag.id, tag.name))

            self.tagsByCategoryId[category.id] = tags

        iconContainer = Container(name='SearchIconContainer',
                                  parent=searchContainer,
                                  width=CATEGORIES_HEIGHT,
                                  align=uiconst.TOLEFT,
                                  bgColor=CATEGORY_COLOR)
        Sprite(parent=iconContainer,
               texturePath='res:/UI/Texture/Vgs/Search_icon.png',
               width=32,
               height=32,
               align=uiconst.CENTER)
        self.searchEdit = SinglelineEdit(parent=searchContainer,
                                         align=uiconst.TORIGHT,
                                         pos=(0, 0, SEARCH_BOX_WIDTH -
                                              CATEGORIES_HEIGHT - 2, 0),
                                         fontsize=16,
                                         padding=(1, 0, 0, 0),
                                         OnChange=self.Search,
                                         bgColor=TAG_COLOR)
        self.searchEdit.ShowClearButton(
            icon='res:/UI/Texture/Icons/73_16_45.png')
        self.searchEdit.SetHistoryVisibility(False)
        self.searchEdit.sr.background.Hide()

    @RunThreadOnce(THREAD_KEY_LOAD_PAGE)
    def Search(self, searchString):
        self.page = PAGE_SEARCH
        self.HideBanner()
        self.SelectSubCategory(None)
        self.SelectCategory(None)
        self._SetSubCategories(None)
        self.SetFilterTags([])
        sm.GetService('viewState').GetView(
            ViewState.VirtualGoodsStore).Search(searchString)

    @RunThreadOnce('VGS.SetSubCategories')
    def SetSubCategories(self, subcategories):
        self._SetSubCategories(subcategories)

    def _SetSubCategories(self, subcategories):
        self.subCategoryButtonContainer.Flush()
        self.subcategoryButtons = []
        if subcategories is None:
            if self.subCategoryContainer.height > 0:
                uicore.animations.MorphScalar(
                    self.subCategoryContainer,
                    attrName='height',
                    startVal=self.subCategoryContainer.height,
                    endVal=0,
                    duration=0.5,
                    callback=self.SetSidebarContentMask)
        else:
            if int(self.subCategoryContainer.height) != CATEGORIES_HEIGHT:
                uicore.animations.MorphScalar(
                    self.subCategoryContainer,
                    attrName='height',
                    startVal=self.subCategoryContainer.height,
                    endVal=CATEGORIES_HEIGHT,
                    duration=0.5,
                    sleep=False,
                    callback=self.SetSidebarContentMask)
            for subcategory in subcategories:
                button = SubCategoryButton(
                    parent=self.subCategoryButtonContainer,
                    label=subcategory.name,
                    align=uiconst.NOALIGN,
                    height=CATEGORIES_HEIGHT,
                    categoryId=subcategory.id,
                    onClick=self.OnClickSubCategory)
                self.subcategoryButtons.append(button)

    def SetOffers(self, offers):
        if self.selectedCategoryId is None and self.selectedRootCategoryId is None:
            specialOffers = [o for o in offers if o.label is not None]
            notSpecialOffers = [o for o in offers if o.label is None]
            offers = SortOffers(specialOffers)
            offers.extend(SortOffers(notSpecialOffers))
        else:
            offers = SortOffers(offers)
        self.grid.SetOffers(offers)

    def SetFilterOptions(self):
        self.filterContainer.Flush()
        Fill(name='SlipUnderLayer',
             bgParent=self.filterContainer,
             color=BACKGROUND_COLOR,
             opacity=CONTENT_SLIP_UNDER_AREA_OPACITY,
             padTop=-HEADER_PADDING * 2)
        options = [(localization.GetByLabel(
            'UI/VirtualGoodsStore/Sorting/ByPriceAscending'),
                    SORT_PRICE_ASCENDING),
                   (localization.GetByLabel(
                       'UI/VirtualGoodsStore/Sorting/ByPriceDescending'),
                    SORT_PRICE_DESCENDING),
                   (localization.GetByLabel(
                       'UI/VirtualGoodsStore/Sorting/ByNameAscending'),
                    SORT_NAME_ASCENDING),
                   (localization.GetByLabel(
                       'UI/VirtualGoodsStore/Sorting/ByNameDescending'),
                    SORT_NAME_DESCENDING)]
        self.filterCombo = VgsFilterCombo(parent=self.filterContainer,
                                          align=uiconst.TORIGHT,
                                          options=options,
                                          callback=self.OnSortOrderChanged,
                                          select=GetSortOrder(),
                                          padding=(4, 2, 0, 4))
        self.filterBar = VgsOfferFilterBar(
            parent=self.filterContainer, onFilterChanged=self.OnFilterChanged)

    def SetFilterTags(self, tags):
        activeTags = self.activeTagsByRootCategoryId.get(
            self.GetSelectedRootCategoryId(), {})
        self.subCategoryContainer.state = uiconst.UI_PICKCHILDREN
        self.filterBar.SetTags(tags, activeTags)

    def OnSortOrderChanged(self, combo, key, value):
        settings.user.ui.Set('VgsOfferSortOrder', value)
        sm.GetService('viewState').GetView(
            ViewState.VirtualGoodsStore)._LogFilterChange(value)
        self.SetOffers(self.grid.GetOffers())

    def OnFilterChanged(self):
        tagIds = self.filterBar.GetSelectedFilterTagIds()
        rootCategoryId = self.GetSelectedRootCategoryId()
        self.activeTagsByRootCategoryId[rootCategoryId] = tagIds
        offers = self.store.GetFilteredOffers(
            self.selectedCategoryId or rootCategoryId, tagIds)
        self.SetOffers(offers)

    def GetSelectedCategoryId(self):
        return self.selectedCategoryId

    def GetSelectedRootCategoryId(self):
        return self.selectedRootCategoryId

    def OnMouseWheel(self, dz):
        self.contentScroll.OnMouseWheel(dz)
コード例 #24
0
 def Layout(self):
     if self.skin.licensed:
         colorType = uiconst.COLORTYPE_UIHEADER
     else:
         colorType = uiconst.COLORTYPE_UIBASECONTRAST
     FillThemeColored(bgParent=self,
                      padLeft=self.SKIN_ICON_SIZE / 2,
                      colorType=colorType)
     self.iconGlow = Sprite(
         parent=self,
         align=uiconst.TOPLEFT,
         state=uiconst.UI_DISABLED,
         top=-5,
         width=self.SKIN_ICON_SIZE,
         height=self.SKIN_ICON_SIZE,
         texturePath='res:/UI/Texture/classes/skins/skin-icon-glow.png',
         opacity=0.0)
     Sprite(parent=self,
            align=uiconst.TOPLEFT,
            state=uiconst.UI_DISABLED,
            top=-5,
            width=self.SKIN_ICON_SIZE,
            height=self.SKIN_ICON_SIZE,
            texturePath=self.skin.iconTexturePath)
     self.iconShadow = Sprite(
         parent=self,
         align=uiconst.TOPLEFT,
         state=uiconst.UI_DISABLED,
         top=0,
         left=28,
         width=38,
         height=54,
         texturePath='res:/UI/Texture/classes/skins/icon-shadow.png')
     if self.skin.licensed:
         color = (0.9, 0.9, 0.9, 1.0)
         top = 6
     else:
         color = (0.4, 0.4, 0.4, 1.0)
         top = 4
     title = EveCaptionSmall(parent=self,
                             left=self.SKIN_ICON_SIZE + 6,
                             top=top,
                             text=self.skin.name,
                             color=color)
     title.SetRightAlphaFade(fadeEnd=ENTRY_DEFAULT_WIDTH - title.left - 4,
                             maxFadeWidth=12)
     if self.skin.licensed:
         duration = SkinDurationLabel(parent=self,
                                      left=self.SKIN_ICON_SIZE + 6,
                                      top=title.top + title.height,
                                      skin=self.skin)
         duration.SetRightAlphaFade(fadeEnd=ENTRY_DEFAULT_WIDTH -
                                    duration.left - 4,
                                    maxFadeWidth=12)
     else:
         buttonCont = FlowContainer(parent=self,
                                    align=uiconst.TOPLEFT,
                                    top=title.top + title.height + 2,
                                    left=self.SKIN_ICON_SIZE + 7,
                                    width=200,
                                    contentSpacing=(4, 0))
         SkinMaterialBuyButtonIsk(parent=buttonCont,
                                  align=uiconst.NOALIGN,
                                  typeID=self.controller.typeID,
                                  materialID=self.skin.materialID,
                                  logContext=self._logContext)
         SkinMaterialBuyButtonAur(parent=buttonCont,
                                  align=uiconst.NOALIGN,
                                  typeID=self.controller.typeID,
                                  materialID=self.skin.materialID,
                                  logContext=self._logContext)
     self.pendingIcon = Sprite(
         parent=self,
         align=uiconst.TOPLEFT,
         state=uiconst.UI_DISABLED,
         top=self.height / 2 - 16 / 2,
         left=ENTRY_DEFAULT_WIDTH + 2,
         width=16,
         height=16,
         texturePath='res:/UI/Texture/classes/skins/pending.png',
         opacity=0.0)
     animations.MorphScalar(self.pendingIcon,
                            'rotation',
                            startVal=0.0,
                            endVal=-2 * math.pi,
                            duration=1.0,
                            curveType=uiconst.ANIM_LINEAR,
                            loops=uiconst.ANIM_REPEAT)
     self.appliedIcon = Sprite(
         parent=self,
         align=uiconst.TOPLEFT,
         state=uiconst.UI_DISABLED,
         top=self.height / 2 - 16 / 2,
         left=ENTRY_DEFAULT_WIDTH + 2,
         width=16,
         height=16,
         texturePath='res:/UI/Texture/classes/skins/applied.png',
         opacity=0.0)
     self.previewedIcon = Sprite(
         parent=self,
         align=uiconst.TOPLEFT,
         state=uiconst.UI_DISABLED,
         top=self.height / 2 - 16 / 2,
         left=ENTRY_DEFAULT_WIDTH + 2,
         width=16,
         height=16,
         texturePath='res:/UI/Texture/classes/skins/previewed.png',
         opacity=0.0)
     self.stateIconLight = GradientThemeColored(
         parent=self,
         align=uiconst.TOALL,
         state=uiconst.UI_DISABLED,
         rotation=0,
         alphaData=[(0.0, 0.0), (0.25, 0.01), (0.5, 0.1), (0.6, 0.2),
                    (0.7, 0.4), (0.8, 0.8), (0.9, 1.0)],
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=0.0)
     if self.skin.licensed:
         colorType = uiconst.COLORTYPE_UIHILIGHT
     else:
         colorType = uiconst.COLORTYPE_UIHEADER
     self.selectionGradient = GradientThemeColored(
         parent=self,
         align=uiconst.TOALL,
         state=uiconst.UI_DISABLED,
         rotation=0,
         alphaData=[(0.0, 0.0), (0.9, 1.0)],
         colorType=colorType,
         opacity=0.0)
     self.blinkFill = FillThemeColored(
         bgParent=self,
         colorType=uiconst.COLORTYPE_UIHILIGHT,
         padLeft=self.SKIN_ICON_SIZE / 2,
         opacity=0.0)
コード例 #25
0
 def ApplyAttributes(self, attributes):
     FlowContainer.ApplyAttributes(self, attributes)
     self.typeID = attributes.get('typeID', None)
     if self.typeID is not None:
         self.LoadTypeRequirements(self.typeID)
コード例 #26
0
    def DrawRightSide(self):
        self.sr.rightside = uiprimitives.Container(name='rightside', parent=self.sr.main, align=uiconst.TOALL, pos=(0, 0, 0, 0))
        a = uiprimitives.Container(name='push', parent=self.sr.rightside, align=uiconst.TOTOP, height=6)
        self.sr.rightMainPanel = uiprimitives.Container(name='rightMainPanel', parent=self.sr.rightside, align=uiconst.TOALL, pos=(0, 0, 0, 0))
        topParent = uiprimitives.Container(parent=self.sr.rightMainPanel, align=uiconst.TOTOP, height=80)
        topLeftParent = uiprimitives.Container(parent=topParent, align=uiconst.TOLEFT, width=70)
        topRightParent = uiprimitives.Container(parent=topParent, align=uiconst.TOALL, pos=(0, 0, 0, 0))
        bottomParent = uiprimitives.Container(parent=self.sr.rightMainPanel, align=uiconst.TOALL, pos=(0, 0, 0, 0))
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TOTOP, height=const.defaultPadding)
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TOBOTTOM, height=const.defaultPadding)
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TOLEFT, width=const.defaultPadding)
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TORIGHT, width=const.defaultPadding)
        self.sr.shipIcon = uicontrols.Icon(parent=topParent, state=uiconst.UI_HIDDEN, size=64, left=const.defaultPadding, ignoreSize=True)
        self.sr.techicon = uiprimitives.Sprite(name='techIcon', parent=topParent, align=uiconst.RELATIVE, left=const.defaultPadding, width=16, height=16, idx=0)
        self.sr.dragIcon = dragIcon = FittingDraggableIcon(name='theicon', align=uiconst.TOPLEFT, parent=topParent, height=64, width=64, top=const.defaultPadding, left=const.defaultPadding)
        dragIcon.Startup(self.fitting)
        dragIcon.hint = localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/FittingIconHint')
        dragIcon.OnClick = self.ClickDragIcon
        dragIcon.state = uiconst.UI_NORMAL
        fittingNameContainer = uiprimitives.Container(parent=topRightParent, align=uiconst.TOTOP, height=20)
        self.sr.fittingName = uicontrols.SinglelineEdit(name='fittingName', parent=fittingNameContainer, align=uiconst.TOPLEFT, pos=(const.defaultPadding,
         1,
         120,
         0), maxLength=40)
        shipInfoContainer = uiprimitives.Container(parent=topRightParent, align=uiconst.TOTOP, height=20)
        self.sr.shipTypeName = uicontrols.EveLabelMedium(text='', parent=shipInfoContainer, align=uiconst.RELATIVE, state=uiconst.UI_NORMAL, left=const.defaultPadding)
        self.sr.infoicon = InfoIcon(parent=shipInfoContainer, left=1, top=0, idx=0, state=uiconst.UI_HIDDEN)
        self.sr.infoicon.OnClick = self.ShowInfo
        self.sr.radioButton = uiprimitives.Container(name='', parent=topRightParent, align=uiconst.TOPLEFT, height=50, width=100, top=fittingNameContainer.height + shipInfoContainer.height)
        radioBtns = []
        for cfgname, value, label, checked, group in [['fittingNone',
          session.charid,
          localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Personal'),
          self.ownerID == None,
          'ownership'], ['fittingOwnerCorporation',
          session.corpid,
          localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Corporation'),
          self.ownerID == session.corpid,
          'ownership']]:
            radioBtns.append(uicontrols.Checkbox(text=label, parent=self.sr.radioButton, configName=cfgname, retval=value, checked=checked, groupname=group, callback=None))

        self.sr.radioButtons = radioBtns
        self.sr.fittingDescription = uicls.EditPlainText(setvalue=None, parent=bottomParent, align=uiconst.TOALL, maxLength=400)
        self.sr.fittingInfo = uicontrols.Scroll(name='fittingInfoScroll', parent=bottomParent)
        tabs = [[localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Fittings'),
          self.sr.fittingInfo,
          self,
          None,
          self.sr.fittingInfo], [localization.GetByLabel('UI/Common/Description'),
          self.sr.fittingDescription,
          self,
          None,
          self.sr.fittingDescription]]
        self.fittingInfoTab = uicontrols.TabGroup(name='tabparent', parent=bottomParent, idx=0)
        self.fittingInfoTab.Startup(tabs, 'fittingInfoTab')
        self.sr.fittingInfo.Startup()
        saveDeleteButtons = FlowContainer(name='buttonParent', parent=self.sr.rightside, align=uiconst.TOBOTTOM, padding=6, autoHeight=True, centerContent=True, contentSpacing=uiconst.BUTTONGROUPMARGIN, idx=0)
        self.fitBtn = Button(parent=saveDeleteButtons, label=localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Fit'), func=self.Fit, align=uiconst.NOALIGN)
        self.saveBtn = Button(parent=saveDeleteButtons, label=localization.GetByLabel('UI/Common/Buttons/Save'), func=self.Save, align=uiconst.NOALIGN)
        self.deleteBtn = Button(parent=saveDeleteButtons, label=localization.GetByLabel('UI/Common/Buttons/Delete'), func=self.Delete, align=uiconst.NOALIGN)
        if boot.region != 'optic':
            self.exportBtn = Button(parent=saveDeleteButtons, label=localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/ExportToClipboard'), func=self.ExportFittingToClipboard, align=uiconst.NOALIGN)
            self.exportBtn.hint = localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/ExportToClipboardHint')
コード例 #27
0
 def __init__(self, incrementSize = 4, **kwargs):
     FlowContainer.__init__(self, **kwargs)
     self.offers = []
     self.index = 0
     self.incrementSize = incrementSize
     self.onUpdate = signals.Signal()
コード例 #28
0
 def __init__(self, incrementSize=4, **kwargs):
     FlowContainer.__init__(self, **kwargs)
     self.offers = []
     self.index = 0
     self.incrementSize = incrementSize
     self.onUpdate = Signal()
コード例 #29
0
 def Layout(self):
     """
     Setup UI controls for this window.
     """
     self.HideHeader()
     self.MakeUnResizeable()
     self.container = ContainerAutoSize(parent=self.GetMainArea(),
                                        align=uiconst.TOTOP,
                                        alignMode=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        callback=self.OnContainerResized)
     headerCont = ContainerAutoSize(parent=self.container,
                                    align=uiconst.TOTOP)
     EveCaptionMedium(parent=headerCont,
                      align=uiconst.CENTERTOP,
                      text=localization.GetByLabel('UI/TrialUpsell/Header'),
                      padding=(0, 8, 0, 4))
     LineUnderlay(parent=self.container,
                  align=uiconst.TOTOP,
                  padding=(2, 0, 2, 0))
     bodyCont = ContainerAutoSize(parent=self.container,
                                  align=uiconst.TOTOP,
                                  alignMode=uiconst.TOTOP)
     mainCont = ContainerAutoSize(parent=bodyCont,
                                  align=uiconst.TOTOP,
                                  alignMode=uiconst.TOTOP)
     GradientSprite(bgParent=bodyCont,
                    rgbData=[(0, (0.138, 0.138, 0.08)),
                             (0.6, (0.06, 0.06, 0.06)),
                             (1.0, (0.1, 0.1, 0.1))],
                    alphaData=[(0.0, 0.8), (1.0, 0.2)],
                    alphaInterp=GradientConst.INTERP_LINEAR,
                    colorInterp=GradientConst.INTERP_LINEAR,
                    rotation=-math.pi / 2,
                    padding=(2, 0, 2, 2))
     EveLabelLarge(parent=mainCont,
                   align=uiconst.TOTOP,
                   text=localization.GetByLabel('UI/TrialUpsell/Greeting'),
                   padding=(160, 18, 20, 8))
     EveLabelLarge(parent=mainCont,
                   align=uiconst.TOTOP,
                   text=self.message
                   or localization.GetByLabel('UI/TrialUpsell/DefaultBody'),
                   padding=(160, 0, 20, 8))
     EveLabelLarge(parent=mainCont,
                   align=uiconst.TOTOP,
                   text=localization.GetByLabel('UI/TrialUpsell/Footer'),
                   padding=(160, 0, 20, 16))
     trialDays = sm.RemoteSvc('userSvc').GetTrialDaysRemaining()
     EveLabelLarge(parent=mainCont,
                   align=uiconst.TOTOP,
                   text=localization.GetByLabel(
                       'UI/TrialUpsell/TrialTimeLeft',
                       daysLeft=trialDays.daysLeft,
                       daysTotal=trialDays.trialLen),
                   color=(0.8, 0.6, 0.2, 0.8),
                   padding=(160, 0, 20, 8))
     self.iconGlow = Sprite(
         parent=mainCont,
         align=uiconst.CENTERLEFT,
         state=uiconst.UI_DISABLED,
         texturePath=
         'res:/UI/Texture/classes/Monetization/Trial_Icon_Glow_256.png',
         left=-20,
         width=200,
         height=200)
     Sprite(
         parent=mainCont,
         align=uiconst.CENTERLEFT,
         state=uiconst.UI_DISABLED,
         texturePath=
         'res:/UI/Texture/classes/Monetization/Trial_Icon_NoGlow_256.png',
         left=-20,
         width=200,
         height=200)
     self.iconGlare1 = Sprite(
         parent=mainCont,
         align=uiconst.CENTERLEFT,
         state=uiconst.UI_DISABLED,
         texturePath='res:/UI/Texture/classes/Monetization/glare_256_1.png',
         textureSecondaryPath=
         'res:/UI/Texture/classes/Monetization/Trial_Icon_NoGlow_256.png',
         spriteEffect=trinity.TR2_SFX_MODULATE,
         blendMode=trinity.TR2_SBM_ADDX2,
         left=-20,
         width=200,
         height=200,
         tileX=True,
         tileY=True)
     self.iconGlare2 = Sprite(
         parent=mainCont,
         align=uiconst.CENTERLEFT,
         state=uiconst.UI_DISABLED,
         texturePath='res:/UI/Texture/classes/Monetization/glare_256_2.png',
         textureSecondaryPath=
         'res:/UI/Texture/classes/Monetization/Trial_Icon_NoGlow_256.png',
         spriteEffect=trinity.TR2_SFX_MODULATE,
         left=-20,
         width=200,
         height=200,
         tileX=True,
         tileY=True)
     buttonCont = FlowContainer(parent=bodyCont,
                                align=uiconst.TOTOP,
                                centerContent=True,
                                contentSpacing=(4, 4),
                                padding=(8, 16, 8, 16))
     closeButton = Button(
         parent=buttonCont,
         align=uiconst.NOALIGN,
         fixedheight=26,
         label=localization.GetByLabel('UI/TrialUpsell/ButtonClose'),
         fontsize=12,
         func=lambda _: self.Close(),
         color=(0.2, 0.2, 0.2, 1.0))
     closeButton.sr.activeframe.SetFixedColor((0.6, 0.6, 0.6, 1.0))
     moreButton = Button(
         parent=buttonCont,
         align=uiconst.NOALIGN,
         fixedheight=26,
         label=localization.GetByLabel('UI/TrialUpsell/ButtonSubscribe'),
         fontsize=14,
         func=lambda _: self.OpenSubscriptionPage(),
         color=(0.8, 0.6, 0.2, 0.6))
     moreButton.sr.activeframe.SetFixedColor((0.9, 0.9, 0.9, 1.0))
     self.Animate()
コード例 #30
0
 def Layout(self):
     self.compactMode = False
     Frame(bgParent=self,
           texturePath='res:/UI/Texture/classes/Monetization/vignette.png',
           cornerSize=150)
     self.characters = Sprite(
         parent=self,
         align=uiconst.CENTER,
         state=uiconst.UI_DISABLED,
         left=self.CHARACTERS_LEFT,
         top=10,
         texturePath='res:/UI/Texture/classes/Monetization/characters.png',
         width=299,
         height=355)
     self.content = ContainerAutoSize(parent=self,
                                      align=uiconst.CENTER,
                                      left=self.CONTENT_LEFT,
                                      width=340)
     EveCaptionLarge(
         parent=self.content,
         align=uiconst.TOTOP,
         text=localization.GetByLabel(
             'UI/SkillQueue/MultiTrainingOverlay/MultiplePilotTraining'))
     EveLabelMedium(
         parent=self.content,
         align=uiconst.TOTOP,
         top=4,
         text=localization.GetByLabel(
             'UI/SkillQueue/MultiTrainingOverlay/MultiTrainingMessageTop'))
     itemCont = ContainerAutoSize(parent=self.content,
                                  align=uiconst.TOTOP,
                                  alignMode=uiconst.TOTOP,
                                  top=12)
     Frame(bgParent=itemCont,
           texturePath=
           'res:/UI/Texture/classes/Monetization/item_well_frame.png',
           cornerSize=2)
     itemIconCont = ContainerAutoSize(parent=itemCont,
                                      align=uiconst.TOLEFT,
                                      padding=(8, 8, 0, 8))
     Icon(parent=itemIconCont,
          align=uiconst.TOPLEFT,
          state=uiconst.UI_DISABLED,
          size=64,
          typeID=typeMultiTrainingToken)
     Sprite(parent=itemIconCont,
            align=uiconst.TOPLEFT,
            state=uiconst.UI_DISABLED,
            texturePath='res:/UI/Texture/classes/InvItem/bgNormal.png',
            width=64,
            height=64)
     EveLabelLargeBold(parent=itemCont,
                       align=uiconst.TOTOP,
                       padding=(8, 8, 24, 0),
                       text=evetypes.GetName(typeMultiTrainingToken))
     InfoIcon(parent=itemCont,
              align=uiconst.TOPRIGHT,
              top=8,
              left=8,
              typeID=typeMultiTrainingToken)
     self.estimatePriceLabel = EveLabelMedium(parent=itemCont,
                                              align=uiconst.TOTOP,
                                              padding=(8, 0, 8, 6),
                                              color=Color.GRAY5)
     buyButtonCont = FlowContainer(parent=itemCont,
                                   align=uiconst.TOTOP,
                                   padding=(8, 0, 8, 8),
                                   contentSpacing=(8, 0))
     MultiTrainingBuyButtonIsk(parent=buyButtonCont,
                               align=uiconst.NOALIGN,
                               typeID=typeMultiTrainingToken)
     MultiTrainingBuyButtonAur(parent=buyButtonCont,
                               align=uiconst.NOALIGN,
                               types=[typeMultiTrainingToken])
     EveLabelMedium(
         parent=self.content,
         align=uiconst.TOTOP,
         top=12,
         text=localization.GetByLabel(
             'UI/SkillQueue/MultiTrainingOverlay/MultiTrainingMessageBottom'
         ))
     dismissCont = FlowContainer(parent=self.content,
                                 align=uiconst.TOTOP,
                                 padding=(8, 24, 8, 0),
                                 contentAlignment=CONTENT_ALIGN_CENTER,
                                 contentSpacing=(8, 4))
     Button(parent=dismissCont,
            align=uiconst.NOALIGN,
            label=localization.GetByLabel(
                'UI/SkillQueue/MultiTrainingOverlay/Dismiss'),
            func=lambda *args: self.Dismiss())
     self.suppressCheckbox = Checkbox(
         parent=dismissCont,
         align=uiconst.NOALIGN,
         width=200,
         text=localization.GetByLabel('UI/Common/SuppressionShowMessage'),
         checked=self.suppressed,
         callback=self.OnSuppressChanged)
コード例 #31
0
class Lobby(Window):
    __guid__ = 'form.Lobby'
    __notifyevents__ = ['OnCharNowInStation',
     'OnCharNoLongerInStation',
     'OnProcessStationServiceItemChange',
     'OnAgentMissionChange',
     'OnStandingSet',
     'OnCorporationChanged',
     'OnCorporationMemberChanged',
     'OnPrimaryViewChanged',
     'OnSetDevice']
    default_windowID = 'lobby'
    default_top = 16
    default_width = 223
    default_captionLabelPath = 'UI/Station/StationServices'
    default_pinned = True
    selectedGroupButtonID = None

    @staticmethod
    def default_height(*args):
        return uicore.desktop.height - 100

    @staticmethod
    def default_left(*args):
        return uicore.desktop.width - Lobby.default_width - 16

    def OnPrimaryViewChanged(self, oldViewInfo, newViewInfo):
        """
        Since the view states happen so late in all transitions we
        need to rehook the function and label to the station mode button.
        """
        self.UpdateCQButton(newViewInfo.name)

    def OnSetDevice(self):
        bottom = self.top + self.height
        if bottom > uicore.desktop.height:
            self.height = max(self.default_minSize[1], uicore.desktop.height - self.top)
        right = self.left + self.width
        if right > uicore.desktop.width:
            self.width = max(self.default_minSize[0], uicore.desktop.width - self.left)

    def ApplyAttributes(self, attributes):
        self.viewState = sm.GetService('viewState')
        if not settings.user.ui.Get('stationservicebtns', 1):
            minWidth = BIGBUTTONSIZE + (BIGBUTTONSIZE + BUTTONGAP) * 3 + 14
            minHeight = 495
        else:
            minWidth = SMALLBUTTONSIZE + (SMALLBUTTONSIZE + BUTTONGAP) * 5 + 10
            minHeight = 470
        self.default_minSize = (minWidth, minHeight)
        Window.ApplyAttributes(self, attributes)
        self.stationSvc = sm.GetService('station')
        self.guestScroll = None
        self.sr.serviceAccessCache = {}
        self.SetWndIcon(None)
        self.HideHeader()
        self.scope = 'station'
        self.MakeUnKillable()
        self.MakeUnstackable()
        self.SetTopparentHeight(0)
        main = self.sr.main
        main.clipChildren = True
        self.corpLogoParent = Container(name='corpLogoParent', align=uiconst.TOTOP, height=160, parent=main)
        self.corpName = CaptionLabel(parent=main, align=uiconst.TOTOP, name='corpName', uppercase=False)
        self.undockparent = Container(name='undockparent', align=uiconst.TOTOP, height=78, parent=main)
        self.AddCQButton(parent=self.undockparent)
        self.AddUndockButton(parent=self.undockparent)
        EveLabelMedium(text=localization.GetByLabel('UI/Station/StationServices'), align=uiconst.TOTOP, parent=main, bold=True, padding=(6, 6, 6, 0))
        self.serviceButtons = FlowContainer(name='serviceButtons', align=uiconst.TOTOP, parent=main, contentSpacing=(BUTTONGAP, BUTTONGAP), padding=(6, 6, 3, 6))
        btnGroup = ToggleButtonGroup(name='btnGroup', parent=main, align=uiconst.TOTOP, height=32, padding=(6, 6, 6, 6), idx=-1, callback=self.OnButtonGroupSelection)
        self.mainButtonGroup = btnGroup
        self.guestsPanel = Container(name=GUESTSPANEL, parent=main, padding=const.defaultPadding)
        self.quickFilter = QuickFilterEdit(name='quickFilterEdit', parent=self.guestsPanel)
        self.quickFilter.ReloadFunction = lambda : self.ShowGuests()
        self.guestScroll = BasicDynamicScroll(parent=self.guestsPanel, padTop=const.defaultPadding + self.quickFilter.height)
        guestSettingsMenu = UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=self.guestsPanel, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/SettingsCogwheel.png', width=18, height=18, iconSize=18)
        self.userType = settings.user.ui.Get('guestCondensedUserList', False)
        self.agentsPanel = Container(name=AGENTSPANEL, parent=main, padding=const.defaultPadding)
        self.agentFinderBtn = Button(label=localization.GetByLabel('UI/AgentFinder/AgentFinder'), parent=self.agentsPanel, align=uiconst.CENTERTOP, func=uicore.cmd.OpenAgentFinder)
        self.agentScroll = Scroll(parent=self.agentsPanel, padTop=const.defaultPadding + self.agentFinderBtn.height)
        self.officesPanel = Container(name=OFFICESPANEL, parent=main, padding=const.defaultPadding)
        self.officesButtons = FlowContainer(name='officesButtons', align=uiconst.TOTOP, parent=self.officesPanel, contentSpacing=(4, 4), centerContent=True)
        self.officesScroll = Scroll(parent=self.officesPanel, padTop=const.defaultPadding)
        agentsButton = btnGroup.AddButton(AGENTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Agents'), self.agentsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/AgentsTab_descrtiption'))
        agentsButton.name = 'stationInformationTabAgents'
        guestsButton = btnGroup.AddButton(GUESTSPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Guests'), self.guestsPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/GuestsTab_description'))
        guestsButton.counter = CounterBox(parent=guestsButton, align=uiconst.TOPRIGHT, left=2, top=-5)
        self.guestsButton = guestsButton
        btnGroup.AddButton(OFFICESPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Offices'), self.officesPanel, btnClass=LobbyToggleButtonGroupButton, hint=localization.GetByLabel('Tooltips/StationServices/OfficesTab_description'))
        activePanel = settings.user.ui.Get('stationsLobbyTabs', AGENTSPANEL)
        if settings.char.windows.Get('dockshipsanditems', 0):
            self.inventoryPanel = Container(name=INVENTORYPANEL, parent=main)
            self.sr.shipsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding)
            self.sr.itemsContainer = Container(parent=self.inventoryPanel, state=uiconst.UI_HIDDEN, padding=const.defaultPadding)
            tabs = [[localization.GetByLabel('UI/Station/Ships'),
              self.sr.shipsContainer,
              self,
              'lobby_ships'], [localization.GetByLabel('UI/Station/Items'),
              self.sr.itemsContainer,
              self,
              'lobby_items']]
            self.inventoryTabs = TabGroup(name='inventoryPanel', parent=self.inventoryPanel, idx=0)
            self.inventoryTabs.Startup(tabs, 'lobbyInventoryPanel', autoselecttab=True, UIIDPrefix='lobbyInventoryPanelTab')
            self.invButton = btnGroup.AddButton(INVENTORYPANEL, '<center>' + localization.GetByLabel('UI/Station/Lobby/Hangars'), self.inventoryPanel, btnClass=LobbyToggleButtonGroupButton, hint='<b>%s</b><br>%s' % (localization.GetByLabel('Tooltips/StationServices/Hangars'), localization.GetByLabel('Tooltips/StationServices/Hangars_description')))
        elif activePanel == INVENTORYPANEL:
            activePanel = AGENTSPANEL
        btnGroup.SelectByID(activePanel)
        myDefaultView = 'hangar' if session.userid % 2 == 1 else 'station'
        curView = collections.namedtuple('FakeViewInfo', ['name'])(settings.user.ui.Get('defaultDockingView', myDefaultView))
        self.OnPrimaryViewChanged(curView, curView)
        self.LoadOwnerInfo()
        self.LoadServiceButtons()
        if self.destroyed:
            return
        sm.RegisterNotify(self)
        self.UpdateGuestTabText()

    def OnButtonGroupSelection(self, buttonID):
        settings.user.ui.Set('stationsLobbyTabs', buttonID)
        self.selectedGroupButtonID = buttonID
        if buttonID == AGENTSPANEL:
            self.ShowAgents()
        elif buttonID == GUESTSPANEL:
            self.ShowGuests()
        elif buttonID == OFFICESPANEL:
            self.ShowOffices()
        elif buttonID == INVENTORYPANEL:
            if not len(self.sr.shipsContainer.children):
                self.LayoutShipsAndItems()

    def SettingMenu(self, menuParent):
        showCompact = settings.user.ui.Get('guestCondensedUserList', False)
        menuParent.AddCheckBox(text=localization.GetByLabel('UI/Chat/ShowCompactMemberList'), checked=bool(showCompact), callback=(self.ShowGuests, not showCompact))

    def AddCQButton(self, parent):
        """
        Creates the undock button at the bottom of the lobby
        """
        scale = 1.0
        self.cqCont = Container(name='cqCont', align=uiconst.TOLEFT_PROP, width=0.5, parent=parent, state=uiconst.UI_PICKCHILDREN, padding=3)
        width = 63 * scale
        height = 34 * scale
        self.cqSpriteCont = Container(name='cq', align=uiconst.CENTERTOP, width=width, height=height, top=3, parent=self.cqCont, state=uiconst.UI_NORMAL)
        self.cqSprites = []
        spacing = 30 * scale
        for i in xrange(3):
            s = Sprite(parent=self.cqSpriteCont, texturePath='res:/UI/Texture/classes/Lobby/{0}.png'.format(i + 1), align=uiconst.CENTERTOP, width=-width, height=height, left=0, state=uiconst.UI_DISABLED)
            s.color = COLOR_CQ
            self.cqSprites.insert(0, s)

        self.cqLabel = EveLabelMedium(parent=self.cqCont, align=uiconst.CENTERTOP, top=8 + height, width=100)
        self.UpdateCQButton()
        if gfxsettings.Get(gfxsettings.MISC_LOAD_STATION_ENV):
            self.cqSpriteCont.OnClick = self.OnCQClicked
            self.cqSpriteCont.OnMouseEnter = self.OnCQMouseEnter
            self.cqSpriteCont.OnMouseExit = self.OnCQMouseExit
        else:
            self.cqSpriteCont.hint = localization.GetByLabel('UI/Station/CannotEnterCaptainsQuarters')
            for s in self.cqSprites:
                s.opacity = 0.2

    def OnCQClicked(self, *args):
        self.OnCQMouseExit()
        for i, s in enumerate(self.cqSprites):
            uicore.animations.SpGlowFadeIn(s, glowColor=(0.8, 0.8, 0.1, 0.3), glowExpand=1, loops=1, duration=1.0, curveType=uiconst.ANIM_WAVE, timeOffset=(3 - i) * 0.1)

        if self.IsInCQ():
            self.EnterHangar()
        else:
            self.EnterCQ()

    def OnCQMouseEnter(self, *args):
        self.AnimateCQSprites((0.8, 1, 1))

    def OnCQMouseExit(self, *args):
        self.AnimateCQSprites(COLOR_CQ[:3])

    def AnimateCQSprites(self, endColor):
        for i, s in enumerate(self.cqSprites):
            uicore.animations.SpColorMorphTo(s, startColor=(s.color.r, s.color.g, s.color.b), endColor=endColor, duration=0.1)

    def UpdateCQButton(self, viewName = None):
        isInCQ = False
        if viewName is not None:
            isInCQ = viewName == 'station'
        else:
            isInCQ = self.IsInCQ()
        if isInCQ:
            self.cqLabel.text = '<center>' + localization.GetByLabel('UI/Commands/EnterHangar') + '</center>'
        else:
            self.cqLabel.text = '<center>' + localization.GetByLabel('UI/Commands/EnterCQ') + '</center>'
        self.cqCont.height = self.cqLabel.height + self.cqSpriteCont.height + 6

    def IsInCQ(self):
        viewStateSvc = sm.GetService('viewState')
        currentView = viewStateSvc.GetCurrentView()
        if currentView is not None and currentView.name == 'station':
            return True
        else:
            return False

    def AddUndockButton(self, parent):
        """
        Creates the undock button at the bottom of the lobby
        """
        scale = 1.0
        self.undockCont = Container(name='undockCont', align=uiconst.TORIGHT_PROP, width=0.5, parent=parent, state=uiconst.UI_PICKCHILDREN, padding=3)
        width = 63 * scale
        height = 34 * scale
        self.undockSpriteCont = Container(name='undock', align=uiconst.CENTERTOP, width=width, height=height, top=3, parent=self.undockCont, state=uiconst.UI_NORMAL)
        self.undockSprites = []
        spacing = 30 * scale
        for i in xrange(3):
            s = Sprite(parent=self.undockSpriteCont, texturePath='res:/UI/Texture/classes/Lobby/{0}.png'.format(i + 1), align=uiconst.CENTERTOP, width=width, height=height, left=0, state=uiconst.UI_DISABLED)
            s.color = COLOR_UNDOCK
            self.undockSprites.append(s)

        self.undockLabel = EveLabelMedium(parent=self.undockCont, align=uiconst.CENTERTOP, top=8 + height, width=100)
        self.UpdateUndockButton()
        self.undockCont.height = self.undockLabel.height + height + 6
        self.undockSpriteCont.OnClick = self.OnUndockClicked
        self.undockSpriteCont.OnMouseEnter = self.OnUndockMouseEnter
        self.undockSpriteCont.OnMouseExit = self.OnUndockMouseExit

    def OnUndockClicked(self, *args):
        if sm.GetService('station').PastUndockPointOfNoReturn():
            return
        uthread.new(self.AttemptToUndock).context = 'UndockButtonThread'

    def LockCQButton(self):
        self.cqCont.opacity = 0.5
        self.cqCont.state = uiconst.UI_DISABLED

    def UnlockCQButton(self):
        self.cqCont.opacity = 1.0
        self.cqCont.state = uiconst.UI_NORMAL

    def AttemptToUndock(self):
        exiting = sm.GetService('station').Exit()
        if exiting:
            self.LockCQButton()

    def OnUndockMouseEnter(self, *args):
        self.AnimateUndockSprites((1, 1, 0.8))

    def OnUndockMouseExit(self, *args):
        self.AnimateUndockSprites(COLOR_UNDOCK[:3])

    def AnimateUndockSprites(self, endColor):
        if sm.GetService('station').PastUndockPointOfNoReturn():
            return
        for i, s in enumerate(self.undockSprites):
            uicore.animations.SpColorMorphTo(s, startColor=(s.color.r, s.color.g, s.color.b), endColor=endColor, duration=0.1)

    def SetUndockProgress(self, undockProgress):
        if undockProgress is None:
            self.UpdateUndockButton()
            return
        i = int(undockProgress * 3)
        if i < 3:
            self.UpdateUndockButton()
            uicore.animations.SpGlowFadeIn(self.undockSprites[i], glowColor=(1.0, 1.0, 0.8, 0.2), glowExpand=1, loops=1, duration=0.2)
        else:
            self.undockLabel.text = '<center>' + localization.GetByLabel('UI/Station/UndockingConfirmed') + '</center>'
            for i, s in enumerate(self.undockSprites):
                uicore.animations.StopAllAnimations(s)
                s.glowColor = (0, 0, 0, 0)
                uicore.animations.SpColorMorphTo(s, startColor=(1, 0.8, 0), endColor=(1, 0, 0), loops=1000, duration=1, curveType=uiconst.ANIM_WAVE, timeOffset=i * 0.1 - 0.5, includeAlpha=False)
                uicore.animations.SpGlowFadeIn(s, glowColor=(1.0, 1.0, 0.8, 0.2), glowExpand=1, loops=1000, duration=1, curveType=uiconst.ANIM_WAVE, timeOffset=i * 0.1)

    def UpdateUndockButton(self):
        if self.stationSvc.exitingstation:
            self.undockLabel.text = '<center>' + localization.GetByLabel('UI/Station/AbortUndock') + '</center>'
            self.LockCQButton()
        else:
            self.undockLabel.text = '<center>' + localization.GetByLabel('UI/Neocom/UndockBtn') + '</center>'
            self.UnlockCQButton()

    def EnterCQ(self, *args):
        if self.viewState.HasActiveTransition():
            return
        sm.GetService('cmd').CmdEnterCQ()

    def EnterHangar(self, *args):
        if self.viewState.HasActiveTransition():
            return
        sm.GetService('cmd').CmdEnterHangar()

    def OnScale_(self, *args):
        return
        height = 0
        for each in self.sr.main.children:
            if each.align in (uiconst.TOTOP, uiconst.TOBOTTOM):
                height += each.padTop + each.height + each.padBottom

        height += 160
        self.SetMinSize([self.minsize[0], height])

    def LayoutShipsAndItems(self):
        self.sr.itemsContainer.Flush()
        itemsContainer = invCont.StationItems(name='stationItems', parent=self.sr.itemsContainer, showControls=True, state=uiconst.UI_NORMAL)
        self.sr.shipsContainer.Flush()
        shipsContainer = invCont.StationShips(name='stationShips', parent=self.sr.shipsContainer, showControls=True, state=uiconst.UI_NORMAL)
        self.invButton.OnDropData = itemsContainer.OnDropData
        self.sr.itemsContainer.OnDropData = itemsContainer.OnDropData
        self.sr.shipsContainer.OnDropData = shipsContainer.OnDropData

    def OnProcessStationServiceItemChange(self, stationID, solarSystemID, serviceID, stationServiceItemID, isEnabled):
        if self.destroyed or stationID != eve.session.stationid:
            return
        for icon in self.serviceButtons.children:
            if hasattr(icon, 'stationServiceIDs') and serviceID in icon.stationServiceIDs:
                self.SetServiceButtonState(icon, [serviceID])

    def OnAgentMissionChange(self, actionID, agentID, tutorialID = None):
        """
        When a mission is declined or completed, that might change which agents
        are available, so update that portion of the lobby if it is displayed.
        """
        if self.selectedGroupButtonID == AGENTSPANEL:
            self.ShowAgents()

    def OnCorporationChanged(self, corpID, change):
        blue.pyos.synchro.Yield()
        self.LoadButtons()

    def OnStandingSet(self, fromID, toID, rank):
        """
        Notification that a standing has been set directly (probably from the
        debug admin window).  Might need to update agent availability.
        """
        if self.selectedGroupButtonID == AGENTSPANEL:
            self.ShowAgents()

    def SetServiceButtonState(self, button, serviceIDs):
        for serviceID in serviceIDs:
            currentstate = sm.GetService('station').GetServiceState(serviceID)
            if currentstate is not None:
                if self.sr.serviceAccessCache.has_key(serviceID):
                    del self.sr.serviceAccessCache[serviceID]
                if not currentstate.isEnabled:
                    button.Disable()
                    button.serviceStatus = localization.GetByLabel('UI/Station/Lobby/Disabled')
                    button.serviceEnabled = False
                else:
                    button.Enable()
                    button.serviceStatus = localization.GetByLabel('UI/Station/Lobby/Enabled')
                    button.serviceEnabled = True

    def LoadServiceButtons(self):
        parent = self.serviceButtons
        parent.Flush()
        services = sm.GetService('station').GetStationServiceInfo()
        serviceMask = eve.stationItem.serviceMask
        icon = None
        stationservicebtns = settings.user.ui.Get('stationservicebtns', 1)
        btnsize = BIGBUTTONSIZE
        if stationservicebtns:
            btnsize = SMALLBUTTONSIZE
        haveServices = []
        for service in services:
            hasStationService = False
            combinedServiceMask = sum(service.serviceIDs)
            if serviceMask & combinedServiceMask > 0:
                hasStationService = True
                if service.name == 'navyoffices':
                    if not sm.GetService('facwar').CheckStationElegibleForMilitia():
                        hasStationService = False
                elif service.name == 'securityoffice':
                    if not sm.GetService('securityOfficeSvc').CanAccessServiceInStation(session.stationid2):
                        hasStationService = False
            if hasStationService or -1 in service.serviceIDs:
                haveServices.append(service)

        for service in reversed(haveServices):
            button = BigButton(parent=parent, width=btnsize, height=btnsize, name=service.name, align=uiconst.NOALIGN)
            button.Startup(btnsize, btnsize, iconOpacity=0.75)
            button.cmdStr = service.command
            button.stationServiceIDs = service.serviceIDs
            button.displayName = service.label
            button.OnClick = (self.OnSvcBtnClick, button)
            button.serviceStatus = localization.GetByLabel('UI/Station/Lobby/Enabled')
            button.serviceEnabled = True
            if hasattr(service, 'iconID'):
                button.SetTexturePath(service.iconID)
            else:
                button.SetTexturePath(service.texturePath)
            self.SetServiceButtonState(button, service.serviceIDs)
            button.LoadTooltipPanel = self.LoadServiceButtonTooltipPanel

    def LoadServiceButtonTooltipPanel(self, tooltipPanel, tooltipOwner, *args):
        tooltipPanel.LoadGeneric3ColumnTemplate()
        command = uicore.cmd.commandMap.GetCommandByName(tooltipOwner.cmdStr)
        tooltipPanel.AddCommandTooltip(command)
        if not tooltipOwner.serviceEnabled:
            tooltipPanel.AddLabelMedium(text=localization.GetByLabel('UI/Station/Lobby/Disabled'), color=(1, 0, 0, 1), bold=True, colSpan=tooltipPanel.columns)

    def OnSvcBtnClick(self, btn, *args):
        self.CheckCanAccessService(btn.name)
        sm.GetService('station').LoadSvc(btn.name)

    def CheckCanAccessService(self, serviceName):
        services = sm.GetService('station').GetStationServiceInfo()
        for service in services:
            if service.name == serviceName:
                corpStationMgr = None
                now = blue.os.GetWallclockTime()
                for stationServiceID in service.serviceIDs:
                    doCheck = 1
                    time, result = (None, None)
                    if self.sr.serviceAccessCache.has_key(stationServiceID):
                        time, result = self.sr.serviceAccessCache[stationServiceID]
                        if time + const.MIN * 5 > now:
                            doCheck = 0
                    if doCheck:
                        if corpStationMgr is None:
                            corpStationMgr = sm.GetService('corp').GetCorpStationManager()
                        try:
                            corpStationMgr.DoStandingCheckForStationService(stationServiceID)
                            self.sr.serviceAccessCache[stationServiceID] = (now, None)
                        except Exception as e:
                            self.sr.serviceAccessCache[stationServiceID] = (now, e)
                            sys.exc_clear()

                    time, result = self.sr.serviceAccessCache[stationServiceID]
                    if result is not None:
                        raise result

    def LoadButtons(self):
        if self.destroyed:
            return
        btns = []
        officeExists = sm.GetService('corp').GetOffice() is not None
        canRent = session.corprole & const.corpRoleCanRentOffice == const.corpRoleCanRentOffice
        canMove = session.corprole & const.corpRoleDirector == const.corpRoleDirector
        if canRent and not officeExists:
            rentLabel = localization.GetByLabel('UI/Station/Lobby/RentOffice')
            btns.append([rentLabel, self.RentOffice, None])
        if canMove and officeExists:
            btns.append([localization.GetByLabel('UI/Station/Hangar/UnrentOffice'), self.UnrentOffice, None])
        if canMove:
            isHQHere = sm.GetService('corp').GetCorporation().stationID == session.stationid2
            if not isHQHere:
                hqLabel = localization.GetByLabel('UI/Station/Lobby/MoveHeadquartersHere')
                btns.append([hqLabel, self.SetHQ, None])
            if not officeExists and sm.GetService('corp').HasCorpImpoundedItemsAtStation():
                btns.append([localization.GetByLabel('UI/Inventory/ReleaseItems'), self.ReleaseImpoundedItems, None])
        if sm.GetService('corp').DoesCharactersCorpOwnThisStation():
            mgmtLabel = localization.GetByLabel('UI/Station/Lobby/StationManagement')
            btns.append([mgmtLabel, self.OpenStationManagement, None])
        if self.destroyed:
            return
        self.officesButtons.Flush()
        for label, func, args in btns:
            Button(parent=self.officesButtons, label=label, func=func, args=args, align=uiconst.NOALIGN)

    def ReleaseImpoundedItems(self, *args):
        corpStationMgr = sm.GetService('corp').GetCorpStationManager()
        cost = corpStationMgr.GetQuoteForGettingCorpJunkBack()
        if eve.Message('CrpJunkAcceptCost', {'cost': FmtAmt(cost)}, uiconst.YESNO) != uiconst.ID_YES:
            return
        corpStationMgr.PayForReturnOfCorpJunk(cost)
        sm.GetService('corp').hasImpoundedItemsCacheTime = None
        self.LoadButtons()

    def UnrentOffice(self, *args):
        items = invCtrl.StationCorpHangar(divisionID=None).GetItems()
        asked = False
        if len([ item for item in items if item.ownerID == session.corpid ]):
            asked = True
            if eve.Message('crpUnrentOfficeWithContent', {}, uiconst.YESNO) != uiconst.ID_YES:
                return
        if not asked:
            if eve.Message('crpUnrentOffice', {}, uiconst.YESNO) != uiconst.ID_YES:
                return
        corpStationMgr = sm.GetService('corp').GetCorpStationManager()
        sm.GetService('corp').hasImpoundedItemsCacheTime = None
        corpStationMgr.CancelRentOfOffice()

    def OpenStationManagement(self, *args):
        uthread.new(uicore.cmd.OpenStationManagement)

    def LoadOwnerInfo(self):
        parent = self.corpLogoParent
        parent.Flush()
        corpID = eve.stationItem.ownerID
        size = 128 if CheckCorpID(corpID) else 64
        logo = GetLogoIcon(itemID=corpID, parent=parent, acceptNone=False, state=uiconst.UI_DISABLED, pos=(0,
         8,
         size,
         size), align=uiconst.CENTERTOP)
        InfoIcon(typeID=const.typeCorporation, itemID=corpID, left=const.defaultPadding, top=20, align=uiconst.TOPRIGHT, parent=parent, idx=0)
        self.corpLogoParent.height = logo.top + logo.height
        if not CheckCorpID(corpID):
            self.corpName.text = '<center>' + cfg.eveowners.Get(corpID).name
            self.corpName.display = True
        else:
            self.corpName.display = False

    def ImVisible(self):
        return bool(self.state != uiconst.UI_HIDDEN and not self.IsCollapsed() and not self.IsMinimized())

    def Load(self, key):
        pass

    @telemetry.ZONE_METHOD
    def OnCharNowInStation(self, rec):
        if self.destroyed or not session.stationid2:
            return
        self.UpdateGuestTabText()
        if self.selectedGroupButtonID == GUESTSPANEL:
            charID, corpID, allianceID, warFactionID = rec
            cfg.eveowners.Prime([charID])
            if self.destroyed:
                return
            newcharinfo = cfg.eveowners.Get(charID)
            idx = 0
            for each in self.guestScroll.GetNodes():
                if each.charID == charID:
                    return
                if CaseFoldCompare(each.info.name, newcharinfo.name) > 0:
                    break
                idx += 1

            filteredGuest = None
            guestFilter = self.quickFilter.GetValue()
            if len(guestFilter):
                filteredGuest = NiceFilter(self.quickFilter.QuickFilter, newcharinfo.name)
            if filteredGuest or len(guestFilter) == 0:
                entry = GetListEntry(self.userEntry, {'charID': charID,
                 'info': newcharinfo,
                 'label': newcharinfo.name,
                 'corpID': corpID,
                 'allianceID': allianceID,
                 'warFactionID': warFactionID})
                self.guestScroll.AddNodes(idx, [entry])

    @telemetry.ZONE_METHOD
    def OnCharNoLongerInStation(self, rec):
        if self.destroyed or not session.stationid2:
            return
        self.UpdateGuestTabText()
        charID, corpID, allianceID, warFactionID = rec
        if self.selectedGroupButtonID == GUESTSPANEL:
            for entry in self.guestScroll.GetNodes():
                if entry.charID == charID:
                    self.guestScroll.RemoveNodes([entry])
                    return

    def ShowGuests(self, condensed = None, *args):
        if self.selectedGroupButtonID != GUESTSPANEL:
            return
        if condensed is not None:
            settings.user.ui.Set('guestCondensedUserList', condensed)
        self.SetGuestEntryType()
        guests = sm.GetService('station').GetGuests()
        owners = []
        for charID in guests.keys():
            if charID not in owners:
                owners.append(charID)

        cfg.eveowners.Prime(owners)
        guestsNames = [ KeyVal(name=cfg.eveowners.Get(charID).name, charID=charID) for charID in guests ]
        guestFilter = self.quickFilter.GetValue()
        if len(guestFilter):
            guestsNames = NiceFilter(self.quickFilter.QuickFilter, guestsNames)
        if self.destroyed:
            return
        scrolllist = []
        for guest in guestsNames:
            charID = guest.charID
            corpID, allianceID, warFactionID = guests[charID]
            charinfo = cfg.eveowners.Get(charID)
            scrolllist.append((charinfo.name.lower(), GetListEntry(self.userEntry, {'charID': charID,
              'info': charinfo,
              'label': charinfo.name,
              'corpID': corpID,
              'allianceID': allianceID,
              'warFactionID': warFactionID})))

        scrolllist = SortListOfTuples(scrolllist)
        self.guestScroll.Clear()
        self.guestScroll.AddNodes(0, scrolllist)
        self.UpdateGuestTabText()

    def UpdateGuestTabText(self):
        numGuests = len(sm.GetService('station').GetGuests())
        self.guestsButton.counter.text = numGuests

    def SetGuestEntryType(self):
        if settings.user.ui.Get('guestCondensedUserList', False):
            self.userEntry = 'ChatUserSimple'
        else:
            self.userEntry = 'User'

    def ShowAgents(self):
        try:
            agentsSvc = sm.GetService('agents')
            journalSvc = sm.GetService('journal')
            facWarSvc = sm.StartService('facwar')
            standingSvc = sm.StartService('standing')
            epicArcStatusSvc = sm.RemoteSvc('epicArcStatus')
            if self.selectedGroupButtonID != AGENTSPANEL:
                return
            agentMissions = journalSvc.GetMyAgentJournalDetails()[:1][0]
            agentsInStation = agentsSvc.GetAgentsByStationID()[session.stationid2]
            relevantAgents = []
            missionStateDict = {}
            for each in agentMissions:
                missionState, importantMission, missionType, missionName, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = each
                agent = agentsSvc.GetAgentByID(agentID)
                missionStateDict[agentID] = missionState
                if missionState not in (const.agentMissionStateAllocated, const.agentMissionStateOffered) or agent.agentTypeID in (const.agentTypeGenericStorylineMissionAgent,
                 const.agentTypeStorylineMissionAgent,
                 const.agentTypeEventMissionAgent,
                 const.agentTypeCareerAgent,
                 const.agentTypeEpicArcAgent):
                    relevantAgents.append(agentID)

            localRelevantAgents = []
            for agent in agentsInStation:
                if agent.agentID in relevantAgents:
                    localRelevantAgents.append(agent.agentID)

            if self.destroyed:
                return
            scrolllist = []
            sortlist = []
            for agentID in relevantAgents:
                if not eve.rookieState or agentID in const.rookieAgentList:
                    if agentID not in localRelevantAgents:
                        missionState = missionStateDict.get(agentID)
                        sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID,
                          'missionState': missionState})))

            if sortlist:
                agentLabel = localization.GetByLabel('UI/Station/Lobby/AgentsOfInterest')
                scrolllist.append(GetListEntry('Header', {'label': agentLabel}))
                scrolllist += SortListOfTuples(sortlist)
            unavailableAgents = []
            availableAgents = []
            for agent in agentsInStation:
                if agent.agentID in const.rookieAgentList:
                    continue
                if not eve.rookieState or agent.agentID in const.rookieAgentList:
                    isLimitedToFacWar = False
                    if agent.agentTypeID == const.agentTypeFactionalWarfareAgent and facWarSvc.GetCorporationWarFactionID(agent.corporationID) != session.warfactionid:
                        isLimitedToFacWar = True
                    if agent.agentTypeID in (const.agentTypeResearchAgent,
                     const.agentTypeBasicAgent,
                     const.agentTypeEventMissionAgent,
                     const.agentTypeCareerAgent,
                     const.agentTypeFactionalWarfareAgent):
                        standingIsValid = standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID)
                        haveMissionFromAgent = agent.agentID in relevantAgents
                        if not isLimitedToFacWar and (standingIsValid or haveMissionFromAgent):
                            availableAgents.append(agent.agentID)
                        else:
                            unavailableAgents.append(agent.agentID)
                    elif agent.agentTypeID == const.agentTypeEpicArcAgent:
                        standingIsValid = standingSvc.CanUseAgent(agent.factionID, agent.corporationID, agent.agentID, agent.level, agent.agentTypeID)
                        haveMissionFromAgent = agent.agentID in relevantAgents
                        epicAgentAvailable = False
                        if haveMissionFromAgent:
                            epicAgentAvailable = True
                        elif standingIsValid:
                            if agent.agentID in relevantAgents or epicArcStatusSvc.AgentHasEpicMissionsForCharacter(agent.agentID):
                                epicAgentAvailable = True
                        if epicAgentAvailable:
                            availableAgents.append(agent.agentID)
                        else:
                            unavailableAgents.append(agent.agentID)
                    if agent.agentTypeID == const.agentTypeAura:
                        if sm.GetService('experimentClientSvc').IsTutorialEnabled():
                            availableAgents.append(agent.agentID)
                    elif agent.agentTypeID in (const.agentTypeGenericStorylineMissionAgent, const.agentTypeStorylineMissionAgent):
                        if agent.agentID in localRelevantAgents:
                            availableAgents.append(agent.agentID)
                        else:
                            unavailableAgents.append(agent.agentID)

            if availableAgents:
                availableLabel = localization.GetByLabel('UI/Station/Lobby/AvailableToYou')
                scrolllist.append(GetListEntry('Header', {'label': availableLabel}))
                sortlist = []
                for agentID in availableAgents:
                    missionState = missionStateDict.get(agentID)
                    sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID,
                      'missionState': missionState})))

                scrolllist += SortListOfTuples(sortlist)
            if unavailableAgents:
                unavailableLabel = localization.GetByLabel('UI/Station/Lobby/NotAvailableToYou')
                scrolllist.append(GetListEntry('Header', {'label': unavailableLabel}))
                sortlist = []
                for agentID in unavailableAgents:
                    missionState = missionStateDict.get(agentID)
                    sortlist.append((cfg.eveowners.Get(agentID).name, GetListEntry('AgentEntry', {'charID': agentID,
                      'missionState': missionState})))

                scrolllist += SortListOfTuples(sortlist)
            if self.destroyed:
                return
            self.agentScroll.Load(fixedEntryHeight=40, contentList=scrolllist)
        except:
            log.LogException()
            sys.exc_clear()

    def InteractWithAgent(self, agentID, *args):
        sm.StartService('agents').InteractWith(agentID)

    def SetHQ(self, *args):
        if sm.GetService('godma').GetType(eve.stationItem.stationTypeID).isPlayerOwnable == 1:
            raise UserError('CanNotSetHQAtPlayerOwnedStation')
        if eve.Message('MoveHQHere', {}, uiconst.YESNO) == uiconst.ID_YES:
            sm.GetService('corp').GetCorpStationManager().MoveCorpHQHere()

    def RentOffice(self, *args):
        if not self.sr.Get('isRentOfficeOpening') or not self.sr.isRentOfficeOpening:
            self.sr.isRentOfficeOpening = 1
            try:
                cost = sm.GetService('corp').GetCorpStationManager().GetQuoteForRentingAnOffice()
                if eve.Message('AskPayOfficeRentalFee', {'cost': cost,
                 'duration': const.rentalPeriodOffice * const.DAY}, uiconst.YESNO) == uiconst.ID_YES:
                    officeID = sm.GetService('corp').GetCorpStationManager().RentOffice(cost)
                    if officeID:
                        office = sm.GetService('corp').GetOffice()
                        invCache = sm.GetService('invCache')
                        invCache.InvalidateLocationCache(officeID)
                        if office is not None:
                            folder = invCache.GetInventoryFromId(office.officeFolderID, locationID=session.stationid2)
                            folder.List()
                            wnd = InventoryWindow.GetIfOpen()
                            if not wnd:
                                InventoryWindow.OpenOrShow()
                uthread.new(self.LoadButtons)
                if self.selectedGroupButtonID == OFFICESPANEL:
                    self.ShowOffices()
            finally:
                self.sr.isRentOfficeOpening = 0

    def ShowShips(self):
        if self.sr.shipsContainer is None:
            return
        self.mainButtonGroup.SelectByID(INVENTORYPANEL)
        self.inventoryTabs.ShowPanel(self.sr.shipsContainer)

    def ShowItems(self):
        if self.sr.itemsContainer is None:
            return
        self.mainButtonGroup.SelectByID(INVENTORYPANEL)
        self.inventoryTabs.ShowPanel(self.sr.itemsContainer)

    def ReloadOfficesIfVisible(self):
        if self.selectedGroupButtonID == OFFICESPANEL:
            self.ShowOffices()

    def ShowOffices(self):
        if self.selectedGroupButtonID != OFFICESPANEL:
            return
        self.LoadButtons()
        corpsWithOffices = sm.GetService('corp').GetCorporationsWithOfficesAtStation()
        cfg.corptickernames.Prime([ c.corporationID for c in corpsWithOffices ])
        scrolllist = []
        for corp in corpsWithOffices:
            data = KeyVal()
            data.corpName = corp.corporationName
            data.corpID = corp.corporationID
            data.corporation = corp
            scrolllist.append((data.corpName.lower(), GetListEntry('OfficeEntry', data=data)))

        scrolllist = SortListOfTuples(scrolllist)
        numUnrentedOffices = self.GetNumberOfUnrentedOffices()
        availOfficesLabel = localization.GetByLabel('UI/Station/Lobby/NumAvailableOffices', numOffices=numUnrentedOffices)
        scrolllist.insert(0, GetListEntry('Header', {'label': availOfficesLabel}))
        if not self.destroyed:
            self.officesScroll.Load(contentList=scrolllist)

    def GetNumberOfUnrentedOffices(self):
        return sm.GetService('corp').GetCorpStationManager().GetNumberOfUnrentedOffices()

    def OnCorporationMemberChanged(self, corporationID, memberID, change):
        if memberID == session.charid:
            self.LoadButtons()

    def StopAllBlinkButtons(self):
        for each in self.serviceButtons.children:
            if hasattr(each, 'Blink'):
                each.Blink(0)

    def BlinkButton(self, whatBtn):
        for each in self.serviceButtons.children:
            if each.name.lower() == whatBtn.lower():
                each.Blink(blinks=40)
コード例 #32
0
ファイル: leftPanel.py プロジェクト: connoryang/1v1dec
    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        self.fittingSvc = sm.GetService('fittingSvc')
        self.configName = attributes.configName
        self.controller = attributes.controller
        self.ChangeSignalConnection()
        self.loaded = False
        padding = 0
        self.ammoShowingForType = None
        btnCont = FlowContainer(parent=self,
                                align=uiconst.TOBOTTOM,
                                contentAlignment=CONTENT_ALIGN_RIGHT,
                                padTop=4,
                                padRight=0,
                                contentSpacing=uiconst.BUTTONGROUPMARGIN)
        self.fitBtn = Button(parent=btnCont,
                             label='Fit Ship',
                             func=self.FitShip,
                             align=uiconst.NOALIGN)
        self.builtShipBtn = Button(
            parent=btnCont,
            label=GetByLabel('UI/Fitting/FittingWindow/BuildShip'),
            func=self.BuildShip,
            align=uiconst.NOALIGN)
        self.saveBtn = Button(
            parent=btnCont,
            label=GetByLabel('UI/Fitting/FittingWindow/SaveFitAs'),
            func=self.SaveFitting,
            align=uiconst.NOALIGN)
        SetFittingTooltipInfo(targetObject=self.saveBtn,
                              tooltipName='SaveFitting',
                              includeDesc=False)
        self.AdjustButtons()
        self.btnGroup = ToggleButtonGroup(name='fittingToggleBtnGroup',
                                          parent=self,
                                          align=uiconst.TOTOP,
                                          callback=self.BrowserSelected,
                                          height=40,
                                          idx=-1)
        self.AddExportImportMenu()
        self.AddSearchFields()
        self.AddFilterCont()
        self.hwBrowserBtns = self.AddHardwareSelcetionCont()
        self.AddFittingFilterButtons()
        self.hardwareFilterBtns = self.AddHardwareFilterButtons()
        self.AddChargeFilterButtons()
        self.browserBtns = {}
        self.moduleChargeButtons = {}
        for btnID, labelPath, iconPath, dblClickCallback in (
            (BROWSE_FITTINGS, 'UI/Fitting/FittingWindow/ShipAndFittings',
             'res:/UI/Texture/classes/Fitting/tabFittings.png',
             self.LoadFittingSetup),
            (BROWSE_HARDWARE, 'UI/Fitting/FittingWindow/Hardware',
             'res:/UI/Texture/classes/Fitting/tabHardware.png', None)):
            btn = self.btnGroup.AddButton(btnID,
                                          GetByLabel(labelPath),
                                          iconPath=iconPath,
                                          btnClass=ToggleButtonGhost)
            self.browserBtns[btnID] = btn
            if dblClickCallback:
                btn.OnDblClick = dblClickCallback

        self.scroll = Scroll(parent=self,
                             align=uiconst.TOALL,
                             padding=(padding, 2, padding, 0))
        self.scroll.sr.content.OnDropData = self.OnDropData
        sm.RegisterNotify(self)