auraVideoAssistancePanel.py (3974B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\careerPortal\panels\auraVideoAssistancePanel.py 2 import eveicon 3 import localization 4 from carbonui import ButtonVariant, uiconst 5 from carbonui.control.button import Button 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.containerAutoSize import ContainerAutoSize 8 from carbonui.primitives.line import Line 9 from careergoals.client.career_goal_svc import get_career_goals_svc 10 from eve.client.script.ui.control.eveLabel import EveCaptionSmall, EveLabelMedium 11 from eve.client.script.ui.shared.careerPortal import careerConst 12 from eve.client.script.ui.shared.careerPortal.careerControllerUI import get_career_portal_controller_svc 13 from eve.client.script.ui.shared.careerPortal.panels.auraCareerAssistancePanel import AuraBaseAssistancePanel 14 from eve.client.script.ui.shared.careerPortal.util import are_freelance_projects_available, OpenFreelanceProjects 15 from fsdBuiltData.client.agency.helpVideoFSDLoader import AgencyHelpVideosFSDLoader 16 from localization import GetByMessageID 17 18 class AuraVideoAssistancePanel(AuraBaseAssistancePanel): 19 default_name = 'AuraVideoAssistancePanel' 20 default_alignMode = uiconst.TOTOP 21 22 def __init__(self, *args, **kwargs): 23 super(AuraVideoAssistancePanel, self).__init__(*args, **kwargs) 24 careerConst.SELECTED_ACTIVITY_SETTING.on_change.connect(self.LoadActivity) 25 self.LoadActivity(careerConst.SELECTED_ACTIVITY_SETTING.get()) 26 27 def Close(self): 28 careerConst.SELECTED_ACTIVITY_SETTING.on_change.disconnect(self.LoadActivity) 29 super(AuraVideoAssistancePanel, self).Close() 30 31 def ConstructLayout(self): 32 EveCaptionSmall(name='helpVideosTitle', parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/CareerPortal/HelpVideos'), bold=True, top=16) 33 self.helpVideosContainer = ContainerAutoSize(name='helpVideoContainer', parent=self, align=uiconst.TOTOP) 34 if are_freelance_projects_available(): 35 Line(parent=self, align=uiconst.TOTOP, top=16) 36 self._ConstructFreelanceJobSection() 37 38 def _ConstructFreelanceJobSection(self): 39 EveCaptionSmall(name='freelanceJobsTitle', parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/CareerPortal/AuraAssistanceFreelanceJobsTitle'), bold=True, top=16) 40 auraContainer = ContainerAutoSize(name='auraContainer', parent=self, align=uiconst.TOTOP) 41 Button(parent=Container(parent=auraContainer, align=uiconst.TOTOP, height=32, top=8), name='freelanceJobsButton', align=uiconst.CENTERLEFT, label=localization.GetByLabel('UI/CareerPortal/OpenFreelanceJobs'), texturePath=eveicon.freelance_projects, func=OpenFreelanceProjects, args=(), variant=ButtonVariant.GHOST) 42 43 def LoadActivity(self, activityID): 44 self.helpVideosContainer.Flush() 45 selectedCareer = careerConst.SELECTED_CAREER_PATH_SETTING.get() 46 goalsInGroup = get_career_goals_svc().get_goal_data_controller().get_goals_in_group(selectedCareer, activityID) 47 distinctVideos = set((int(goal.definition.video_id) for goal in goalsInGroup if goal.definition.has_video_id())) 48 if not distinctVideos: 49 EveLabelMedium(parent=self.helpVideosContainer, align=uiconst.TOTOP, text=localization.GetByLabel('UI/CareerPortal/NoVideosAvailable'), top=8) 50 else: 51 for videoID in distinctVideos: 52 if not videoID: 53 continue 54 video = AgencyHelpVideosFSDLoader.GetByID(videoID) 55 if not video: 56 continue 57 Button(parent=Container(parent=self.helpVideosContainer, align=uiconst.TOTOP, height=32, top=8), name='videoButton', align=uiconst.CENTERLEFT, label=GetByMessageID(video.nameID), texturePath='res:/UI/Texture/classes/careerPortal/playVideo.png', func=get_career_portal_controller_svc().play_video, variant=ButtonVariant.GHOST, args=video.path)