Exemplo n.º 1
0
 def Layout(self):
     self.HideHeader()
     self.MakeUnResizeable()
     self.SetWndIcon(self.iconNum, mainTop=2, mainLeft=6)
     self.SetTopparentHeight(self.TOP_PARENT_HEIGHT)
     station = cfg.stations.Get(session.stationid2)
     WndCaptionLabel(parent=self.sr.topParent,
                     align=uiconst.RELATIVE,
                     text=localization.GetByLabel('UI/Medical/Medical'),
                     subcaption=station.stationName)
     self.container = ContainerAutoSize(parent=self.GetMainArea(),
                                        align=uiconst.TOTOP,
                                        alignMode=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        padding=(self.PADDING, self.PADDING,
                                                 self.PADDING,
                                                 self.PADDING),
                                        callback=self.OnContainerResized,
                                        opacity=0.0)
     EveLabelLargeBold(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/MedicalClone'))
     EveLabelMedium(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/MedicalCloneDescription'),
         color=GRAY_COLOR,
         padding=(0, 0, 0, self.HALF_PADDING))
     self.homeStation = CreateSectionContainer(self.container)
     EveLabelLargeBold(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/ActiveClone'),
         padding=(0, self.PADDING, 0, 0))
     EveLabelMedium(parent=self.container,
                    align=uiconst.TOTOP,
                    text=localization.GetByLabel(
                        'UI/Medical/DestroyActiveCloneDescription'),
                    color=GRAY_COLOR,
                    padding=(0, 0, 0, self.HALF_PADDING))
     EveLabelMediumBold(parent=self.container,
                        align=uiconst.TOTOP,
                        text=localization.GetByLabel(
                            'UI/Medical/DestroyActiveCloneWarning'),
                        color=RED_COLOR,
                        padding=(0, 0, 0, self.HALF_PADDING))
     self.activeClone = CreateSectionContainer(self.container)
     EveLabelLargeBold(parent=self.container,
                       align=uiconst.TOTOP,
                       text=localization.GetByLabel('UI/Medical/JumpClone'),
                       padding=(0, self.PADDING, 0, 0))
     EveLabelMedium(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/JumpCloneDescription'),
         color=GRAY_COLOR,
         padding=(0, 0, 0, self.HALF_PADDING))
     self.jumpClone = CreateSectionContainer(self.container)
     animations.FadeIn(self.container, duration=0.5)
Exemplo n.º 2
0
 def DrawSplitList(self):
     myShipsCont = DragResizeCont(name='myShipsCont',
                                  parent=self.sr.main,
                                  align=uiconst.TOTOP_PROP,
                                  minSize=0.3,
                                  maxSize=0.7,
                                  defaultSize=0.45,
                                  padding=4)
     EveLabelLargeBold(parent=myShipsCont,
                       align=uiconst.TOTOP,
                       text=localization.GetByLabel(
                           'UI/Insurance/InsuranceWindow/MyShips'),
                       padTop=2,
                       padLeft=2)
     self.DrawMyShipsScroll(parentCont=myShipsCont)
     corpShipsCont = Container(parent=self.sr.main,
                               name='corpShipsCont',
                               align=uiconst.TOALL,
                               padLeft=4,
                               padRight=4)
     EveLabelLargeBold(parent=corpShipsCont,
                       align=uiconst.TOTOP,
                       text=localization.GetByLabel(
                           'UI/Insurance/InsuranceWindow/CorpShips'),
                       padTop=2,
                       padLeft=2)
     self.corpShipsScroll = Scroll(parent=corpShipsCont,
                                   padding=const.defaultPadding)
     self.corpShipsScroll.sr.id = 'corpinsurance'
     self.corpShipsScroll.multiSelect = 0
     self.corpShipsScroll.sr.minColumnWidth = {
         localization.GetByLabel('UI/Common/Type'): 30
     }
Exemplo n.º 3
0
 def PrimeTimeMenu(self, menuParent):
     headerCont = menuParent.AddContainer(align=uiconst.TOTOP,
                                          height=20,
                                          padding=const.defaultPadding)
     EveLabelLargeBold(parent=headerCont,
                       text=GetByLabel('UI/Sovereignty/SetSovereigntyHour'),
                       align=uiconst.TOTOP)
     menuParent.AddSpace(height=10)
     text = menuParent.AddText(
         GetByLabel('UI/Sovereignty/SetNewVulnerabilityTimeDescription'))
     text.GetEntryWidth = lambda mc=text: 250
     cont = menuParent.AddContainer(align=uiconst.TOTOP,
                                    height=60,
                                    padding=const.defaultPadding)
     myCont = Container(name='myCont',
                        parent=cont,
                        align=uiconst.TOTOP,
                        height=22,
                        padTop=10)
     currentPrimeHour = self.GetCurrentPrimeHour()
     self.primeTimeCombo = Combo(name='primeTimeCombo',
                                 parent=myCont,
                                 options=self.GetTimeComboOptions(),
                                 select=currentPrimeHour,
                                 width=150)
     setBtn = Button(name='SetPrimeTimeBtn',
                     align=uiconst.TOPRIGHT,
                     parent=myCont,
                     label=GetByLabel('UI/Common/CommandSet'),
                     func=self.SetPrimeTime)
Exemplo n.º 4
0
 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)
     FrameThemeColored(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 = FillThemeColored(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()
Exemplo n.º 5
0
 def DrawNumbers(self):
     self.numbersGrid = LayoutGrid(parent=self.bottomRight,
                                   columns=2,
                                   align=uiconst.TORIGHT,
                                   top=self.numbersGridTop)
     if self.showTaxAndBrokersFee:
         self.brokersFee = EveLabelMedium(text='', padRight=4)
         self.numbersGrid.AddCell(self.brokersFee)
         self.brokersFeeAmt = EveLabelMediumBold(text='',
                                                 align=uiconst.CENTERRIGHT,
                                                 padLeft=4)
         self.numbersGrid.AddCell(self.brokersFeeAmt)
         self.salesTax = EveLabelMedium(text='', padRight=4)
         self.numbersGrid.AddCell(self.salesTax)
         self.salesTaxAmt = EveLabelMediumBold(text='',
                                               align=uiconst.CENTERRIGHT,
                                               padLeft=4)
         self.numbersGrid.AddCell(self.salesTaxAmt)
         spacer = Container(align=uiconst.TOTOP, height=12)
         self.numbersGrid.AddCell(spacer, colSpan=2)
     self.totalAmt = EveLabelLargeBold(text='',
                                       align=uiconst.CENTERRIGHT,
                                       padLeft=4,
                                       state=uiconst.UI_NORMAL)
     self.numbersGrid.AddCell(self.totalAmt, colSpan=2)
Exemplo n.º 6
0
 def SetSizeAutomatically(self):
     width = self.displayRect[2]
     height = EveLabelMediumBold.MeasureTextSize(
         self.text.text,
         width=width - 40)[1] + EveLabelLargeBold.MeasureTextSize(
             self.label.text, width=width - 40)[1]
     self.height = height
Exemplo n.º 7
0
 def _construct_description(self):
     self.title_container = Container(name='title_container',
                                      parent=self.top_container,
                                      align=uiconst.TOTOP,
                                      height=max(
                                          TITLE_CONTAINER_HEIGHT,
                                          self.challenge_title_height),
                                      padLeft=TOP_CONTAINER_PAD_LEFT)
     title_label_container_width = self.width - AGENT_IMAGE_SIZE - CHALLENGE_EXPIRATION_CLOCK_PAD_RIGHT - CHALLENGE_EXPIRATION_CLOCK_SIZE - TOP_CONTAINER_PAD_LEFT - TOP_CONTAINER_PAD_RIGHT
     self.title_label_container = Container(
         name='title_label_container',
         parent=self.title_container,
         align=uiconst.TOLEFT,
         width=title_label_container_width,
         clipChildren=True)
     title_label = EveLabelLargeBold(name='title_label',
                                     parent=self.title_label_container,
                                     align=uiconst.CENTERLEFT,
                                     text=self.challenge.name)
     title_label.color = SEASON_THEME_TEXT_COLOR_HIGHLIGHTED
     expiration_timer_container = Container(
         name='expiration_timer_container',
         parent=self.title_container,
         align=uiconst.TORIGHT,
         width=CHALLENGE_EXPIRATION_CLOCK_SIZE)
     ChallengeExpirationTimer(
         name='expiration_timer',
         parent=expiration_timer_container,
         align=uiconst.CENTER,
         height=CHALLENGE_EXPIRATION_CLOCK_SIZE,
         width=CHALLENGE_EXPIRATION_CLOCK_SIZE,
         expiration_date=self.challenge.expiration_date)
     description_container = Container(
         name='description_container',
         parent=self.top_container,
         align=uiconst.TOTOP,
         height=self.challenge_description_height,
         padLeft=TOP_CONTAINER_PAD_LEFT,
         padTop=DESCRIPTION_CONTAINER_PAD_TOP)
     description_label = Label(name='description_label',
                               parent=description_container,
                               align=uiconst.TOTOP,
                               text=self.challenge.message_text,
                               fontsize=DESCRIPTION_FONTSIZE)
     description_label.color = SEASON_THEME_TEXT_COLOR_REGULAR
Exemplo n.º 8
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.categoryInfo = attributes.categoryInfo
     text = self.categoryInfo['categoryName']
     textLabel = EveLabelLargeBold(parent=self,
                                   text=str(text),
                                   align=uiconst.CENTER)
     self.width = textLabel.textwidth + 2 * self.textPadding
     self.hiliteFill = Fill(bgParent=self, opacity=0.0)
Exemplo n.º 9
0
 def setup_rewards_screen(self):
     self.parent_container = uiprimitives.Container(name='parentContainer', parent=self, align=uiconst.CENTER, height=400, width=450, top=-10)
     self.background_container = uiprimitives.Container(name='background', parent=self.parent_container, width=450, height=285, align=uiconst.CENTERTOP, bgColor=(0.037, 0.037, 0.037, 1))
     uicontrols.Frame(parent=self.background_container, color=(0.36, 0.36, 0.36, 0.36))
     self.main_container = uiprimitives.Container(name='mainContainer', parent=self.background_container, width=440, height=275, align=uiconst.CENTER)
     self.rank_container = uiprimitives.Container(name='rankContainer', parent=self.parent_container, width=450, height=100, align=uiconst.CENTERBOTTOM, bgColor=(0.037, 0.037, 0.037, 1))
     uicontrols.Frame(parent=self.rank_container, color=(0.36, 0.36, 0.36, 0.36))
     self.agent_container = uiprimitives.Container(name='agentContainer', parent=self.main_container, align=uiconst.TOPLEFT, height=180, width=150, left=5, top=5)
     self.agent_image = uiprimitives.Sprite(name='agentImage', parent=self.agent_container, align=uiconst.TOPLEFT, height=150, width=150, texturePath='res:/UI/Texture/classes/ProjectDiscovery/lundberg.jpg')
     self.agent_label = uicontrols.Label(name='agentName', parent=self.agent_container, align=uiconst.BOTTOMLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/AgentName'), top=5, height=18, fontsize=14)
     self.SOE_image = uiprimitives.Sprite(name='SOE_logo', parent=self.main_container, align=uiconst.BOTTOMLEFT, height=75, width=75, texturePath='res:/UI/Texture/Corps/14_128_1.png')
     self.text_container = uiprimitives.Container(name='textContainer', parent=self.main_container, align=uiconst.TOPRIGHT, width=270, height=80, top=20)
     self.text_header_container = uiprimitives.Container(name='textHeaderContainer', parent=self.text_container, align=uiconst.TOTOP, height=20)
     self.header_message = EveLabelLargeBold(parent=self.text_header_container, align=uiconst.TOTOP, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/Header'))
     self.main_message = uicontrols.Label(parent=self.text_container, align=uiconst.TOTOP, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ThanksMessage'))
     self.setup_reward_container()
     self.setup_reward_footer()
     self.setup_continue_button()
Exemplo n.º 10
0
 def Layout(self):
     self.HideHeader()
     self.MakeUnResizeable()
     self.SetWndIcon(self.iconNum, mainTop=2, mainLeft=6)
     self.SetTopparentHeight(self.TOP_PARENT_HEIGHT)
     locationInfo = cfg.evelocations.Get(self.currentLocationID)
     WndCaptionLabel(parent=self.sr.topParent,
                     align=uiconst.RELATIVE,
                     text=localization.GetByLabel('UI/Medical/Medical'),
                     subcaption=locationInfo.name)
     self.container = ContainerAutoSize(parent=self.GetMainArea(),
                                        align=uiconst.TOTOP,
                                        alignMode=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        padding=(self.PADDING, self.PADDING,
                                                 self.PADDING,
                                                 self.PADDING),
                                        callback=self.OnContainerResized,
                                        opacity=0.0)
     EveLabelLargeBold(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/MedicalClone'))
     EveLabelMedium(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/MedicalCloneDescription'),
         color=GRAY_COLOR,
         padding=(0, 0, 0, self.HALF_PADDING))
     self.homeStation = CreateSectionContainer(self.container)
     if self.medicalController.HasAbilityToActivateClone():
         self.AddSelfDestructSection()
     EveLabelLargeBold(parent=self.container,
                       align=uiconst.TOTOP,
                       text=localization.GetByLabel('UI/Medical/JumpClone'),
                       padding=(0, self.PADDING, 0, 0))
     EveLabelMedium(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/JumpCloneDescription'),
         color=GRAY_COLOR,
         padding=(0, 0, 0, self.HALF_PADDING))
     self.jumpClone = CreateSectionContainer(self.container)
     animations.FadeIn(self.container, duration=0.5)
Exemplo n.º 11
0
 def Layout(self):
     self.MakeUnMinimizable()
     self.HideHeader()
     self.MakeUnResizeable()
     self.container = ContainerAutoSize(parent=self.GetMainArea(), align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, padding=(self.PADDING,
      self.PADDING,
      self.PADDING,
      self.PADDING), callback=self.OnContainerResized)
     text = GetByLabel('UI/Inventory/AssetSafety/DeliverToStation')
     header = EveLabelLargeBold(parent=self.container, align=uiconst.TOTOP, text=text)
     self.explanationLabel = EveLabelMedium(parent=self.container, align=uiconst.TOTOP, text='', color=self.GRAY_COLOR, padding=(0, 0, 0, 15), state=uiconst.UI_NORMAL)
     Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR)
     self.sameSolarSystemParent = ScrollContainer(parent=self.container, align=uiconst.TOTOP)
     self.sameSolarSystem = ContainerAutoSize(parent=self.sameSolarSystemParent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP)
     self.nearestStationLabel = EveLabelMedium(parent=self.container, align=uiconst.TOTOP, text='', color=self.GRAY_COLOR, padding=(0, 0, 0, 0))
     self.closeButton = Button(parent=self.container, label=GetByLabel('UI/Generic/Cancel'), func=self.Close, align=uiconst.TOTOP, fontsize=13, padding=(220, 10, 220, 0))
     uicore.animations.FadeTo(self.container, startVal=0.0, endVal=1.0, duration=0.5)
Exemplo n.º 12
0
 def AddSelfDestructSection(self):
     EveLabelLargeBold(
         parent=self.container,
         align=uiconst.TOTOP,
         text=localization.GetByLabel('UI/Medical/ActiveClone'),
         padding=(0, self.PADDING, 0, 0))
     EveLabelMedium(parent=self.container,
                    align=uiconst.TOTOP,
                    text=localization.GetByLabel(
                        'UI/Medical/DestroyActiveCloneDescription'),
                    color=GRAY_COLOR,
                    padding=(0, 0, 0, self.HALF_PADDING))
     EveLabelMediumBold(parent=self.container,
                        align=uiconst.TOTOP,
                        text=localization.GetByLabel(
                            'UI/Medical/DestroyActiveCloneWarning'),
                        color=RED_COLOR,
                        padding=(0, 0, 0, self.HALF_PADDING))
     self.activeClone = CreateSectionContainer(self.container)
Exemplo n.º 13
0
    def ApplyAttributes(self, attributes):
        def play():
            HelpWindow.PlayVideoId(attributes['videoid'])

        uiprimitives.Container.ApplyAttributes(self, attributes)
        textCont = ContainerAutoSize(parent=self,
                                     align=uiconst.TOALL,
                                     padLeft=40,
                                     clipChildren=True)
        self.label = EveLabelLargeBold(parent=textCont,
                                       align=uiconst.TOTOP,
                                       state=uiconst.UI_NORMAL)
        self.label.OnClick = play
        self.text = EveLabelMediumBold(parent=textCont, align=uiconst.TOTOP)
        playicon = ButtonIcon(parent=self,
                              idx=0,
                              iconSize=32,
                              align=uiconst.CENTERLEFT,
                              func=play)
        playicon.SetTexturePath('res:/ui/texture/icons/bigplay.png')
        self.label.text = attributes.get('title', '')
        self.text.text = attributes.get('description', '')
Exemplo n.º 14
0
 def construct_layout(self):
     uicontrols.Frame(name='main_frame', parent=self, texturePath='res:/UI/Texture/classes/ProjectDiscovery/SampleBack.png', cornerSize=20, padLeft=-8, padTop=-8, padRight=-8, padBottom=-8)
     header_container = uiprimitives.Container(name='headerContainer', parent=self, height=HEADER_CONTAINER_HEIGHT, align=uiconst.TOTOP)
     uicontrols.Label(name='headerLabel', parent=header_container, align=uiconst.CENTERLEFT, left=10, text=self.label)
     main_container = uiprimitives.Container(name='mainContainer', parent=self, align=uiconst.TOTOP)
     agent_container = uiprimitives.Container(name='agentContainer', parent=main_container, align=uiconst.TOPLEFT, height=170, width=150, left=10, top=5)
     uiprimitives.Sprite(name='agentImage', parent=agent_container, align=uiconst.TOTOP, height=150, width=150, texturePath='res:/UI/Texture/classes/ProjectDiscovery/lundberg.jpg')
     uicontrols.Label(name='agentName', parent=agent_container, align=uiconst.TOTOP, text=localization.GetByLabel('UI/ProjectDiscovery/AgentName'), top=5)
     uiprimitives.Sprite(name='SOE_logo', parent=main_container, align=uiconst.BOTTOMLEFT, height=75, width=75, texturePath='res:/UI/Texture/Corps/14_128_1.png', top=-10)
     text_container = uiprimitives.Container(name='textContainer', parent=main_container, align=uiconst.TORIGHT, width=270, left=10)
     text_header_container = uiprimitives.Container(name='textHeaderContainer', parent=text_container, align=uiconst.TOTOP, height=TEXT_HEADER_HEIGHT)
     EveLabelLargeBold(parent=text_header_container, align=uiconst.CENTERLEFT, text=self.message_header_text)
     text_message_container = uiprimitives.Container(name='text_message_container', parent=text_container, align=uiconst.TOTOP)
     main_message = uicontrols.Label(parent=text_message_container, align=uiconst.TOTOP, text=self.message_text, top=5)
     bottom_container = uiprimitives.Container(name='bottomContainer', parent=self, height=BOTTOM_CONTAINER_HEIGHT, align=uiconst.TOBOTTOM)
     self.close_button = uicontrols.Button(name='close_button', parent=bottom_container, fontsize=14, fixedwidth=125, fixedheight=22, label=self.button_label, align=uiconst.BOTTOMRIGHT, top=10, left=10, func=lambda x: self.close())
     if self.isTutorial:
         self.skip_button = uicontrols.Button(name='skipButton', parent=bottom_container, fontsize=14, fixedwidth=125, fixedheight=22, label='Skip Tutorial', align=uiconst.CENTERBOTTOM, top=10, left=10, func=lambda x: self.skip_tutorial())
     message_height = max(MIN_MESSAGE_TEXT_HEIGHT, main_message.height)
     text_message_container.height = message_height
     self.height = message_height + TEXT_HEADER_HEIGHT + HEADER_CONTAINER_HEIGHT + BOTTOM_CONTAINER_HEIGHT
     main_container.height = message_height + TEXT_HEADER_HEIGHT
Exemplo n.º 15
0
 def _create_item_reward_label(self):
     self.reward_item_label_container = Container(
         name='reward_item_label_container',
         parent=self.reward_content_container,
         align=uiconst.TOTOP,
         width=self.width,
         height=REWARD_ITEM_LABEL_HEIGHT,
         opacity=ANIMATED_DEFAULT_OPACITY)
     Sprite(name='reward_item_label_line',
            parent=self.reward_item_label_container,
            texturePath=SEASON_LINE_BREAK_GRADIENT,
            align=uiconst.TOBOTTOM,
            width=self.width - REWARD_ITEM_BACKGROUND_PADDING * 2,
            height=REWARD_ITEM_LABEL_LINE_HEIGHT,
            opacity=REWARD_ITEM_LABEL_LINE_OPACITY,
            useSizeFromTexture=False)
     self.reward_item_label = EveLabelLargeBold(
         name='reward_item_label',
         parent=self.reward_item_label_container,
         align=uiconst.CENTER,
         text='')
     self.reward_label_background_container = None
     self._create_reward_label_background()
Exemplo n.º 16
0
 def _construct_season_header(self):
     season_header_container = Container(name='season_header_container',
                                         parent=self,
                                         align=uiconst.TOTOP,
                                         height=SEASON_TITLE_HEIGHT)
     add_base_border_line_to_container(season_header_container,
                                       uiconst.TOLEFT)
     add_base_border_line_to_container(season_header_container,
                                       uiconst.TOBOTTOM)
     season_header_content_container = Container(
         name='season_header_container',
         parent=season_header_container,
         align=uiconst.TOTOP,
         height=season_header_container.height)
     fill_default_background_color_for_container(
         season_header_content_container)
     Fill(bgParent=season_header_content_container,
          color=SEASONS_THEME_BACKGROUND_COLOR)
     season_top_container = Container(
         name='season_top_container',
         parent=season_header_content_container,
         align=uiconst.TOTOP,
         height=SEASON_TITLE_HEIGHT)
     Line(parent=season_top_container, align=uiconst.TOBOTTOM, weight=1)
     scope_logo_container = Container(name='scope_logo_container',
                                      parent=season_top_container,
                                      align=uiconst.TOLEFT,
                                      width=SCOPE_LOGO_WIDTH,
                                      padBottom=SEASON_BASE_PADDING,
                                      padLeft=SEASON_BASE_PADDING)
     Sprite(name='scope_logo',
            parent=scope_logo_container,
            texturePath=season_client_const.SCOPE_LOGO_RES_PATH,
            align=uiconst.TOALL)
     clock_container = Container(name='clock_container',
                                 parent=season_top_container,
                                 align=uiconst.TORIGHT,
                                 width=CLOCK_WIDTH)
     self.clock = InGameClock(parent=clock_container,
                              align=uiconst.TOALL,
                              label_font_size=CLOCK_LABEL_SIZE)
     scope_title_container = Container(name='scope_title_container',
                                       parent=season_top_container,
                                       align=uiconst.TOTOP,
                                       height=SEASON_TITLE_LABEL_HEIGHT,
                                       padLeft=SEASON_BASE_PADDING,
                                       padTop=SEASON_BASE_PADDING)
     EveLabelLargeBold(name='scope_title_label',
                       parent=scope_title_container,
                       text=season_client_const.get_seasons_title())
     scope_title_description_container = Container(
         name='scope_title_description_container',
         parent=season_top_container,
         align=uiconst.TOTOP,
         height=SEASON_TITLE_DESCRIPTION_HEIGHT,
         padLeft=SEASON_BASE_PADDING)
     Label(name='scope_title_description_label',
           parent=scope_title_description_container,
           text=season_client_const.get_seasons_subcaption(),
           align=uiconst.TOPLEFT,
           fontsize=10)
Exemplo n.º 17
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)))
Exemplo n.º 18
0
 def ConstructLayout(self):
     if self.isConstructed:
         return
     self.isConstructed = True
     scrollContainer = ScrollContainer(name='plexScroll',
                                       parent=self,
                                       align=uiconst.TOALL,
                                       padding=(10, 10, 10, 10))
     EveLabelLargeBold(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/PlexTitle'
         ),
         padding=(10, 10, 0, 0))
     EveLabelMedium(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/PlexDescription'
         ),
         padding=(10, 2, 0, 10),
         color=Color.GRAY5)
     subscription = ContainerAutoSize(parent=scrollContainer,
                                      align=uiconst.TOTOP,
                                      alignMode=uiconst.TOTOP,
                                      state=uiconst.UI_PICKCHILDREN,
                                      bgColor=(0, 0, 0, 0.3))
     self.plexSubscriptionLabel = EveLabelMedium(parent=subscription,
                                                 align=uiconst.TOTOP,
                                                 text='',
                                                 padding=(75, 15, 0, 15))
     InfoIcon(parent=subscription,
              typeID=const.typePilotLicence,
              pos=(10, 2, 55, 55),
              texturePath='res:/UI/Texture/Icons/plex.png',
              iconOpacity=1.0)
     InfoIcon(parent=subscription,
              align=uiconst.TOPRIGHT,
              typeID=const.typePilotLicence,
              top=10,
              left=10)
     EveLabelLargeBold(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/BuyingPlexTitle'
         ),
         padding=(10, 10, 0, 0))
     EveLabelMedium(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/BuyingPlexDescription'
         ),
         padding=(10, 2, 0, 10),
         color=Color.GRAY5)
     buyButtons = FlowContainer(parent=scrollContainer,
                                align=uiconst.TOTOP,
                                contentAlignment=CONTENT_ALIGN_CENTER,
                                contentSpacing=(8, 0))
     BuyButtonIsk(parent=buyButtons,
                  align=uiconst.NOALIGN,
                  typeID=const.typePilotLicence)
     BuyButtonPlex(parent=buyButtons,
                   align=uiconst.NOALIGN,
                   logContext='CharacterSheet')
     EveLabelLargeBold(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/MultipleCharacterTitle'
         ),
         padding=(10, 25, 0, 0))
     EveLabelMedium(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/MultipleCharacterDescription'
         ),
         padding=(10, 2, 0, 10),
         color=Color.GRAY5)
     multipleQueue1 = ContainerAutoSize(parent=scrollContainer,
                                        align=uiconst.TOTOP,
                                        alignMode=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        bgColor=(0, 0, 0, 0.3))
     self.multipleQueueLabel1 = EveLabelMediumBold(parent=multipleQueue1,
                                                   align=uiconst.TOTOP,
                                                   text='',
                                                   padding=(35, 8, 0, 8))
     self.multipleQueueExpiryLabel1 = EveLabelMediumBold(
         parent=multipleQueue1,
         align=uiconst.TOPRIGHT,
         text='',
         pos=(10, 8, 0, 0),
         color=Color.GRAY5)
     self.multipleQueueIcon1 = Icon(
         parent=multipleQueue1,
         align=uiconst.TOPLEFT,
         icon='res:/UI/Texture/Icons/additional_training_queue.png',
         pos=(10, 7, 17, 17))
     multipleQueue2 = ContainerAutoSize(parent=scrollContainer,
                                        align=uiconst.TOTOP,
                                        alignMode=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        bgColor=(0, 0, 0, 0.3))
     self.multipleQueueLabel2 = EveLabelMediumBold(parent=multipleQueue2,
                                                   align=uiconst.TOTOP,
                                                   text='',
                                                   padding=(35, 8, 0, 8))
     self.multipleQueueExpiryLabel2 = EveLabelMediumBold(
         parent=multipleQueue2,
         align=uiconst.TOPRIGHT,
         text='',
         pos=(10, 8, 0, 0),
         color=Color.GRAY5)
     self.multipleQueueIcon2 = Icon(
         parent=multipleQueue2,
         align=uiconst.TOPLEFT,
         icon='res:/UI/Texture/Icons/additional_training_queue.png',
         pos=(10, 7, 17, 17))
     EveLabelLargeBold(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/ConvertAurumTitle'
         ),
         padding=(10, 25, 0, 0))
     EveLabelMedium(
         parent=scrollContainer,
         align=uiconst.TOTOP,
         text=GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/ConvertAurumDescription'
         ),
         padding=(10, 2, 0, 0),
         color=Color.GRAY5)
     if boot.region != 'optic':
         EveLabelLargeBold(
             parent=scrollContainer,
             align=uiconst.TOTOP,
             text=GetByLabel(
                 'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/CharacterTransferTitle'
             ),
             padding=(10, 25, 0, 0))
         EveLabelMedium(
             parent=scrollContainer,
             align=uiconst.TOTOP,
             text=GetByLabel(
                 'UI/CharacterSheet/CharacterSheetWindow/PilotLicense/CharacterTransferDescription'
             ),
             padding=(10, 2, 0, 0),
             color=Color.GRAY5)
     FillThemeColored(parent=self,
                      colorType=uiconst.COLORTYPE_UIHILIGHT,
                      opacity=0.1)
Exemplo n.º 19
0
 def DrawStationWarning(self):
     self.stationWarning = EveLabelLargeBold(parent=self.bottomLeft,
                                             text='',
                                             align=uiconst.CENTERBOTTOM)
     self.stationWarning.SetRGB(*COL_RED)
     self.stationWarning.display = False
Exemplo n.º 20
0
class MultiBuy(SellBuyItemsWindow):
    __guid__ = 'form.BuyItems'
    default_iconNum = 'res:/UI/Texture/classes/MultiSell/multiBuy.png'
    default_windowID = 'MultiBuy'
    default_name = 'multiBuy'
    captionTextPath = 'UI/Inventory/ItemActions/MultiBuy'
    scrollId = 'MultiBuyScroll'
    tradeForCorpSettingConfig = 'buyUseCorp'
    tradeTextPath = 'UI/Market/MarketQuote/CommandBuy'
    orderCap = 'MultiBuyOrderCap'
    tradeOnConfirm = False
    dropLabelPath = 'UI/Market/Marketbase/DropItemsToAddToBuy'
    cannotBeTradeLabelPath = 'UI/Market/MarketQuote/CannotBeBought'
    badDeltaWarningPath = 'UI/Market/MarketQuote/MultiBuyTypesAboveAverage'
    corpCheckboxTop = 0
    numbersGridTop = 1
    showTaxAndBrokersFee = False
    belowColor = '<color=0xff00ff00>'
    aboveColor = '<color=0xffff5050>'
    __notifyevents__ = ['OnOwnOrdersChanged', 'OnSessionChanged']

    def ApplyAttributes(self, attributes):
        self.blinkEditBG = None
        SellBuyItemsWindow.ApplyAttributes(self, attributes)
        self.dropCont.OnDropData = self.DropItems
        self.infoCont.height = 40
        self.totalAmt.LoadTooltipPanel = self.LoadTotalTooltip
        self.itemsScroll.OnDropData = self.DropItems
        self.AddImportButton()
        self.DrawStationWarning()
        self.AddToLocationCont()
        self.StartAddItemsThread()

    def InitializeVariables(self, attributes):
        SellBuyItemsWindow.InitializeVariables(self, attributes)
        self.entriesInScrollByTypeID = {}
        self.orderMultiplier = 1
        self.activeOrders = set()
        self.orderDisabled = False
        self.preItems = self.GetKeyValsForWantedTypes(
            attributes.get('wantToBuy'))
        self.reloadingItemsCounter = 0
        self.verifyMultiplierTimer = None
        self.expiredOrders = {}

    def GetKeyValsForWantedTypes(self, wantToBuy):
        keyVals = []
        for typeID, qty in wantToBuy.iteritems():
            keyVals.append(KeyVal(typeID=typeID, qty=qty))

        return keyVals

    def AddToLocationCont(self):
        self.locationCont.height = 28
        self.orderMultiplierEdit = SinglelineEdit(
            name='orderMultiplierEdit',
            parent=self.locationCont,
            align=uiconst.TOPRIGHT,
            label=GetByLabel('UI/Market/MarketQuote/NumberOfOrders'),
            adjustWidth=True,
            ints=[1, 1000],
            left=const.defaultPadding,
            OnChange=self.OnMultiplierEditChange)
        self.stationCombo = Combo(
            parent=self.locationCont,
            callback=self.OnStationChanged,
            left=const.defaultPadding,
            width=200,
            noChoiceLabel=GetByLabel(
                'UI/Market/MarketQuote/NotStationsAvailable'))
        self.LoadStationOptions()

    def AddImportButton(self):
        if boot.region == 'optic':
            return
        self.dropCont.padLeft = 30
        importMenu = UtilMenu(
            menuAlign=uiconst.TOPLEFT,
            parent=self.mainCont,
            align=uiconst.TOPLEFT,
            pos=(4, 0, 28, 28),
            GetUtilMenu=self.GetImportMenu,
            texturePath='res:/UI/Texture/Shared/pasteFrom.png',
            iconSize=28,
            hint=GetByLabel('UI/Market/MarketQuote/ImportShoppingListHint'))

    def GetImportMenu(self, menuParent):
        hint = GetByLabel('UI/Market/MarketQuote/ImportShoppingListOptionHint',
                          type1=const.typeVeldspar,
                          type2=const.typeTritanium)
        menuParent.AddIconEntry(
            icon=ACTION_ICON,
            text=GetByLabel('UI/Market/MarketQuote/ImportShoppingListOption'),
            hint=hint,
            callback=self.ImportShoppingList)

    def ImportShoppingList(self, *args):
        localizedDecimal = eveLocalization.GetDecimalSeparator(
            localization.SYSTEM_LANGUAGE)
        localizedSeparator = eveLocalization.GetThousandSeparator(
            localization.SYSTEM_LANGUAGE)
        multibuyImporter = ImportMultibuy(localizedDecimal, localizedSeparator)
        text = GetClipboardData()
        toAdd, failedLines = multibuyImporter.GetTypesAndQty(text)
        self.AddToOrder(toAdd)
        if failedLines:
            text = '%s<br>' % GetByLabel('UI/SkillQueue/CouldNotReadLines')
            text += '<br>'.join(failedLines)
            eve.Message('CustomInfo', {'info': text}, modal=False)

    def LoadStationOptions(self):
        currentSelection = self.stationCombo.GetValue()
        stations = self.GetStations()
        if currentSelection:
            select = currentSelection
        elif session.stationid2:
            select = session.stationid2
        elif stations:
            select = stations[0][1]
        else:
            select = None
        self.stationCombo.LoadOptions(stations, select)
        self.stationCombo.Confirm()

    def DrawStationWarning(self):
        self.stationWarning = EveLabelLargeBold(parent=self.bottomLeft,
                                                text='',
                                                align=uiconst.CENTERBOTTOM)
        self.stationWarning.SetRGB(*COL_RED)
        self.stationWarning.display = False

    def AddToOrder(self, wantToBuy):
        wantedTypes = self.GetKeyValsForWantedTypes(wantToBuy)
        self.AddPreItems(wantedTypes)

    def AddPreItems(self, preItems):
        self.reloadingItemsCounter += 1
        items = self.CheckOrderAvailability(preItems)
        self.ClearErrorLists()
        for item in items:
            self.AddItem(item)

        self.DisplayErrorHints()
        self.reloadingItemsCounter -= 1

    def AddItem(self, itemKeyVal):
        if not self.IsBuyable(itemKeyVal):
            return
        existingEntry = self.entriesInScrollByTypeID.get(
            itemKeyVal.typeID, None)
        if existingEntry and not existingEntry.destroyed:
            existingEntry.AddQtyToEntry(itemKeyVal.qty)
        else:
            self.DoAddItem(itemKeyVal)

    def AddItemToCollection(self, itemKeyVal, itemEntry):
        self.entriesInScrollByTypeID[itemKeyVal.typeID] = itemEntry

    def GetItemEntry(self, itemKeyVal):
        itemEntry = BuyItemContainer(typeID=itemKeyVal.typeID,
                                     qty=int(itemKeyVal.qty),
                                     parentFunc=self.RemoveItem,
                                     editFunc=self.OnEntryEdit,
                                     stationID=self.baseStationID,
                                     orderMultiplier=self.orderMultiplier,
                                     dropParentFunc=self.DropItems)
        return itemEntry

    def PerformTrade(self, *args):
        useCorp = self.TradingForCorp()
        buyItemList, failedItems = self.GetValidatedAndFailedTypes()
        if not len(buyItemList):
            uicore.Message('uiwarning03')
            return
        if not self.ContinueAfterWarning(buyItemList):
            return
        with ExceptionEater():
            self.LogBuy(buyItemList)
        ordersCreated = sm.GetService('marketQuote').BuyMulti(
            self.baseStationID, buyItemList, useCorp)
        orderIDs = {order.orderID for order in ordersCreated}
        self.activeOrders.update(orderIDs)
        self.CreateNewBuyOrder(failedItems)
        self.VerifyExpiredOrders()

    def GetItemsWithBadDelta(self, buyItemList):
        highItems = []
        for item in buyItemList:
            if item.delta > 1.0:
                highItems.append((item.delta, item))

        return highItems

    def GetOrderDeltaTextForWarning(self):
        orderPercentage = self.GetOrderDelta()
        orderText = ''
        if orderPercentage > 1.0:
            percText = GetByLabel('UI/Common/Percentage',
                                  percentage=FmtAmt(abs(orderPercentage * 100),
                                                    showFraction=0))
            orderText = GetByLabel(
                'UI/Market/MarketQuote/MultiBuyAboveAverage',
                percentage=percText)
        return orderText

    def GetValidatedAndFailedTypes(self):
        allItems = self.GetItems()
        failedItemsList = []
        buyItemsList = []
        for item in allItems:
            if item.isUpdating:
                return ([], [])
            if item.newBestPrice:
                validatedItem = self.GetValidatedItem(item)
                if validatedItem:
                    buyItemsList.append(validatedItem)
                    continue
            failedBuyInfo = KeyVal(typeID=item.typeID, qty=item.GetTotalQty())
            failedItemsList.append(failedBuyInfo)

        return (buyItemsList, failedItemsList)

    def GetValidatedItem(self, item):
        if item.isUpdating:
            return
        price = item.GetPrice()
        if not price:
            return
        if price > self.MAX_PRICE:
            return
        price = round(price, 2)
        qty = item.GetTotalQty()
        if qty < 1:
            return
        validatedItem = GetBuyItemInfo(stationID=session.stationid
                                       or session.structureid,
                                       typeID=item.typeID,
                                       price=price,
                                       quantity=qty,
                                       minVolume=1,
                                       delta=item.GetDelta())
        return validatedItem

    def CreateNewBuyOrder(self, failedItems):
        self.ChangeOrderUIState(disable=True)
        self.RemoveAllItem()
        if self.orderMultiplierEdit.GetValue() != 1:
            self.BlinkNumOrdersEdit()
        self.orderMultiplierEdit.SetValue(1)
        if failedItems:
            self.AddPreItems(failedItems)

    def ChangeOrderUIState(self, disable):
        if disable:
            opacity = 0.5
        else:
            opacity = 1.0
        mainArea = self.GetMainArea()
        mainArea.opacity = opacity
        self.orderDisabled = disable

    def GetStations(self):
        solarsytemItems = sm.GetService('map').GetSolarsystemItems(
            session.solarsystemid2, True, False)
        stations = {
            i
            for i in solarsytemItems if i.groupID == const.groupStation
        }
        currentStation = session.stationid2 or session.structureid
        stationList = []
        for eachStation in stations:
            if eachStation.itemID == currentStation:
                continue
            sortValue = (eachStation.celestialIndex, eachStation.orbitIndex,
                         eachStation.itemName)
            stationList.append(
                (sortValue, (eachStation.itemName, eachStation.itemID)))

        stationList = SortListOfTuples(stationList)
        if currentStation:
            stationName = cfg.evelocations.Get(currentStation).name
            currentStationOption = (GetByLabel(
                'UI/Market/MarketQuote/CurrentStation',
                stationName=stationName), currentStation)
            stationList = [currentStationOption] + stationList
        return stationList

    def RemoveItemFromCollection(self, itemEntry):
        self.entriesInScrollByTypeID.pop(itemEntry.typeID, None)

    def OnMultiplierEditChange(self, *args):
        self.UpdateOrderMultiplierInEntries()
        if self.verifyMultiplierTimer:
            self.verifyMultiplierTimer.KillTimer()
        self.verifyMultiplierTimer = AutoTimer(
            2000, self.VerifyOrderMultiplier_thread)

    def UpdateOrderMultiplierInEntries(self, force=True):
        self.orderMultiplier = self.orderMultiplierEdit.GetValue()
        for item in self.GetItemsIterator():
            if force or item.orderMultiplier != self.orderMultiplier:
                item.UpdateOrderMultiplier(self.orderMultiplier)

    def VerifyOrderMultiplier_thread(self):
        self.verifyMultiplierTimer = None
        self.UpdateOrderMultiplierInEntries(force=False)

    def OnEntryEdit(self, *args):
        uthread.new(self.UpdateNumbers)

    def UpdateNumbers(self):
        totalShown = self.GetSum()
        if totalShown >= MILLION:
            totalAmtText = '%s (%s)' % (FmtISK(totalShown),
                                        FmtISKWithDescription(totalShown,
                                                              justDesc=True))
        else:
            totalAmtText = FmtISK(totalShown)
        self.totalAmt.text = totalAmtText
        self.totalAmt.SetRGB(*COL_RED)
        self.ShowOrHideStationWarning()

    def ShowOrHideStationWarning(self):
        currentStation = session.stationid2 or session.structureid
        if self.baseStationID is None:
            self.stationWarning.text = GetByLabel(
                'UI/Market/MarketQuote/NoStationSelected')
            self.stationWarning.display = True
        elif self.baseStationID == currentStation:
            self.stationWarning.display = False
        else:
            self.stationWarning.text = GetByLabel(
                'UI/Market/MarketQuote/StationWarning')
            self.stationWarning.display = True

    def GetSum(self):
        totalSum = 0
        for item in self.GetItemsIterator():
            totalSum += item.GetTotalSum()

        return totalSum

    def LoadTotalTooltip(self, tooltipPanel, *args):
        totalShown = self.GetSum()
        if not totalShown or not self.orderMultiplier:
            return
        numTypes, numAvailableTypes = self.GetNumTypesAndNumAvailableTypes()
        pricePerOrder = totalShown / float(self.orderMultiplier)
        tooltipPanel.LoadGeneric2ColumnTemplate()
        tooltipPanel.cellPadding = (4, 1, 4, 1)
        tooltipPanel.AddLabelMedium(
            text=GetByLabel('UI/Market/MarketQuote/NumOrders'))
        tooltipPanel.AddLabelMedium(text=FmtAmt(self.orderMultiplier),
                                    align=uiconst.CENTERRIGHT)
        tooltipPanel.AddLabelMedium(
            text=GetByLabel('UI/Market/MarketQuote/PricePerOrder'))
        tooltipPanel.AddLabelMedium(text=FmtISK(pricePerOrder),
                                    align=uiconst.CENTERRIGHT)
        if pricePerOrder >= MILLION:
            tooltipPanel.AddCell()
            tooltipPanel.AddLabelMedium(
                text='=%s' %
                FmtISKWithDescription(pricePerOrder, justDesc=True),
                align=uiconst.CENTERRIGHT)
        buyingText = GetByLabel(
            'UI/Market/MarketQuote/TypesAvailableAndTotalInOrder',
            numAvailable=numAvailableTypes,
            numTypes=numTypes)
        buyingLabel = tooltipPanel.AddLabelSmall(text=buyingText,
                                                 align=uiconst.CENTERRIGHT,
                                                 colSpan=tooltipPanel.columns)
        buyingLabel.SetAlpha(0.6)
        tooltipPanel.AddSpacer(1, 8, colSpan=tooltipPanel.columns)
        deltaText = self.GetOrderDeltaText()
        tooltipPanel.AddLabelMedium(text=deltaText,
                                    colSpan=tooltipPanel.columns)

    def GetOrderDelta(self):
        totalPrice = sum(
            (i.GetTotalSum() for i in self.GetItemsIterator(onlyValid=True)))
        change = 0
        for item in self.GetItemsIterator(onlyValid=True):
            price = item.GetTotalSum()
            qty = item.GetTotalQty()
            avgPriceForQty = qty * item.averagePrice
            change += (price -
                       avgPriceForQty) / avgPriceForQty * price / totalPrice

        return change

    def GetOrderDeltaText(self):
        percentage = self.GetOrderDelta()
        if percentage == 0:
            return ''
        if percentage < 0:
            percColor = self.belowColor
            devLabelPath = 'UI/Market/MarketQuote/BelowRegionalAverageWithPercentage'
        else:
            percColor = self.aboveColor
            devLabelPath = 'UI/Market/MarketQuote/AboveRegionalAverageWithPercentage'
        percentage = abs(percentage)
        percentageText = FmtAmt(percentage * 100, showFraction=1)
        percText = '%s%s</color>' % (percColor,
                                     GetByLabel('UI/Common/Percentage',
                                                percentage=percentageText))
        return GetByLabel(devLabelPath, percentage=percText)

    def GetNumTypesAndNumAvailableTypes(self):
        numTypes = 0
        numAvailableTypes = 0
        for item in self.GetItemsIterator():
            numTypes += 1
            if item.GetPrice():
                numAvailableTypes += 1

        return (numTypes, numAvailableTypes)

    def DropItems(self, dragObj, nodes):
        if dragObj is None:
            return
        items = self.CheckOrderAvailability(nodes)
        self.ClearErrorLists()
        for node in items:
            typeID = GetTypeIDFromDragItem(node)
            if typeID:
                self.AddItem(KeyVal(typeID=typeID, qty=1))

        self.DisplayErrorHints()

    def GetTypeIDFromDragItem(self, node):
        return GetTypeIDFromDragItem(node)

    def OnStationChanged(self, combo, key, value):
        self.baseStationID = value
        self.UpdateStationID()

    def UpdateStationID(self):
        for item in self.GetItemsIterator():
            item.UpdateStationID(self.baseStationID)

        self.UpdateHeaderCount()
        self.UpdateNumbers()

    def OnOwnOrdersChanged(self, orders, reason, isCorp):
        if reason != 'Expiry':
            return
        orderIDs = set()
        for eachOrder in orders:
            self.expiredOrders[eachOrder.orderID] = eachOrder
            orderIDs.add(eachOrder.orderID)

        self._ProccessExpiredOrders(orderIDs)

    def _ProccessExpiredOrders(self, orderIDs):
        failedItems = []
        for eachOrderID in orderIDs:
            if eachOrderID not in self.activeOrders:
                continue
            eachOrder = self.expiredOrders.get(eachOrderID, None)
            if eachOrder and eachOrder.volRemaining != 0:
                failedBuyInfo = KeyVal(typeID=eachOrder.typeID,
                                       qty=eachOrder.volRemaining)
                failedItems.append(failedBuyInfo)
            self.activeOrders.discard(eachOrderID)

        if failedItems:
            self.AddPreItems(failedItems)
        if not failedItems and not self.AreStillItemsInWindow():
            self.Close()
            return
        if self.orderDisabled and not self.activeOrders:
            self.ChangeOrderUIState(disable=False)

    def VerifyExpiredOrders(self):
        expiredOrders = set(self.expiredOrders.keys())
        expiredOrdersNotProcessed = self.activeOrders.intersection(
            expiredOrders)
        if expiredOrdersNotProcessed:
            self._ProccessExpiredOrders(expiredOrdersNotProcessed)

    def AreStillItemsInWindow(self):
        if self.activeOrders:
            return True
        if self.reloadingItemsCounter > 0:
            return True
        if self.itemList:
            return True
        return False

    def RemoveAllItem(self):
        self.itemsScroll.Flush()
        self.itemList = []
        self.entriesInScrollByTypeID = {}
        self.UpdateNumbers()
        self.UpdateHeaderCount()
        self.ClearErrorLists()

    def OnSessionChanged(self, isRemote, session, change):
        if 'solarsystemid2' in change or 'stationid2' in change:
            self.LoadStationOptions()

    def IsBuyable(self, itemKeyVal):
        buyable = True
        if evetypes.GetMarketGroupID(itemKeyVal.typeID) is None:
            self.cannotTradeItemList.append(itemKeyVal)
            buyable = False
        return buyable

    def BlinkNumOrdersEdit(self):
        self.ConstructBlinkBG()
        uicore.animations.FadeTo(self.blinkEditBG,
                                 0.0,
                                 0.5,
                                 duration=0.5,
                                 curveType=uiconst.ANIM_WAVE,
                                 loops=2)

    def ConstructBlinkBG(self):
        if self.blinkEditBG is None:
            self.blinkEditBG = Sprite(
                name='blinkEditBG',
                bgParent=self.orderMultiplierEdit,
                align=uiconst.TOALL,
                state=uiconst.UI_DISABLED,
                texturePath='res:/UI/Texture/classes/InvItem/bgSelected.png',
                opacity=0.0,
                idx=0)

    def LogBuy(self, buyItemList):
        totalDisplayed = self.totalAmt.text
        totalSum = self.GetSum()
        multiplier = self.orderMultiplierEdit.GetValue()
        buyTextList = []
        for eachItem in buyItemList:
            text = '[typeID=%s, price=%s, qty=%s]' % (
                eachItem.typeID, eachItem.price, eachItem.quantity)
            buyTextList.append(text)

        buyText = ','.join(buyTextList)
        logInfo = 'Multibuy: totalDisplayed=%s, totalSum=%s, multiplier=%s, buyText=%s' % (
            totalDisplayed, totalSum, multiplier, buyText)
        log.LogNotice(logInfo)

    def Close(self, *args, **kwds):
        self.verifyMultiplierTimer = None
        return SellBuyItemsWindow.Close(self, *args, **kwds)

    def DisplayErrorHints(self):
        hintTextList = self.GetErrorHints()
        if hintTextList:
            hintText = '<br>'.join(hintTextList)
            eve.Message('CustomInfo', {'info': hintText})
Exemplo n.º 21
0
 def Layout(self):
     self.compactMode = False
     Frame(bgParent=self,
           texturePath='res:/UI/Texture/classes/Monetization/vignette.png',
           cornerSize=150)
     self.characters = Sprite(
         parent=self,
         align=uiconst.CENTER,
         state=uiconst.UI_DISABLED,
         left=self.CHARACTERS_LEFT,
         top=10,
         texturePath='res:/UI/Texture/classes/Monetization/characters.png',
         width=299,
         height=355)
     self.content = ContainerAutoSize(parent=self,
                                      align=uiconst.CENTER,
                                      left=self.CONTENT_LEFT,
                                      width=340)
     EveCaptionLarge(
         parent=self.content,
         align=uiconst.TOTOP,
         text=localization.GetByLabel(
             'UI/SkillQueue/MultiTrainingOverlay/MultiplePilotTraining'))
     EveLabelMedium(
         parent=self.content,
         align=uiconst.TOTOP,
         top=4,
         text=localization.GetByLabel(
             'UI/SkillQueue/MultiTrainingOverlay/MultiTrainingMessageTop'))
     itemCont = ContainerAutoSize(parent=self.content,
                                  align=uiconst.TOTOP,
                                  alignMode=uiconst.TOTOP,
                                  top=12)
     Frame(bgParent=itemCont,
           texturePath=
           'res:/UI/Texture/classes/Monetization/item_well_frame.png',
           cornerSize=2)
     itemIconCont = ContainerAutoSize(parent=itemCont,
                                      align=uiconst.TOLEFT,
                                      padding=(8, 8, 0, 8))
     Icon(parent=itemIconCont,
          align=uiconst.TOPLEFT,
          state=uiconst.UI_DISABLED,
          size=64,
          typeID=typeMultiTrainingToken)
     Sprite(parent=itemIconCont,
            align=uiconst.TOPLEFT,
            state=uiconst.UI_DISABLED,
            texturePath='res:/UI/Texture/classes/InvItem/bgNormal.png',
            width=64,
            height=64)
     EveLabelLargeBold(parent=itemCont,
                       align=uiconst.TOTOP,
                       padding=(8, 8, 24, 0),
                       text=evetypes.GetName(typeMultiTrainingToken))
     InfoIcon(parent=itemCont,
              align=uiconst.TOPRIGHT,
              top=8,
              left=8,
              typeID=typeMultiTrainingToken)
     self.estimatePriceLabel = EveLabelMedium(parent=itemCont,
                                              align=uiconst.TOTOP,
                                              padding=(8, 0, 8, 6),
                                              color=Color.GRAY5)
     buyButtonCont = FlowContainer(parent=itemCont,
                                   align=uiconst.TOTOP,
                                   padding=(8, 0, 8, 8),
                                   contentSpacing=(8, 0))
     MultiTrainingBuyButtonIsk(parent=buyButtonCont,
                               align=uiconst.NOALIGN,
                               typeID=typeMultiTrainingToken)
     MultiTrainingBuyButtonAur(parent=buyButtonCont,
                               align=uiconst.NOALIGN,
                               types=[typeMultiTrainingToken])
     EveLabelMedium(
         parent=self.content,
         align=uiconst.TOTOP,
         top=12,
         text=localization.GetByLabel(
             'UI/SkillQueue/MultiTrainingOverlay/MultiTrainingMessageBottom'
         ))
     dismissCont = FlowContainer(parent=self.content,
                                 align=uiconst.TOTOP,
                                 padding=(8, 24, 8, 0),
                                 contentAlignment=CONTENT_ALIGN_CENTER,
                                 contentSpacing=(8, 4))
     Button(parent=dismissCont,
            align=uiconst.NOALIGN,
            label=localization.GetByLabel(
                'UI/SkillQueue/MultiTrainingOverlay/Dismiss'),
            func=lambda *args: self.Dismiss())
     self.suppressCheckbox = Checkbox(
         parent=dismissCont,
         align=uiconst.NOALIGN,
         width=200,
         text=localization.GetByLabel('UI/Common/SuppressionShowMessage'),
         checked=self.suppressed,
         callback=self.OnSuppressChanged)
Exemplo n.º 22
0
class RewardsView(uiprimitives.Container):
    default_clipChildren = True

    def ApplyAttributes(self, attributes):
        super(RewardsView, self).ApplyAttributes(attributes)
        self.projectDiscovery = sm.RemoteSvc('ProjectDiscovery')
        self.isTraining = False
        self.XP_Reward = 0
        self.ISK_Reward = 0
        self.bottom_container = attributes.get('bottom_container')
        self.playerState = attributes.get('playerState')
        self.experience = self.playerState.experience
        self.player_rank = self.playerState.rank
        self.total_xp_needed_for_current_rank = self.projectDiscovery.get_total_needed_xp(self.player_rank)
        self.total_xp_needed_for_next_rank = self.projectDiscovery.get_total_needed_xp(self.player_rank + 1)
        self.original_rank_band = calculate_rank_band(self.player_rank)
        self.rank_band = self.original_rank_band
        self.score_bar_height = 7
        self.setup_rewards_screen()

    def setup_rewards_screen(self):
        self.parent_container = uiprimitives.Container(name='parentContainer', parent=self, align=uiconst.CENTER, height=400, width=450, top=-10)
        self.background_container = uiprimitives.Container(name='background', parent=self.parent_container, width=450, height=285, align=uiconst.CENTERTOP, bgColor=(0.037, 0.037, 0.037, 1))
        uicontrols.Frame(parent=self.background_container, color=(0.36, 0.36, 0.36, 0.36))
        self.main_container = uiprimitives.Container(name='mainContainer', parent=self.background_container, width=440, height=275, align=uiconst.CENTER)
        self.rank_container = uiprimitives.Container(name='rankContainer', parent=self.parent_container, width=450, height=100, align=uiconst.CENTERBOTTOM, bgColor=(0.037, 0.037, 0.037, 1))
        uicontrols.Frame(parent=self.rank_container, color=(0.36, 0.36, 0.36, 0.36))
        self.agent_container = uiprimitives.Container(name='agentContainer', parent=self.main_container, align=uiconst.TOPLEFT, height=180, width=150, left=5, top=5)
        self.agent_image = uiprimitives.Sprite(name='agentImage', parent=self.agent_container, align=uiconst.TOPLEFT, height=150, width=150, texturePath='res:/UI/Texture/classes/ProjectDiscovery/lundberg.jpg')
        self.agent_label = uicontrols.Label(name='agentName', parent=self.agent_container, align=uiconst.BOTTOMLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/AgentName'), top=5, height=18, fontsize=14)
        self.SOE_image = uiprimitives.Sprite(name='SOE_logo', parent=self.main_container, align=uiconst.BOTTOMLEFT, height=75, width=75, texturePath='res:/UI/Texture/Corps/14_128_1.png')
        self.text_container = uiprimitives.Container(name='textContainer', parent=self.main_container, align=uiconst.TOPRIGHT, width=270, height=80, top=20)
        self.text_header_container = uiprimitives.Container(name='textHeaderContainer', parent=self.text_container, align=uiconst.TOTOP, height=20)
        self.header_message = EveLabelLargeBold(parent=self.text_header_container, align=uiconst.TOTOP, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/Header'))
        self.main_message = uicontrols.Label(parent=self.text_container, align=uiconst.TOTOP, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ThanksMessage'))
        self.setup_reward_container()
        self.setup_reward_footer()
        self.setup_continue_button()

    def setup_continue_button(self):
        self.main_button_container = uiprimitives.Container(name='MainRewardsContinueButtonContainer', parent=self.bottom_container, align=uiconst.CENTERBOTTOM, width=355, height=53, bgTexturePath='res:/UI/Texture/classes/ProjectDiscovery/footerBG.png', state=uiconst.UI_HIDDEN)
        self.continue_button_container = uiprimitives.Container(name='RewardsContinueButtonContainer', parent=self.main_button_container, width=250, align=uiconst.CENTER, height=40, top=5)
        self.continue_button = uicontrols.Button(name='RewardViewContinueButton', parent=self.continue_button_container, align=uiconst.CENTER, label=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ContinueButtonLabel'), fontsize=18, fixedwidth=170, fixedheight=30, func=lambda x: self.fade_out(), state=uiconst.UI_DISABLED)
        uiprimitives.Sprite(parent=self.continue_button_container, align=uiconst.CENTERLEFT, width=34, height=20, texturePath='res:/UI/Texture/classes/ProjectDiscovery/submitArrow.png', opacity=0.7)
        uiprimitives.Sprite(parent=uiprimitives.Transform(parent=self.continue_button_container, align=uiconst.CENTERRIGHT, width=34, height=20, rotation=math.pi), align=uiconst.CENTERRIGHT, width=34, height=20, texturePath='res:/UI/Texture/classes/ProjectDiscovery/submitArrow.png', opacity=0.7)

    def setup_reward_container(self):
        self.reward_container = uiprimitives.Container(name='reward_container', parent=self.main_container, align=uiconst.BOTTOMRIGHT, width=270, height=130)
        self.setup_experience_reward_container()
        self.setup_isk_reward_container()
        self.setup_analysis_kredits_container()

    def setup_experience_reward_container(self):
        self.experience_points_container = uiprimitives.Container(parent=self.reward_container, width=360, height=40, align=uiconst.TOTOP, bgColor=(0.36, 0.36, 0.36, 0.36))
        self.experience_points_icon = uiprimitives.Sprite(parent=uiprimitives.Container(parent=self.experience_points_container, width=40, height=40, align=uiconst.TOLEFT, left=10), name='experience_points_Logo', align=uiconst.TOALL, texturePath='res:/UI/Texture/classes/ProjectDiscovery/experiencePointsIcon.png')
        self.experience_points_label = uicontrols.Label(parent=uiprimitives.Container(parent=self.experience_points_container, align=uiconst.TOLEFT, width=75, height=50), align=uiconst.CENTERLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ExperiencePointsLabel'), fontsize=14)
        self.experience_points = uicontrols.Label(parent=uiprimitives.Container(parent=self.experience_points_container, align=uiconst.CENTERRIGHT, width=20, height=50, left=25), align=uiconst.CENTER, fontsize=16, text='0')

    def setup_isk_reward_container(self):
        self.ISK_reward_container = uiprimitives.Container(parent=self.reward_container, width=360, height=40, align=uiconst.TOTOP, top=5, bgColor=(0.36, 0.36, 0.36, 0.36))
        self.ISK_reward_icon = uiprimitives.Sprite(parent=uiprimitives.Container(parent=self.ISK_reward_container, width=40, height=40, align=uiconst.TOLEFT, left=10), name='ISK_reward_Logo', align=uiconst.TOALL, texturePath='res:/ui/texture/WindowIcons/wallet.png')
        self.ISK_reward_label = uicontrols.Label(parent=uiprimitives.Container(parent=self.ISK_reward_container, align=uiconst.TOLEFT, width=75, height=50), align=uiconst.CENTERLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/IskLabel'), fontsize=14)
        self.ISK_reward = uicontrols.Label(parent=uiprimitives.Container(parent=self.ISK_reward_container, align=uiconst.CENTERRIGHT, width=20, height=50, left=25), align=uiconst.CENTER, fontsize=16, text='0')

    def setup_analysis_kredits_container(self):
        self.analysis_kredits_container = uiprimitives.Container(parent=self.reward_container, width=360, height=40, align=uiconst.TOTOP, bgColor=(0.36, 0.36, 0.36, 0.36), top=5)
        self.analysis_kredits_icon = uiprimitives.Sprite(parent=uiprimitives.Container(parent=self.analysis_kredits_container, width=40, height=40, align=uiconst.TOLEFT, left=10), name='Analyst_points_Logo', align=uiconst.TOALL, texturePath='res:/UI/Texture/classes/ProjectDiscovery/analysisKreditsIcon.png')
        self.analysis_kredits_label = uicontrols.Label(parent=uiprimitives.Container(parent=self.analysis_kredits_container, align=uiconst.TOLEFT, width=75, height=50), align=uiconst.CENTERLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/AnalysisKreditsLabel'), fontsize=14)
        self.analysis_kredits = uicontrols.Label(parent=uiprimitives.Container(parent=self.analysis_kredits_container, align=uiconst.CENTERRIGHT, width=20, height=50, left=25), align=uiconst.CENTER, fontsize=16, text='0')

    def setup_reward_footer(self):
        self.rank_header = uiprimitives.Container(parent=self.rank_container, align=uiconst.TOTOP, height=20, bgColor=(0.36, 0.36, 0.36, 0.36))
        uicontrols.Label(parent=self.rank_header, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ScientistRank'), align=uiconst.CENTERLEFT, left=5)
        self.footer_container = uiprimitives.Container(name='footerContainer', parent=self.rank_container, align=uiconst.CENTER, height=65, width=435, top=10, bgTexturePath='res:/UI/Texture/classes/ProjectDiscovery/rankInfoBackground.png')
        self.rank_icon_container = uiprimitives.Container(name='rankIconContainer', parent=self.footer_container, align=uiconst.CENTERLEFT, width=64, height=64, bgTexturePath='res:/UI/Texture/classes/ProjectDiscovery/rankIconBackground.png')
        self.rank_icon = uiprimitives.Sprite(name='rank_icon', parent=self.rank_icon_container, align=uiconst.CENTER, width=64, height=64, texturePath=self.get_rank_icon_path())
        self.rank_information_container = uiprimitives.Container(name='rankInfoContainer', parent=self.footer_container, align=uiconst.TOLEFT, width=360, left=64)
        self.rank_label = uicontrols.Label(name='rankLabel', parent=self.rank_information_container, align=uiconst.TOPLEFT, text='', fontsize=14)
        self.rank = uicontrols.Label(name='rank', parent=self.rank_information_container, align=uiconst.TOPRIGHT, text='', fontsize=14)
        self.scorebar_container = uiprimitives.Container(name='scorebarContainer', parent=self.rank_information_container, align=uiconst.TOBOTTOM, height=60)
        self._initialize_score_bar_length()
        self.total_points_container = uiprimitives.Container(name='totalPointsContainer', parent=self.scorebar_container, align=uiconst.TOTOP, width=self.scorebar_container.width, height=15, top=10)
        self.total_points_label = uicontrols.Label(name='totalPointsLabel', parent=self.total_points_container, align=uiconst.TOPLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/TotalExperiencePointsLabel'), fontsize=12)
        self.total_points = uicontrols.Label(name='totalPoints', parent=self.total_points_container, align=uiconst.TOPRIGHT, fontsize=12)
        self.score_bar = uicls.VectorLine(name='ScoreBar', parent=self.scorebar_container, align=uiconst.TOTOP, translationFrom=(0, self.score_bar_height), translationTo=(1, self.score_bar_height), colorFrom=(1.0, 1.0, 1.0, 0.95), colorTo=(1.0, 1.0, 1.0, 0.95), widthFrom=3, widthTo=3)
        self.empty_score_bar = uicls.VectorLine(name='EmptyScoreBar', parent=self.scorebar_container, align=uiconst.TOTOP_NOPUSH, translationFrom=(0, self.score_bar_height), translationTo=(self.scoreBarLength, self.score_bar_height), colorFrom=(0.0, 0.0, 0.0, 0.75), colorTo=(0.0, 0.0, 0.0, 0.75), widthFrom=4, widthTo=4)
        self.needed_points_container = uiprimitives.Container(parent=self.scorebar_container, align=uiconst.TOBOTTOM, width=self.scorebar_container.width, height=15, top=10)
        self.needed_points_label = uicontrols.Label(parent=self.needed_points_container, align=uiconst.BOTTOMLEFT, text=localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/NeededXpLabel'), fontsize=12)
        self.needed_points = uicontrols.Label(parent=self.needed_points_container, align=uiconst.TOPRIGHT, fontsize=12)

    def _initialize_score_bar_length(self):
        self.scoreBarLength = self.rank_information_container.width
        self.oldScoreBarLength = self.calculate_score_bar_length()

    def close(self):
        self.main_button_container.Close()
        self.Close()

    @on_event(const.Events.CloseResult)
    def on_result_closed(self, result):
        self.set_score_bar_length(self.calculate_score_bar_length())
        self.XP_Reward = result['XP_Reward']
        self.ISK_Reward = result['ISK_Reward']
        self.AK_Reward = result['AK_Reward']
        self.playerState = result['playerState']
        self.show_reward_containers()
        if 'isTraining' in result:
            self.display_training_complete_message()
        else:
            self.display_normal_thanking_message()
        self.update_analysis_kredits_container()
        self.update_isk_reward_container()
        self.update_player_info()
        self.update_experience_labels()

    def display_normal_thanking_message(self):
        self.header_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/Header'))
        self.main_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ThanksMessage'))

    def display_training_complete_message(self):
        self.header_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/TutorialCompletedHeader'))
        self.main_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/TutorialCompletedMessage'))

    def show_reward_containers(self):
        self.experience_points_container.SetOpacity(1)
        self.ISK_reward_container.SetOpacity(1)
        self.analysis_kredits_container.SetOpacity(1)

    def update_experience_labels(self):
        self.needed_points.SetText('{:,.0f}'.format(self.needed_experience))
        self.total_points.SetText('{:,.0f}'.format(self.experience))

    def update_player_info(self):
        self.experience = self.playerState.experience
        self.player_rank = self.playerState.rank
        self.total_xp_needed_for_current_rank = self.projectDiscovery.get_total_needed_xp(self.player_rank)
        self.total_xp_needed_for_next_rank = self.projectDiscovery.get_total_needed_xp(self.player_rank + 1)
        self.needed_experience = self.total_xp_needed_for_next_rank - self.experience

    def update_isk_reward_container(self):
        if self.ISK_Reward == 0:
            self.ISK_reward_container.SetOpacity(0)
        if self.XP_Reward <= 0:
            self.experience_points_container.SetOpacity(0)
            self.main_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/ThanksButNoRewardsMessage'))

    def update_analysis_kredits_container(self):
        if self.AK_Reward == 0:
            self.analysis_kredits_container.SetOpacity(0)
        else:
            self.analysis_kredits.SetText(str(FmtAmt(self.AK_Reward)))
            self.header_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/NewRankHeader'))
            self.main_message.SetText(localization.GetByLabel('UI/ProjectDiscovery/Subcellular/RewardsScreen/NewRankMessage'))

    def set_score_bar_length(self, length):
        if self.score_bar:
            self.score_bar.translationTo = (length, self.score_bar_height)

    def update_rank_values(self):
        self.update_player_info()
        self.rank.SetText(const.Texts.RankLabel + str(self.player_rank))
        self.update_experience_labels()
        self.rank_label.SetText(localization.GetByLabel('UI/ProjectDiscovery/RankTitles/RankTitle' + str(self.rank_band)))
        self.tick_rewards()
        self.update_experience_values()

    def update_experience_values(self):
        self.oldExperience = self.experience
        self.experience = self.playerState.experience
        uthread.new(self.update_experience_points_values)
        self.oldNeededExperience = self.needed_experience
        self.needed_experience = self.total_xp_needed_for_next_rank - self.experience
        uthread.new(self.update_needed_experience_points_values)

    def tick_rewards(self):
        uthread.new(self.update_xp_reward)
        uthread.new(self.update_isk_reward)

    def update_needed_experience_points_values(self):
        while self.oldNeededExperience > self.needed_experience:
            self.oldNeededExperience -= 2
            self.needed_points.SetText(FmtAmt(self.oldNeededExperience))
            blue.synchro.Sleep(1)

        self.needed_points.SetText(FmtAmt(self.oldNeededExperience))

    def update_experience_points_values(self):
        while self.oldExperience < self.experience:
            self.oldExperience += 2
            self.total_points.SetText(FmtAmt(self.oldExperience))
            blue.synchro.Sleep(1)

        self.total_points.SetText(FmtAmt(self.experience))

    def update_xp_reward(self):
        counter = 0
        while counter + 2 < self.XP_Reward:
            counter += 2
            self.experience_points.SetText(counter)
            blue.synchro.Sleep(1)

        self.experience_points.SetText(FmtAmt(self.XP_Reward))

    def update_isk_reward(self):
        if self.ISK_Reward:
            counter = 0
            while counter + 1000 < self.ISK_Reward:
                counter += 1000
                self.ISK_reward.SetText(FmtAmt(counter))
                blue.synchro.Sleep(1)

            self.ISK_reward.SetText(FmtAmt(self.ISK_Reward))

    def reset_reward_labels(self):
        self.ISK_reward.SetText('0')
        self.experience_points.SetText('0')

    def get_rank_icon_path(self):
        return const.rank_paths[calculate_rank_band(self.player_rank)]

    def get_rank_band(self):
        rank_band = int(math.ceil(float(self.player_rank) / 10 + 0.1))
        if rank_band < 1:
            rank_band = 1
        elif rank_band > 11:
            rank_band = 11
        return rank_band

    def calculate_score_bar_length(self):
        return calculate_score_bar_length(self.experience, self.total_xp_needed_for_current_rank, self.total_xp_needed_for_next_rank, self.scoreBarLength)

    def update_score_bar(self):
        if self.XP_Reward <= 0:
            return
        sm.ScatterEvent(const.Events.UpdateScoreBar, self.playerState)
        new_score_bar_length = self.calculate_score_bar_length()
        counter = self.oldScoreBarLength
        self.oldScoreBarLength = new_score_bar_length
        uthread.new(self.tick_score_bar, counter, new_score_bar_length)

    def tick_score_bar(self, counter, new_score_bar_length):
        while counter >= new_score_bar_length:
            counter += 1
            if counter >= ScaleDpi(self.scoreBarLength):
                counter = -1
                self.rank_band = calculate_rank_band(self.player_rank)
                if self.rank_band > self.original_rank_band:
                    self.original_rank_band = self.rank_band
                    self.fade_badge_out()
            else:
                self.set_score_bar_length(counter)
                blue.synchro.Sleep(1)

        while counter < new_score_bar_length:
            counter += 1
            self.set_score_bar_length(counter)
            blue.synchro.Sleep(1)

    def fade_badge_out(self):
        animations.FadeOut(self.rank_icon, duration=0.5, callback=self.fade_badge_in)
        animations.FadeOut(self.rank_label, duration=0.5)

    def fade_badge_in(self):
        self.rank_icon.SetTexturePath(self.get_rank_icon_path())
        animations.FadeIn(self.rank_icon, timeOffset=0.2, duration=0.5, curveType=uiconst.ANIM_OVERSHOT5)
        self.rank_label.SetText(localization.GetByLabel('UI/ProjectDiscovery/RankTitles/RankTitle' + str(self.rank_band)))
        animations.FadeIn(self.rank_label, timeOffset=0.2, duration=0.4, curveType=uiconst.ANIM_OVERSHOT5)

    def fade_out(self):
        self.main_button_container.SetState(uiconst.UI_HIDDEN)
        sm.ScatterEvent(const.Events.RewardViewFadeOut)
        animations.FadeOut(self, duration=0.5, callback=self.continue_from_reward)

    @on_event(const.Events.ProcessingViewFinished)
    def fade_in(self):
        self.update_rank_values()
        animations.FadeIn(self, duration=0.5, callback=self.update_score_bar)
        sm.GetService('audio').SendUIEvent(const.Sounds.RewardsWindowLoopPlay)
        self.enable_button()

    def continue_from_reward(self):
        if self.isTraining:
            if self.tutorial_completed:
                sm.ScatterEvent(const.Events.ProjectDiscoveryStarted, True)
        else:
            sm.ScatterEvent(const.Events.ContinueFromReward)
        self.reset_reward_labels()
        self.disable_button()
        taskimages.Audio.play_sound = True
        sm.GetService('audio').SendUIEvent(const.Sounds.RewardsWindowLoopStop)
        sm.GetService('audio').SendUIEvent(const.Sounds.RewardsWindowClosePlay)
        sm.GetService('audio').SendUIEvent(const.Sounds.MainImageLoopPlay)

    def enable_button(self):
        self.continue_button.state = uiconst.UI_NORMAL
        self.main_button_container.SetState(uiconst.UI_NORMAL)

    def disable_button(self):
        self.continue_button.state = uiconst.UI_DISABLED
Exemplo n.º 23
0
 def Layout(self):
     self.HideHeader()
     self.MakeUnResizeable()
     self.container = ContainerAutoSize(parent=self.GetMainArea(),
                                        align=uiconst.TOTOP,
                                        alignMode=uiconst.TOTOP,
                                        state=uiconst.UI_PICKCHILDREN,
                                        padding=(15, 15, 15, 0),
                                        callback=self.OnContainerResized)
     EveLabelLargeBold(parent=self.container,
                       align=uiconst.TOTOP,
                       text=localization.GetByLabel(
                           'UI/ActivateMultiTraining/ActivateHeading'))
     EveLabelMedium(parent=self.container,
                    align=uiconst.TOTOP,
                    text=localization.GetByLabel(
                        'UI/ActivateMultiTraining/ActivateDescription'),
                    color=self.GRAY_COLOR,
                    padding=(0, 5, 0, 10))
     Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR)
     slot1 = ContainerAutoSize(parent=self.container,
                               align=uiconst.TOTOP,
                               alignMode=uiconst.TOTOP,
                               state=uiconst.UI_PICKCHILDREN,
                               bgColor=(0, 0, 0, 0.3))
     self.slot1Background = Fill(parent=slot1,
                                 color=self.GREEN_COLOR,
                                 opacity=0.0)
     self.slot1Title = EveLabelMediumBold(parent=slot1,
                                          align=uiconst.TOTOP,
                                          text='',
                                          padding=(60, 12, 140, 0),
                                          color=self.WHITE_COLOR)
     self.slot1Expiry = EveLabelMediumBold(parent=slot1,
                                           align=uiconst.TOTOP,
                                           text='',
                                           padding=(60, 0, 140, 10),
                                           color=self.GRAY_COLOR)
     self.slot1Button = Button(parent=slot1,
                               label='',
                               align=uiconst.CENTERRIGHT,
                               fontsize=13,
                               fixedwidth=120,
                               fixedheight=30,
                               pos=(10, 0, 0, 0))
     self.slot1Button.confirmHilite = GradientSprite(
         bgParent=self.slot1Button,
         rotation=-math.pi / 2,
         rgbData=[(0, self.GREEN_COLOR[:3])],
         alphaData=[(0, 0.5), (0.3, 0.2), (0.6, 0.14)],
         opacity=0.0)
     self.slot1Icon = Sprite(
         parent=slot1,
         texturePath='res:/UI/Texture/Icons/add_training_queue.png',
         align=uiconst.CENTERLEFT,
         pos=(15, 0, 32, 32))
     Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR)
     slot2 = ContainerAutoSize(parent=self.container,
                               align=uiconst.TOTOP,
                               alignMode=uiconst.TOTOP,
                               state=uiconst.UI_PICKCHILDREN,
                               bgColor=(0, 0, 0, 0.3))
     self.slot2Background = Fill(parent=slot2,
                                 color=self.GREEN_COLOR,
                                 opacity=0.0)
     self.slot2Title = EveLabelMediumBold(parent=slot2,
                                          align=uiconst.TOTOP,
                                          text='',
                                          padding=(60, 12, 140, 0),
                                          color=self.WHITE_COLOR)
     self.slot2Expiry = EveLabelMediumBold(parent=slot2,
                                           align=uiconst.TOTOP,
                                           text='',
                                           padding=(60, 0, 140, 10),
                                           color=self.GRAY_COLOR)
     self.slot2Button = Button(parent=slot2,
                               label='',
                               align=uiconst.CENTERRIGHT,
                               fontsize=13,
                               fixedwidth=120,
                               fixedheight=30,
                               pos=(10, 0, 0, 0))
     self.slot2Button.confirmHilite = GradientSprite(
         bgParent=self.slot2Button,
         rotation=-math.pi / 2,
         rgbData=[(0, self.GREEN_COLOR[:3])],
         alphaData=[(0, 0.5), (0.3, 0.2), (0.6, 0.14)],
         opacity=0.0)
     self.slot2Icon = Sprite(
         parent=slot2,
         texturePath='res:/UI/Texture/Icons/add_training_queue.png',
         align=uiconst.CENTERLEFT,
         pos=(15, 0, 32, 32))
     Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR)
     self.closeButton = Button(
         parent=self.container,
         label=localization.GetByLabel('UI/Generic/Cancel'),
         func=self.Close,
         align=uiconst.TOTOP,
         fontsize=13,
         padding=(120, 10, 120, 30))