auraCareerAssistancePanel.py (6034B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\careerPortal\panels\auraCareerAssistancePanel.py 2 import eveicon 3 import localization 4 from carbonui import TextAlign, uiconst, ButtonFrameType, ButtonVariant 5 from carbonui.control.button import Button 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.primitives.line import Line 8 from characterdata.careerpath import get_career_path_name_id 9 from eve.client.script.ui.control.eveLabel import EveCaptionLarge, EveLabelMedium, EveCaptionSmall 10 from eve.client.script.ui.shared.careerPortal import careerConst 11 from eve.client.script.ui.shared.careerPortal.panels.basePanel import BasePanel 12 from eve.client.script.ui.shared.careerPortal.util import OpenSkillPlanWindow, OpenFreelanceProjects, are_freelance_projects_available 13 from eveui import Sprite 14 from localization.formatters.timeIntervalFormatters import GetByLabel 15 INFO_ICON_SIZE = 16 16 TYPE_ICON_SIZE = 32 17 DEFAULT_PADDING = 4 18 19 class AuraBaseAssistancePanel(BasePanel): 20 default_name = 'AuraBaseAssistancePanel' 21 default_alignMode = uiconst.TOTOP 22 23 def __init__(self, *args, **kwargs): 24 super(AuraBaseAssistancePanel, self).__init__(*args, **kwargs) 25 self._ConstructTitle() 26 self.auraBadge = Sprite(name='auraBadge', texturePath='res:/UI/Texture/classes/careerPortal/aura/AURABADGE.png', align=uiconst.TOPRIGHT, parent=self, width=careerConst.AURA_BADGE_WIDTH, height=careerConst.AURA_BADGE_HEIGHT) 27 self.ConstructLayout() 28 29 def ConstructLayout(self): 30 pass 31 32 def _ConstructTitle(self): 33 EveCaptionLarge(name='title', parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/CareerPortal/AuraAssistancePanelTitle'), color=self.color, bold=True) 34 35 36 class AuraCareerAssistancePanelActivity(AuraBaseAssistancePanel): 37 default_name = 'AuraAssistancePanel' 38 default_alignMode = uiconst.TOTOP 39 40 def __init__(self, *args, **kwargs): 41 super(AuraCareerAssistancePanelActivity, self).__init__(*args, **kwargs) 42 careerConst.SELECTED_CAREER_PATH_SETTING.on_change.connect(self.LoadCareer) 43 self.LoadCareer(careerConst.SELECTED_CAREER_PATH_SETTING.get()) 44 45 def Close(self): 46 careerConst.SELECTED_CAREER_PATH_SETTING.on_change.disconnect(self.LoadCareer) 47 super(AuraCareerAssistancePanelActivity, self).Close() 48 49 def ConstructLayout(self): 50 self._ConstructCareerAgentMissionDescription() 51 Line(parent=self, align=uiconst.TOTOP, top=INFO_ICON_SIZE) 52 self._ConstructSkillPlanSection() 53 if are_freelance_projects_available(): 54 Line(parent=self, align=uiconst.TOTOP, top=INFO_ICON_SIZE) 55 ConstructFreelanceJobSection(self, use_short_description=True) 56 57 def _ConstructSkillPlanSection(self): 58 EveCaptionSmall(name='skillPlansTitle', parent=self, align=uiconst.TOTOP, text=localization.GetByLabel('UI/CareerPortal/AuraAssistanceSkillPlansTitle'), bold=True, top=INFO_ICON_SIZE) 59 EveLabelMedium(name='skillPlansDescription', parent=self, align=uiconst.TOTOP, textAlign=TextAlign.LEFT, top=8, text=localization.GetByLabel('UI/CareerPortal/AuraAssistanceSkillPlansText')) 60 self.openSkillPlanBtn = Button(parent=self, align=uiconst.TOTOP, top=INFO_ICON_SIZE, texturePath='res:/UI/Texture/classes/careerPortal/aura_icon_skillplans.png', variant=ButtonVariant.GHOST, frame_type=ButtonFrameType.CUT_BOTTOM_LEFT_RIGHT) 61 62 def _ConstructCareerAgentMissionDescription(self): 63 self.careerAgentMissionContainer = ContainerAutoSize(name='careerAgentMissionContainer', parent=self, align=uiconst.TOTOP, top=INFO_ICON_SIZE) 64 EveCaptionSmall(name='careerAgentMissionTitle', parent=self.careerAgentMissionContainer, align=uiconst.TOTOP, textAlign=TextAlign.LEFT, text=localization.GetByLabel('UI/CareerPortal/AuraAssistanceCareerAgentMissionsTitle'), bold=True) 65 self.careerAgentMissionDescription = EveLabelMedium(name='careerAgentMissionDescription', parent=self.careerAgentMissionContainer, align=uiconst.TOTOP, textAlign=TextAlign.LEFT, top=8) 66 67 def LoadCareer(self, careerID): 68 if not careerID: 69 return 70 careerPathName = localization.GetByMessageID(get_career_path_name_id(careerID)) 71 self.careerAgentMissionDescription.text = localization.GetByLabel('UI/CareerPortal/AuraAssistanceCareerAgentsText', careerPathName=careerPathName) 72 self.openSkillPlanBtn.SetLabel(localization.GetByLabel('UI/CareerPortal/AuraAssistanceOpenSkillPlanButton', careerPathName=careerPathName)) 73 self.openSkillPlanBtn.func = lambda x: OpenSkillPlanWindow(careerID) 74 75 76 class AuraCareerAssistancePanel(AuraBaseAssistancePanel): 77 default_name = 'AuraCareerAssistancePanel' 78 default_alignMode = uiconst.TOTOP 79 80 def ConstructLayout(self): 81 if are_freelance_projects_available(): 82 ConstructFreelanceJobSection(self, use_short_description=False) 83 84 85 def ConstructFreelanceJobSection(parent, use_short_description = False): 86 EveCaptionSmall(name='freelanceJobsTitle', parent=parent, align=uiconst.TOTOP, text=localization.GetByLabel('UI/CareerPortal/AuraAssistanceFreelanceJobsTitle'), bold=True, top=INFO_ICON_SIZE) 87 if use_short_description: 88 EveLabelMedium(name='freelanceJobsDescription', parent=parent, align=uiconst.TOTOP, textAlign=TextAlign.LEFT, top=8, text=localization.GetByLabel('UI/Corporations/FreelanceProjects/FreelanceJobsAOFeatureDescription')) 89 else: 90 EveLabelMedium(name='freelanceJobsDescription', parent=parent, align=uiconst.TOTOP, textAlign=TextAlign.LEFT, top=8, text=localization.GetByLabel('UI/CareerPortal/AuraAssistanceFreelanceJobsText')) 91 Button(analyticID='air_career_portal.open_freelance_jobs_button', parent=parent, align=uiconst.TOTOP, top=INFO_ICON_SIZE, texturePath=eveicon.freelance_projects, variant=ButtonVariant.GHOST, frame_type=ButtonFrameType.CUT_BOTTOM_LEFT_RIGHT, label=GetByLabel('UI/CareerPortal/OpenFreelanceJobs'), func=OpenFreelanceProjects, args=())