def DrawItem(self): iconCont = Container(parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) self.iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTERLEFT, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=self.iconInnerCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=self.iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) self.icon = Icon(parent=self.iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, ignoreSize=True, pos=(0, 0, 32, 32)) GetTechLevelIcon(self.techIcon, 1, self.typeID) itemName = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=self.itemName, info=('showinfo', self.typeID, self.item.itemID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12)
def ApplyAttributes(self, attributes): super(VgsLoadingWheel, self).ApplyAttributes(attributes) size = attributes.get('size') or self.DEFAULT_SIZE self.width = size self.height = size LoadingWheel(parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=size, height=size, texturePath='res:/UI/Texture/Vgs/loading-bar-glow.png', color=(0.969, 0.522, 0.463, 1.0)) Sprite(parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=size, height=size, texturePath='res:/UI/Texture/Vgs/loading-track-overlay.png') LoadingWheel(parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=size, height=size, texturePath='res:/UI/Texture/Vgs/loading-bar.png', color=(0.769, 0.322, 0.263, 1.0)) Sprite(parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=size, height=size, texturePath='res:/UI/Texture/Vgs/loading-track.png')
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) loadSize = attributes.loadSize or 100 self.loadingWheel = LoadingWheel(parent=self, align=uiconst.CENTER, width=loadSize, height=loadSize, opacity=0.2) self.sprite = Sprite(bgParent=self, align=uiconst.TOALL) self.SetImageFromUrl(attributes.imageUrl)
def Layout(self): self.frame = Frame( bgParent=self, texturePath= 'res:/UI/Texture/Classes/Industry/CenterBar/buttonBg.png', cornerSize=5, color=Color.GRAY2) self.arrows = Sprite( bgParent=self, texturePath= 'res:/UI/Texture/Classes/Industry/CenterBar/arrowMask.png', textureSecondaryPath= 'res:/UI/Texture/Classes/Industry/CenterBar/arrows.png', translationSecondary=(-0.16, 0), spriteEffect=trinity.TR2_SFX_MODULATE, color=Color.GRAY2, opacity=0.2) animations.MorphVector2(self.arrows, 'translationSecondary', startVal=(0.16, 0.0), endVal=(-0.16, 0.0), duration=2.0, curveType=uiconst.ANIM_LINEAR, loops=uiconst.ANIM_REPEAT) self.label = CaptionLabel( parent=self, align=uiconst.CENTER, text=localization.GetByLabel('UI/SkillTrading/Extract')) self.spinner = LoadingWheel(parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=30, height=30, opacity=0.0)
def DrawItem(self): iconCont = Container(name='iconCont', parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTER, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=iconCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) GetTechLevelIcon(self.techIcon, 1, self.typeID) self.icon = Icon(parent=iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, align=uiconst.CENTER) self.icon.SetSize(32, 32) itemName = GetShowInfoLink(typeID=self.typeID, text=evetypes.GetName(self.typeID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12)
def ApplyAttributes(self, attributes): super(LoadingPanel, self).ApplyAttributes(attributes) self.enableClickToClose = False self.logo = Sprite(parent=self, align=uiconst.CENTER, texturePath='res:/UI/Texture/vgs/huge-NES-logo.png', top=-108, width=521, height=216, state=uiconst.UI_DISABLED) bottomContainer = Container(parent=self, align=uiconst.TOBOTTOM_PROP, height=0.25) self.loadingWheel = LoadingWheel(parent=bottomContainer, align=uiconst.CENTERTOP, width=100, height=100) self.statusLabel = VgsLabelMedium( parent=bottomContainer, align=uiconst.CENTERTOP, text=localization.GetByLabel( 'UI/VirtualGoodsStore/LoadingStoreData'), top=80) ExitButton( parent=self, align=uiconst.TOPRIGHT, onClick=self.Shutdown, top=4, left=4, hint=localization.GetByLabel('UI/VirtualGoodsStore/ExitStore'))
def setup_layout(self): self.dialogue_container = uiprimitives.Container(name='dialogue_container', parent=self.parent, idx=0) self.left_main_container = uiprimitives.Container(name='left_main_container', parent=self, align=uiconst.TOLEFT_PROP, width=0.5, clipChildren=True, top=20) self.category_container = uiprimitives.Container(name='category_container', parent=self, align=uiconst.TOLEFT_PROP, width=0.5, padTop=45, clipChildren=True) self.loading_container = uiprimitives.Container(name='loadingContainer', parent=self.category_container, align=uiconst.CENTER, width=100, height=100, state=uiconst.UI_HIDDEN) self.loading_result_label = themeColored.LabelThemeColored(name='loadingResultLabel', parent=self.loading_container, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/ProjectDiscovery/LoadingResultLabel'), fontsize=20) self.loading_wheel = LoadingWheel(name='ResultLoadingIndicator', parent=self.loading_container, align=uiconst.CENTER, width=64, height=64) self.error_container = uiprimitives.Container(parent=self.category_container, align=uiconst.CENTER, width=100, height=100, state=uiconst.UI_HIDDEN) self.error_label = themeColored.LabelThemeColored(parent=self.error_container, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/ProjectDiscovery/LoadingResultErrorLabel'), fontsize=20) self.task_label = themeColored.LabelThemeColored(parent=self.left_main_container, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/ProjectDiscovery/TaskLabel'), top=40, fontsize=28, opacity=1) self.task_image = TaskImage(label=const.Texts.TaskImageLabel, parent=self.left_main_container, align=uiconst.TOPLEFT_PROP, pos=(25, 80, 420, 445), starting_scale=self.starting_scale) self.checkbox_container = uiprimitives.Container(name='checkboxContainer', parent=self.task_image, align=uiconst.BOTTOMLEFT, width=110, height=20, left=8, top=10) self.report_checkbox = uicontrols.Checkbox(name='reportCheckbox', parent=self.checkbox_container, text=localization.GetByLabel('UI/ProjectDiscovery/ReportCheckboxLabel')) SetTooltipHeaderAndDescription(self.report_checkbox, headerText=localization.GetByLabel('UI/ProjectDiscovery/AbnormalSampleTooltipHeader'), descriptionText=localization.GetByLabel('UI/ProjectDiscovery/AbnormalSampleTooltipDescription')) self.result_window = ResultWindow(name='ResultWindow', parent=self.parent, align=uiconst.TOALL, opacity=0, isTrainingPhase=False, starting_scale=self.starting_scale, bottom_container=self.bottom_container) self.rewards_view = RewardsView(parent=self.parent.parent, opacity=0, align=uiconst.TOALL, playerState=self.playerState, bottom_container=self.bottom_container, idx=1, state=uiconst.UI_DISABLED) self.processing_view = ProcessingView(parent=self.parent.parent, opacity=0, idx=2, state=uiconst.UI_DISABLED) self.category_selector = CategorySelector(categories=nested_categories_from_json(PROJECT_INFO['info']['classes']), parent=self.category_container, state=uiconst.UI_DISABLED, starting_scale=self.starting_scale) self.main_button_container = uiprimitives.Container(name='main_button_container', parent=self.bottom_container, align=uiconst.CENTERBOTTOM, width=355, height=53, bgTexturePath='res:/UI/Texture/classes/ProjectDiscovery/footerBG.png') self.submit_button_container = uiprimitives.Container(name='submitButtonContainer', parent=self.main_button_container, width=250, align=uiconst.CENTER, height=40, top=5) self.submit_button = uicontrols.Button(name='SubcellularSubmitButton', parent=self.submit_button_container, align=uiconst.CENTER, label=localization.GetByLabel('UI/ProjectDiscovery/SubmitButtonLabel'), fontsize=18, fixedwidth=170, fixedheight=30, func=lambda x: self.submit_solution()) uiprimitives.Sprite(parent=self.submit_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.submit_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) self.task_id = uicontrols.Label(name='TaskID', parent=self.bottom_container, align=uiconst.BOTTOMRIGHT, height=20, opacity=0, left=10) self.new_task_button = uicontrols.ButtonIcon(name='newTaskButton', parent=self.left_main_container, align=uiconst.TOPLEFT, texturePath='res:/UI/Texture/classes/ProjectDiscovery/recycleButtonUp.png', hoverTexture='res:/UI/Texture/classes/ProjectDiscovery/recycleButtonOver.png', downTexture='res:/UI/Texture/classes/ProjectDiscovery/recycleButtonDown.png', iconSize=24, func=lambda : self.reset_and_get_new_task(), idx=0, left=32, top=54) SetTooltipHeaderAndDescription(self.new_task_button, headerText='', descriptionText=localization.GetByLabel('UI/ProjectDiscovery/NewTaskButtonTooltipDescription'))
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(0) self.preSelectedItems = attributes.selectedItems self.outputPrice = 0 self.outputItemsCount = 0 mainCont = Container(name='mainCont', parent=self.sr.main, padding=const.defaultPadding) bottomCont = Container(name='bottomCont', parent=mainCont, align=uiconst.TOBOTTOM, height=36) reprocessingCont = Container(name='reprocessingCont', parent=mainCont, align=uiconst.TOALL) inputCont = Container(name='inputCont', parent=reprocessingCont, align=uiconst.TOLEFT_PROP, width=0.48) centerCont = Container(name='centerCont', parent=reprocessingCont, align=uiconst.TOLEFT_PROP, width=0.02) outputCont = Container(name='outputCont', parent=reprocessingCont, align=uiconst.TORIGHT_PROP, width=0.48) self.inputInfoCont = ReprocessInputContainer(name='inputInfo', parent=inputCont, dropFunc=self.AddItemByDrag, removeFunc=self.RemoveItem) self.outputInfoCont = ReprocessOutputContainer(name='outputInfo', parent=outputCont) self.loadingOverlay = Container(parent=self.inputInfoCont, idx=0) Fill(bgParent=self.loadingOverlay, color=(0.0, 0.0, 0.0, 0.3)) LoadingWheel(name='loadingWheel', parent=self.loadingOverlay, align=uiconst.CENTER, width=80, height=80) self.loadingOverlay.opacity = 0.0 self.controller = CreateReprocessingWindowController(self, self.inputInfoCont, self.outputInfoCont, sm.GetService('invCache'), sm.GetService('reprocessing'), GetActiveShip) self.inputInfoCont.captionLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/InputMaterials') self.outputInfoCont.captionLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/OutputResults') btnCont = Container(name='buttonCont', parent=bottomCont, align=uiconst.TOBOTTOM, height=36, idx=0, padding=(-4, 3, -4, -2)) GradientUnderlay(bgParent=btnCont) self.reprocessButton = Button(parent=btnCont, label=GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessButton'), func=self.ReprocessItems, align=uiconst.CENTER, fixedheight=28) self.cancelButton = Button(parent=btnCont, label=GetByLabel('UI/Common/Buttons/Cancel'), func=self.Cancel, align=uiconst.CENTERRIGHT, left=8) self.DisableReprocessButton(disable=True) if self.preSelectedItems: start_tasklet(self.AddPreselectedItems, self.preSelectedItems)
def ApplyAttributes(self, attributes): super(PurchaseProgressPanel, self).ApplyAttributes(attributes) cont = Container(parent=self, align=uiconst.TOTOP, height=72, padTop=4) LoadingWheel(parent=cont, align=uiconst.CENTER, width=100, height=100) captionCont = Container(parent=self, align=uiconst.TOTOP, height=40) VgsLabelLarge(parent=captionCont, align=uiconst.CENTER, text=localization.GetByLabel( 'UI/VirtualGoodsStore/Purchase/Processing'))
def ShowLoading(self): if not self.loadingWheel: self.loadingWheel = LoadingWheel(name='myLoadingWheel', parent=self, align=uiconst.CENTER, width=self.width * 1.5, height=self.height * 1.5, opacity=0.5) self.loadingWheel.display = True
def Layout(self): self.HideHeader() self.contentCont = Container(parent=self.GetMainArea(), align=uiconst.TOALL) topCont = Container(parent=self.contentCont, align=uiconst.TOTOP, height=90, top=10) SkillExtractorBar(parent=topCont, align=uiconst.CENTER, state=uiconst.UI_NORMAL, width=250, controller=self.controller) middleCont = Container(parent=self.contentCont, align=uiconst.TOALL, padding=(8, 0, 8, 8)) self.filterCont = Container(parent=middleCont, align=uiconst.TOTOP, height=26, opacity=0.0) SkillFilterMenu( parent=self.filterCont, align=uiconst.CENTERRIGHT, settings=self.filterSettings, hint=localization.GetByLabel('UI/SkillTrading/FilterSettings')) SkillFilterEdit(parent=self.filterCont, align=uiconst.CENTERRIGHT, left=20, filterSettings=self.filterSettings) self.skillScroll = ScrollContainer(parent=middleCont, align=uiconst.TOALL, showUnderlay=True, opacity=0.0) self.loadingPanel = Container(parent=middleCont, align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=250, height=150) LoadingWheel(parent=self.loadingPanel, align=uiconst.CENTERTOP) text = localization.GetByLabel('UI/SkillTrading/LoadingSkills') EveHeaderMedium(parent=self.loadingPanel, align=uiconst.TOTOP, top=50, text='<center>%s</center>' % text) self.messagePanel = ContainerAutoSize(parent=self.GetMainArea(), align=uiconst.CENTER, alignMode=uiconst.TOTOP, width=300, opacity=0.0, idx=0)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.context = None self.loadingThread = None self.startLoadingCallback = attributes.get('OnStartLoading', None) self.stopLoadingCallback = attributes.get('OnStopLoading', None) self.loadingWheel = LoadingWheel(parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED) self.loadingWheel.opacity = 0.0 self.sceneContainer = PreviewSceneContainer(parent=self, align=uiconst.TOALL) self.sceneContainer.Startup() self.navigation = PreviewNavigation(parent=self) self.navigation.Startup(self.sceneContainer)
def ConstructTopCont(self): Sprite(name='twitchLogo', parent=self.topCont, texturePath='res:/UI/Texture/Classes/Twitch/logo.png', pos=(0, 0, 200, 69)) self.stateIcon = TwitchStateIcon(parent=self.topCont, align=uiconst.TOPLEFT, pos=(0, 80, 32, 32), func=self.OnStateIconClick, controller=self) self.loadingWheel = LoadingWheel(parent=self.topCont, align=uiconst.TOPLEFT, pos=(-16, 64, 64, 64), opacity=0.0) self.stateLabel = EveCaptionMedium(parent=self.topCont, pos=(40, 87, 210, 0))
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) itemID = attributes.itemID self.typeID = attributes.typeID subsystems = attributes.subsystems animate = attributes.animate self.loadingWheel = LoadingWheel(parent=self.sr.main, align=uiconst.CENTER, state=uiconst.UI_DISABLED) self.previewContFill = FillThemeColored(parent=self.sr.main, align=uiconst.TOALL) overlayCont = Container(name='overlayCont', parent=self.sr.main, padding=2, clipChildren=1) self.title = EveCaptionMedium(text='', parent=overlayCont, align=uiconst.TOTOP, padding=(17, 4, 17, 0), state=uiconst.UI_NORMAL) self.title.GetMenu = self.GetShipMenu self.title.expandOnLeft = 1 self.subtitle = EveHeaderSmall(text='', parent=overlayCont, align=uiconst.TOTOP, padding=(19, 0, 17, 0), state=uiconst.UI_DISABLED) descLayer = Container(parent=self.sr.main) self.descCont = ContainerAutoSize(parent=descLayer, align=uiconst.TOBOTTOM, bgColor=(0.0, 0.0, 0.0, 0.3), padding=6, state=uiconst.UI_HIDDEN) self.desc = Label(parent=self.descCont, padding=6, fontsize=12, align=uiconst.TOBOTTOM) self.previewContainer = PreviewContainer( parent=self.sr.main, OnStartLoading=self.OnStartLoading, OnStopLoading=self.OnStopLoading, padding=2) self.previewContainer.navigation.OnDropData = self.OnDropData self.PreviewType(self.typeID, subsystems, itemID, animate)
class LazyUrlSprite(Container): default_name = 'LazyUrlSprite' default_clipChildren = False def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) loadSize = attributes.loadSize or 100 self.loadingWheel = LoadingWheel(parent=self, align=uiconst.CENTER, width=loadSize, height=loadSize, opacity=0.2) self.sprite = Sprite(bgParent=self, align=uiconst.TOALL) self.SetImageFromUrl(attributes.imageUrl) def SetImageFromUrl(self, imageUrl): uthread.new(self._SetImageFromUrl, imageUrl) def _SetImageFromUrl(self, imageUrl): LoadImageToSprite(self.sprite, imageUrl) uicore.animations.SpMaskIn(self.sprite, duration=1) self.loadingWheel.Close()
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) itemID = attributes.itemID self.typeID = attributes.typeID subsystems = attributes.subsystems animate = attributes.animate width = self.PANEL_WIDTH if self.IsPanelExpanded() else 0 self.sidePanel = Container(parent=self.sr.main, align=uiconst.TOLEFT, width=width, clipChildren=True) self.skinController = SkinPanelController(typeID=None) SkinPanel(parent=self.sidePanel, align=uiconst.TOLEFT, width=self.PANEL_WIDTH - 10, left=10, controller=self.skinController, settingsPrefix='Preview_SkinPanel', logContext='PreviewWindow') mainCont = Container(parent=self.sr.main, align=uiconst.TOALL, padding=(2, 0, 2, 2)) opacity = 1.0 if self.IsPanelEnabled() else 0.0 self.sidePanelButton = SidePanelButton(parent=mainCont, align=uiconst.CENTERLEFT, opacity=opacity, onClick=self.ToggleSidePanel, expanded=self.IsPanelExpanded()) self.loadingWheel = LoadingWheel(parent=mainCont, align=uiconst.CENTER, state=uiconst.UI_DISABLED) self.previewContFill = FillThemeColored(parent=mainCont, align=uiconst.TOALL) overlayCont = Container(name='overlayCont', parent=mainCont, padding=2, clipChildren=1) self.title = EveCaptionMedium(text='', parent=overlayCont, align=uiconst.TOTOP, padding=(17, 4, 17, 0), state=uiconst.UI_NORMAL) self.title.GetMenu = self.GetShipMenu self.title.expandOnLeft = 1 self.subtitle = EveHeaderSmall(text='', parent=overlayCont, align=uiconst.TOTOP, padding=(19, 0, 17, 0), state=uiconst.UI_DISABLED) descLayer = Container(parent=mainCont) self.descCont = ContainerAutoSize(parent=descLayer, align=uiconst.TOBOTTOM, bgColor=(0.0, 0.0, 0.0, 0.3), padding=6, state=uiconst.UI_HIDDEN) self.desc = Label(parent=self.descCont, padding=6, fontsize=12, align=uiconst.TOBOTTOM) self.previewContainer = PreviewContainer( parent=mainCont, OnStartLoading=self.OnStartLoading, OnStopLoading=self.OnStopLoading) self.previewContainer.navigation.OnDropData = self.OnDropData self.PreviewType(self.typeID, subsystems, itemID, animate)
def setup_layout(self): self.transmitting_container = uiprimitives.Container( name='transmitting_container', parent=self, align=uiconst.CENTER, width=self.width, height=70, top=-15, opacity=0, state=uiconst.UI_DISABLED) self._create_processing_label() self.expandTopContainer = uiprimitives.Container( name='expandTopContainer', parent=self.transmitting_container, width=364, height=8, align=uiconst.TOTOP) self.expandTop = uiprimitives.Sprite( name='expandTop', parent=self.expandTopContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandTop.png', width=174, height=5, align=uiconst.CENTERTOP) self.original_expand_width = self.expandTop.width self.expandBracketTop = uiprimitives.Sprite( name='expandbracketsTop', parent=self.expandTopContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandBrackets.png', width=364, height=3, align=uiconst.CENTERTOP, top=5) self.original_expand_bracket_width = self.expandBracketTop.width self.expandBottomContainer = uiprimitives.Transform( name='expandBottomContainer', parent=self.transmitting_container, width=364, height=8, align=uiconst.TOBOTTOM, rotation=math.pi) self.expandBracketBot = uiprimitives.Sprite( name='expandbracketBot', parent=self.expandBottomContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandBrackets.png', width=364, height=3, align=uiconst.CENTERTOP, top=5) self.expandBot = uiprimitives.Sprite( name='expandBot', parent=self.expandBottomContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandTop.png', width=174, height=5, align=uiconst.CENTERBOTTOM, top=3) self.expandGradient = uiprimitives.Sprite( parent=self.transmitting_container, align=uiconst.CENTER, width=364, height=64, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandGradient.png') self.colorFilterContainer = uiprimitives.Container( name='colorFilterContainer', parent=self, align=uiconst.TOBOTTOM_PROP, height=0.065) self.colorFilterButtonsContainer = uiprimitives.Container( name='colorFilterButtonsContainer', parent=self.colorFilterContainer, align=uiconst.CENTERTOP, width=120, height=24) self.colorCube = uicontrols.ButtonIcon( name='colorCube', parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, opacity=2, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterCube.png', func=self.toggle_all_channels) self.colorCube.icon.SetSize(30, 24) self.colorCubeSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png' ) self.colorSwatchRed = uicontrols.ButtonIcon( parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSwatch_R.png', func=self.toggle_red_channel) self.colorSwatchRed.icon.SetSize(30, 24) self.redSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png', left=30, opacity=0) self.colorSwatchGreen = uicontrols.ButtonIcon( name='colorSwatchGreen', parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSwatch_G.png', func=self.toggle_green_channel) self.colorSwatchGreen.icon.SetSize(30, 24) self.greenSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png', left=60, opacity=0) self.colorSwatchBlue = uicontrols.ButtonIcon( parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, iconSize=30, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSwatch_B.png', func=self.toggle_blue_channel) self.colorSwatchBlue.icon.SetSize(30, 24) self.blueSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png', left=90, opacity=0) self.colorFilterBack = uiprimitives.Sprite( parent=self.colorFilterContainer, align=uiconst.CENTERTOP, width=187, height=32, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterBack.png') self.images_container = uiprimitives.Container( name='ImagesContainer', parent=self, align=uiconst.TOPLEFT_PROP, clipChildren=True, width=self.ORIGINAL_WIDTH, height=self.ORIGINAL_HEIGHT) self.image_locked_sprite = uiprimitives.Sprite( name='lockImage', parent=self.images_container, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/magnifyLocked.png', width=54, height=64, align=uiconst.CENTER, opacity=0, state=uiconst.UI_DISABLED) self.image_unlocked_sprite = uiprimitives.Sprite( name='unlockImage', parent=self.images_container, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/magnifyUnlocked.png', width=108, height=64, align=uiconst.CENTER, opacity=0, state=uiconst.UI_DISABLED) self.image_container = uiprimitives.Container( name='mainImageContainer', parent=self.images_container, align=uiconst.TOALL, clipChildren=True) self.image_frame = uicontrols.Frame( name='imageFrame', bgParent=self.images_container, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/SampleBack.png', cornerSize=20) self.loading_wheel = LoadingWheel(name='SampleLoadingIndicator', parent=self.images_container, align=uiconst.CENTER, width=64, height=64) self.image_sprite = SubCellularSprite(name='mainImage', parent=self.image_container, align=uiconst.TOALL, opacity=1, pos=(10, 10, 10, 10)) self.image_sprite.texture = None self.mini_map_container = uiprimitives.Container( name='miniMapContainer', parent=self.images_container, align=uiconst.BOTTOMRIGHT, width=100, height=100, top=12, left=12) self.mini_map_container_frame = uicontrols.Frame( name='zoomContainerFrame', parent=self.mini_map_container, state=uiconst.UI_HIDDEN) self.mini_map_frame_container = uiprimitives.Container( name='miniMapFrameContainer', parent=self.mini_map_container, align=uiconst.TOPLEFT, width=30, height=30) self.mini_map_frame = uicontrols.Frame( name='zoomFrame', parent=self.mini_map_frame_container, state=uiconst.UI_HIDDEN) self.mini_map_image_sprite = uiprimitives.Sprite( name='miniMapSprite', parent=self.mini_map_container, width=100, height=100) self.zoom_image_container = uiprimitives.Container( name='zoomContainer', parent=self.images_container, align=uiconst.TOALL, clipChildren=True, pos=(10, 10, 10, 10)) self.zoom_image_sprite = uiprimitives.Sprite( name='zoomSprite', parent=self.zoom_image_container, align=uiconst.TOALL, opacity=0, pos=(0, 0, -1200, -1200)) self.error_message = uicontrols.Label( parent=self.images_container, align=uiconst.CENTER, text=localization.GetByLabel( 'UI/ProjectDiscovery/NoImageErrorLabel'), opacity=0)
class SellItemContainer(BuySellItemContainerBase): __guid__ = 'uicls.SellItemContainer' belowColor = '<color=0xffff5050>' aboveColor = '<color=0xff00ff00>' totaLabelPath = 'UI/Market/MarketQuote/AskTotal' def ApplyAttributes(self, attributes): self.item = attributes.item self.typeID = self.item.typeID BuySellItemContainerBase.ApplyAttributes(self, attributes) self.adjustQtyAndPriceTimer = None self.isUpdating = False self.singleton = self.item.singleton self.itemID = self.item.itemID self.itemName = evetypes.GetName(self.typeID) self.brokersFee = 0.0 self.salesTax = 0.0 self.totalSum = 0.0 self.stationID = attributes.stationID self.limits = self.quoteSvc.GetSkillLimits(self.stationID) self.solarSystemID = attributes.solarSystemID self.regionID = self.GetRegionID() self.locationID = self.item.locationID self.bestBid = attributes.bestBid self.bestPrice = attributes.bestPrice self.totalStrikethroughLine = None self.priceAmountWarning = None self.deltaCont = Container(parent=self, align=uiconst.TORIGHT, width=30) theRestCont = Container(name='theRestCont', parent=self, align=uiconst.TOALL) self.totalCont = Container(name='totalCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.3) self.priceCont = Container(name='priceCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.22) self.qtyCont = Container(name='qtyCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.15) self.itemCont = Container(name='itemCont', parent=theRestCont, align=uiconst.TORIGHT_PROP, width=0.33) self.deleteCont = Container(name='deleteCont', parent=self.itemCont, align=uiconst.TORIGHT, width=24) self.deleteButton = ButtonIcon( texturePath='res:/UI/Texture/Icons/73_16_210.png', pos=(0, 0, 16, 16), align=uiconst.CENTERRIGHT, parent=self.deleteCont, hint=GetByLabel('UI/Generic/RemoveItem'), idx=0, func=self.RemoveItem) self.deleteCont.display = False self.textCont = Container(name='textCont', parent=self.itemCont, align=uiconst.TOALL) self.errorBg = ErrorFrame(bgParent=self) self.DrawItem() self.DrawQty() self.DrawPrice() self.DrawTotal() self.DrawDelta() self.estimatedSellCount = self.GetSellCountEstimate() self.SetTotalSumAndLabel() self.brokersFeePerc = self.limits.GetBrokersFeeForLocation( self.stationID) self.UpdateBrokersFee() self.GetSalesTax() self.ShowNoSellOrders() self.UpdateOrderStateInUI() def GetRegionID(self): return cfg.mapSystemCache.Get(session.solarsystemid2).regionID def OnDurationChanged(self, duration): self.OnChange() def ShowNoSellOrders(self, force=False): if self.IsImmediateOrder() and (self.bestBid is None or force): uicore.animations.FadeIn(self.errorBg, 0.35, duration=0.3) def GetDuration(self): from eve.client.script.ui.shared.market.sellMulti import SellItems wnd = SellItems.GetIfOpen() if not wnd: return return wnd.durationCombo.GetValue() def DrawQty(self): qty = self.item.stacksize self.qtyEdit = SinglelineEdit(name='qtyEdit', parent=self.qtyCont, align=uiconst.TOTOP, top=11, padLeft=4) self.qtyEdit.IntMode(*(1, long(qty))) self.qtyEdit.SetValue(qty) self.qtyEdit.OnChange = self.OnChange self.qtyEdit.hint = GetByLabel('UI/Common/Quantity') def DrawPrice(self): self.priceEdit = SinglelineEdit(name='priceEdit', parent=self.priceCont, align=uiconst.TOTOP, top=11, padLeft=8) self.priceEdit.FloatMode(*(0.01, 9223372036854.0, 2)) self.priceEdit.SetValue(self.bestPrice) self.priceEdit.OnChange = self.OnChange self.priceEdit.hint = GetByLabel('UI/Market/MarketQuote/AskPrice') def DrawDelta(self): self.deltaContainer = SellDeltaContainer(parent=self.deltaCont, delta=self.GetDelta(), func=self.OpenMarket, align=uiconst.CENTERRIGHT) self.deltaContainer.LoadTooltipPanel = self.LoadDeltaTooltip self.UpdateDelta() def GetTradeWndClass(self): from eve.client.script.ui.shared.market.sellMulti import SellItems return SellItems def LoadDeltaTooltip(self, tooltipPanel, *args): tooltipPanel.LoadGeneric2ColumnTemplate() tooltipPanel.cellPadding = (4, 1, 4, 1) tooltipPanel.AddLabelLarge( text=GetByLabel('UI/Market/MarketQuote/AskPrice')) tooltipPanel.AddLabelLarge(text=FmtISK(self.priceEdit.GetValue()), align=uiconst.CENTERRIGHT) tooltipPanel.AddSpacer(1, 8, colSpan=tooltipPanel.columns) tooltipPanel.AddLabelMedium( text='%s %s' % (GetByLabel('UI/Market/MarketQuote/RegionalAdverage'), self.GetDeltaText())) tooltipPanel.AddLabelMedium(text=FmtISK(self.averagePrice), align=uiconst.CENTERRIGHT) tooltipPanel.AddLabelMedium( text=GetByLabel('UI/Market/MarketQuote/BestRegional')) bestMatch = tooltipPanel.AddLabelMedium(text='', align=uiconst.CENTERRIGHT) bestMatchDetails = tooltipPanel.AddLabelSmall( text='', align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) if not self.bestBid: bestMatch.text = GetByLabel('UI/Contracts/ContractEntry/NoBids') bestMatchDetails.text = GetByLabel( 'UI/Market/MarketQuote/ImmediateWillFail') bestMatch.color = (1.0, 0.275, 0.0, 1.0) bestMatchDetails.color = (1.0, 0.275, 0.0, 1.0) else: bestMatch.text = FmtISK(self.bestBid.price) bestMatchText, volRemaining = self.GetBestMatchText() bestMatchDetails.text = bestMatchText bestMatchDetails.SetAlpha(0.6) if volRemaining: vol = tooltipPanel.AddLabelSmall(text=volRemaining, align=uiconst.CENTERRIGHT, colSpan=tooltipPanel.columns) vol.SetAlpha(0.6) def GetBestMatchText(self): jumps = max(self.bestBid.jumps - max(0, self.bestBid.range), 0) minVolumeText = None if jumps == 0 and self.stationID == self.bestBid.stationID: jumpText = GetByLabel('UI/Market/MarketQuote/ItemsInSameStation') else: jumpText = GetByLabel('UI/Market/MarketQuote/JumpsFromThisSystem', jumps=jumps) if self.bestBid.minVolume > 1 and self.bestBid.volRemaining >= self.bestBid.minVolume: minVolumeText = GetByLabel( 'UI/Market/MarketQuote/SimpleMinimumVolume', min=self.bestBid.minVolume) return (GetByLabel('UI/Market/MarketQuote/SellQuantity', volRemaining=long(self.bestBid.volRemaining), jumpText=jumpText), minVolumeText) def DrawItem(self): iconCont = Container(parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) self.iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTERLEFT, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=self.iconInnerCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=self.iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) self.icon = Icon(parent=self.iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, ignoreSize=True, pos=(0, 0, 32, 32)) GetTechLevelIcon(self.techIcon, 1, self.typeID) itemName = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=self.itemName, info=('showinfo', self.typeID, self.item.itemID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12) def UpdateBrokersFee(self): fee = self.quoteSvc.BrokersFee(self.stationID, self.totalSum, self.brokersFeePerc) feeAmount = fee.amt self.brokersFee = feeAmount def GetSalesTax(self): tax = self.totalSum * self.limits['acc'] self.salesTax = tax def GetTotalSum(self): self.GetTotalSumAndDisplaySum() return self.totalSum def GetTotalSumAndDisplaySum(self): price = self.GetPrice() qty = self.GetQty() sumToDisplay = price * qty totalSum = sumToDisplay if self.IsImmediateOrder(): if self.estimatedSellCount == 0: totalSum = 0 elif self.estimatedSellCount < qty: sumToDisplay = self.estimatedSellCount * price totalSum = sumToDisplay self.totalSum = totalSum return (totalSum, sumToDisplay) def UpdateTotalSumLabel(self, totalSum, sumToDisplay): self.totalLabel.text = FmtISK(sumToDisplay) if sumToDisplay != totalSum: self.ConstructTotalStrikethroughLine() self.totalStrikethroughLine.width = self.totalLabel.textwidth else: self.ChangeTotalStrikethroughDisplay(display=False) def OnChange(self, *args): if self.adjustQtyAndPriceTimer: self.adjustQtyAndPriceTimer.KillTimer() self.adjustQtyAndPriceTimer = AutoTimer(200, self.AdjustQtyAndPrice_thread, *args) self.SetItemLoading() def AdjustQtyAndPrice_thread(self, *args): self.adjustQtyTimer = None if self.destroyed: return self.estimatedSellCount = self.GetSellCountEstimate() self.SetTotalSumAndLabel() self.UpdateBrokersFee() self.GetSalesTax() self.deltaContainer.display = True self.UpdateDelta() self.wheel.display = False self.isUpdating = False if self.parentEditFunc: self.parentEditFunc(args) self.UpdateOrderStateInUI() def SetItemLoading(self): self.totalLabel.text = NA_CHAR self.deltaContainer.display = False self.wheel.display = True self.isUpdating = True def SetTotalSumAndLabel(self): totalSum, displaySum = self.GetTotalSumAndDisplaySum() self.UpdateTotalSumLabel(totalSum, displaySum) def UpdateOrderStateInUI(self): duration = self.GetDuration() if duration != 0: self.ChangePriceAmountWarningDisplay(display=False) self.HideNoSellOrders() return qty = self.GetQty() if self.estimatedSellCount == 0: self.ShowNoSellOrders(force=True) self.ChangePriceAmountWarningDisplay(display=False) elif self.estimatedSellCount < qty: self.HideNoSellOrders() self.PrepareWarningInfo(self.estimatedSellCount, qty) else: self.HideNoSellOrders() self.ChangePriceAmountWarningDisplay(display=False) def PrepareWarningInfo(self, estimatedSellCount, qtyToSell): self.ConstructPriceAmountWarning() self.ConstructQtyBg() self.ChangePriceAmountWarningDisplay(display=True) self.priceAmountWarning.info = (estimatedSellCount, qtyToSell) def GetPrice(self): price = self.priceEdit.GetValue() return price def GetQty(self): qty = self.qtyEdit.GetValue() return qty def GetQtyToSell(self): qty = self.GetQty() if self.IsImmediateOrder(): return min(self.estimatedSellCount, qty) else: return qty def IsImmediateOrder(self): isImmediate = self.GetDuration() == 0 return isImmediate def SetQtyAndPrice(self, newQty, newPrice): self.qtyEdit.SetValue(newQty) self.priceEdit.SetValue(newPrice) self.OnChange() def GetSellCountEstimate(self): return self.quoteSvc.GetSellCountEstimate(self.typeID, self.stationID, self.GetPrice(), self.GetQty()) def MakeSingle(self): self.height = 80 self.qtyCont.width = 0 self.itemCont.width = 0.42 self.totalCont.width = 0.36 self.itemNameLabel.fontsize = 14 self.totalLabel.fontsize = 14 self.itemNameLabel.left = 72 self.icon.SetSize(64, 64) self.wheel.SetSize(64, 64) self.iconInnerCont.SetSize(64, 64) self.priceEdit.padLeft = 4 self.priceEdit.align = uiconst.TOBOTTOM self.qtyEdit.top = 20 self.priceEdit.top = 20 self.qtyEdit.SetParent(self.priceCont) if self.priceAmountWarning: self.priceAmountWarning.top = -10 def RemoveSingle(self): self.height = 40 self.qtyCont.width = 0.15 self.itemCont.width = 0.33 self.totalCont.width = 0.3 self.itemNameLabel.fontsize = 12 self.totalLabel.fontsize = 12 self.itemNameLabel.left = 40 self.icon.SetSize(32, 32) self.wheel.SetSize(48, 48) self.iconInnerCont.SetSize(32, 32) self.priceEdit.align = uiconst.TOTOP self.qtyEdit.top = 11 self.priceEdit.top = 11 self.priceEdit.padLeft = 8 self.qtyEdit.SetParent(self.qtyCont) if self.priceAmountWarning: self.priceAmountWarning.top = 0 def ConstructPriceAmountWarning(self): if self.priceAmountWarning: return None cont = Container(name='priceAmountWarning', parent=self.itemCont, align=uiconst.TORIGHT, left=-4, width=16, idx=0) self.priceAmountWarning = Sprite( parent=cont, pos=(0, 0, 16, 16), align=uiconst.CENTER, texturePath='res:/ui/texture/icons/44_32_7.png') self.priceAmountWarning.SetRGB(1.0, 0.3, 0.3, 0.8) self.priceAmountWarning.info = (None, None) self.priceAmountWarning.GetHint = self.GetWarningHint def ConstructQtyBg(self): if getattr(self.qtyEdit, 'warningBg', None): return warningBg = Fill(bgParent=self.qtyEdit, color=(1, 0, 0, 0.3)) self.qtyEdit.warningBg = warningBg def ConstructTotalStrikethroughLine(self): if self.totalStrikethroughLine: return self.totalStrikethroughLine = Line(parent=self.totalCont, align=uiconst.CENTERRIGHT, pos=(2, 0, 0, 1), idx=0, color=(1, 1, 1, 0.8)) def ChangeTotalStrikethroughDisplay(self, display=False): if self.totalStrikethroughLine: self.totalStrikethroughLine.display = display def ChangePriceAmountWarningDisplay(self, display=False): if self.priceAmountWarning: self.priceAmountWarning.display = display if getattr(self.qtyEdit, 'warningBg', None): self.qtyEdit.warningBg.display = display def GetWarningHint(self): estimatedSellCount, qtyToSell = self.priceAmountWarning.info if estimatedSellCount is None or qtyToSell is None: return txt = GetByLabel('UI/Market/MarketQuote/QtyPriceWarning', estimatedSellNum=int(estimatedSellCount), tryingToSellNum=qtyToSell) return txt
class TaskImage(uiprimitives.Container): ORIGINAL_HEIGHT = 420 ORIGINAL_WIDTH = 420 def ApplyAttributes(self, attributes): super(TaskImage, self).ApplyAttributes(attributes) self.reset_color_channels() self.all_selected = False self.service = sm.RemoteSvc('ProjectDiscovery') self.photo_service = sm.GetService('photo') self.audio_service = sm.GetService('audio') self.is_zoom_fixed = False self.cacheID = None self.setup_layout() self.oldTranslationTop = self.expandTopContainer.translation self.oldTranslationBottom = self.expandBottomContainer.translation self.resize_to_scale(attributes.get('starting_scale')) def setup_layout(self): self.transmitting_container = uiprimitives.Container( name='transmitting_container', parent=self, align=uiconst.CENTER, width=self.width, height=70, top=-15, opacity=0, state=uiconst.UI_DISABLED) self._create_processing_label() self.expandTopContainer = uiprimitives.Container( name='expandTopContainer', parent=self.transmitting_container, width=364, height=8, align=uiconst.TOTOP) self.expandTop = uiprimitives.Sprite( name='expandTop', parent=self.expandTopContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandTop.png', width=174, height=5, align=uiconst.CENTERTOP) self.original_expand_width = self.expandTop.width self.expandBracketTop = uiprimitives.Sprite( name='expandbracketsTop', parent=self.expandTopContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandBrackets.png', width=364, height=3, align=uiconst.CENTERTOP, top=5) self.original_expand_bracket_width = self.expandBracketTop.width self.expandBottomContainer = uiprimitives.Transform( name='expandBottomContainer', parent=self.transmitting_container, width=364, height=8, align=uiconst.TOBOTTOM, rotation=math.pi) self.expandBracketBot = uiprimitives.Sprite( name='expandbracketBot', parent=self.expandBottomContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandBrackets.png', width=364, height=3, align=uiconst.CENTERTOP, top=5) self.expandBot = uiprimitives.Sprite( name='expandBot', parent=self.expandBottomContainer, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandTop.png', width=174, height=5, align=uiconst.CENTERBOTTOM, top=3) self.expandGradient = uiprimitives.Sprite( parent=self.transmitting_container, align=uiconst.CENTER, width=364, height=64, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/expandGradient.png') self.colorFilterContainer = uiprimitives.Container( name='colorFilterContainer', parent=self, align=uiconst.TOBOTTOM_PROP, height=0.065) self.colorFilterButtonsContainer = uiprimitives.Container( name='colorFilterButtonsContainer', parent=self.colorFilterContainer, align=uiconst.CENTERTOP, width=120, height=24) self.colorCube = uicontrols.ButtonIcon( name='colorCube', parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, opacity=2, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterCube.png', func=self.toggle_all_channels) self.colorCube.icon.SetSize(30, 24) self.colorCubeSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png' ) self.colorSwatchRed = uicontrols.ButtonIcon( parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSwatch_R.png', func=self.toggle_red_channel) self.colorSwatchRed.icon.SetSize(30, 24) self.redSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png', left=30, opacity=0) self.colorSwatchGreen = uicontrols.ButtonIcon( name='colorSwatchGreen', parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSwatch_G.png', func=self.toggle_green_channel) self.colorSwatchGreen.icon.SetSize(30, 24) self.greenSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png', left=60, opacity=0) self.colorSwatchBlue = uicontrols.ButtonIcon( parent=self.colorFilterButtonsContainer, align=uiconst.TOLEFT, width=30, height=24, iconSize=30, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSwatch_B.png', func=self.toggle_blue_channel) self.colorSwatchBlue.icon.SetSize(30, 24) self.blueSelectedSprite = uiprimitives.Sprite( name='selectedFilter', parent=self.colorFilterButtonsContainer, width=30, height=24, align=uiconst.TOPLEFT, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterSelection.png', left=90, opacity=0) self.colorFilterBack = uiprimitives.Sprite( parent=self.colorFilterContainer, align=uiconst.CENTERTOP, width=187, height=32, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/colorFilterBack.png') self.images_container = uiprimitives.Container( name='ImagesContainer', parent=self, align=uiconst.TOPLEFT_PROP, clipChildren=True, width=self.ORIGINAL_WIDTH, height=self.ORIGINAL_HEIGHT) self.image_locked_sprite = uiprimitives.Sprite( name='lockImage', parent=self.images_container, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/magnifyLocked.png', width=54, height=64, align=uiconst.CENTER, opacity=0, state=uiconst.UI_DISABLED) self.image_unlocked_sprite = uiprimitives.Sprite( name='unlockImage', parent=self.images_container, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/magnifyUnlocked.png', width=108, height=64, align=uiconst.CENTER, opacity=0, state=uiconst.UI_DISABLED) self.image_container = uiprimitives.Container( name='mainImageContainer', parent=self.images_container, align=uiconst.TOALL, clipChildren=True) self.image_frame = uicontrols.Frame( name='imageFrame', bgParent=self.images_container, texturePath= 'res:/UI/Texture/classes/ProjectDiscovery/SampleBack.png', cornerSize=20) self.loading_wheel = LoadingWheel(name='SampleLoadingIndicator', parent=self.images_container, align=uiconst.CENTER, width=64, height=64) self.image_sprite = SubCellularSprite(name='mainImage', parent=self.image_container, align=uiconst.TOALL, opacity=1, pos=(10, 10, 10, 10)) self.image_sprite.texture = None self.mini_map_container = uiprimitives.Container( name='miniMapContainer', parent=self.images_container, align=uiconst.BOTTOMRIGHT, width=100, height=100, top=12, left=12) self.mini_map_container_frame = uicontrols.Frame( name='zoomContainerFrame', parent=self.mini_map_container, state=uiconst.UI_HIDDEN) self.mini_map_frame_container = uiprimitives.Container( name='miniMapFrameContainer', parent=self.mini_map_container, align=uiconst.TOPLEFT, width=30, height=30) self.mini_map_frame = uicontrols.Frame( name='zoomFrame', parent=self.mini_map_frame_container, state=uiconst.UI_HIDDEN) self.mini_map_image_sprite = uiprimitives.Sprite( name='miniMapSprite', parent=self.mini_map_container, width=100, height=100) self.zoom_image_container = uiprimitives.Container( name='zoomContainer', parent=self.images_container, align=uiconst.TOALL, clipChildren=True, pos=(10, 10, 10, 10)) self.zoom_image_sprite = uiprimitives.Sprite( name='zoomSprite', parent=self.zoom_image_container, align=uiconst.TOALL, opacity=0, pos=(0, 0, -1200, -1200)) self.error_message = uicontrols.Label( parent=self.images_container, align=uiconst.CENTER, text=localization.GetByLabel( 'UI/ProjectDiscovery/NoImageErrorLabel'), opacity=0) def _create_processing_label(self): self.label_container = uiprimitives.Container( parent=self.transmitting_container, height=PROCESSING_LABEL_HEIGHT, align=uiconst.CENTER, fontsize=PROCESSING_LABEL_FONT_SIZE) self.processing_message_label = EveCaptionSmall( parent=self.label_container, align=uiconst.CENTERLEFT, text=localization.GetByLabel( 'UI/ProjectDiscovery/Subcellular/RewardsScreen/ProcessingLabel' )) self.processing_percentage = EveCaptionSmall( parent=self.label_container, align=uiconst.CENTERRIGHT, text=str(FmtAmt(0)) + '%') self.label_container.width = self._get_processing_text_width() def _resize_processing_label(self): self.label_container.width = self._get_processing_text_width() def _get_processing_text_width(self): processing_message_text_width = self.processing_message_label.textwidth processing_percentage_text_width = self._get_processing_percentage_max_text_width( ) text_width = processing_message_text_width + processing_percentage_text_width if text_width > 0: return text_width return PROCESSING_LABEL_DEFAULT_WIDTH def _get_processing_percentage_max_text_width(self): max_percentage_text = str(FmtAmt(100)) + '%' return uicore.font.GetTextWidth(max_percentage_text, self.processing_percentage.fontsize, self.processing_percentage.letterspace, self.processing_percentage.uppercase) @on_event('OnWindowClosed') def on_window_closed(self, wndID, wndCaption, wndGUID): self.delete_previous_image() @on_event('OnProjectDiscoveryResized') def resize_to_scale(self, scale): if self.is_zoom_fixed: self.is_zoom_fixed = False self.show_main_image() self.fade_in_unlock() self.reset_animation() self.SetSize(self.ORIGINAL_WIDTH * scale, 445 * scale) self.images_container.SetSize(self.ORIGINAL_WIDTH * scale, self.ORIGINAL_HEIGHT * scale) self.transmitting_container.SetSize(self.width, self.transmitting_container.height) self._resize_processing_label() self.expandTop.width = self.original_expand_width * scale self.expandBot.width = self.expandTop.width self.expandBracketTop.width = self.original_expand_bracket_width * scale self.expandBracketBot.width = self.expandBracketTop.width def toggle_green_channel(self): if self.all_selected: self.all_selected = False self.red_channel = 0 self.blue_channel = 0 if self.green_channel == 1: self.green_channel = 0 self.greenSelectedSprite.SetAlpha(0) else: self.green_channel = 1 self.greenSelectedSprite.SetAlpha(1) self.set_color_channels() if self.is_zoom_fixed: self.hide_main_image() def toggle_blue_channel(self): if self.all_selected: self.all_selected = False self.green_channel = 0 self.red_channel = 0 if self.blue_channel == 1: self.blue_channel = 0 self.blueSelectedSprite.SetAlpha(0) else: self.blue_channel = 1 self.blueSelectedSprite.SetAlpha(1) self.set_color_channels() if self.is_zoom_fixed: self.hide_main_image() def toggle_red_channel(self): if self.all_selected: self.all_selected = False self.green_channel = 0 self.blue_channel = 0 if self.red_channel == 1: self.red_channel = 0 self.redSelectedSprite.SetAlpha(0) else: self.red_channel = 1 self.redSelectedSprite.SetAlpha(1) self.set_color_channels() if self.is_zoom_fixed: self.hide_main_image() def toggle_all_channels(self): self.reset_color_selection() self.reset_color_channels() self.image_sprite.SetRGB(1, 1, 1) self.zoom_image_sprite.SetRGB(1, 1, 1) self.mini_map_image_sprite.SetRGB(1, 1, 1) if self.is_zoom_fixed: self.hide_main_image() def reset_color_channels(self): self.red_channel = 0 self.green_channel = 0 self.blue_channel = 0 def reset_color_selection(self): self.redSelectedSprite.SetAlpha(0) self.greenSelectedSprite.SetAlpha(0) self.blueSelectedSprite.SetAlpha(0) self.colorCubeSelectedSprite.SetAlpha(1) self.all_selected = True def hide_main_image(self): self.image_sprite.SetAlpha(0) def set_color_channels(self): self.colorCubeSelectedSprite.SetAlpha(0) self.audio_service.SendUIEvent(const.Sounds.ColorSelectPlay) self.image_sprite.SetRGB(self.red_channel, self.green_channel, self.blue_channel) self.zoom_image_sprite.SetRGB(self.red_channel, self.green_channel, self.blue_channel) self.mini_map_image_sprite.SetRGB(self.red_channel, self.green_channel, self.blue_channel) def load_image(self): self.hide_error_message() self.show_loading_wheel() self.stop_loop_sound_and_play_load_sound() self.image_sprite.texture = self.photo_service.GetTextureFromURL( self.image_url, dontcache=1, ignoreCache=1)[0] self.cacheID = self.image_sprite.texturePath.split('/')[-1:][0][:-5] self.zoom_image_sprite.texture = self.image_sprite.texture self.mini_map_image_sprite.texture = self.image_sprite.texture self.check_if_image_loaded() def delete_previous_image(self): if self.cacheID: file_path = '%sBrowser/Img/%s.%s' % ( blue.paths.ResolvePath(u'cache:/'), self.cacheID, 'jpeg') try: os.remove(file_path) except WindowsError: pass def check_if_image_loaded(self): if self.image_sprite.texture.resPath == NONE_PATH or not self.image_sprite or not self.image_sprite.texture: logger.error( 'ProjectDiscovery::load_image: Image failed to load URL: %s' % self.image_url) self.hide_loading_wheel() self.show_error_message() else: self.hide_loading_wheel() self.stop_load_sound_and_play_open_and_loop_sound() sm.ScatterEvent(const.Events.MainImageLoaded) def stop_load_sound_and_play_open_and_loop_sound(self): if Audio.play_sound: self.audio_service.SendUIEvent(const.Sounds.MainImageLoadStop) self.audio_service.SendUIEvent(const.Sounds.MainImageOpenPlay) self.audio_service.SendUIEvent(const.Sounds.MainImageLoopPlay) def stop_loop_sound_and_play_load_sound(self): if Audio.play_sound: self.audio_service.SendUIEvent(const.Sounds.MainImageLoopStop) self.audio_service.SendUIEvent(const.Sounds.MainImageLoadPlay) def show_loading_wheel(self): self.loading_wheel.SetAlpha(1) def hide_loading_wheel(self): self.loading_wheel.SetAlpha(0) def show_error_message(self): self.error_message.SetAlpha(1) def hide_error_message(self): self.error_message.SetAlpha(0) def show_minimap_frames(self): self.mini_map_frame.state = uiconst.UI_NORMAL self.mini_map_container_frame.state = uiconst.UI_NORMAL def hide_minimap_frames(self): self.mini_map_container_frame.state = uiconst.UI_HIDDEN self.mini_map_frame.state = uiconst.UI_HIDDEN def remove_all_textures(self): self.image_sprite.texture = None self.zoom_image_sprite.texture = None self.mini_map_image_sprite.texture = None def show_retry_button(self): self.retry_button.SetState(uiconst.UI_NORMAL) def hide_retry_button(self): self.retry_button.SetState(uiconst.UI_HIDDEN) @on_event(const.Events.NewTask) def on_new_task(self, task): self.image_url = task['assets']['url'] self.load_image() self.toggle_all_channels() self.image_sprite.SetAlpha(1) self.is_zoom_fixed = False def reset_image(self): if hasattr(self, 'image_sprite'): self.hide_error_message() self.remove_all_textures() self.delete_previous_image() self.hide_minimap_frames() self.image_frame.SetRGB(1, 1, 1, 0.5) self.show_loading_wheel() @on_event(const.Events.ClickMainImage) def fix_post(self): animations.FadeTo(self.image_frame, duration=0.3, endVal=2.0, startVal=1.0, curveType=uiconst.ANIM_BOUNCE) self.is_zoom_fixed = not self.is_zoom_fixed if self.is_zoom_fixed: self.fade_in_lock() else: self.fade_in_unlock() def fade_in_lock(self): animations.FadeIn(self.image_locked_sprite, duration=0.3, endVal=0.5, callback=self.fade_out_lock) def fade_out_lock(self): animations.FadeOut(self.image_locked_sprite, duration=0.5) def fade_in_unlock(self): animations.FadeIn(self.image_unlocked_sprite, duration=0.3, endVal=0.5, callback=self.fade_out_unlock) def fade_out_unlock(self): animations.FadeOut(self.image_unlocked_sprite, duration=0.5) @on_event(const.Events.HoverMainImage) def zoom_in(self): if not self.image_sprite.texture or self.image_sprite.texture.resPath.startswith( 'res:'): return if self.is_zoom_fixed: uicore.uilib.SetCursor(uiconst.UICURSOR_POINTER) else: self.show_zoom_image() self.hide_main_image() self.show_minimap_frames() uicore.uilib.SetCursor(uiconst.UICURSOR_MAGNIFIER) mouse_position = (uicore.uilib.x, uicore.uilib.y) img_position = self.image_sprite.GetAbsolutePosition() if self.is_mouse_out_of_bounds(mouse_position, img_position): return zoom_aspect_ratio = ScaleDpi( self.zoom_image_sprite._displayWidth) / float( self.image_sprite._displayWidth) - 1 self.zoom_image_sprite.displayX = ( img_position[0] - mouse_position[0]) * zoom_aspect_ratio self.zoom_image_sprite.displayY = ( img_position[1] - mouse_position[1]) * zoom_aspect_ratio self.mini_map_frame_container.displayX = self.zoom_image_sprite.displayX / -17 self.mini_map_frame_container.displayY = self.zoom_image_sprite.displayY / -17 def is_mouse_out_of_bounds(self, mouse_position, img_position): if mouse_position[0] < img_position[0]: return True elif mouse_position[0] > img_position[0] + ReverseScaleDpi( self.image_sprite.displayWidth): return True elif mouse_position[1] < img_position[1]: return True elif mouse_position[1] > img_position[1] + ReverseScaleDpi( self.image_sprite.displayHeight): return True else: return False @on_event(const.Events.MouseExitMainImage) def on_mouse_exit_main_image(self): animations.FadeTo(self.image_frame, duration=0.3, endVal=0.5, startVal=1.0) self.hide_mini_map() if not self.is_zoom_fixed: self.hide_zoom_image() self.show_main_image() uicore.uilib.SetCursor(uiconst.UICURSOR_POINTER) def show_zoom_image(self): self.zoom_image_sprite.SetAlpha(1) def hide_zoom_image(self): self.zoom_image_sprite.SetAlpha(0) def show_main_image(self): self.image_sprite.SetAlpha(1) @on_event(const.Events.MouseEnterMainImage) def on_mouse_enter_main_image(self): self.show_mini_map() animations.FadeIn(self.image_frame, duration=0.3) def show_mini_map(self): self.mini_map_container.SetOpacity(1) def hide_mini_map(self): self.mini_map_container.SetOpacity(0) def reset_animation(self): self.expandTopContainer.translation = self.oldTranslationTop self.expandBottomContainer.translation = self.oldTranslationBottom self.expandGradient.height = 64 @property def gradient_height(self): return self._gradient_height @gradient_height.setter def gradient_height(self, value): self._gradient_height = value self.expandGradient.SetSize(364, self._gradient_height) def gradient_height_callback(self): self.gradient_height = self.images_container.displayHeight animations.FadeOut(self.transmitting_container, callback=self.reset_animation) self.fade_in_active_image() sm.ScatterEvent(const.Events.TransmissionFinished) def fade_in_active_image(self): if self.is_zoom_fixed: animations.FadeIn(self.zoom_image_sprite) else: animations.FadeIn(self.image_sprite) @property def percentage(self): return self._percentage @percentage.setter def percentage(self, value): self._percentage = value self.processing_percentage.SetText(str(FmtAmt(self._percentage)) + '%') def percentage_callback(self): self.percentage = 100 self.move_image_out() sm.ScatterEvent(const.Events.PercentageCountFinished) self.audio_service.SendUIEvent(const.Sounds.ProcessingStop) self.audio_service.SendUIEvent(const.Sounds.AnalysisDonePlay) def start_transmission_animation(self): self.reset_animation() self.audio_service.SendUIEvent(const.Sounds.ProcessingPlay) self.hide_mini_map() self.percentage = 0 self.move_image_in() self.fade_out_active_image() animations.FadeIn(self.transmitting_container, duration=0.5) self.start_percentage_count() def fade_out_active_image(self): if self.is_zoom_fixed: animations.FadeTo(self.zoom_image_sprite, startVal=1.0, endVal=0.5) self.image_sprite.SetAlpha(0) else: animations.FadeTo(self.image_sprite, startVal=1.0, endVal=0.5) self.hide_zoom_image() def start_percentage_count(self): animations.MorphScalar(self, 'percentage', startVal=self.percentage, endVal=100, curveType=uiconst.ANIM_SMOOTH, duration=2.5, callback=self.percentage_callback) def expand_screen(self): self.oldTranslationTop = self.expandTopContainer.translation self.oldTranslationBottom = self.expandBottomContainer.translation translationtop = (self.expandTopContainer.displayX, -self.images_container.displayHeight / 2.5) translationbottom = (self.expandBottomContainer.displayX, -self.images_container.displayHeight / 2.5) self.image_frame.SetRGB(0.498, 0.627, 0.74, 0.5) animations.MoveTo(self.expandTopContainer, startPos=(0, 0), endPos=translationtop, duration=0.3, curveType=uiconst.ANIM_LINEAR) animations.MoveTo(self.expandBottomContainer, startPos=(0, 0), endPos=translationbottom, duration=0.3, curveType=uiconst.ANIM_LINEAR) animations.MorphScalar(self, 'gradient_height', startVal=48, endVal=self.images_container.displayHeight, curveType=uiconst.ANIM_LINEAR, duration=0.3, callback=self.gradient_height_callback) self.audio_service.SendUIEvent(const.Sounds.AnalysisWindowMovePlay) def move_image_in(self): animations.SpShadowAppear(self.image_sprite, duration=1, curveType=uiconst.ANIM_BOUNCE) end_pos = (self.parent.parent.parent.parent.displayWidth / 2 - self.width / 1.8, 20) animations.MoveTo(self.parent, startPos=(0, 20), endPos=end_pos, duration=1) def move_image_out(self): animations.SpShadowDisappear(self.image_sprite, duration=1, curveType=uiconst.ANIM_BOUNCE) start_pos = (self.parent.parent.parent.parent.displayWidth / 2 - self.width / 1.8, 20) animations.MoveTo(self.parent, startPos=start_pos, endPos=(0, 20), duration=1, timeOffset=0.8, callback=self.expand_screen)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.offer = attributes.offer self._charID = None self._typeID = None self.on_charid = fsdlite.Signal() self.on_typeid = fsdlite.Signal() self.on_charid.connect(self.OnPickCharacter) self.on_typeid.connect(self.OnPickType) self.charButtons = [] self._charButtonsDisplayed = False textLayer = Container(name='TextLayer', parent=self) descriptionBox = ContainerAutoSize(parent=textLayer, align=uiconst.TOBOTTOM, bgColor=OFFER_TEXT_BOX_COLOR, clipChildren=True) Label(parent=descriptionBox, align=uiconst.TOTOP, text=self.offer.description, fontsize=VGS_FONTSIZE_SMALL, padding=(INFO_PADDING_BIG, 0, INFO_PADDING_BIG, 10)) titleBox = ContainerAutoSize(name='InfoBox', parent=textLayer, align=uiconst.TOBOTTOM, bgColor=OFFER_TEXT_BOX_COLOR) Label(parent=titleBox, align=uiconst.TOTOP, text=self.offer.name, fontsize=VGS_FONTSIZE_LARGE, padding=(INFO_PADDING_BIG, 2, INFO_PADDING_BIG + 32, 2), fontStyle=fontConst.STYLE_HEADER, uppercase=True, lineSpacing=-0.15) collapseBox = ContainerAutoSize(parent=textLayer, align=uiconst.TOBOTTOM_NOPUSH, top=-36) CollapseButton(parent=collapseBox, align=uiconst.TOPRIGHT, target=descriptionBox) self.characterPickerLayer = ContainerAutoSize( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_PICKCHILDREN, top=50 if self.offer.label else 10, left=10) self.CreateCharacterButtons() self.loadingLayer = Container(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED) self.loadingWheel = LoadingWheel(parent=self.loadingLayer, align=uiconst.CENTER, state=uiconst.UI_DISABLED, opacity=0.0) self.cover = Sprite( parent=self.loadingLayer, align=uiconst.TOALL, texturePath='res:/UI/Texture/preview/asset_preview_background.png') self.imageLayer = Transform(name='imageLayer', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5), bgColor=OFFER_BACKGROUND_COLOR) if self.offer.label is not None: Ribbon(parent=self.imageLayer, align=uiconst.TOPLEFT, label=self.offer.label, state=uiconst.UI_DISABLED, idx=0, isBig=True) self.previewContainer = PreviewContainer( parent=self.imageLayer, OnStartLoading=self.OnStartLoading, OnStopLoading=self.OnStopLoading) self.lazySprite = LazyUrlSprite(parent=self.imageLayer, align=uiconst.TOALL, imageUrl=self.offer.imageUrl, state=uiconst.UI_DISABLED) GradientSprite(name='OfferGradient', align=uiconst.TOALL, bgParent=self.imageLayer, rgbData=((1.0, OFFER_RADIAL_SHADOW), ), alphaData=((0.0, 0.0), (1.0, 1.0)), radial=True, idx=0) self.PickFirstPreviewableType()