NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

window.py (3788B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\agentinteraction\window.py
      2 from agentinteraction.npccharacterview import NpcCharacterView
      3 from agentinteraction.npcinteractionview import NpcInteractionView
      4 from carbonui import uiconst
      5 from carbonui.control.window import Window
      6 from characterdata.npccharacter import NpcCharacter
      7 from eve.client.script.ui.control.eveLoadingWheel import LoadingWheel
      8 CHARACTER_PANEL_WIDTH = 0.4
      9 
     10 class NpcCharacterInteractionWindow(Window):
     11     __guid__ = 'NpcCharacterInteractionWindow'
     12     default_windowID = 'NpcCharacterInteractionWindow'
     13     default_width = 1000
     14     default_height = 700
     15     default_minSize = (700, 500)
     16     default_isLockable = False
     17     default_isOverlayable = False
     18     default_isCollapseable = False
     19     default_extend_content_into_header = True
     20     default_apply_content_padding = False
     21     hasWindowIcon = False
     22     character_view_class = NpcCharacterView
     23     interaction_view_class = NpcInteractionView
     24 
     25     def ApplyAttributes(self, attributes):
     26         self.npc_character_id = attributes.npcCharacterID
     27         self.npc_character = NpcCharacter(self.npc_character_id)
     28         super(NpcCharacterInteractionWindow, self).ApplyAttributes(attributes)
     29         self._build_ui()
     30         self.on_content_padding_changed.connect(self._on_content_padding_changed)
     31         self.on_header_height_changed.connect(self._on_header_height_changed)
     32 
     33     def _build_ui(self):
     34         self._build_loading_wheel()
     35         self._build_npc_character_panel()
     36         self._build_interaction_panel()
     37         self._update_sizes()
     38 
     39     def _build_loading_wheel(self):
     40         self.loading_wheel = LoadingWheel(parent=self.content, align=uiconst.BOTTOMLEFT, state=uiconst.UI_HIDDEN, left=-8, top=-8, idx=0)
     41 
     42     def _build_npc_character_panel(self):
     43         self.container_npc_character = self.character_view_class(name='container_npc_character', parent=self.content, align=uiconst.TOLEFT_PROP, width=CHARACTER_PANEL_WIDTH, npc_character=self.npc_character, inner_padding=self._get_container_npc_character_inner_padding(), idx=0)
     44 
     45     def _on_content_padding_changed(self, window):
     46         self._update_container_npc_character_inner_padding()
     47         self._update_container_interaction_inner_padding()
     48 
     49     def _on_header_height_changed(self, window):
     50         self._update_container_interaction_inner_padding()
     51 
     52     def _get_container_npc_character_inner_padding(self):
     53         pad_left, pad_top, pad_right, pad_bottom = self.content_padding
     54         return (pad_left,
     55          pad_top,
     56          0,
     57          pad_bottom)
     58 
     59     def _update_container_npc_character_inner_padding(self):
     60         if self.container_npc_character:
     61             self.container_npc_character.inner_padding = self._get_container_npc_character_inner_padding()
     62 
     63     def _build_interaction_panel(self):
     64         self.container_interaction = self.interaction_view_class(name='container_interaction', parent=self.content, align=uiconst.TOALL, npc_character=self.npc_character, inner_padding=self._get_container_interaction_inner_padding())
     65 
     66     def _get_container_interaction_inner_padding(self):
     67         pad_left, pad_top, pad_right, pad_bottom = self.content_padding
     68         return (pad_right,
     69          self.header.height,
     70          pad_right,
     71          pad_bottom)
     72 
     73     def _update_container_interaction_inner_padding(self):
     74         if self.container_interaction:
     75             self.container_interaction.inner_padding = self._get_container_interaction_inner_padding()
     76 
     77     def disable_buttons(self):
     78         self.container_interaction.disable_buttons()
     79 
     80     def enable_buttons(self):
     81         self.container_interaction.enable_buttons()
     82 
     83     def _update_sizes(self):
     84         pass
     85 
     86     def OnResize_(self, *args, **kwargs):
     87         self._update_sizes()