objectivesview.py (3173B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\agentinteraction\objectivesview.py 2 import carbonui.text.styles 3 from agentinteraction.constUI import HEADER_SIZE_MEDIUM 4 from agentinteraction.objectivesteps import ObjectiveSteps 5 import carbonui 6 from carbonui import const as uiconst 7 from carbonui.primitives.container import Container 8 from carbonui.primitives.containerAutoSize import ContainerAutoSize 9 from carbonui.util.color import Color 10 from eve.client.script.ui.control.eveLabel import Label 11 from evemissions.client.objectives import TalkToAgentObjective, CargoObjective, PickUpObjective, DropOffObjective, DungeonObjective 12 from localization import GetByLabel 13 GENERAL_OBJECTIVES = [TalkToAgentObjective, 14 CargoObjective, 15 PickUpObjective, 16 DropOffObjective] 17 EXTRA_OBJECTIVES = [DungeonObjective] 18 PADDING_BETWEEN_OBJECTIVE_SETS = 24 19 20 class ObjectivesView(ContainerAutoSize): 21 22 def ApplyAttributes(self, attributes): 23 self.general_objectives = None 24 self.extra_objectives = None 25 super(ObjectivesView, self).ApplyAttributes(attributes) 26 self._build_title() 27 self._build_objectives_subcontainer() 28 29 def update_objectives(self, objectives, objective_type): 30 self._build_objectives_subcontainer(should_clear=True) 31 general_objectives = [ objective for objective in objectives if type(objective) in GENERAL_OBJECTIVES ] 32 extra_objectives = [ objective for objective in objectives if type(objective) in EXTRA_OBJECTIVES ] 33 self.general_objectives.update_objective_steps(general_objectives, objective_type) 34 self.extra_objectives.update_objective_steps(extra_objectives, objective_type) 35 if general_objectives and extra_objectives: 36 self.general_objectives.padBottom = PADDING_BETWEEN_OBJECTIVE_SETS 37 else: 38 self.general_objectives.padBottom = 0 39 if general_objectives: 40 self.general_objectives.Show() 41 else: 42 self.general_objectives.Hide() 43 if extra_objectives: 44 self.extra_objectives.Show() 45 else: 46 self.extra_objectives.Hide() 47 if not general_objectives and not extra_objectives: 48 self.Hide() 49 50 def _clear_container(self, container): 51 if isinstance(container, Container) and not getattr(container, 'destroyed', False): 52 container.Close() 53 54 def _build_title(self): 55 carbonui.text.styles.TextHeader(name='title', parent=self, align=uiconst.TOTOP, text=GetByLabel('UI/Agents/StandardMission/Objectives'), color=carbonui.TextColor.HIGHLIGHT, padBottom=9) 56 57 def _build_objectives_subcontainer(self, should_clear = False): 58 if should_clear: 59 self._clear_container(container=self.subcontainer_objectives) 60 self.subcontainer_objectives = ContainerAutoSize(name='subcontainer_objectives', parent=self, align=uiconst.TOTOP) 61 self.general_objectives = ObjectiveSteps(name='general_objectives', parent=self.subcontainer_objectives, align=uiconst.TOTOP) 62 self.extra_objectives = ObjectiveSteps(name='extra_objectives', parent=self.subcontainer_objectives, align=uiconst.TOTOP)