예제 #1
0
 def ApplyAttributes(self, attributes):
     uiprimitives.Container.ApplyAttributes(self, attributes)
     self.btnData = attributes.btnData
     self.btnNum = attributes.btnNum
     self.width = attributes.width
     self._isDraggable = attributes.get('isDraggable', self.default_isDraggable)
     self._openNeocomPanel = None
     self.height = self.width
     self.top = self.height * self.btnNum
     self.panel = None
     self.blinkThread = None
     self.realTop = self.top
     self.dragEventCookie = None
     self.disableClick = False
     self.iconSize = self.height - 2 * self.PADVERTICAL
     self.iconTransform = uiprimitives.Transform(name='iconTransform', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5))
     self.iconLabelCont = None
     if self.btnData.id == 'map_beta':
         Sprite(parent=self.iconTransform, align=uiconst.TOPLEFT, pos=(0, 0, 11, 29), texturePath='res:/UI/Texture/Shared/betaTag.png', state=uiconst.UI_DISABLED)
     self.icon = GlowSprite(parent=self.iconTransform, name='icon', state=uiconst.UI_DISABLED, align=uiconst.CENTER, width=self.iconSize, height=self.iconSize, iconOpacity=1.0)
     self.UpdateIcon()
     PAD = 1
     self.blinkSprite = SpriteUnderlay(bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/buttonBlink.png', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     self.activeFrame = FrameUnderlay(bgParent=self, name='hoverFill', texturePath='res:/UI/Texture/classes/Neocom/buttonActive.png', cornerSize=5, state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     self.CheckIfActive()
     self.dropFrame = uicontrols.Frame(parent=self, name='hoverFrame', color=util.Color.GetGrayRGBA(1.0, 0.5), state=uiconst.UI_HIDDEN)
     sm.RegisterNotify(self)
예제 #2
0
 def Prepare_Underlay_(self):
     border = FrameUnderlay(parent=self,
                            frameConst=uiconst.FRAME_BORDER1_CORNER0,
                            state=uiconst.UI_DISABLED,
                            colorType=uiconst.COLORTYPE_UIHILIGHT,
                            opacity=0.25)
     frame = FrameUnderlay(parent=self,
                           frameConst=uiconst.FRAME_FILLED_CORNER4,
                           state=uiconst.UI_DISABLED)
예제 #3
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.jobData = attributes.jobData
     self.oldJobData = None
     self.pattern = Frame(
         parent=self,
         texturePath=
         'res:/UI/Texture/Classes/Industry/Output/boxPattern.png',
         align=TOALL,
         state=UI_DISABLED,
         opacity=0.0,
         cornerSize=5)
     FrameUnderlay(parent=self, state=UI_DISABLED, align=TOALL, opacity=0.3)
     FillUnderlay(bgParent=self, opacity=0.5)
     self.contentCont = Container(name='contentCont', parent=self)
     self.errorFrame = ErrorFrame(bgParent=self, padding=1)
     self.openInventoryBtn = ButtonIcon(
         name='openInventoryBtn ',
         parent=self,
         align=uiconst.TOPRIGHT,
         pos=(1, 1, 21, 21),
         iconSize=16,
         texturePath='res:/UI/Texture/Vgs/Search_icon.png',
         func=self.OnOpenInventoryBtn)
     self.UpdateState()
     self.AnimEntry()
예제 #4
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     callback = attributes.callback
     submit = attributes.submit
     self.oldJobData = None
     self.jobData = attributes.jobData
     self.jobsSummary = JobsSummary(parent=self,
                                    align=uiconst.CENTERLEFT,
                                    left=10)
     self.activitySelectionButtons = ActivitySelectionButtons(
         parent=self,
         align=uiconst.CENTER,
         callback=callback,
         width=248,
         height=38)
     self.submitBtn = SubmitButton(parent=self,
                                   align=uiconst.CENTERRIGHT,
                                   fixedheight=30,
                                   fixedwidth=125,
                                   left=7)
     GradientSprite(bgParent=self,
                    rotation=-math.pi / 2,
                    rgbData=[(0, (0.3, 0.3, 0.3))],
                    alphaData=[(0, 0.3), (1.0, 0.05)])
     FrameUnderlay(bgParent=self,
                   colorType=uiconst.COLORTYPE_UIBASECONTRAST)
     self.UpdateState()
예제 #5
0
 def ApplyAttributes(self, attributes):
     attributes.align = uiconst.TOPLEFT
     attributes.width = 128
     attributes.height = 128
     ContainerAutoSize.ApplyAttributes(self, attributes)
     if attributes.GetUtilMenu:
         self._getMenuFunction = attributes.GetUtilMenu
     else:
         raise RuntimeError('GetUtilMenu has to be provided in order to use UtilMenu')
     self.controller = attributes.controller
     self.isTopLevelWindow = True
     self.menuAlign = attributes.Get('menuAlign', self.default_menuAlign)
     self.minWidth = attributes.minWidth or 0
     FrameUnderlay(bgParent=self, colorType=uiconst.COLORTYPE_UIHILIGHT, opacity=OPACITY_LINES)
     FillUnderlay(bgParent=self, opacity=OPACITY_BG)
     FrameUnderlay(bgParent=self, frameConst=('ui_105_32_26', 15, 0), padding=(-12, -5, -12, -15))
     uicore.uilib.RegisterForTriuiEvents([uiconst.UI_MOUSEDOWN], self.OnGlobalMouseDown)
     self.ReloadMenu()
     self.AnimFadeIn()
     self.UpdateMenuPosition()
예제 #6
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     skinName = attributes.get('skinName', 'general')
     actualSkinClass = SKIN_NAME_TO_CLASS.get(skinName)
     if not FrameWithPointer.skinCache.get(skinName):
         FrameWithPointer.skinCache[skinName] = actualSkinClass()
     self.skin = FrameWithPointer.skinCache[skinName]
     self._pointer = SpriteUnderlay(
         texturePath=
         'res:/UI/Texture/classes/FrameWithPointer/pointer_down_02.png',
         parent=self,
         colorType=attributes.colorType or uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=0.95)
     self._background = FrameUnderlay(
         name='__underlay',
         bgParent=self,
         cornerSize=self.skin.backgroundCornerSize,
         offset=self.skin.backgroundOffset,
         texturePath=self.skin.backgroundTexture,
         colorType=attributes.colorType or uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=0.95)
예제 #7
0
 def Prepare_(self):
     self.sr.label = LabelUnderlay(
         parent=self,
         align=uiconst.CENTER,
         state=uiconst.UI_DISABLED,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=1.0,
         fontsize=10)
     self.glowLabel = LabelUnderlay(name='glowLabel',
                                    parent=self,
                                    align=uiconst.CENTER,
                                    state=uiconst.UI_DISABLED,
                                    opacity=0.0,
                                    color=self.color,
                                    fontsize=10)
     self.glowLabel.renderObject.spriteEffect = trinity.TR2_SFX_BLUR
     if self.iconPath is not None:
         if self.iconSize:
             width = self.iconSize
             height = self.iconSize
         else:
             width = height = min(self.width, self.height)
         self.icon = GlowSprite(parent=self,
                                state=uiconst.UI_DISABLED,
                                align=uiconst.CENTER,
                                pos=(0, 0, width, height),
                                texturePath=self.iconPath,
                                color=self.color,
                                iconOpacity=0.75)
         self.sr.label.state = uiconst.UI_HIDDEN
         self.width = width + 4
         self.height = height + 4
     else:
         self.icon = None
     self.sr.hilite = Fill(bgParent=self,
                           color=(0.7, 0.7, 0.7, 0.5),
                           state=uiconst.UI_HIDDEN)
     self.sr.activeframe = FrameUnderlay(
         parent=self,
         name='activeline',
         state=uiconst.UI_HIDDEN,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=0.1)
     self.underlay = RaisedUnderlay(name='backgroundFrame',
                                    bgParent=self,
                                    state=uiconst.UI_DISABLED,
                                    color=self.color)
예제 #8
0
 def AddFrame(self, *args):
     self.sr.frame = FrameUnderlay(parent=self,
                                   name='frame',
                                   frameConst=uiconst.FRAME_BORDER1_CORNER0,
                                   colorType=uiconst.COLORTYPE_UIHILIGHT,
                                   opacity=0.1)
     self.sr.todayFill = Frame(parent=self,
                               name='todayFill',
                               frameConst=uiconst.FRAME_FILLED_CORNER0,
                               padding=(1, 1, 1, 1),
                               color=(0.5, 0.5, 0.5, 0.75))
     self.sr.selectedFrame = Frame(parent=self,
                                   name='frame',
                                   frameConst=uiconst.FRAME_BORDER1_CORNER0,
                                   color=(0.5, 0.5, 0.5, 0.1),
                                   padding=(1, 1, 1, 1),
                                   state=uiconst.UI_HIDDEN)
예제 #9
0
 def SetupStuff(self):
     options = [
         (localization.GetByLabel(
             'UI/Fleet/FleetRegistry/MyAvailableFleets'), INVITE_ALL),
         (localization.GetByLabel('UI/Fleet/FleetRegistry/MyCorpFleets'),
          INVITE_CORP)
     ]
     selected = settings.user.ui.Get('fleetfinder_scopeFilter', None)
     if session.allianceid is not None:
         options.append((localization.GetByLabel(
             'UI/Fleet/FleetRegistry/MyAllianceFleets'), INVITE_ALLIANCE))
     elif selected == INVITE_ALLIANCE:
         selected = None
     if session.warfactionid is not None:
         options.append((localization.GetByLabel(
             'UI/Fleet/FleetRegistry/MyMilitiaFleets'), INVITE_MILITIA))
     elif selected == INVITE_MILITIA:
         selected = None
     options.append((
         localization.GetByLabel('UI/Fleet/FleetRegistry/BasedOnStandings'),
         INVITE_PUBLIC))
     l = 1
     combo = self.sr.scopeCombo = uicontrols.Combo(
         label=localization.GetByLabel('UI/Fleet/FleetRegistry/Scope'),
         parent=self.sr.filterCont,
         options=options,
         name='fleetfinder_scopeFilter',
         select=selected,
         pos=(l, 14, 0, 0),
         width=COMBO_SIZES[0])
     self.sr.scopeCombo.OnChange = self.OnComboChange
     l += combo.width + 3
     selected = settings.user.ui.Get('fleetfinder_rangeFilter', None)
     options = [
         (localization.GetByLabel('UI/Common/Any'), None),
         (localization.GetByLabel('UI/Fleet/FleetRegistry/NumberOfJumps',
                                  numJumps=5), 5),
         (localization.GetByLabel('UI/Fleet/FleetRegistry/NumberOfJumps',
                                  numJumps=10), 10),
         (localization.GetByLabel('UI/Common/LocationTypes/Region'), -1)
     ]
     combo = self.sr.rangeCombo = uicontrols.Combo(
         label=localization.GetByLabel('UI/Fleet/FleetRegistry/Range'),
         parent=self.sr.filterCont,
         options=options,
         name='fleetfinder_rangeFilter',
         select=selected,
         pos=(l, 14, 0, 0),
         width=COMBO_SIZES[1])
     self.sr.rangeCombo.OnChange = self.OnComboChange
     l += combo.width + 3
     selected = settings.user.ui.Get('fleetfinder_standingFilter', None)
     options = [(localization.GetByLabel('UI/Common/Any'), None),
                (localization.GetByLabel('UI/Standings/Good'),
                 const.contactGoodStanding),
                (localization.GetByLabel('UI/Standings/Excellent'),
                 const.contactHighStanding)]
     combo = self.sr.standingCombo = uicontrols.Combo(
         label=localization.GetByLabel(
             'UI/Fleet/FleetRegistry/RequireStanding'),
         parent=self.sr.filterCont,
         options=options,
         name='fleetfinder_standingFilter',
         select=selected,
         pos=(l, 14, 0, 0),
         width=COMBO_SIZES[2])
     self.sr.standingCombo.OnChange = self.OnComboChange
     l += combo.width + 3
     self.sr.getFleetsBtn = btn = uicontrols.Button(
         parent=self.sr.filterCont,
         label=localization.GetByLabel('UI/Fleet/FleetRegistry/FindFleets'),
         pos=(0, 14, 0, 0),
         func=self.GetFleetsClick,
         align=uiconst.TOPRIGHT)
     self.sr.scroll = uicontrols.Scroll(parent=self.sr.scrollCont)
     self.sr.scroll.sr.id = 'fleetfinderScroll'
     self.sr.scroll.multiSelect = 0
     self.sr.scroll.Load(contentList=[],
                         headers=[],
                         scrolltotop=0,
                         noContentHint=localization.GetByLabel(
                             'UI/Fleet/FleetRegistry/SearchHint'))
     self.sr.caption = uicontrols.EveLabelMediumBold(
         text='',
         parent=self.sr.topInfoCont,
         align=uiconst.RELATIVE,
         left=4,
         top=2,
         state=uiconst.UI_NORMAL)
     self.sr.detailsText = uicls.EditPlainText(name='detailsText',
                                               parent=self.sr.descrCont,
                                               padTop=2,
                                               padBottom=4,
                                               state=uiconst.UI_NORMAL,
                                               readonly=1)
     self.sr.detailsText.HideBackground()
     self.sr.detailsText.RemoveActiveFrame()
     FrameUnderlay(parent=self.sr.detailsText,
                   colorType=uiconst.COLORTYPE_UIHILIGHT)
     tabs = [110, 540]
     self.sr.infoText = uicontrols.EveLabelMedium(name='infoText',
                                                  text='',
                                                  parent=self.sr.descrCont,
                                                  top=const.defaultPadding,
                                                  idx=0,
                                                  tabs=tabs,
                                                  state=uiconst.UI_NORMAL)
     self.sr.joinBtn = btn = uicontrols.Button(
         parent=self.sr.topInfoCont,
         label=localization.GetByLabel('UI/Fleet/FleetRegistry/JoinFleet'),
         pos=(0, 1, 0, 0),
         func=self.JoinFleet,
         align=uiconst.CENTERRIGHT)
     self.sr.joinRequestBtn = btn = uicontrols.Button(
         parent=self.sr.topInfoCont,
         label=localization.GetByLabel(
             'UI/Fleet/FleetRegistry/RequestJoinFleet'),
         pos=(0, 1, 0, 0),
         func=self.JoinFleet,
         align=uiconst.CENTERRIGHT)
     self.sr.myAdvertMainCont = uiprimitives.Container(
         name='myAdvertMainCont',
         parent=self.sr.myAdvertCont,
         align=uiconst.TOALL,
         pos=(0, 0, 0, 0))
     self.myAdvertButtons = [
         (localization.GetByLabel('UI/Fleet/FleetWindow/EditAdvert'),
          sm.GetService('fleet').OpenRegisterFleetWindow, (), 84),
         (localization.GetByLabel('UI/Fleet/FleetWindow/RemoveAdvert'),
          sm.GetService('fleet').UnregisterFleet, (), 84)
     ]
     self.sr.myAdvertButtonWnd = uicontrols.ButtonGroup(
         btns=self.myAdvertButtons,
         parent=self.sr.myAdvertButtons,
         unisize=1)
     self.sr.myAdvertCaption = uicontrols.EveCaptionMedium(
         text='',
         parent=self.sr.myAdvertCont,
         align=uiconst.TOTOP,
         left=0,
         top=7,
         state=uiconst.UI_DISABLED)
     self.sr.myAdvertDescCont = uiprimitives.Container(
         name='myAdvertDescCont',
         parent=self.sr.myAdvertCont,
         align=uiconst.TOALL,
         pos=(0, 0, 0, 0))
     self.sr.myAdvertText = uicontrols.EveLabelMedium(
         text='',
         parent=self.sr.myAdvertCont,
         top=const.defaultPadding,
         tabs=tabs,
         align=uiconst.TOTOP,
         state=uiconst.UI_NORMAL)
     self.sr.myAdvertDesc = uicls.EditPlainText(
         parent=self.sr.myAdvertDescCont,
         padTop=2,
         state=uiconst.UI_NORMAL,
         readonly=1)
     self.myAdvertButtons_Register = [
         (localization.GetByLabel('UI/Fleet/FleetWindow/CreateAdvert'),
          sm.GetService('fleet').OpenRegisterFleetWindow, (), 84)
     ]
     self.sr.myAdvertButtonWnd_Register = uicontrols.ButtonGroup(
         btns=self.myAdvertButtons_Register,
         parent=self.sr.myAdvertButtons,
         unisize=1)
     self.sr.myAdvertButtonWnd_Register.state = uiconst.UI_HIDDEN
예제 #10
0
class ButtonBase(uiprimitives.Container):
    """
    An abstract button that others inherit from
    """
    __guid__ = 'neocom.ButtonBase'
    __notifyevents__ = ['ProcessNeocomBlinkPulse']
    default_name = 'ButtonBase'
    default_state = uiconst.UI_NORMAL
    default_align = uiconst.TOPLEFT
    default_isDraggable = True
    PADHORIZONTAL = 6
    PADVERTICAL = 4
    ACTIVEFILL_DEFAULTALPHA = 0.5
    ACTIVEFILL_HOVERALPHA = 0.8

    def ApplyAttributes(self, attributes):
        uiprimitives.Container.ApplyAttributes(self, attributes)
        self.btnData = attributes.btnData
        self.btnNum = attributes.btnNum
        self.width = attributes.width
        self._isDraggable = attributes.get('isDraggable', self.default_isDraggable)
        self._openNeocomPanel = None
        self.height = self.width
        self.top = self.height * self.btnNum
        self.panel = None
        self.blinkThread = None
        self.realTop = self.top
        self.dragEventCookie = None
        self.disableClick = False
        self.iconSize = self.height - 2 * self.PADVERTICAL
        self.iconTransform = uiprimitives.Transform(name='iconTransform', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5))
        self.iconLabelCont = None
        if self.btnData.id == 'map_beta':
            Sprite(parent=self.iconTransform, align=uiconst.TOPLEFT, pos=(0, 0, 11, 29), texturePath='res:/UI/Texture/Shared/betaTag.png', state=uiconst.UI_DISABLED)
        self.icon = GlowSprite(parent=self.iconTransform, name='icon', state=uiconst.UI_DISABLED, align=uiconst.CENTER, width=self.iconSize, height=self.iconSize, iconOpacity=1.0)
        self.UpdateIcon()
        PAD = 1
        self.blinkSprite = SpriteUnderlay(bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/buttonBlink.png', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
        self.activeFrame = FrameUnderlay(bgParent=self, name='hoverFill', texturePath='res:/UI/Texture/classes/Neocom/buttonActive.png', cornerSize=5, state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
        self.CheckIfActive()
        self.dropFrame = uicontrols.Frame(parent=self, name='hoverFrame', color=util.Color.GetGrayRGBA(1.0, 0.5), state=uiconst.UI_HIDDEN)
        sm.RegisterNotify(self)

    def UpdateIcon(self):
        texturePath = self._GetPathFromIconNum(self.btnData.iconPath)
        self.icon.SetTexturePath(texturePath)

    def CheckIfActive(self):
        if self.btnData.isActive:
            self.activeFrame.Show()
        else:
            self.activeFrame.Hide()

    def GetIconPath(self):
        return self._GetPathFromIconNum(self.btnData.iconPath)

    def _GetPathFromIconNum(self, iconNum):
        if iconNum.startswith('res:/'):
            return iconNum
        parts = iconNum.split('_')
        if len(parts) == 2:
            sheet, iconNum = parts
            iconSize = uix.GetIconSize(sheet)
            return 'res:/ui/texture/icons/%s_%s_%s.png' % (int(sheet), int(iconSize), int(iconNum))
        elif len(parts) == 4:
            root, sheet, iconSize, iconNum = parts
            if root == 'ui':
                root = 'icons'
            return 'res:/ui/texture/%s/%s_%s_%s.png' % (root,
             int(sheet),
             int(iconSize),
             int(iconNum))
        else:
            return neocomCommon.ICONPATH_DEFAULT

    def IsDraggable(self):
        return self._isDraggable

    def SetDraggable(self, isDraggable):
        self._isDraggable = isDraggable

    def GetMenu(self):
        return self.btnData.GetMenu()

    def LoadTooltipPanel(self, tooltipPanel, *args):
        isOpen = self._openNeocomPanel and not self._openNeocomPanel.destroyed
        if isOpen:
            return
        tooltipPanel.LoadGeneric3ColumnTemplate()
        blinkHintStr = None
        if getattr(self.btnData, 'cmdName', None):
            cmd = uicore.cmd.commandMap.GetCommandByName(self.btnData.cmdName)
            tooltipPanel.AddCommandTooltip(cmd)
            blinkHintStr = self.btnData.blinkHint
        else:
            label = None
            if self.IsSingleWindow():
                wnd = self.GetWindow()
                if not wnd.destroyed:
                    label = wnd.GetCaption()
            elif self.btnData.children:
                label = self.btnData.children[0].wnd.GetNeocomGroupLabel()
            mainStr = label or self.btnData.label
            tooltipPanel.AddLabelMedium(text=mainStr)
        self.LoadTooltipPanelDetails(tooltipPanel, self.btnData)
        if blinkHintStr:
            tooltipPanel.AddLabelMedium(text=blinkHintStr, width=200, colSpan=tooltipPanel.columns)

    def LoadTooltipPanelDetails(cls, tooltipPanel, btnData):
        if btnData.id == 'wallet':
            showFractions = settings.user.ui.Get('walletShowCents', 1)
            personalWealth = util.FmtISK(sm.GetService('wallet').GetWealth(), showFractions)
            tooltipPanel.AddLabelValue(label=localization.GetByLabel('Tooltips/Neocom/Balance'), value=personalWealth)
            canAccess = sm.GetService('wallet').HaveReadAccessToCorpWalletDivision(session.corpAccountKey)
            if canAccess:
                corpWealth = util.FmtISK(sm.GetService('wallet').GetCorpWealthCached1Min(session.corpAccountKey), showFractions)
                tooltipPanel.AddLabelValue(label=localization.GetByLabel('Tooltips/Neocom/CorporationBalance'), value=corpWealth)

    def GetTooltipPointer(self):
        return uiconst.POINT_LEFT_2

    def IsSingleWindow(self):
        return False

    def OnMouseEnter(self, *args):
        self.btnData.SetBlinkingOff()
        self.icon.OnMouseEnter()

    def OnMouseExit(self, *args):
        self.icon.OnMouseExit()

    def OnMouseDown(self, *args):
        if not self.IsDraggable():
            return
        if not uicore.uilib.leftbtn:
            return
        self.isDragging = False
        self.mouseDownY = uicore.uilib.y
        if self.dragEventCookie is not None:
            uicore.event.UnregisterForTriuiEvents(self.dragEventCookie)
        self.dragEventCookie = uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEMOVE, self.OnDrag)
        uicore.animations.Tr2DScaleTo(self.iconTransform, self.iconTransform.scale, (0.95, 0.95), duration=0.1)
        self.icon.OnMouseDown()

    def OnMouseUp(self, *args):
        if uicore.uilib.mouseOver == self:
            uicore.animations.Tr2DScaleTo(self.iconTransform, self.iconTransform.scale, (1.0, 1.0), duration=0.1)
        if self.dragEventCookie is not None:
            uicore.event.UnregisterForTriuiEvents(self.dragEventCookie)
            self.dragEventCookie = None
        self.icon.OnMouseUp()

    def OnDragEnd(self, *args):
        uicore.event.UnregisterForTriuiEvents(self.dragEventCookie)
        self.dragEventCookie = None
        self.isDragging = False
        sm.GetService('neocom').OnButtonDragEnd(self)
        self.CheckIfActive()

    def OnDrag(self, *args):
        if math.fabs(self.mouseDownY - uicore.uilib.y) > 5 or self.isDragging:
            if not self.isDragging:
                uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnDragEnd)
            self.disableClick = True
            self.isDragging = True
            sm.GetService('neocom').OnButtonDragged(self)
        return True

    def OnClick(self, *args):
        if not self or self.destroyed:
            return
        self.btnData.CheckContinueBlinking()
        if not self.disableClick:
            self.OnClickCommand()
        if not self or self.destroyed:
            return
        self.disableClick = False
        if self.dragEventCookie:
            uicore.event.UnregisterForTriuiEvents(self.dragEventCookie)

    def OnDblClick(self, *args):
        """ Swallow double click event so that we don't get two OnClick events """
        pass

    def OnClickCommand(self):
        """
        Overridden by subclasses
        """
        pass

    def OnSwitched(self):
        uicore.effect.MorphUIMassSpringDamper(item=self, attrname='opacity', float=1, newVal=1.0, minVal=0, maxVal=2.0, dampRatio=0.45, frequency=15.0, initSpeed=0, maxTime=4.0, callback=None, initVal=0.0)
        self.isDragging = False
        self.disableClick = False

    def GetDragData(self, *args):
        if self.btnData.isDraggable:
            return [self.btnData]

    def BlinkOnce(self, duration = 0.7):
        self.blinkSprite.Show()
        uicore.animations.SpSwoopBlink(self.blinkSprite, rotation=math.pi * 0.75, duration=duration)

    def ProcessNeocomBlinkPulse(self):
        if self.btnData.isBlinking:
            self.BlinkOnce()

    def OnDropData(self, source, dropData):
        if not sm.GetService('neocom').IsValidDropData(dropData):
            return
        index = self.btnData.parent.children.index(self.btnData)
        sm.GetService('neocom').OnBtnDataDropped(dropData[0], index)

    def OnDragEnter(self, panelEntry, dropData):
        if not sm.GetService('neocom').IsValidDropData(dropData):
            return
        sm.GetService('neocom').OnButtonDragEnter(self.btnData, dropData[0])
        uthread.new(self.ShowPanelOnMouseHoverThread)

    def OnDragExit(self, *args):
        sm.GetService('neocom').OnButtonDragExit(self.btnData, args)

    def ToggleNeocomPanel(self):
        isOpen = self._openNeocomPanel and not self._openNeocomPanel.destroyed
        sm.GetService('neocom').CloseAllPanels()
        if isOpen:
            self._openNeocomPanel = None
        else:
            self._openNeocomPanel = sm.GetService('neocom').ShowPanel(triggerCont=self, panelClass=self.GetPanelClass(), panelAlign=neocomCommon.PANEL_SHOWONSIDE, parent=uicore.layer.abovemain, btnData=self.btnData)
        RefreshTooltipForOwner(self)

    def ShowPanelOnMouseHoverThread(self):
        if len(self.btnData.children) <= 1:
            return
        blue.pyos.synchro.Sleep(500)
        if not self or self.destroyed:
            return
        if uicore.uilib.mouseOver == self:
            self.ToggleNeocomPanel()

    def GetPanelClass(self):
        return neocomPanels.PanelGroup

    def SetAsActive(self):
        self.btnData.isActive = True
        self.activeFrame.state = uiconst.UI_DISABLED

    def SetAsInactive(self):
        self.btnData.isActive = False
        self.activeFrame.state = uiconst.UI_HIDDEN
예제 #11
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     innerContainerPadding = self.outerFrameWidth + self.distanceFromOuterToInnerFrame_side
     innerContainer = Container(parent=self,
                                name='innerContainer',
                                padding=innerContainerPadding,
                                bgColor=(0, 0, 0, 0.5))
     frameCornerSize = 2 + self.innerFrameWidth
     glowFrameTexturePath = 'res:/UI/Texture/classes/CharacterSelection/glowDotFrame.png'
     self.normalGlowFrame = Frame(parent=innerContainer,
                                  name='glowFrame',
                                  color=FRAME_GLOW_ACTIVE,
                                  frameConst=(glowFrameTexturePath, 5, -2,
                                              0),
                                  padding=0)
     self.normalFrame = FrameUnderlay(parent=innerContainer,
                                      name='normalFrame',
                                      padding=0,
                                      frameConst=('ui_1_16_161',
                                                  frameCornerSize, -2, 0))
     self.normalFrame.opacity = 0.0
     self.selectionFrameGlow = Frame(
         parent=self,
         name='selectionFrame',
         color=FRAME_GLOW_ACTIVE,
         texturePath=
         'res:/UI/Texture/classes/CharacterSelection/selectFrame.png',
         cornerSize=22)
     self.selectionFrameGlow.opacity = 0
     frameCornerSize = 2 + self.outerFrameWidth
     self.selectionFrame = Frame(parent=self,
                                 name='selectionFrame',
                                 color=OUTER_FRAME,
                                 frameConst=('ui_1_16_161', frameCornerSize,
                                             -2, 0))
     self.selectionFrame.opacity = 0
     contentPadding = self.distanceFromInnerFrameToContent_sides + self.innerFrameWidth
     contentParent = Container(parent=innerContainer,
                               name='contentParent',
                               padding=contentPadding,
                               align=uiconst.TOALL)
     self.contentTopPush = Container(name='contentTopPush',
                                     parent=contentParent,
                                     align=uiconst.TOTOP_PROP,
                                     height=0.55)
     self.contentBottomPush = Container(name='contentBottomPush',
                                        parent=contentParent,
                                        align=uiconst.TOBOTTOM_PROP,
                                        height=0.55)
     self.content = Container(parent=contentParent,
                              name='content',
                              align=uiconst.TOALL,
                              pos=(0, 0, 0, 0),
                              clipChildren=True,
                              state=uiconst.UI_PICKCHILDREN,
                              opacity=0.0)
     self.dotFrameTopPush = Container(name='dotFrameTopPush',
                                      parent=innerContainer,
                                      align=uiconst.TOTOP_PROP,
                                      height=0.5)
     self.dotFrameBottomPush = Container(name='dotFrameBottomPush',
                                         parent=innerContainer,
                                         align=uiconst.TOBOTTOM_PROP,
                                         height=0.5)
     self.dotFrame = FrameUnderlay(
         parent=innerContainer,
         name='dotFrame',
         color=FRAME_GLOW_ACTIVE,
         texturePath='res:/UI/Texture/classes/MapView/dotFrame.png',
         cornerSize=21,
         offset=-1)
     self.dotFrame.opacity = 0.0
예제 #12
0
class FrameWithPointer(Container):
    pointerOffset = None
    skinCache = {}

    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        skinName = attributes.get('skinName', 'general')
        actualSkinClass = SKIN_NAME_TO_CLASS.get(skinName)
        if not FrameWithPointer.skinCache.get(skinName):
            FrameWithPointer.skinCache[skinName] = actualSkinClass()
        self.skin = FrameWithPointer.skinCache[skinName]
        self._pointer = SpriteUnderlay(
            texturePath=
            'res:/UI/Texture/classes/FrameWithPointer/pointer_down_02.png',
            parent=self,
            colorType=attributes.colorType or uiconst.COLORTYPE_UIHILIGHTGLOW,
            opacity=0.95)
        self._background = FrameUnderlay(
            name='__underlay',
            bgParent=self,
            cornerSize=self.skin.backgroundCornerSize,
            offset=self.skin.backgroundOffset,
            texturePath=self.skin.backgroundTexture,
            colorType=attributes.colorType or uiconst.COLORTYPE_UIHILIGHTGLOW,
            opacity=0.95)

    def SetColor(self, color):
        self._background.color = color
        self._pointer.color = color

    def SetAlpha(self, alphaValue):
        self._background.SetAlpha(alphaValue)
        self._pointer.SetAlpha(alphaValue)

    def UpdatePointerPosition(self, positionFlag):
        if positionFlag == uiconst.POINTER_NONE:
            self._pointer.display = False
            return (0, 0)
        SIZE = 24
        BACKOFFSET = 8
        x, y = positionFlag
        self._pointer.displayX = [
            -SIZE + BACKOFFSET, 0, (self.displayWidth - SIZE) / 2,
            self.displayWidth - SIZE, self.displayWidth - BACKOFFSET
        ][x]
        self._pointer.displayY = [
            -SIZE + BACKOFFSET, 0, (self.displayHeight - SIZE) / 2,
            self.displayHeight - SIZE, self.displayHeight - BACKOFFSET
        ][y]
        self._pointer.displayWidth = SIZE
        self._pointer.displayHeight = SIZE
        if y == 0:
            if x == 0:
                self._pointer.displayX = -11
                self._pointer.displayY = -11
                resPath = self.skin.topLeftTexture
                self.pointerOffset = [
                    self._pointer.displayX + 5, self._pointer.displayY + 5
                ]
            elif x == 4:
                self._pointer.displayX = self.displayWidth - 13
                self._pointer.displayY = -11
                resPath = self.skin.topRightTexture
                self.pointerOffset = [
                    self._pointer.displayX + 19, self._pointer.displayY + 5
                ]
            else:
                resPath = self.skin.upTexture
                self.pointerOffset = [
                    self._pointer.displayX + SIZE / 2,
                    self._pointer.displayY + 10
                ]
        elif y == 4:
            if x == 0:
                self._pointer.displayX = -11
                self._pointer.displayY = self.displayHeight - 13
                resPath = self.skin.bottomLeftTexture
                self.pointerOffset = [
                    self._pointer.displayX + 5, self._pointer.displayY + 19
                ]
            elif x == 4:
                self._pointer.displayX = self.displayWidth - 13
                self._pointer.displayY = self.displayHeight - 13
                resPath = self.skin.bottomRightTexture
                self.pointerOffset = [
                    self._pointer.displayX + 19, self._pointer.displayY + 19
                ]
            else:
                resPath = self.skin.downTexture
                self.pointerOffset = [
                    self._pointer.displayX + SIZE / 2,
                    self._pointer.displayY + 14
                ]
        elif x == 0:
            resPath = self.skin.leftTexture
            self.pointerOffset = [
                self._pointer.displayX + 10, self._pointer.displayY + SIZE / 2
            ]
        elif x == 4:
            resPath = self.skin.rightTexture
            self.pointerOffset = [
                self._pointer.displayX + 14, self._pointer.displayY + SIZE / 2
            ]
        self._pointer.SetTexturePath(resPath)
        self._pointer.display = True
        return self.pointerOffset
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     sm.RegisterNotify(self)
     self.jobData = attributes.jobData
     self.videoThread = None
     self.iconCont = Container(name='iconCont',
                               parent=self,
                               align=CENTER,
                               state=uiconst.UI_NORMAL,
                               width=64,
                               height=64)
     self.errorFrame = ErrorFrame(parent=self,
                                  align=uiconst.CENTER,
                                  pos=(0, 0, 64, 64),
                                  state=uiconst.UI_HIDDEN)
     self.qtyLabel = EveLabelLargeBold(parent=self, align=CENTER, top=42)
     FrameUnderlay(name='bgVignette',
                   parent=self,
                   texturePath=
                   'res:/UI/Texture/Classes/Industry/Output/bgVignette.png',
                   cornerSize=30)
     self.videoCont = Container(name='videoCont',
                                parent=self,
                                align=uiconst.CENTER,
                                width=324,
                                height=199)
     self.previewContFill = FillUnderlay(parent=self)
     self.previewCont = PreviewContainer(parent=self,
                                         align=uiconst.TOALL,
                                         state=uiconst.UI_HIDDEN)
     self.leftProbabilityGradient = GradientSprite(
         name='leftProbabilityGradient',
         parent=self,
         align=uiconst.CENTERLEFT,
         state=uiconst.UI_HIDDEN,
         pos=(0, 0, 160, 64),
         rgbData=((0, (1.0, 1.0, 1.0)), ),
         alphaData=((0.0, 0.5), (1.0, 0.0)))
     self.rightProbabilityGradient = GradientSprite(
         name='rightProbabilityGradient',
         parent=self,
         align=uiconst.CENTERRIGHT,
         state=uiconst.UI_HIDDEN,
         pos=(0, 0, 160, 64),
         rgbData=((0, (1.0, 1.0, 1.0)), ),
         alphaData=((0.0, 0.0), (1.0, 0.5)))
     self.previewCont.navigation.LoadTooltipPanel = self.LoadIconContTooltipPanel
     self.previewCont.navigation.GetTooltipDelay = self.GetIconContTooltipDelay
     self.previewCont.navigation.GetMenu = self.GetMenu
     self.iconCont.LoadTooltipPanel = self.LoadIconContTooltipPanel
     self.iconCont.GetTooltipDelay = self.GetIconContTooltipDelay
     self.iconCont.OnMouseEnter = self.OnIconContMouseEnter
     self.iconCont.OnMouseExit = self.OnIconContMouseExit
     self.iconCont.OnClick = self.OnIconContClick
     self.iconCont.GetMenu = self.GetMenu
     self.iconCont.GetDragData = self.GetIconContDragData
     self.iconCont.isDragObject = True
     self.techIcon = Sprite(name='techIcon',
                            parent=self.iconCont,
                            width=16,
                            height=16)
     self.icon = Icon(parent=self.iconCont,
                      align=CENTER,
                      state=uiconst.UI_DISABLED)
     self.bgCont = Container(name='bgCont',
                             parent=self,
                             align=uiconst.CENTER,
                             width=201,
                             height=192)
     self.bg = Sprite(
         bgParent=self.bgCont,
         texturePath='res:/UI/Texture/Classes/Industry/Output/itemBg.png')
     self.itemPattern = Sprite(
         bgParent=self.bgCont,
         texturePath=
         'res:/UI/Texture/Classes/Industry/Output/itemBgColor.png')
     self.UpdateState()
     self.AnimEntry()
예제 #14
0
 def ApplyAttributes(self, attributes):
     uiprimitives.Container.ApplyAttributes(self, attributes)
     self.abortbtn = None
     self.abortbtnpar = None
     self.confirmbtn = None
     self.abortconfirmbtnpar = None
     self.sr.progresstext = None
     self.sr.readprogress = util.KeyVal(text='', prev=0)
     self.scope = 'all'
     self.sr.main = uiprimitives.Container(parent=self,
                                           pos=(0, 0, 0, 0),
                                           name='maincontainer',
                                           state=uiconst.UI_PICKCHILDREN,
                                           align=uiconst.TOALL)
     self.sr.wndUnderlay = uicontrols.WindowUnderlay(parent=self,
                                                     transparent=False)
     par = uiprimitives.Container(name='progressParent',
                                  parent=self.sr.main,
                                  align=uiconst.TOBOTTOM,
                                  height=32)
     progress = uiprimitives.Container(parent=par,
                                       pos=(25, 10, self.width - 50, 10),
                                       name='progressbar',
                                       state=uiconst.UI_DISABLED,
                                       align=uiconst.RELATIVE)
     self.sr.glowClipper = uiprimitives.Container(parent=progress,
                                                  pos=(0, 0, 0, 10),
                                                  name='glowclipper',
                                                  state=uiconst.UI_DISABLED,
                                                  clipChildren=True,
                                                  align=uiconst.RELATIVE)
     self.sr.glow = uiprimitives.Container(parent=self.sr.glowClipper,
                                           pos=(0, 0, progress.width, 10),
                                           name='glow',
                                           state=uiconst.UI_DISABLED,
                                           align=uiconst.RELATIVE)
     glowFill = FillUnderlay(parent=self.sr.glow,
                             name='glowFill',
                             state=uiconst.UI_DISABLED,
                             colorType=uiconst.COLORTYPE_UIHILIGHT,
                             align=uiconst.TOALL,
                             opacity=0.4)
     shade = uiprimitives.Container(parent=progress,
                                    pos=(0, 0, 0, 0),
                                    name='shade',
                                    state=uiconst.UI_DISABLED,
                                    align=uiconst.TOALL)
     shadeFill = FillUnderlay(parent=shade,
                              name='shadeFill',
                              state=uiconst.UI_DISABLED,
                              colorType=uiconst.COLORTYPE_UIHILIGHT,
                              align=uiconst.TOALL)
     FrameUnderlay(parent=progress, colorType=uiconst.COLORTYPE_UIHILIGHT)
     self.sr.loading_progress = progress
     self.sr.progresstext = uicontrols.EveLabelMedium(
         text='',
         parent=progress,
         width=270,
         left=2,
         top=4,
         state=uiconst.UI_NORMAL)
     self.state = uiconst.UI_PICKCHILDREN
예제 #15
0
 def ConstructBackground(self):
     Frame(name='bgFrame',
           parent=self,
           align=uiconst.CENTER,
           state=uiconst.UI_DISABLED,
           width=75,
           height=75,
           opacity=0.1)
     blueprintBg = FrameUnderlay(
         name='blueprintBgFill',
         parent=self,
         align=uiconst.CENTER,
         state=uiconst.UI_DISABLED,
         texturePath='res:/UI/Texture/classes/Industry/Center/bgFrame.png',
         width=90,
         height=90)
     self.dashesCont = Container(name='dashesCont',
                                 parent=self,
                                 state=uiconst.UI_DISABLED,
                                 pos=(75, 0, 150, 150),
                                 align=uiconst.CENTER)
     self.bgCont = Container(name='bgCont',
                             parent=self,
                             state=uiconst.UI_DISABLED,
                             width=150,
                             height=150,
                             align=uiconst.CENTER)
     self.topWedge = Container(name='topWedge',
                               parent=self.bgCont,
                               align=uiconst.CENTERTOP,
                               pos=(0, 0, 84, 60))
     topLines = Sprite(
         bgParent=self.topWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/wedgeTopBottom.png')
     topDots = Sprite(
         bgParent=self.topWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/dotsTopBottom.png')
     topBg = Sprite(
         bgParent=self.topWedge,
         texturePath='res:/UI/Texture/classes/Industry/Center/bgTop.png',
         color=COLOR_FRAME)
     self.bottomWedge = Container(name='bottomWedge',
                                  parent=self.bgCont,
                                  align=uiconst.CENTERBOTTOM,
                                  pos=(0, 0, 84, 60))
     bottomLines = Sprite(
         bgParent=self.bottomWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/wedgeTopBottom.png',
         rotation=pi)
     bottomDots = Sprite(
         bgParent=self.bottomWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/dotsTopBottom.png',
         rotation=pi)
     bottomBg = Sprite(
         bgParent=self.bottomWedge,
         texturePath='res:/UI/Texture/classes/Industry/Center/bgBottom.png',
         color=COLOR_FRAME)
     self.leftWedge = Container(name='leftWedge',
                                parent=self.bgCont,
                                align=uiconst.CENTERLEFT,
                                pos=(0, 0, 60, 84))
     leftLines = Sprite(
         bgParent=self.leftWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/wedgeLeftRight.png')
     leftDots = Sprite(
         bgParent=self.leftWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/dotsLeftRight.png')
     leftBg = Sprite(
         bgParent=self.leftWedge,
         texturePath='res:/UI/Texture/classes/Industry/Center/bgLeft.png',
         color=COLOR_FRAME)
     self.rightWedge = Container(name='rightWedge',
                                 parent=self.bgCont,
                                 align=uiconst.CENTERRIGHT,
                                 pos=(0, 0, 60, 84))
     rightLines = Sprite(
         bgParent=self.rightWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/wedgeLeftRight.png',
         rotation=pi)
     rightDots = Sprite(
         bgParent=self.rightWedge,
         texturePath=
         'res:/UI/Texture/classes/Industry/Center/dotsLeftRight.png',
         rotation=pi)
     rightBg = Sprite(
         bgParent=self.rightWedge,
         texturePath='res:/UI/Texture/classes/Industry/Center/bgRight.png',
         color=COLOR_FRAME)
     self.wedgeLines = [topLines, bottomLines, leftLines, rightLines]
     self.wedgeDots = [topDots, bottomDots, leftDots, rightDots]
     self.wedgeBg = [topBg, bottomBg, leftBg, rightBg]