def ApplyAttributes(self, attributes):
     ReprocessingContainer.ApplyAttributes(self, attributes)
     self.scrollCont.name = 'outputScroll'
     self.volumeLabel.display = True
     self.UpdateItemInfo(0, 0, 0)
     self.overlayCont.display = False
     w, h = self.overlayCont.GetAbsoluteSize()
     overlayLabel = EveCaptionMedium(name='overlayLabel', parent=self.overlayCont, align=uiconst.CENTER)
     overlayLabel2 = EveLabelMediumBold(name='overlayLabel2', parent=self.overlayCont, align=uiconst.CENTER, top=20, state=uiconst.UI_NORMAL)
     overlayLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/OutputTransferredTo')
     overlayLabel2.text = GetByLabel('UI/Inventory/ItemHangar')
     overlayLabel2.OnClick = uicore.cmd.OpenInventory
Exemplo n.º 2
0
 def ApplyAttributes(self, attributes):
     ReprocessingContainer.ApplyAttributes(self, attributes)
     self.scrollCont.name = 'outputScroll'
     self.volumeLabel.display = True
     self.UpdateItemInfo(0, 0, 0)
     self.overlayCont.display = False
     w, h = self.overlayCont.GetAbsoluteSize()
     overlayLabel = EveCaptionMedium(name='overlayLabel', parent=self.overlayCont, align=uiconst.CENTER)
     overlayLabel2 = EveLabelMediumBold(name='overlayLabel2', parent=self.overlayCont, align=uiconst.CENTER, top=20, state=uiconst.UI_NORMAL)
     overlayLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/OutputTransferredTo')
     overlayLabel2.text = GetByLabel('UI/Inventory/ItemHangar')
     overlayLabel2.OnClick = uicore.cmd.OpenInventory
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     sm.RegisterNotify(self)
     self.jobData = attributes.jobData
     self.materialGroups = []
     self.lines = []
     self.fromLine = None
     self.bigConnectorCircle = None
     self.animateTextThread = None
     noItemsLabelCont = Container(
         parent=self,
         align=uiconst.TOPLEFT_PROP,
         pos=(0.0, 0.5, 0.5, 500),
         padRight=industryUIConst.RADIUS_CENTERCIRCLE_OUTER)
     self.noItemsRequiredLabel = EveCaptionMedium(
         name='noItemsRequiredLabel',
         parent=noItemsLabelCont,
         align=uiconst.CENTER,
         opacity=0.0)
     self.bg = StretchSpriteHorizontal(name='groupBackground',
                                       parent=self,
                                       align=uiconst.TOLEFT_PROP,
                                       state=uiconst.UI_DISABLED,
                                       width=0.5,
                                       height=402,
                                       leftEdgeSize=10,
                                       rightEdgeSize=400)
     groupsData = self.GetMaterialGroups()
     self.ConstructGroups(groupsData)
     self.ConstructLines(groupsData)
     self.UpdateState()
     self.AnimEntry()
Exemplo n.º 4
0
 def ApplyAttributes(self, attributes):
     ContainerAutoSize.ApplyAttributes(self, attributes)
     self.abortbtn = None
     self.abortbtnpar = None
     self.confirmbtn = None
     self.abortconfirmbtnpar = None
     self.sr.readprogress = util.KeyVal(text='', prev=0)
     self.caption = EveCaptionMedium(name='caption',
                                     parent=self,
                                     align=uiconst.TOTOP,
                                     padding=(25, 0, 25, 0),
                                     top=12,
                                     idx=0,
                                     state=uiconst.UI_DISABLED)
     self.progressText = EveLabelMedium(parent=self,
                                        width=270,
                                        left=2,
                                        top=4,
                                        state=uiconst.UI_NORMAL,
                                        align=uiconst.TOTOP,
                                        padding=(25, 0, 25, 0))
     self.progressBar = ProgressBar(parent=self,
                                    height=10,
                                    padding=(25, 10, 25, 10),
                                    align=uiconst.TOTOP)
     uicontrols.WindowUnderlay(bgParent=self)
Exemplo n.º 5
0
 def CustomizeHeader(self):
     self.sr.headerParent.display = False
     self.sr.caption = EveCaptionMedium(text='Pod Guide',
                                        parent=self.podGuideNavigation,
                                        left=18,
                                        top=22,
                                        state=uiconst.UI_DISABLED)
Exemplo n.º 6
0
 def ConstructTopCont(self):
     Sprite(name='twitchLogo',
            parent=self.topCont,
            texturePath='res:/UI/Texture/Classes/Twitch/logo.png',
            pos=(0, 0, 200, 69))
     self.stateIcon = TwitchStateIcon(parent=self.topCont,
                                      align=uiconst.TOPLEFT,
                                      pos=(0, 80, 32, 32),
                                      func=self.OnStateIconClick,
                                      controller=self)
     self.loadingWheel = LoadingWheel(parent=self.topCont,
                                      align=uiconst.TOPLEFT,
                                      pos=(-16, 64, 64, 64),
                                      opacity=0.0)
     self.stateLabel = EveCaptionMedium(parent=self.topCont,
                                        pos=(40, 87, 210, 0))
Exemplo n.º 7
0
 def ApplyAttributes(self, attributes):
     PointerContainer.ApplyAttributes(self, attributes)
     self.data = attributes.data
     self.callback = attributes.callback
     self.minDisplayTime = attributes.Get('minDisplayTime', self.default_minDisplayTime)
     self.outsideBoundsTime = attributes.Get('outsideBoundsTime', self.default_outsideBoundsTime)
     self.updateLoopTimeMSec = attributes.Get('updateLoopTimeMSec', self.default_updateLoopTimeMSec)
     self._updateThread = None
     self.michelle = sm.GetService('michelle')
     self.sensorSuite = sm.GetService('sensorSuite')
     self.topContainer = Container(parent=self, height=20, align=uiconst.TOTOP)
     self.bottomContainer = Container(parent=self, align=uiconst.TOALL)
     self.contentContainer = Container(parent=self.bottomContainer, align=uiconst.TOALL, padLeft=16)
     Fill(bgParent=self.bottomContainer, color=(0, 0, 0, 0.4))
     Line(parent=self.bottomContainer, align=uiconst.TOBOTTOM)
     leftPadContainer = Container(parent=self.topContainer, align=uiconst.TOLEFT, width=12)
     Line(parent=leftPadContainer, align=uiconst.TORIGHT)
     Line(parent=leftPadContainer, align=uiconst.TOBOTTOM)
     textContainer = Container(parent=self.topContainer, align=uiconst.TOLEFT, width=150)
     Fill(bgParent=textContainer, color=(0, 0, 0, 0.5))
     Line(parent=textContainer, align=uiconst.TOTOP)
     Line(parent=textContainer, align=uiconst.TORIGHT)
     self.captionLabel = EveLabelMediumBold(parent=textContainer, text=self.GetCaptionText(), align=uiconst.CENTER)
     textContainer.width = self.captionLabel.textwidth + 16
     rightPadContainer = Container(parent=self.topContainer, align=uiconst.TOALL)
     Line(parent=rightPadContainer, align=uiconst.TOBOTTOM)
     self.iconCont = Container(parent=self.contentContainer, pos=(8, 8, 32, 32), state=uiconst.UI_DISABLED, align=uiconst.TOPRIGHT)
     if self.default_iconTexturePath:
         self.CreateIconSpite()
         self.ownerIcon.SetTexturePath(self.default_iconTexturePath)
         self.ownerIcon.state = uiconst.UI_DISABLED
     topTextCont = ContainerAutoSize(top=8, name='topTextCont', parent=self.contentContainer, align=uiconst.TOTOP)
     self.mainLabel = EveCaptionMedium(name='mainLabel', parent=topTextCont, color=(0.235, 0.745, 0.765), text='', align=uiconst.TOTOP, singleline=True)
     self.mainLabel.SetRightAlphaFade(fadeEnd=250, maxFadeWidth=30)
     self.subLabel = EveLabelMediumBold(name='subLabel', parent=topTextCont, align=uiconst.TOTOP, text='', singleline=True)
     self.subLabel.SetRightAlphaFade(fadeEnd=250, maxFadeWidth=30)
     bottomTextCont = ContainerAutoSize(top=2, name='bottomTextCont', parent=self.contentContainer, align=uiconst.TOBOTTOM)
     self.dataLabel = EveLabelMediumBold(name='dataLabel', parent=bottomTextCont, align=uiconst.TOBOTTOM, text='')
     self.rangeLabel = EveLabelMediumBold(name='rangeLabel', parent=bottomTextCont, align=uiconst.TOBOTTOM, text='')
     self.buttonContainer = Container(parent=self.contentContainer, align=uiconst.BOTTOMRIGHT, heigh=32)
     GradientSprite(parent=self.bottomContainer, align=uiconst.TOALL, rotation=-pi / 2, rgbData=[(0, (0.25, 0.25, 0.25)), (0.3, (0.0, 0.0, 0.0))], alphaData=[(0, 0.5)], state=uiconst.UI_DISABLED)
     self.warpButton = Button(parent=self.contentContainer, top=8, left=88, icon='res:/UI/Texture/Icons/44_32_18.png', func=self.WarpToAction, hint=localization.GetByLabel('UI/Commands/WarpTo'), align=uiconst.BOTTOMRIGHT)
     self.bookmarkButton = Button(parent=self.contentContainer, top=8, left=48, icon='res:/UI/Texture/Icons/bookmark.png', func=self.BookmarkSite, hint=localization.GetByLabel('UI/Inflight/BookmarkLocation'), align=uiconst.BOTTOMRIGHT)
     self.probeScannerButton = Button(parent=self.contentContainer, top=8, left=4, icon='res:/UI/Texture/Icons/probe_scan.png', func=OpenProbeScanner, hint=localization.GetByLabel('UI/Inflight/Scanner/SensorOverlayProbeScanButtonHint'), align=uiconst.BOTTOMRIGHT)
     uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEDOWN, self.OnGlobalMouseDown)
     self._updateThread = uthread.new(self.UpdateHint)
Exemplo n.º 8
0
 def PrepareCompleteMessage(self):
     self.messagePanel.Flush()
     text = localization.GetByLabel(
         'UI/SkillTrading/CompleteMessageCaption')
     EveCaptionMedium(parent=self.messagePanel,
                      align=uiconst.TOTOP,
                      text='<center>%s</center>' % text)
     text = localization.GetByLabel('UI/SkillTrading/CompleteMessageMain',
                                    amount=self.controller.SKILL_POINT_GOAL,
                                    injector=invconst.typeSkillInjector)
     EveLabelMedium(parent=self.messagePanel,
                    align=uiconst.TOTOP,
                    top=4,
                    text='<center>%s</center>' % text)
     iconCont = Container(parent=self.messagePanel,
                          align=uiconst.TOTOP,
                          top=8,
                          height=64)
     Icon(parent=iconCont,
          align=uiconst.CENTER,
          left=-40,
          typeID=invconst.typeSkillInjector,
          size=64,
          state=uiconst.UI_DISABLED)
     Sprite(
         parent=iconCont,
         align=uiconst.CENTER,
         state=uiconst.UI_DISABLED,
         texturePath='res:/UI/Texture/classes/skilltrading/arrow_right.png',
         width=32,
         height=32,
         opacity=0.6)
     Sprite(parent=iconCont,
            align=uiconst.CENTER,
            state=uiconst.UI_DISABLED,
            left=40,
            texturePath='res:/UI/Texture/WindowIcons/itemHangar.png',
            width=64,
            height=64)
     text = localization.GetByLabel('UI/SkillTrading/CompleteMessageTail',
                                    injector=invconst.typeSkillInjector)
     EveLabelMedium(parent=self.messagePanel,
                    align=uiconst.TOTOP,
                    top=8,
                    text='<center>%s</center>' % text)
     buttonCont = Container(parent=self.messagePanel,
                            align=uiconst.TOTOP,
                            top=16,
                            height=40)
     Button(parent=buttonCont,
            align=uiconst.CENTER,
            label=localization.GetByLabel('UI/Common/Done'),
            func=self.Close)
Exemplo n.º 9
0
 def BuildProgressUI(self):
     self.progressCont = Container(parent=self.sr.main,
                                   height=36,
                                   align=uiconst.TOBOTTOM,
                                   padding=(10, 0, 10, 10))
     self.progressCounter = EveCaptionMedium(name='progressCounter',
                                             parent=self.progressCont,
                                             state=uiconst.UI_NORMAL,
                                             align=uiconst.CENTERTOP)
     self.progressBar = ProgressBar(parent=self.progressCont,
                                    height=10,
                                    align=uiconst.TOBOTTOM)
     self.progressCont.display = False
Exemplo n.º 10
0
 def ConstructUI(self):
     self.hintLabel = EveCaptionMedium(
         parent=self,
         align=uiconst.TOTOP,
         top=50,
         text='<center>%s' %
         GetByLabel('UI/Structures/AccessGroups/CreateGroup'))
     self.innerCont = Container(parent=self, name='innerCont')
     self.nameAndDescCont = NameAndDescCont(name='nameAndDescCont',
                                            parent=self.innerCont,
                                            align=uiconst.TOTOP)
     self.dropCont = DropCont(parent=self.innerCont,
                              align=uiconst.TOTOP,
                              controller=self.controller)
     btnText = GetByLabel('UI/Structures/AccessGroups/AddPublic')
     self.addParent = Container(parent=self.innerCont,
                                align=uiconst.TOBOTTOM,
                                height=32)
     self.addMemberCont = AddPublic(parent=self.addParent,
                                    padBottom=2,
                                    func=self.AddPublicGroup)
     self.addMemberCont = AddMemberCont(parent=self.addParent,
                                        func=self.AddMembers,
                                        padBottom=2,
                                        padRight=4)
     self.groupCont = Container(name='browserCont',
                                parent=self.innerCont,
                                padding=(0, 2, 0, 4))
     self.groupMemberCont = AccessGroupMemberCont(
         name='groupMemberCont',
         parent=self.groupCont,
         controller=self.controller)
     self.auditLogCont = AuditLogCont(name='auditLogCont',
                                      parent=self.groupCont,
                                      controller=self.controller)
     tabs = ((GetByLabel('UI/Structures/AccessGroups/GroupMembers'),
              self.groupMemberCont, None, 'groupMemberCont', None),
             (GetByLabel('UI/Structures/AccessGroups/GroupLogs'),
              self.auditLogCont, None, 'auditLogCont', None))
     self.tabs = TabGroup(parent=self.groupCont,
                          tabs=tabs,
                          height=26,
                          labelPadding=12,
                          idx=0,
                          padLeft=0,
                          groupID='groupMemberConts',
                          callback=self.OnTabSelected,
                          autoselecttab=True)
Exemplo n.º 11
0
 def ApplyAttributes(self, attributes):
     ReprocessingContainer.ApplyAttributes(self, attributes)
     self.removeFunc = attributes.removeFunc
     self.scrollCont.name = 'inputScroll'
     self.scrollCont.OnDropData = self.OnDroppingItems
     self.parentDropFunc = attributes.dropFunc
     self.volumeLabel.display = False
     self.UpdateItemInfo(0, 0)
     w, h = self.overlayCont.GetAbsoluteSize()
     self.overlayLabel = EveCaptionMedium(name='overlayLabel', parent=self.overlayCont, align=uiconst.TOTOP, pos=(16,
      32,
      w - 32,
      0))
     self.overlayLabel.opacity = 0.0
     self.overlayLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/DropHereToReprocess')
     self.ShowHint()
Exemplo n.º 12
0
 def ShowHint(self, hint=None):
     isNew = self.sr.hint is None or self.sr.hint.text != hint
     if self.sr.hint is None and hint:
         clipperWidth = self.GetContentWidth()
         self.sr.hint = EveCaptionMedium(parent=self.sr.clipper,
                                         align=uiconst.TOPLEFT,
                                         left=16,
                                         top=32,
                                         width=clipperWidth - 32,
                                         text=hint)
     elif self.sr.hint is not None and hint:
         self.sr.hint.text = hint
         self.sr.hint.state = uiconst.UI_DISABLED
         isNew = isNew or self.sr.hint.display == False
     elif self.sr.hint is not None and not hint:
         self.sr.hint.state = uiconst.UI_HIDDEN
     if self.sr.hint and self.sr.hint.display and isNew:
         uicore.animations.FadeTo(self.sr.hint, 0.0, 0.5, duration=0.3)
Exemplo n.º 13
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     itemID = attributes.itemID
     self.typeID = attributes.typeID
     subsystems = attributes.subsystems
     animate = attributes.animate
     self.loadingWheel = LoadingWheel(parent=self.sr.main,
                                      align=uiconst.CENTER,
                                      state=uiconst.UI_DISABLED)
     self.previewContFill = FillThemeColored(parent=self.sr.main,
                                             align=uiconst.TOALL)
     overlayCont = Container(name='overlayCont',
                             parent=self.sr.main,
                             padding=2,
                             clipChildren=1)
     self.title = EveCaptionMedium(text='',
                                   parent=overlayCont,
                                   align=uiconst.TOTOP,
                                   padding=(17, 4, 17, 0),
                                   state=uiconst.UI_NORMAL)
     self.title.GetMenu = self.GetShipMenu
     self.title.expandOnLeft = 1
     self.subtitle = EveHeaderSmall(text='',
                                    parent=overlayCont,
                                    align=uiconst.TOTOP,
                                    padding=(19, 0, 17, 0),
                                    state=uiconst.UI_DISABLED)
     descLayer = Container(parent=self.sr.main)
     self.descCont = ContainerAutoSize(parent=descLayer,
                                       align=uiconst.TOBOTTOM,
                                       bgColor=(0.0, 0.0, 0.0, 0.3),
                                       padding=6,
                                       state=uiconst.UI_HIDDEN)
     self.desc = Label(parent=self.descCont,
                       padding=6,
                       fontsize=12,
                       align=uiconst.TOBOTTOM)
     self.previewContainer = PreviewContainer(
         parent=self.sr.main,
         OnStartLoading=self.OnStartLoading,
         OnStopLoading=self.OnStopLoading,
         padding=2)
     self.previewContainer.navigation.OnDropData = self.OnDropData
     self.PreviewType(self.typeID, subsystems, itemID, animate)
Exemplo n.º 14
0
 def BuildEquipmentUI(self):
     self.equipmentCounter = EveCaptionMedium(name='equipmentCounter',
                                              parent=self.missingLayoutGrid,
                                              state=uiconst.UI_NORMAL,
                                              align=uiconst.CENTERRIGHT,
                                              left=4)
     self.equipmentCounter.LoadTooltipPanel = self.LoadEqCounterTooltipPanel
     self.equipmentCounter.missingDict = {}
     eqText = GetByLabel(
         'UI/Fitting/FittingWindow/FittingManagement/RoundsOfFittingsInHangar'
     )
     self.availableEquipmentLabel = EveLabelLarge(
         name='availableEquipmentLabel',
         parent=self.missingLayoutGrid,
         state=uiconst.UI_NORMAL,
         text=eqText,
         align=uiconst.CENTERLEFT,
         width=MAX_TEXT_WIDTH,
         autoFitToText=True)
     self.layoutGrid.FillRow()
Exemplo n.º 15
0
 def PrepareShipMessage(self):
     self.messagePanel.Flush()
     text = 'Must Be In Capsule'
     EveCaptionMedium(parent=self.messagePanel,
                      align=uiconst.TOTOP,
                      text='<center>%s</center>' % text)
     text = 'A direct connection to your capsule is required in order to extract skill points. Please leave your active ship to continue.'
     EveLabelMedium(parent=self.messagePanel,
                    align=uiconst.TOTOP,
                    top=4,
                    text='<center>%s</center>' % text)
     buttonCont = Container(parent=self.messagePanel,
                            align=uiconst.TOTOP,
                            top=16,
                            height=40)
     Button(parent=buttonCont,
            align=uiconst.CENTER,
            label='Leave Current Ship',
            func=self.LeaveShip,
            args=())
Exemplo n.º 16
0
 def BuildAvailableShipsUI(self):
     self.shipCounter = EveCaptionMedium(name='shipCounter',
                                         parent=self.missingLayoutGrid,
                                         state=uiconst.UI_NORMAL,
                                         align=uiconst.CENTERRIGHT,
                                         left=4)
     self.shipCounter.LoadTooltipPanel = self.LoadShipCounterTooltipPanel
     self.shipCounter.missingDict = {}
     shipText = GetByLabel(
         'UI/Fitting/FittingWindow/FittingManagement/PackagedShipsInHangar')
     self.availableShipsLabel = EveLabelLarge(name='availableShipsLabel',
                                              parent=self.missingLayoutGrid,
                                              state=uiconst.UI_NORMAL,
                                              text=shipText,
                                              align=uiconst.CENTERLEFT,
                                              width=MAX_TEXT_WIDTH,
                                              autoFitToText=True)
     self.availableShipsLabel.hint = GetByLabel(
         'UI/Fitting/FittingWindow/FittingManagement/PackagedShipsInHangarHint'
     )
     self.layoutGrid.FillRow()
Exemplo n.º 17
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     itemID = attributes.itemID
     self.typeID = attributes.typeID
     subsystems = attributes.subsystems
     animate = attributes.animate
     width = self.PANEL_WIDTH if self.IsPanelExpanded() else 0
     self.sidePanel = Container(parent=self.sr.main,
                                align=uiconst.TOLEFT,
                                width=width,
                                clipChildren=True)
     self.skinController = SkinPanelController(typeID=None)
     SkinPanel(parent=self.sidePanel,
               align=uiconst.TOLEFT,
               width=self.PANEL_WIDTH - 10,
               left=10,
               controller=self.skinController,
               settingsPrefix='Preview_SkinPanel',
               logContext='PreviewWindow')
     mainCont = Container(parent=self.sr.main,
                          align=uiconst.TOALL,
                          padding=(2, 0, 2, 2))
     opacity = 1.0 if self.IsPanelEnabled() else 0.0
     self.sidePanelButton = SidePanelButton(parent=mainCont,
                                            align=uiconst.CENTERLEFT,
                                            opacity=opacity,
                                            onClick=self.ToggleSidePanel,
                                            expanded=self.IsPanelExpanded())
     self.loadingWheel = LoadingWheel(parent=mainCont,
                                      align=uiconst.CENTER,
                                      state=uiconst.UI_DISABLED)
     self.previewContFill = FillThemeColored(parent=mainCont,
                                             align=uiconst.TOALL)
     overlayCont = Container(name='overlayCont',
                             parent=mainCont,
                             padding=2,
                             clipChildren=1)
     self.title = EveCaptionMedium(text='',
                                   parent=overlayCont,
                                   align=uiconst.TOTOP,
                                   padding=(17, 4, 17, 0),
                                   state=uiconst.UI_NORMAL)
     self.title.GetMenu = self.GetShipMenu
     self.title.expandOnLeft = 1
     self.subtitle = EveHeaderSmall(text='',
                                    parent=overlayCont,
                                    align=uiconst.TOTOP,
                                    padding=(19, 0, 17, 0),
                                    state=uiconst.UI_DISABLED)
     descLayer = Container(parent=mainCont)
     self.descCont = ContainerAutoSize(parent=descLayer,
                                       align=uiconst.TOBOTTOM,
                                       bgColor=(0.0, 0.0, 0.0, 0.3),
                                       padding=6,
                                       state=uiconst.UI_HIDDEN)
     self.desc = Label(parent=self.descCont,
                       padding=6,
                       fontsize=12,
                       align=uiconst.TOBOTTOM)
     self.previewContainer = PreviewContainer(
         parent=mainCont,
         OnStartLoading=self.OnStartLoading,
         OnStopLoading=self.OnStopLoading)
     self.previewContainer.navigation.OnDropData = self.OnDropData
     self.PreviewType(self.typeID, subsystems, itemID, animate)
Exemplo n.º 18
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()
Exemplo n.º 19
0
class BaseSensorSuiteHint(PointerContainer):
    """
    This is the base implementation of a sensor suite hint
    """
    default_name = 'BaseSensorSuiteHint'
    default_height = 122
    default_width = 300
    default_minDisplayTime = SEC
    default_outsideBoundsTime = 400 * MSEC
    default_updateLoopTimeMSec = 200
    default_captionLabel = None
    default_iconTexturePath = None

    def GetCaptionText(self):
        raise NotImplementedError()

    def CreateIconSpite(self):
        self.ownerIcon = Sprite(parent=self.iconCont, pos=(0, 0, 32, 32), state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT)

    def ApplyAttributes(self, attributes):
        PointerContainer.ApplyAttributes(self, attributes)
        self.data = attributes.data
        self.callback = attributes.callback
        self.minDisplayTime = attributes.Get('minDisplayTime', self.default_minDisplayTime)
        self.outsideBoundsTime = attributes.Get('outsideBoundsTime', self.default_outsideBoundsTime)
        self.updateLoopTimeMSec = attributes.Get('updateLoopTimeMSec', self.default_updateLoopTimeMSec)
        self._updateThread = None
        self.michelle = sm.GetService('michelle')
        self.sensorSuite = sm.GetService('sensorSuite')
        self.topContainer = Container(parent=self, height=20, align=uiconst.TOTOP)
        self.bottomContainer = Container(parent=self, align=uiconst.TOALL)
        self.contentContainer = Container(parent=self.bottomContainer, align=uiconst.TOALL, padLeft=16)
        Fill(bgParent=self.bottomContainer, color=(0, 0, 0, 0.4))
        Line(parent=self.bottomContainer, align=uiconst.TOBOTTOM)
        leftPadContainer = Container(parent=self.topContainer, align=uiconst.TOLEFT, width=12)
        Line(parent=leftPadContainer, align=uiconst.TORIGHT)
        Line(parent=leftPadContainer, align=uiconst.TOBOTTOM)
        textContainer = Container(parent=self.topContainer, align=uiconst.TOLEFT, width=150)
        Fill(bgParent=textContainer, color=(0, 0, 0, 0.5))
        Line(parent=textContainer, align=uiconst.TOTOP)
        Line(parent=textContainer, align=uiconst.TORIGHT)
        self.captionLabel = EveLabelMediumBold(parent=textContainer, text=self.GetCaptionText(), align=uiconst.CENTER)
        textContainer.width = self.captionLabel.textwidth + 16
        rightPadContainer = Container(parent=self.topContainer, align=uiconst.TOALL)
        Line(parent=rightPadContainer, align=uiconst.TOBOTTOM)
        self.iconCont = Container(parent=self.contentContainer, pos=(8, 8, 32, 32), state=uiconst.UI_DISABLED, align=uiconst.TOPRIGHT)
        if self.default_iconTexturePath:
            self.CreateIconSpite()
            self.ownerIcon.SetTexturePath(self.default_iconTexturePath)
            self.ownerIcon.state = uiconst.UI_DISABLED
        topTextCont = ContainerAutoSize(top=8, name='topTextCont', parent=self.contentContainer, align=uiconst.TOTOP)
        self.mainLabel = EveCaptionMedium(name='mainLabel', parent=topTextCont, color=(0.235, 0.745, 0.765), text='', align=uiconst.TOTOP, singleline=True)
        self.mainLabel.SetRightAlphaFade(fadeEnd=250, maxFadeWidth=30)
        self.subLabel = EveLabelMediumBold(name='subLabel', parent=topTextCont, align=uiconst.TOTOP, text='', singleline=True)
        self.subLabel.SetRightAlphaFade(fadeEnd=250, maxFadeWidth=30)
        bottomTextCont = ContainerAutoSize(top=2, name='bottomTextCont', parent=self.contentContainer, align=uiconst.TOBOTTOM)
        self.dataLabel = EveLabelMediumBold(name='dataLabel', parent=bottomTextCont, align=uiconst.TOBOTTOM, text='')
        self.rangeLabel = EveLabelMediumBold(name='rangeLabel', parent=bottomTextCont, align=uiconst.TOBOTTOM, text='')
        self.buttonContainer = Container(parent=self.contentContainer, align=uiconst.BOTTOMRIGHT, heigh=32)
        GradientSprite(parent=self.bottomContainer, align=uiconst.TOALL, rotation=-pi / 2, rgbData=[(0, (0.25, 0.25, 0.25)), (0.3, (0.0, 0.0, 0.0))], alphaData=[(0, 0.5)], state=uiconst.UI_DISABLED)
        self.warpButton = Button(parent=self.contentContainer, top=8, left=88, icon='res:/UI/Texture/Icons/44_32_18.png', func=self.WarpToAction, hint=localization.GetByLabel('UI/Commands/WarpTo'), align=uiconst.BOTTOMRIGHT)
        self.bookmarkButton = Button(parent=self.contentContainer, top=8, left=48, icon='res:/UI/Texture/Icons/bookmark.png', func=self.BookmarkSite, hint=localization.GetByLabel('UI/Inflight/BookmarkLocation'), align=uiconst.BOTTOMRIGHT)
        self.probeScannerButton = Button(parent=self.contentContainer, top=8, left=4, icon='res:/UI/Texture/Icons/probe_scan.png', func=OpenProbeScanner, hint=localization.GetByLabel('UI/Inflight/Scanner/SensorOverlayProbeScanButtonHint'), align=uiconst.BOTTOMRIGHT)
        uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEDOWN, self.OnGlobalMouseDown)
        self._updateThread = uthread.new(self.UpdateHint)

    def SetFactionIcon(self, factionID):
        iconID = LogoIcon.GetFactionIconID(factionID, isSmall=True)
        if iconID is not None:
            resPath = Icon.ConvertIconNoToResPath(iconID)
            if resPath is not None:
                self.CreateIconSpite()
                self.ownerIcon.SetTexturePath(resPath[0])
                self.iconCont.state = uiconst.UI_NORMAL
                self.iconCont.OnClick = lambda : sm.GetService('info').ShowInfo(itemID=factionID, typeID=typeFaction)

    def SetOwnerIcon(self, ownerID):
        GetOwnerLogo(self.iconCont, ownerID, size=32)
        self.iconCont.state = uiconst.UI_NORMAL
        self.iconCont.OnClick = lambda : sm.GetService('info').ShowInfo(itemID=ownerID, typeID=typeCorporation)

    def GetBestDockPlacement(self):
        dockPlacementOrder = (DockPlacement.LeftCenter,
         DockPlacement.RightCenter,
         DockPlacement.TopCenter,
         DockPlacement.BottomCenter)
        screenRect = uicore.layer.sensorsuite.GetAbsolute()
        anchorRect = self.anchor.GetAbsolute()
        bestDockPlacement = self.dockPlacement
        for dockPlacement in dockPlacementOrder:
            left, top = self.CalcPosition(dockPlacement, anchorRect)
            hintRect = (left,
             top,
             self.width,
             self.height)
            if IsRectBWithinA(screenRect, hintRect):
                bestDockPlacement = dockPlacement
                break

        return bestDockPlacement

    def UpdateWidth(self):
        buttonOffset = 144
        listWidths = (self.default_width,
         self.mainLabel.textwidth + 16 + 32 + 8 + 4,
         self.rangeLabel.textwidth + buttonOffset,
         self.dataLabel.textwidth + buttonOffset)
        self.width = max(listWidths)

    def WarpToAction(self, *args):
        WarpToItem(self.data.siteID)

    def BookmarkSite(self, *args):
        sm.GetService('addressbook').BookmarkLocationPopup(self.data.siteID, typeCosmicAnomaly, session.solarsystemid, locationName=localization.GetByMessageID(self.data.dungeonNameID))

    def UpdateHint(self):
        """
        This is the hint automatic fade out logic
        """
        startTime = blue.os.GetSimTime() + self.minDisplayTime
        outsideBoundsEndTime = None
        doUpdates = True
        try:
            while doUpdates:
                timeNow = blue.os.GetSimTime()
                if not self or self.destroyed:
                    return
                if timeNow > startTime:
                    if not (uicore.uilib.mouseOver in (self, self.anchor) or IsUnder(uicore.uilib.mouseOver, self) or IsUnder(uicore.uilib.mouseOver, self.anchor)):
                        if outsideBoundsEndTime is None:
                            outsideBoundsEndTime = timeNow + self.outsideBoundsTime
                        elif timeNow > outsideBoundsEndTime:
                            doUpdates = False
                    else:
                        outsideBoundsEndTime = None
                if self.sensorSuite.activeBracketHint is not self:
                    doUpdates = False
                if doUpdates:
                    try:
                        self.OnUpdateHint()
                        self.UpdateWarpButton()
                        blue.pyos.synchro.SleepWallclock(self.updateLoopTimeMSec)
                    except InvalidClientStateError:
                        doUpdates = False

        finally:
            if self and not self.destroyed:
                animations.FadeOut(self, sleep=True)
                uthread.new(self.Close)

    def OnUpdateHint(self):
        """
        This is for auto-magical update of data in the hint
        """
        pass

    def UpdateWarpButton(self):
        if self.data.IsAccurate() and self.michelle.IsPositionWithinWarpDistance(self.data.position):
            self.warpButton.Enable()
        else:
            self.warpButton.Disable()

    def _OnClose(self, *args):
        PointerContainer._OnClose(self, *args)
        if self._updateThread is not None:
            self._updateThread.kill()
        self.callback()

    def DoUpdateLayout(self, dockPlacement):
        pass

    def IsMouseOverHint(self):
        isMouseOverHint = False
        if uicore.uilib.mouseOver is self or IsUnder(uicore.uilib.mouseOver, self):
            isMouseOverHint = True
        elif self.sensorSuite.HasActiveOverlapContainerInstance():
            overlapContainer = self.sensorSuite.GetOverlapContainerInstance()
            if uicore.uilib.mouseOver is overlapContainer or IsUnder(uicore.uilib.mouseOver, overlapContainer):
                isMouseOverHint = True
        return isMouseOverHint

    def OnGlobalMouseDown(self, cont, *_):
        if self.IsMouseOverHint() or isinstance(cont, SensorSuiteBracket):
            return True
        else:
            self.Close()
            return False
Exemplo n.º 20
0
class TwitchStreaming(Window):
    __guid__ = 'form.TwitchStreaming'
    __notifyevents__ = ['OnTwitchStreamingStateChange']
    default_topParentHeight = 0
    default_windowID = 'Twitch'
    default_captionLabelPath = 'Tooltips/Neocom/Twitch'
    default_descriptionLabelPath = 'Tooltips/Neocom/Twitch_description'
    default_iconNum = 'res:/UI/Texture/windowIcons/twitch.png'
    default_fixedWidth = 260
    default_fixedHeight = 440

    def ApplyAttributes(self, attributes):
        Window.ApplyAttributes(self, attributes)
        sm.RegisterNotify(self)
        self.streamBtn = None
        self.topCont = ContainerAutoSize(name='topCont',
                                         parent=self.sr.main,
                                         align=uiconst.TOTOP,
                                         padding=(10, 10, 10, 0))
        self.loginCont = Container(name='loginCont',
                                   parent=self.sr.main,
                                   align=uiconst.TOTOP,
                                   height=120,
                                   padding=5)
        self.settingsCont = ContainerAutoSize(name='settingsCont',
                                              parent=self.sr.main,
                                              align=uiconst.TOTOP,
                                              padding=5)
        self.ConstructTopCont()
        self.ConstructLoginCont()
        self.ConstructSettingsCont()
        self.ConstructBottomButtons()
        self.bottomGradient = GradientSprite(bgParent=self.btnGroup,
                                             rotation=-pi / 2,
                                             rgbData=[(0, (0.3, 0.3, 0.3))],
                                             alphaData=[(0, 0.3), (0.9, 0.0)])
        self.UpdateState()
        self.CheckEnableStreamBtn()
        if bool(session.role & ROLE_PROGRAMMER):
            self.debugLabel = Label(parent=self.topCont,
                                    align=uiconst.TOPLEFT,
                                    top=120)

    def ConstructTopCont(self):
        Sprite(name='twitchLogo',
               parent=self.topCont,
               texturePath='res:/UI/Texture/Classes/Twitch/logo.png',
               pos=(0, 0, 200, 69))
        self.stateIcon = TwitchStateIcon(parent=self.topCont,
                                         align=uiconst.TOPLEFT,
                                         pos=(0, 80, 32, 32),
                                         func=self.OnStateIconClick,
                                         controller=self)
        self.loadingWheel = LoadingWheel(parent=self.topCont,
                                         align=uiconst.TOPLEFT,
                                         pos=(-16, 64, 64, 64),
                                         opacity=0.0)
        self.stateLabel = EveCaptionMedium(parent=self.topCont,
                                           pos=(40, 87, 210, 0))

    def OnStateIconClick(self):
        blue.os.ShellExecute(self.GetTwitchChannelURL())

    def GetTwitchChannelURL(self):
        return '%s/%s' % (TWITCH_URL, self.usernameCont.GetValue())

    def ConstructLoginCont(self):
        Line(parent=self.loginCont,
             align=uiconst.TOTOP,
             padBottom=10,
             opacity=0.1)
        EveCaptionSmall(parent=self.loginCont,
                        align=uiconst.TOTOP,
                        text=GetByLabel('UI/Twitch/LoginCaption'))
        twitchSvc = sm.GetService('twitch')
        username = twitchSvc.GetUsername()
        if username is None or not twitchSvc.HasToken():
            password = None
        else:
            password = PASSWORD_IF_HAS_TOKEN
        self.usernameCont = EditWithLabel(parent=self.loginCont,
                                          text=GetByLabel('UI/Login/Username'),
                                          value=username,
                                          OnChange=self.CheckEnableStreamBtn)
        self.passwordCont = EditWithLabel(parent=self.loginCont,
                                          text=GetByLabel('UI/Login/Password'),
                                          OnReturn=self.StartStream,
                                          OnChange=self.CheckEnableStreamBtn,
                                          OnSetFocus=self.OnPasswordContFocus)
        self.passwordCont.edit.SetPasswordChar(u'\u2022')
        self.passwordCont.edit.SetValue(password)
        Label(parent=self.loginCont,
              align=uiconst.TOTOP,
              state=uiconst.UI_NORMAL,
              padding=(LABELWIDTH, 7, 0, 0),
              text=GetByLabel('UI/Twitch/SignupLink'),
              fontsize=10)
        Line(parent=self.loginCont, align=uiconst.TOBOTTOM, idx=0, opacity=0.1)

    def ConstructSettingsCont(self):
        EveCaptionSmall(parent=self.settingsCont,
                        align=uiconst.TOTOP,
                        text=GetByLabel('UI/Twitch/StreamSettings'))
        title = sm.GetService('twitch').GetTitle()
        self.streamTitleCont = EditWithLabel(
            parent=self.settingsCont,
            text=GetByLabel('UI/Twitch/StreamTitle'),
            value=title,
            OnReturn=self.StartStream)
        self.resolutionCombo = ComboWithLabel(
            name='resolutionCombo',
            parent=self.settingsCont,
            text=GetByLabel('UI/Twitch/Resolution'),
            options=sm.GetService('twitch').GetResolutionOptions(),
            callback=self.OnResolutionCombo)
        currResolution = (uicore.desktop.width, uicore.desktop.height)
        self.resolutionCombo.combo.SelectItemByValue(currResolution)
        self.fpsCombo = ComboWithLabel(
            name='resolutionCombo',
            parent=self.settingsCont,
            text=GetByLabel('UI/Twitch/Framerate'),
            options=sm.GetService('twitch').GetFramerateOptions(),
            select=sm.GetService('twitch').GetFPS())

    def ConstructBottomButtons(self):
        self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0, line=False)
        self.btnGroup.AddButton(GetByLabel('UI/Generic/Close'),
                                self.CloseByUser)
        self.streamBtn = self.btnGroup.AddButton(
            GetByLabel('UI/Twitch/StartStream'), self.StartStream)

    def UpdateState(self):
        state, stateName = twitch.get_api_state()
        if state <= twitch.api.STATE.FOUND_INGEST_SERVER:
            text = GetByLabel('UI/Twitch/StreamingInactive')
            btnLabel = GetByLabel('UI/Twitch/StartStream')
            btnFunc = self.StartStream
            color = COLOR_STOPPED
            self.EnableInputFields()
        elif state == twitch.api.STATE.STREAMING:
            text = GetByLabel('UI/Twitch/StreamingToTwitch')
            btnLabel = GetByLabel('UI/Twitch/StopStream')
            btnFunc = self.StopStream
            color = COLOR_STREAMING
            self.DisableInputFields()
            uicore.animations.FadeTo(self.stateLabel,
                                     0.7,
                                     1.2,
                                     loops=ANIM_REPEAT,
                                     curveType=ANIM_WAVE,
                                     duration=3.6)
        else:
            raise RuntimeError('unhandled state: %s (%s)' % (state, stateName))
        self.stateIcon.icon.SetRGBA(*color)
        self.stateLabel.text = text
        self.stateLabel.SetRGBA(*color)
        self.streamBtn.SetLabel(btnLabel)
        self.streamBtn.func = btnFunc

    def CheckEnableStreamBtn(self, *args):
        if not self.streamBtn:
            return
        if self.IsUsernameOrPasswordBlank():
            self.streamBtn.Disable()
        else:
            self.streamBtn.Enable()

    def OnPasswordContFocus(self, *args):
        self.passwordCont.edit.SetValue(u'')

    def IsUsernameOrPasswordBlank(self):
        return not self.usernameCont.GetValue(
        ) or not self.passwordCont.GetValue()

    def GetInputFields(self):
        return (self.loginCont, self.settingsCont)

    def EnableInputFields(self):
        for uiObj in self.GetInputFields():
            uiObj.Enable()
            uiObj.opacity = 1.0

    def DisableInputFields(self):
        for uiObj in self.GetInputFields():
            uiObj.Disable()
            uiObj.opacity = 0.3

    def StartStream(self, *args):
        username = str(self.usernameCont.GetValue())
        password = str(self.passwordCont.GetValue(raw=True))
        if not username or not password:
            return
        self.UpdateResolution()
        try:
            self.ShowLoading()
            if password == PASSWORD_IF_HAS_TOKEN:
                password = None
            title = self.streamTitleCont.GetValue()
            fps = self.fpsCombo.GetValue()
            sm.GetService('twitch').StartStream(username, password, title, fps)
            self.passwordCont.edit.SetValue(PASSWORD_IF_HAS_TOKEN)
            self.usernameCont.SetCorrect()
            self.passwordCont.SetCorrect()
        except Exception as e:
            self.passwordCont.edit.SetValue(u'')
            self.usernameCont.SetIncorrect()
            self.passwordCont.SetIncorrect()
            if str(e) != 'TTV_EC_API_REQUEST_FAILED':
                raise
        finally:
            self.HideLoading(delay=3000)
            self.UpdateState()

    def StopStream(self, *args):
        try:
            self.ShowLoading()
            sm.GetService('twitch').StopStream()
        finally:
            self.HideLoading()

        self.UpdateState()

    def OnResolutionCombo(self, combo, label, resolution):
        self.UpdateResolution()

    def UpdateResolution(self):
        width, height = self.resolutionCombo.GetValue()
        deviceSvc = sm.GetService('device')
        settings = deviceSvc.GetSettings().copy()
        if settings.BackBufferWidth == width and settings.BackBufferHeight == height:
            return
        settings.BackBufferWidth = width
        settings.BackBufferHeight = height
        deviceSvc.SetDevice(settings, userModified=True)

    def ShowLoading(self):
        self.streamBtn.Disable()
        uicore.animations.FadeOut(self.stateIcon)
        uicore.animations.FadeOut(self.stateLabel)
        uicore.animations.FadeIn(self.loadingWheel, timeOffset=0.3)

    def HideLoading(self, delay=None):
        uicore.animations.FadeOut(self.loadingWheel)
        uicore.animations.FadeIn(self.stateIcon, timeOffset=0.3)
        uicore.animations.FadeIn(self.stateLabel, timeOffset=0.6)
        if delay:
            uthread.new(self.EnableStreamBtnWithDelay, delay)
        else:
            self.streamBtn.Enable()

    def EnableStreamBtnWithDelay(self, delay):
        blue.synchro.SleepWallclock(delay)
        self.streamBtn.Enable()

    def OnTwitchStreamingStateChange(self, state):
        self.UpdateState()
        if bool(session.role & ROLE_PROGRAMMER):
            _, stateName = twitch.get_api_state()
            self.debugLabel.text = 'DEBUG INFO: %s' % stateName

    def GetNeocomButtonType(self):
        return BTNTYPE_TWITCH
Exemplo n.º 21
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.parentObj = attributes.parentObj
     self.topOffset = attributes.Get('topOffset', self.default_topOffset)
     self.__isClosing = False
     self.mainCont = Container(name='mainCont', parent=self, padding=10)
     self.bgFrame = Container(name='bgFrame',
                              parent=self,
                              state=uiconst.UI_DISABLED)
     self.frameTop = StretchSpriteHorizontal(
         parent=self.bgFrame,
         align=uiconst.TOTOP,
         texturePath=
         'res:/UI/Texture/classes/ShipTree/InfoBubble/frameUpper.png',
         height=36,
         opacity=0.0)
     self.frameBottom = StretchSpriteHorizontal(
         parent=self.bgFrame,
         align=uiconst.TOBOTTOM,
         texturePath=
         'res:/UI/Texture/classes/ShipTree/InfoBubble/frameLower.png',
         height=36,
         opacity=0.0)
     self.bgFill = Container(name='bgFill',
                             parent=self,
                             state=uiconst.UI_DISABLED,
                             opacity=0.0)
     StretchSpriteHorizontal(
         parent=self.bgFill,
         align=uiconst.TOTOP,
         texturePath=
         'res:/UI/Texture/classes/ShipTree/InfoBubble/backTopExtender.png',
         height=1)
     StretchSpriteHorizontal(
         parent=self.bgFill,
         align=uiconst.TOBOTTOM,
         texturePath=
         'res:/UI/Texture/classes/ShipTree/InfoBubble/backBottom.png',
         height=6)
     Sprite(parent=self.bgFill,
            align=uiconst.TOALL,
            texturePath=
            'res:/UI/Texture/classes/ShipTree/InfoBubble/backMiddle.png')
     self.topContainer = ContainerAutoSize(
         name='topContainer',
         parent=self.mainCont,
         align=uiconst.TOTOP,
         callback=self.OnMainContentSizeChanged)
     self.iconCont = Container(name='iconCont',
                               parent=self.topContainer,
                               align=uiconst.TOPLEFT,
                               width=80,
                               height=80,
                               left=0,
                               top=0)
     self.topRightCont = ContainerAutoSize(name='topRightCont',
                                           align=uiconst.TOPLEFT,
                                           left=90,
                                           width=self.width - 115,
                                           parent=self.topContainer)
     self.caption = EveCaptionMedium(parent=self.topRightCont,
                                     align=uiconst.TOTOP)
     self.attributeCont = ContainerAutoSize(name='attributeCont',
                                            parent=self.topRightCont,
                                            align=uiconst.TOTOP,
                                            padTop=5)
     self.mainContent = ContainerAutoSize(
         name='mainContent',
         parent=self.mainCont,
         align=uiconst.TOTOP,
         callback=self.OnMainContentSizeChanged,
         padTop=5)
Exemplo n.º 22
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.SetTopparentHeight(0)
     self.bountyEscrow = attributes.bountyEscrow
     self.bountyAmount = attributes.bountyAmount
     self.component = attributes.component
     factionResPath = FACTIONPATHBYESSTYPEID[attributes.ESSTypeID]
     navyID = CORPIDBYFACTIONID[attributes.ESSTypeID]
     self.SetCaption(GetByLabel(CAPTIONBYESSTYPEID[attributes.ESSTypeID]))
     self.myContribution = 0
     self.amountInTags = 0
     mainCont = Container(name='mainCont',
                          parent=self.sr.main,
                          padding=const.defaultPadding)
     iconCont = Container(name='iconCont',
                          parent=mainCont,
                          align=uiconst.TOTOP,
                          height=64)
     headerCont = Container(name='headerCont',
                            parent=mainCont,
                            align=uiconst.TOTOP,
                            height=54,
                            padBottom=6)
     buttonsCont = Container(name='buttonsCont',
                             parent=mainCont,
                             align=uiconst.TOBOTTOM,
                             height=80,
                             padTop=4,
                             padBottom=4)
     listCont = Container(name='listCont',
                          parent=mainCont,
                          align=uiconst.TOALL,
                          padBottom=14)
     factionLogo = Sprite(parent=iconCont,
                          align=uiconst.CENTERTOP,
                          width=64,
                          height=64,
                          texturePath=factionResPath)
     factionLogo.hint = cfg.eveowners.Get(navyID).name
     factionLogo.OnClick = (self.OpenNavyInfo, navyID)
     EveLabelLarge(text=GetByLabel('UI/Inflight/Brackets/TotalBounty'),
                   parent=headerCont,
                   maxLines=1,
                   align=uiconst.CENTERTOP)
     EveCaptionMedium(text=FmtISK(self.bountyAmount, 0),
                      parent=headerCont,
                      maxLines=1,
                      align=uiconst.CENTERTOP,
                      state=uiconst.UI_NORMAL,
                      top=16)
     contributorsCont = Container(name='contributorsCont',
                                  parent=listCont,
                                  align=uiconst.TOLEFT_PROP,
                                  width=0.45)
     self.tagsCont = Container(name='tagsCont',
                               parent=listCont,
                               align=uiconst.TORIGHT_PROP,
                               width=0.45)
     topSpaceCont = Container(name='topSpaceCont',
                              parent=listCont,
                              align=uiconst.TOALL)
     self.contributersList = ScrollContainer(name='contributersList',
                                             parent=contributorsCont,
                                             align=uiconst.TOALL)
     shareCont = Container(name='shareCont',
                           parent=buttonsCont,
                           align=uiconst.TOLEFT_PROP,
                           width=0.45)
     takeCont = Container(name='takeCont',
                          parent=buttonsCont,
                          align=uiconst.TORIGHT_PROP,
                          width=0.45)
     spaceCont = Container(name='spaceCont',
                           parent=buttonsCont,
                           align=uiconst.TOALL)
     youGetLabel = EveLabelMedium(
         text=GetByLabel('UI/Inflight/Brackets/YouGet'),
         parent=shareCont,
         align=uiconst.CENTERTOP,
         top=1)
     myContribLabel = EveLabelLargeBold(text='',
                                        parent=shareCont,
                                        align=uiconst.CENTERTOP,
                                        top=16)
     shareLabel = EveLabelSmall(
         text=GetByLabel('UI/Inflight/Brackets/EveryoneGetsTheirShare'),
         parent=shareCont,
         align=uiconst.CENTERBOTTOM)
     shareBtn = Button(parent=shareCont,
                       label=GetByLabel('UI/Inflight/Brackets/Share'),
                       align=uiconst.TOBOTTOM,
                       top=20,
                       func=self.ShareContribution)
     orLabel = EveLabelLargeBold(text=GetByLabel('UI/Inflight/Brackets/Or'),
                                 parent=spaceCont,
                                 align=uiconst.CENTER,
                                 top=10)
     amountInTagsLabel = EveLabelLarge(text=GetByLabel(
         'UI/Inflight/Brackets/AmountInTags', amount=FmtISK(0, 0)),
                                       parent=takeCont,
                                       align=uiconst.CENTERTOP,
                                       top=16)
     takeLabel = EveLabelSmall(
         text=GetByLabel('UI/Inflight/Brackets/OthersGetNothing'),
         parent=takeCont,
         align=uiconst.CENTERBOTTOM)
     takeAllBtn = Button(parent=takeCont,
                         label=GetByLabel('UI/Inflight/Brackets/TakeAll'),
                         align=uiconst.TOBOTTOM,
                         top=20,
                         func=self.TakeAll)
     self.LoadContributions(attributes.contributions)
     myContribLabel.SetText(FmtISK(self.myContribution, 0))
     self.LoadTags()
     amountInTagsLabel.SetText(
         GetByLabel('UI/Inflight/Brackets/AmountInTags',
                    amount=FmtISK(self.amountInTags, 0)))