marqueeCont.py (2121B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\control\marqueeCont.py 2 from carbonui.primitives.container import Container 3 from eve.client.script.ui.control.themeColored import FrameThemeColored, FillThemeColored 4 import carbonui.const as uiconst 5 import uthread 6 import blue 7 from carbonui.uicore import uicore 8 9 class MarqueeCont(Container): 10 default_name = 'MarqueeCont' 11 default_align = uiconst.TOPLEFT 12 default_callback = None 13 14 def ApplyAttributes(self, attributes): 15 Container.ApplyAttributes(self, attributes) 16 self.parentScale = attributes.parentScale or 1.0 17 parLeft, parTop = self.parent.GetAbsolutePosition() 18 self.x0 = uicore.uilib.x - parLeft 19 self.y0 = uicore.uilib.y - parTop 20 FrameThemeColored(parent=self, frameConst=uiconst.FRAME_BORDER1_CORNER3, colorType=uiconst.COLORTYPE_UIHILIGHT, opacity=0.5) 21 FillThemeColored(parent=self, frameConst=uiconst.FRAME_FILLED_CORNER3, opacity=0.15) 22 uthread.new(self.UpdateThread) 23 24 def UpdateThread(self): 25 while not self.destroyed: 26 x = uicore.uilib.x 27 y = uicore.uilib.y 28 parLeft, parTop = self.parent.GetAbsolutePosition() 29 if x > self.x0 + parLeft: 30 self.left = self.x0 31 self.width = x - self.left - parLeft 32 else: 33 self.left = x - parLeft 34 self.width = self.x0 - x + parLeft 35 self.left = self.left / self.parentScale 36 self.width = self.width / self.parentScale 37 if y > self.y0 + parTop: 38 self.top = self.y0 39 self.height = y - self.top - parTop 40 else: 41 self.top = y - parTop 42 self.height = self.y0 - y + parTop 43 self.top = self.top / self.parentScale 44 self.height = self.height / self.parentScale 45 blue.synchro.Yield() 46 47 def GetCenterPoint(self): 48 left, top = self.GetAbsolutePosition() 49 x = left + self.width / 2 50 y = top + self.height / 2 51 return (x, y)