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

pointerFrame.py (3067B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\pointerTool\pointerFrame.py
      2 from carbonui.primitives.frame import Frame
      3 from carbonui.primitives.container import Container
      4 import carbonui.const as uiconst
      5 from eve.client.script.ui.control.eveLabel import EveLabelMedium
      6 from eve.client.script.ui.shared.pointerTool.pointerToolFraming import ChangePickStateOfAllFrames
      7 from eve.client.script.ui.shared.pointerTool.pointerToolFunctions import GetInfoOnElementUnderMouse
      8 from utillib import KeyVal
      9 from carbonui.uicore import uicore
     10 BLUE_COLOR = (0.2, 0.6, 1)
     11 
     12 class PointerFrame(Frame):
     13     default_frameConst = uiconst.FRAME_BORDER1_CORNER9
     14 
     15     @apply
     16     def frameWidth():
     17 
     18         def fset(self, value):
     19             self.width = int(value - self.left)
     20 
     21         return property(**locals())
     22 
     23     @apply
     24     def frameHeight():
     25 
     26         def fset(self, value):
     27             self.height = int(value - self.top)
     28 
     29         return property(**locals())
     30 
     31 
     32 class PointerFill(Container):
     33     default_state = uiconst.UI_DISABLED
     34     isDragObject = True
     35 
     36     def ApplyAttributes(self, attributes):
     37         Container.ApplyAttributes(self, attributes)
     38         self.uiElementName = attributes.uiElementName
     39         self.name = 'pointerFill_%s' % self.uiElementName
     40         color = attributes.get('colorRGB', BLUE_COLOR)
     41         self.pointerFrame = Frame(parent=self, color=color + (0.4,), frameConst=uiconst.FRAME_BORDER1_CORNER9)
     42         self.pointerFill = Frame(parent=self, color=color + (0.2,), frameConst=uiconst.FRAME_FILLED_CORNER9)
     43 
     44     def OnMouseMoveDrag(self, *args):
     45         if not uicore.IsDragging() and not self.IsBeingDragged() and self._dragEnabled and not self.Draggable_blockDrag and uicore.uilib.mouseTravel >= 6:
     46             self._ChangePickStateOfAllFrames(isEnabled=False)
     47         Container.OnMouseMoveDrag(self)
     48 
     49     def GetDragData(self):
     50         try:
     51             x, y = self._dragMouseDown
     52             _, mouseOver = uicore.uilib.PickScreenPosition(uicore.ScaleDpi(x), uicore.ScaleDpi(y))
     53             pointerObj = GetInfoOnElementUnderMouse(mouseOver, x, y)
     54             if not pointerObj:
     55                 return
     56             fakeNode = KeyVal(__guid__='listentry.PointerWndEntry', pointerObjects=[pointerObj])
     57             return [fakeNode]
     58         finally:
     59             self._ChangePickStateOfAllFrames(isEnabled=True)
     60 
     61     def PrepareDrag(self, dragContainer, dragSource):
     62         mx, my = Container.PrepareDrag(self, dragContainer, dragSource)
     63         if dragContainer.dragData:
     64             dragData = dragContainer.dragData[0]
     65             text = dragData.pointerObjects[0].label
     66             label = EveLabelMedium(parent=dragContainer, align=uiconst.TOPLEFT, text=text)
     67             if dragContainer.children:
     68                 dragContainer.children[0].top = label.textheight + 4
     69         return (mx, my)
     70 
     71     def _ChangePickStateOfAllFrames(self, isEnabled):
     72         pointerOverlay = sm.GetService('helpPointer').GetPointerOverlay()
     73         ChangePickStateOfAllFrames(pointerOverlay.fillDict, isEnabled)