base.py (69379B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\carbonui\primitives\base.py 2 import signals 3 import types 4 import telemetry 5 import trinity 6 from carbonui import uiconst 7 from carbonui.uiconst import PUSHALIGNMENTS, AFFECTEDBYPUSHALIGNMENTS, PickState, Align 8 from carbonui.primitives.dragdrop import DragDropObject 9 from carbonui.signals.ui_element_signals import on_unique_ui_element_created, on_unique_ui_element_destroyed 10 from carbonui.uicore import uicore 11 from carbonui.util.bunch import Bunch 12 from carbonui.util.dpi import ScaleDpi, ScaleDpiF, ReverseScaleDpi 13 DELEGATE_EVENTNAMES = ('OnMouseUp', 14 'OnMouseDown', 15 'OnMouseEnter', 16 'OnMouseExit', 17 'OnMouseHover', 18 'OnMouseMove', 19 'OnMouseWheel', 20 'OnClick', 21 'OnDblClick', 22 'GetMenu', 23 'OnMouseMoveDrag', 24 'OnMouseDownDrag') 25 26 class Base(DragDropObject): 27 __guid__ = 'uiprimitives.Base' 28 __renderObject__ = None 29 default_name = '' 30 default_parent = None 31 default_idx = -1 32 default_state = uiconst.UI_NORMAL 33 default_display = True 34 default_pickState = PickState.ON 35 default_align = uiconst.TOPLEFT 36 default_overflowAnchoring = None 37 default_hint = None 38 default_left = 0 39 default_top = 0 40 default_width = 0 41 default_height = 0 42 default_padding = None 43 default_padLeft = 0 44 default_padTop = 0 45 default_padRight = 0 46 default_padBottom = 0 47 default_cursor = None 48 default_minWidth = None 49 default_minHeight = None 50 default_maxWidth = None 51 default_maxHeight = None 52 default_pickingMaskTexturePath = None 53 default_aspectRatio = 1.0 54 _left = 0 55 _top = 0 56 _width = 0 57 _height = 0 58 _align = None 59 _display = True 60 _minWidth = None 61 _minHeight = None 62 _maxWidth = None 63 _maxHeight = None 64 _sr = None 65 _name = default_name 66 _cursor = default_cursor 67 _parentRef = None 68 _elementId = None 69 _alignmentDirty = False 70 _forceUpdateAlignment = False 71 _displayX = 0 72 _displayY = 0 73 _displayWidth = 0 74 _displayHeight = 0 75 _padLeft = 0 76 _padTop = 0 77 _padRight = 0 78 _padBottom = 0 79 _pickState = uiconst.TR2_SPS_ON 80 _hint = None 81 _tooltipPanelClassInfo = None 82 _delegatingEvents = False 83 _constructingBase = True 84 __on_display_changed = None 85 __on_size_changed = None 86 __on_position_changed = None 87 destroyed = False 88 renderObject = None 89 auxiliaryHint = None 90 isPushAligned = False 91 isAffectedByPushAlignment = False 92 isTransformed = False 93 isAnimated = False 94 uniqueUiName = None 95 96 @property 97 def elementId(self): 98 return self._elementId 99 100 @elementId.setter 101 def elementId(self, value): 102 self._elementId = value 103 104 @telemetry.ZONE_METHOD 105 def __init__(self, **kw): 106 if self.__renderObject__: 107 self.renderObject = RO = self.__renderObject__() 108 uicore.uilib.RegisterObject(self, RO) 109 RO.display = True 110 RO.name = self.name 111 attributesBunch = Bunch(**kw) 112 self.ApplyAttributes(attributesBunch) 113 114 @property 115 def on_display_changed(self): 116 if self.__on_display_changed is None: 117 self.__on_display_changed = signals.Signal('{}.on_display_changed'.format(self.__class__.__name__)) 118 return self.__on_display_changed 119 120 @property 121 def on_size_changed(self): 122 if self.__on_size_changed is None: 123 self.__on_size_changed = signals.Signal('{}.__on_size_changed'.format(self.__class__.__name__)) 124 return self.__on_size_changed 125 126 def _emit_on_size_changed(self, new_width, new_height): 127 if self.__on_size_changed: 128 self.on_size_changed(new_width, new_height) 129 130 @property 131 def on_position_changed(self): 132 if self.__on_position_changed is None: 133 self.__on_position_changed = signals.Signal('{}.__on_position_changed'.format(self.__class__.__name__)) 134 return self.__on_position_changed 135 136 def _emit_on_position_changed(self, new_left, new_top): 137 if self.__on_position_changed: 138 self.on_position_changed(new_left, new_top) 139 140 def __repr__(self): 141 return '<{klass} object at {address:#016X}, name={name}, destroyed={destroyed}>'.format(klass=self.__class__.__name__, address=id(self), name=self._get_ui_element_name(), destroyed=self.destroyed) 142 143 def _get_ui_element_name(self): 144 if self.name: 145 try: 146 return self.name.encode('utf8') 147 except UnicodeDecodeError: 148 try: 149 return '{name}'.format(name=self.name) 150 except Exception: 151 pass 152 153 return 'None' 154 155 @telemetry.ZONE_METHOD 156 def ApplyAttributes(self, attributes): 157 self._cursor = attributes.get('cursor', self.default_cursor) 158 self._hint = attributes.get('hint', self.default_hint) 159 if 'name' in attributes and attributes.name is not None: 160 self.name = attributes.name 161 if 'uniqueUiName' in attributes: 162 self.uniqueUiName = attributes.uniqueUiName 163 if self.uniqueUiName is not None: 164 on_unique_ui_element_created(self.uniqueUiName, self) 165 self.SetAlign(attributes.get('align', self.default_align)) 166 self._overflowAnchoring = attributes.get('overflowAnchoring', self.default_overflowAnchoring) 167 pos = attributes.pos 168 if pos is not None: 169 self.pos = pos 170 else: 171 left = attributes.get('left', self.default_left) 172 top = attributes.get('top', self.default_top) 173 width = attributes.get('width', self.default_width) 174 height = attributes.get('height', self.default_height) 175 self.pos = (left, 176 top, 177 width, 178 height) 179 padding = attributes.get('padding', self.default_padding) 180 if padding is not None: 181 self.padding = padding 182 else: 183 padLeft = attributes.get('padLeft', self.default_padLeft) 184 padTop = attributes.get('padTop', self.default_padTop) 185 padRight = attributes.get('padRight', self.default_padRight) 186 padBottom = attributes.get('padBottom', self.default_padBottom) 187 self.padding = (padLeft, 188 padTop, 189 padRight, 190 padBottom) 191 self._aspectRatio = float(attributes.get('aspectRatio', self.default_aspectRatio)) 192 self._minWidth = attributes.get('minWidth', self.default_minWidth) 193 self._minHeight = attributes.get('minHeight', self.default_minHeight) 194 self._maxWidth = attributes.get('maxWidth', self.default_maxWidth) 195 self._maxHeight = attributes.get('maxHeight', self.default_maxHeight) 196 pickingMaskTexturePath = attributes.get('pickingMaskTexturePath', self.default_pickingMaskTexturePath) 197 if pickingMaskTexturePath: 198 self.pickingMaskTexturePath = pickingMaskTexturePath 199 if 'pickState' in attributes or 'display' in attributes: 200 self.display = attributes.get('display', self.default_display) 201 self.pickState = attributes.get('pickState', self.default_pickState) 202 else: 203 self.SetState(attributes.get('state', self.default_state)) 204 if attributes.get('bgParent', None): 205 idx = attributes.get('idx', self.default_idx) 206 if idx is None: 207 idx = -1 208 attributes.bgParent.background.insert(idx, self) 209 else: 210 parent = attributes.get('parent', self.default_parent) 211 if parent and not parent.destroyed: 212 self.SetParent(parent, attributes.get('idx', self.default_idx)) 213 self._constructingBase = False 214 self.FlagAlignmentDirty() 215 216 def Close(self): 217 if getattr(self, 'destroyed', False): 218 return 219 self.destroyed = True 220 if self.uniqueUiName: 221 on_unique_ui_element_destroyed(self.uniqueUiName) 222 uicore.uilib.ReleaseObject(self) 223 notifyevents = getattr(self, '__notifyevents__', None) 224 if notifyevents: 225 sm.UnregisterNotify(self) 226 self._OnClose() 227 parent = self.parent 228 if parent and not parent._containerClosing: 229 parent.children.remove(self) 230 parent.background.remove(self) 231 if self.isAnimated: 232 self.StopAnimations() 233 self.renderObject = None 234 self._alignFunc = None 235 if self._delegatingEvents: 236 for eventName in DELEGATE_EVENTNAMES: 237 setattr(self, eventName, None) 238 239 def _GetSR(self): 240 if self._sr is None: 241 self._sr = Bunch() 242 return self._sr 243 244 sr = property(_GetSR) 245 246 def HasEventHandler(self, handlerName): 247 handlerArgs, handler = self.FindEventHandler(handlerName) 248 if not handler: 249 return False 250 baseHandler = getattr(Base, handlerName, None) 251 if baseHandler and getattr(handler, '__func__', None) is baseHandler.__func__: 252 return False 253 return bool(handler) 254 255 def FindEventHandler(self, handlerName): 256 handler = getattr(self, handlerName, None) 257 if not handler: 258 return (None, None) 259 if type(handler) == types.TupleType: 260 handlerArgs = handler[1:] 261 handler = handler[0] 262 else: 263 handlerArgs = () 264 return (handlerArgs, handler) 265 266 def StopAnimations(self): 267 uicore.animations.StopAllAnimations(self) 268 269 def HasAnimation(self, attrName): 270 curveSet = uicore.animations.GetAnimationCurveSet(self, attrName) 271 return curveSet is not None 272 273 def GetRenderObject(self): 274 return self.renderObject 275 276 def SetParent(self, parent, idx = None): 277 currentParent = self.parent 278 if currentParent: 279 if self in currentParent.children: 280 currentParent.children.remove(self) 281 if parent is not None: 282 self.isTransformed = parent.isTransformed or self.isTransformed 283 if idx is None: 284 idx = -1 285 parent.children.insert(idx, self) 286 287 def GetParent(self): 288 if self._parentRef: 289 return self._parentRef() 290 291 parent = property(GetParent) 292 293 def SetOrder(self, idx): 294 parent = self.parent 295 if parent: 296 currentIndex = self.GetOrder() 297 if currentIndex != idx: 298 self.SetParent(parent, idx) 299 300 def GetOrder(self): 301 parent = self.parent 302 if parent: 303 return parent.children.index(self) 304 305 @property 306 def pos(self): 307 return (self._left, 308 self._top, 309 self._width, 310 self._height) 311 312 @pos.setter 313 def pos(self, value): 314 left, top, width, height = value 315 if left < 1.0: 316 adjustedLeft = left 317 else: 318 adjustedLeft = int(round(left)) 319 if top < 1.0: 320 adjustedTop = top 321 else: 322 adjustedTop = int(round(top)) 323 if width < 1.0: 324 adjustedWidth = width 325 else: 326 adjustedWidth = int(round(width)) 327 if height < 1.0: 328 adjustedHeight = height 329 else: 330 adjustedHeight = int(round(height)) 331 if self._left != adjustedLeft or self._top != adjustedTop or self._width != adjustedWidth or self._height != adjustedHeight: 332 self._left = adjustedLeft 333 self._top = adjustedTop 334 self._width = adjustedWidth 335 self._height = adjustedHeight 336 self.FlagAlignmentDirty() 337 338 @property 339 def left(self): 340 return self._left 341 342 @left.setter 343 def left(self, value): 344 if value < 1.0: 345 adjustedValue = value 346 else: 347 adjustedValue = int(round(value)) 348 if adjustedValue != self._left: 349 self._left = adjustedValue 350 self.FlagAlignmentDirty() 351 352 @property 353 def top(self): 354 return self._top 355 356 @top.setter 357 def top(self, value): 358 if value < 1.0: 359 adjustedValue = value 360 else: 361 adjustedValue = int(round(value)) 362 if adjustedValue != self._top: 363 self._top = adjustedValue 364 self.FlagAlignmentDirty() 365 366 @property 367 def width(self): 368 return self._width 369 370 @width.setter 371 def width(self, value): 372 if value < 1.0: 373 adjustedValue = value 374 else: 375 adjustedValue = int(round(value)) 376 if adjustedValue != self._width: 377 self._width = adjustedValue 378 self.FlagAlignmentDirty() 379 380 @property 381 def height(self): 382 return self._height 383 384 @height.setter 385 def height(self, value): 386 if value < 1.0: 387 adjustedValue = value 388 else: 389 adjustedValue = int(round(value)) 390 if adjustedValue != self._height: 391 self._height = adjustedValue 392 self.FlagAlignmentDirty() 393 394 @property 395 def maxWidth(self): 396 return self._maxWidth 397 398 @maxWidth.setter 399 def maxWidth(self, value): 400 if value != self._maxWidth: 401 self._maxWidth = value 402 self.FlagAlignmentDirty() 403 404 @property 405 def maxHeight(self): 406 return self._maxHeight 407 408 @maxHeight.setter 409 def maxHeight(self, value): 410 if value != self._maxHeight: 411 self._maxHeight = value 412 self.FlagAlignmentDirty() 413 414 @property 415 def minWidth(self): 416 return self._minWidth 417 418 @minWidth.setter 419 def minWidth(self, value): 420 if value != self._minWidth: 421 self._minWidth = value 422 self.FlagAlignmentDirty() 423 424 @property 425 def minHeight(self): 426 return self._minHeight 427 428 @minHeight.setter 429 def minHeight(self, value): 430 if value != self._minHeight: 431 self._minHeight = value 432 self.FlagAlignmentDirty() 433 434 @property 435 def padding(self): 436 return (self._padLeft, 437 self._padTop, 438 self._padRight, 439 self._padBottom) 440 441 @padding.setter 442 def padding(self, value): 443 if isinstance(value, (tuple, list)): 444 padLeft, padTop, padRight, padBottom = value 445 else: 446 padLeft = padTop = padRight = padBottom = value 447 if self._padLeft != padLeft or self._padTop != padTop or self._padRight != padRight or self._padBottom != padBottom: 448 self._padLeft = padLeft 449 self._padTop = padTop 450 self._padRight = padRight 451 self._padBottom = padBottom 452 self.FlagAlignmentDirty() 453 454 @property 455 def padLeft(self): 456 return self._padLeft 457 458 @padLeft.setter 459 def padLeft(self, value): 460 if value != self._padLeft: 461 self._padLeft = value 462 self.FlagAlignmentDirty() 463 464 @property 465 def padRight(self): 466 return self._padRight 467 468 @padRight.setter 469 def padRight(self, value): 470 if value != self._padRight: 471 self._padRight = value 472 self.FlagAlignmentDirty() 473 474 @property 475 def padTop(self): 476 return self._padTop 477 478 @padTop.setter 479 def padTop(self, value): 480 if value != self._padTop: 481 self._padTop = value 482 self.FlagAlignmentDirty() 483 484 @property 485 def padBottom(self): 486 return self._padBottom 487 488 @padBottom.setter 489 def padBottom(self, value): 490 if value != self._padBottom: 491 self._padBottom = value 492 self.FlagAlignmentDirty() 493 494 @property 495 def display(self): 496 return self._GetDisplay() 497 498 @display.setter 499 def display(self, value): 500 self._SetDisplay(value) 501 502 def _GetDisplay(self): 503 return self._display 504 505 def _SetDisplay(self, value): 506 if value != self._display: 507 RO = self.renderObject 508 if RO: 509 RO.display = value 510 if value: 511 self._display = value 512 self.FlagAlignmentDirty() 513 self._display = value 514 self.FlagForceUpdateAlignment() 515 self._emit_on_display_changed() 516 517 def _emit_on_display_changed(self): 518 if self.__on_display_changed is not None: 519 self.__on_display_changed(self) 520 521 def FlagForceUpdateAlignment(self): 522 self.FlagAlignmentDirty() 523 self._forceUpdateAlignment = True 524 525 def SetAlign(self, align): 526 if align == self._align: 527 return 528 if hasattr(self.renderObject, 'absoluteCoordinates'): 529 if align == uiconst.ABSOLUTE: 530 self.renderObject.absoluteCoordinates = True 531 else: 532 self.renderObject.absoluteCoordinates = False 533 self._alignFunc, self.isPushAligned, self.isAffectedByPushAlignment = ALIGN_AND_CONSUME_FUNCTIONS[align] 534 oldAlign = self._align 535 self._align = align 536 self.FlagAlignmentDirty() 537 if uiconst.is_push_alignment(oldAlign) != uiconst.is_push_alignment(align): 538 parent = self.parent 539 if parent is not None and not parent.destroyed: 540 siblings = getattr(parent, 'children', []) 541 found_self = False 542 for sibling in siblings: 543 if sibling == self: 544 found_self = True 545 elif found_self and sibling.isAffectedByPushAlignment: 546 sibling._alignmentDirty = True 547 548 def GetAlign(self): 549 return self._align 550 551 @property 552 def align(self): 553 return self.GetAlign() 554 555 @align.setter 556 def align(self, value): 557 self.SetAlign(value) 558 559 @property 560 def name(self): 561 return self._name or self.default_name or self.__class__.__name__ 562 563 @name.setter 564 def name(self, value): 565 self._name = value 566 ro = self.renderObject 567 if ro: 568 ro.name = value 569 570 @property 571 def translation(self): 572 return (self._displayX, self._displayY) 573 574 @translation.setter 575 def translation(self, value): 576 self._displayX = int(round(value[0])) 577 self._displayY = int(round(value[1])) 578 ro = self.renderObject 579 if ro: 580 ro.displayX = self._displayX 581 ro.displayY = self._displayY 582 583 @property 584 def displayRect(self): 585 return (self._displayX, 586 self._displayY, 587 self._displayWidth, 588 self._displayHeight) 589 590 @displayRect.setter 591 def displayRect(self, value): 592 displayX, displayY, displayWidth, displayHeight = value 593 self._displayX = int(round(displayX)) 594 self._displayY = int(round(displayY)) 595 self._displayWidth = int(round(displayX + displayWidth)) - self._displayX 596 self._displayHeight = int(round(displayY + displayHeight)) - self._displayY 597 if self._displayWidth == 0 and round(displayWidth) > 0: 598 self._displayWidth = 1 599 if self._displayHeight == 0 and round(displayHeight) > 0: 600 self._displayHeight = 1 601 ro = self.renderObject 602 if ro: 603 ro.displayX = self._displayX 604 ro.displayY = self._displayY 605 ro.displayWidth = self._displayWidth 606 ro.displayHeight = self._displayHeight 607 608 @property 609 def displayX(self): 610 return self._displayX 611 612 @displayX.setter 613 def displayX(self, value): 614 self._displayX = int(round(value)) 615 ro = self.renderObject 616 if ro: 617 ro.displayX = self._displayX 618 619 @property 620 def displayY(self): 621 return self._displayY 622 623 @displayY.setter 624 def displayY(self, value): 625 self._displayY = int(round(value)) 626 ro = self.renderObject 627 if ro: 628 ro.displayY = self._displayY 629 630 @property 631 def displayWidth(self): 632 return self._displayWidth 633 634 @displayWidth.setter 635 def displayWidth(self, value): 636 self._displayWidth = int(round(value)) 637 ro = self.renderObject 638 if ro: 639 ro.displayWidth = self._displayWidth 640 641 @property 642 def displayHeight(self): 643 return self._displayHeight 644 645 @displayHeight.setter 646 def displayHeight(self, value): 647 self._displayHeight = int(round(value)) 648 ro = self.renderObject 649 if ro: 650 ro.displayHeight = self._displayHeight 651 652 @property 653 def pickState(self): 654 return self._pickState 655 656 @pickState.setter 657 def pickState(self, value): 658 self._pickState = value 659 ro = self.renderObject 660 if ro: 661 ro.pickState = value 662 663 def Disable(self, *args): 664 self.pickState = uiconst.TR2_SPS_OFF 665 666 def Enable(self, *args): 667 self.pickState = uiconst.TR2_SPS_ON 668 669 def IsEnabled(self): 670 return self.pickState == uiconst.TR2_SPS_ON 671 672 def SetFocus(self, *args): 673 pass 674 675 def SetHint(self, hint): 676 self.hint = hint 677 678 def GetHint(self): 679 return self.hint 680 681 @property 682 def hint(self): 683 return self._hint 684 685 @hint.setter 686 def hint(self, value): 687 if value != self._hint: 688 self._hint = value 689 if self is uicore.uilib.mouseOver: 690 uicore.uilib.UpdateTooltip(instant=True) 691 692 @property 693 def tooltipPanelClassInfo(self): 694 return self._tooltipPanelClassInfo 695 696 @tooltipPanelClassInfo.setter 697 def tooltipPanelClassInfo(self, value): 698 if value != self._tooltipPanelClassInfo: 699 self._tooltipPanelClassInfo = value 700 if self is uicore.uilib.mouseOver: 701 uicore.uilib.RefreshTooltipForOwner(owner=self) 702 703 def SetDisplayRect(self, displayRect): 704 align = self.GetAlign() 705 if align != uiconst.NOALIGN: 706 return 707 self.displayRect = displayRect 708 709 def SetPosition(self, left, top): 710 self.left = left 711 self.top = top 712 713 def GetPosition(self): 714 return (self.left, self.top) 715 716 def IsClickable(self): 717 if self.destroyed or not hasattr(self, 'state') or not hasattr(self, 'parent'): 718 return False 719 if self.state not in (uiconst.UI_NORMAL, uiconst.UI_PICKCHILDREN): 720 return False 721 dad = self.parent 722 if dad is uicore.desktop: 723 return True 724 return dad.IsClickable() 725 726 def IsVisibleAndClickable(self): 727 if self.destroyed or not hasattr(self, 'state') or not hasattr(self, 'display') or not hasattr(self, 'parent'): 728 return False 729 if self.state != uiconst.UI_NORMAL or not self.display: 730 return False 731 dad = self.parent 732 if dad is uicore.desktop: 733 return True 734 return dad.IsVisibleAndClickable() 735 736 def IsUnder(self, ancestor_maybe, retfailed = False): 737 dad = self.parent 738 if not dad: 739 if retfailed: 740 return self 741 return False 742 if dad is ancestor_maybe: 743 return True 744 return dad.IsUnder(ancestor_maybe, retfailed) 745 746 def IsUnderClass(self, parentClass, returnParent = False): 747 dad = self.parent 748 if not dad: 749 if returnParent: 750 return None 751 return False 752 if isinstance(dad, parentClass): 753 if returnParent: 754 return dad 755 return True 756 return dad.IsUnderClass(parentClass, returnParent) 757 758 def IsVisible(self): 759 if self.destroyed or not hasattr(self, 'state') or not hasattr(self, 'parent'): 760 return False 761 if self.state == uiconst.UI_HIDDEN: 762 return False 763 dad = self.parent 764 if not dad: 765 return False 766 if dad.state == uiconst.UI_HIDDEN: 767 return False 768 if dad is uicore.desktop: 769 return True 770 return dad.IsVisible() 771 772 def IsClippedBy(self, clipper): 773 return self.IsCompletelyClipped(clipper) or self.IsPartiallyClipped(clipper) 774 775 def IsCompletelyClipped(self, clipper): 776 if self.GetAbsoluteTop() >= clipper.GetAbsoluteBottom(): 777 return True 778 elif self.GetAbsoluteBottom() <= clipper.GetAbsoluteTop(): 779 return True 780 elif self.GetAbsoluteRight() <= clipper.GetAbsoluteLeft(): 781 return True 782 elif self.GetAbsoluteLeft() >= clipper.GetAbsoluteRight(): 783 return True 784 else: 785 return False 786 787 def IsPartiallyClipped(self, clipper): 788 if self.GetAbsoluteTop() < clipper.GetAbsoluteTop(): 789 return True 790 elif self.GetAbsoluteBottom() > clipper.GetAbsoluteBottom(): 791 return True 792 elif self.GetAbsoluteRight() > clipper.GetAbsoluteRight(): 793 return True 794 elif self.GetAbsoluteLeft() < clipper.GetAbsoluteLeft(): 795 return True 796 else: 797 return False 798 799 def GetClipper(self): 800 if not self.parent: 801 return None 802 elif self.parent.clipChildren: 803 return self.parent 804 else: 805 return self.parent.GetClipper() 806 807 def SetSize(self, width, height): 808 self.width = width 809 self.height = height 810 811 def GetSize(self): 812 return (self.width, self.height) 813 814 def GetAbsoluteViewport(self): 815 if not self.display: 816 return (0, 0, 0, 0) 817 w, h = self.GetAbsoluteSize() 818 l, t = self.GetAbsolutePosition() 819 return (l, 820 t, 821 w, 822 h) 823 824 def GetAbsolute(self): 825 if not self.display: 826 return (0, 0, 0, 0) 827 w, h = self.GetAbsoluteSize() 828 l, t = self.GetAbsolutePosition() 829 return (l, 830 t, 831 w, 832 h) 833 834 @telemetry.ZONE_METHOD 835 def GetAbsoluteSize(self): 836 if self.destroyed or not self.display: 837 return (0, 0) 838 if self.isTransformed: 839 scaleX, scaleY = self._GetAbsoluteScale() 840 else: 841 scaleX, scaleY = (1.0, 1.0) 842 self._AssureAlignmentUpdated() 843 return (ReverseScaleDpi(scaleX * self.displayWidth), ReverseScaleDpi(scaleY * self.displayHeight)) 844 845 def _GetAbsoluteScale(self): 846 if hasattr(self, '_GetScale'): 847 scaleX, scaleY = self._GetScale() 848 else: 849 scaleX, scaleY = (1.0, 1.0) 850 parent = self.parent 851 if parent: 852 parScaleX, parScaleY = parent._GetAbsoluteScale() 853 scaleX *= parScaleX 854 scaleY *= parScaleY 855 return (scaleX, scaleY) 856 857 def _GetScale(self): 858 return (1.0, 1.0) 859 860 def GetCurrentAbsolutePosition(self): 861 if self.destroyed or not self.display: 862 return (0, 0) 863 left, top = self._GetAbsolutePosition(0, 0) 864 return (ReverseScaleDpi(left), ReverseScaleDpi(top)) 865 866 def GetCurrentAbsoluteSize(self): 867 if self.destroyed or not self.display: 868 return (0, 0) 869 return (ReverseScaleDpi(self.displayWidth), ReverseScaleDpi(self.displayHeight)) 870 871 def _AssureAlignmentUpdated(self): 872 if self._alignmentDirty or self._forceUpdateAlignment: 873 parent = self.parent 874 if parent: 875 prevParent = None 876 while parent: 877 if not parent.isAffectedByPushAlignment and not parent._alignmentDirty: 878 break 879 if not parent._childrenAlignmentDirty and not parent._forceUpdateAlignment: 880 break 881 if not parent.display: 882 break 883 prevParent = parent 884 parent = parent.parent 885 886 parent = parent or prevParent 887 if not parent.isAffectedByPushAlignment: 888 oldDisplayWidth = parent.displayWidth 889 oldDisplayHeight = parent.displayHeight 890 parent.displayWidth = ScaleDpiF(parent.width) 891 parent.displayHeight = ScaleDpiF(parent.height) 892 sizeChanged = oldDisplayWidth != parent.displayWidth or oldDisplayHeight != parent.displayHeight 893 if sizeChanged: 894 for each in parent.children: 895 each.FlagAlignmentDirty() 896 897 parent.UpdateAlignment(updateChildrenOnly=True) 898 899 @telemetry.ZONE_METHOD 900 def GetAbsolutePosition(self): 901 if self.destroyed or not self.display: 902 return (0, 0) 903 self._AssureAlignmentUpdated() 904 l, t = self._GetAbsolutePosition(0, 0) 905 return (ReverseScaleDpi(l), ReverseScaleDpi(t)) 906 907 def _GetAbsolutePosition(self, childLeft, childTop): 908 parent = self.GetParent() 909 left, top = self._GetRelativePosition() 910 left += childLeft 911 top += childTop 912 if parent and self.align != uiconst.ABSOLUTE: 913 left, top = parent._GetAbsolutePosition(left, top) 914 return (left, top) 915 916 def _GetRelativePosition(self): 917 if self.renderObject: 918 return (self.renderObject.displayX, self.renderObject.displayY) 919 else: 920 return (self.displayX, self.displayY) 921 922 def GetAbsoluteLeft(self): 923 l, t = self.GetAbsolutePosition() 924 return l 925 926 absoluteLeft = property(GetAbsoluteLeft) 927 928 def GetAbsoluteTop(self): 929 l, t = self.GetAbsolutePosition() 930 return t 931 932 absoluteTop = property(GetAbsoluteTop) 933 934 def GetAbsoluteBottom(self): 935 l, t = self.GetAbsolutePosition() 936 w, h = self.GetAbsoluteSize() 937 return t + h 938 939 absoluteBottom = property(GetAbsoluteBottom) 940 941 def GetAbsoluteRight(self): 942 l, t = self.GetAbsolutePosition() 943 w, h = self.GetAbsoluteSize() 944 return l + w 945 946 absoluteRight = property(GetAbsoluteRight) 947 948 def GetUniqueName(self): 949 return self.uniqueUiName 950 951 def SetState(self, state): 952 if state == uiconst.UI_NORMAL: 953 self.display = True 954 self.pickState = uiconst.TR2_SPS_ON 955 elif state == uiconst.UI_DISABLED: 956 self.display = True 957 self.pickState = uiconst.TR2_SPS_OFF 958 elif state == uiconst.UI_HIDDEN: 959 self.display = False 960 elif state == uiconst.UI_PICKCHILDREN: 961 self.display = True 962 self.pickState = uiconst.TR2_SPS_CHILDREN 963 964 def GetState(self): 965 if not self.display: 966 return uiconst.UI_HIDDEN 967 if self.pickState == uiconst.TR2_SPS_CHILDREN: 968 return uiconst.UI_PICKCHILDREN 969 if self.pickState == uiconst.TR2_SPS_ON: 970 return uiconst.UI_NORMAL 971 if self.pickState == uiconst.TR2_SPS_OFF: 972 return uiconst.UI_DISABLED 973 974 @property 975 def state(self): 976 return self.GetState() 977 978 @state.setter 979 def state(self, newState): 980 self.SetState(newState) 981 982 @property 983 def pickingMaskTexturePath(self): 984 if self.renderObject and self.renderObject.pickingMask: 985 return self.renderObject.pickingMask.maskPath 986 987 @pickingMaskTexturePath.setter 988 def pickingMaskTexturePath(self, pickingMaskTexturePath): 989 if self.renderObject: 990 if pickingMaskTexturePath: 991 self.renderObject.pickingMask = trinity.Tr2Sprite2dPickingMask() 992 self.renderObject.pickingMask.maskPath = unicode(pickingMaskTexturePath) 993 else: 994 self.renderObject.pickingMask = None 995 996 @property 997 def pickingMaskLeftEdgeSize(self): 998 if self.pickingMaskTexturePath: 999 return self.renderObject.pickingMask.leftEdge 1000 1001 @pickingMaskLeftEdgeSize.setter 1002 def pickingMaskLeftEdgeSize(self, value): 1003 if self.pickingMaskTexturePath: 1004 self.renderObject.pickingMask.leftEdge = value 1005 1006 @property 1007 def pickingMaskRightEdgeSize(self): 1008 if self.pickingMaskTexturePath: 1009 return self.renderObject.pickingMask.rightEdge 1010 1011 @pickingMaskRightEdgeSize.setter 1012 def pickingMaskRightEdgeSize(self, value): 1013 if self.pickingMaskTexturePath: 1014 self.renderObject.pickingMask.rightEdge = value 1015 1016 @property 1017 def pickingMaskTopEdgeSize(self): 1018 if self.pickingMaskTexturePath: 1019 return self.renderObject.pickingMask.topEdge 1020 1021 @pickingMaskTopEdgeSize.setter 1022 def pickingMaskTopEdgeSize(self, value): 1023 if self.pickingMaskTexturePath: 1024 self.renderObject.pickingMask.topEdge = value 1025 1026 @property 1027 def pickingMaskBottomEdgeSize(self): 1028 if self.pickingMaskTexturePath: 1029 return self.renderObject.pickingMask.bottomEdge 1030 1031 @pickingMaskBottomEdgeSize.setter 1032 def pickingMaskBottomEdgeSize(self, value): 1033 if self.pickingMaskTexturePath: 1034 self.renderObject.pickingMask.bottomEdge = value 1035 1036 def FlagAlignmentDirty(self, hint = None): 1037 if not self.display or self._constructingBase: 1038 return 1039 self._alignmentDirty = True 1040 flagObj = self.parent 1041 if flagObj and (flagObj._childrenAlignmentDirty or not flagObj._display): 1042 return 1043 while flagObj: 1044 flagObj._childrenAlignmentDirty = True 1045 if flagObj.align == uiconst.NOALIGN: 1046 uicore.uilib.alignIslands.add(flagObj) 1047 return 1048 flagObj = flagObj.parent 1049 if flagObj and (flagObj._childrenAlignmentDirty or not flagObj._display): 1050 return 1051 1052 @telemetry.ZONE_METHOD 1053 def UpdateToLeftAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1054 padLeft, padTop, padRight, padBottom = self.padding 1055 left, top, width, height = self.pos 1056 if not budgetOnly: 1057 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1058 displayY = budgetTop + ScaleDpiF(padTop + top) 1059 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1060 displayWidth = ScaleDpiF(width) 1061 self.displayRect = (displayX, 1062 displayY, 1063 displayWidth, 1064 displayHeight) 1065 widthUsed = ScaleDpiF(padLeft + width + left + padRight) 1066 budgetLeft += widthUsed 1067 budgetWidth -= widthUsed 1068 return (budgetLeft, 1069 budgetTop, 1070 budgetWidth, 1071 budgetHeight) 1072 1073 @telemetry.ZONE_METHOD 1074 def UpdateToLeftAlignmentNoPush(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1075 padLeft, padTop, padRight, padBottom = self.padding 1076 left, top, width, height = self.pos 1077 if not budgetOnly: 1078 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1079 displayY = budgetTop + ScaleDpiF(padTop + top) 1080 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1081 displayWidth = ScaleDpiF(width) 1082 self.displayRect = (displayX, 1083 displayY, 1084 displayWidth, 1085 displayHeight) 1086 return (budgetLeft, 1087 budgetTop, 1088 budgetWidth, 1089 budgetHeight) 1090 1091 @telemetry.ZONE_METHOD 1092 def UpdateToRightAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1093 padLeft, padTop, padRight, padBottom = self.padding 1094 left, top, width, height = self.pos 1095 if not budgetOnly: 1096 displayX = budgetLeft + budgetWidth - ScaleDpiF(width + padRight + left) 1097 displayY = budgetTop + ScaleDpiF(padTop + top) 1098 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1099 displayWidth = ScaleDpiF(width) 1100 self.displayRect = (displayX, 1101 displayY, 1102 displayWidth, 1103 displayHeight) 1104 widthUsed = ScaleDpiF(padLeft + width + padRight + left) 1105 budgetWidth -= widthUsed 1106 return (budgetLeft, 1107 budgetTop, 1108 budgetWidth, 1109 budgetHeight) 1110 1111 @telemetry.ZONE_METHOD 1112 def UpdateToRightAlignmentNoPush(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1113 padLeft, padTop, padRight, padBottom = self.padding 1114 left, top, width, height = self.pos 1115 if not budgetOnly: 1116 displayX = budgetLeft + budgetWidth - ScaleDpiF(width + padRight + left) 1117 displayY = budgetTop + ScaleDpiF(padTop + top) 1118 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1119 displayWidth = ScaleDpiF(width) 1120 self.displayRect = (displayX, 1121 displayY, 1122 displayWidth, 1123 displayHeight) 1124 return (budgetLeft, 1125 budgetTop, 1126 budgetWidth, 1127 budgetHeight) 1128 1129 @telemetry.ZONE_METHOD 1130 def UpdateToBottomAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1131 padLeft, padTop, padRight, padBottom = self.padding 1132 left, top, width, height = self.pos 1133 if not budgetOnly: 1134 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1135 displayY = budgetTop + budgetHeight - ScaleDpiF(height + padBottom + top) 1136 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1137 displayHeight = ScaleDpiF(height) 1138 self.displayRect = (displayX, 1139 displayY, 1140 displayWidth, 1141 displayHeight) 1142 heightUsed = ScaleDpiF(padTop + height + top + padBottom) 1143 budgetHeight -= heightUsed 1144 return (budgetLeft, 1145 budgetTop, 1146 budgetWidth, 1147 budgetHeight) 1148 1149 @telemetry.ZONE_METHOD 1150 def UpdateToBottomAlignmentNoPush(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1151 padLeft, padTop, padRight, padBottom = self.padding 1152 left, top, width, height = self.pos 1153 if not budgetOnly: 1154 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1155 displayY = budgetTop + budgetHeight - ScaleDpiF(height + padBottom + top) 1156 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1157 displayHeight = ScaleDpiF(height) 1158 self.displayRect = (displayX, 1159 displayY, 1160 displayWidth, 1161 displayHeight) 1162 return (budgetLeft, 1163 budgetTop, 1164 budgetWidth, 1165 budgetHeight) 1166 1167 @telemetry.ZONE_METHOD 1168 def UpdateToTopAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1169 padLeft, padTop, padRight, padBottom = self.padding 1170 left, top, width, height = self.pos 1171 if not budgetOnly: 1172 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1173 displayY = budgetTop + ScaleDpiF(padTop + top) 1174 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1175 displayHeight = ScaleDpiF(height) 1176 self.displayRect = (displayX, 1177 displayY, 1178 displayWidth, 1179 displayHeight) 1180 heightUsed = ScaleDpiF(padTop + height + top + padBottom) 1181 budgetTop += heightUsed 1182 budgetHeight -= heightUsed 1183 return (budgetLeft, 1184 budgetTop, 1185 budgetWidth, 1186 budgetHeight) 1187 1188 @telemetry.ZONE_METHOD 1189 def UpdateToTopAlignmentNoPush(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1190 padLeft, padTop, padRight, padBottom = self.padding 1191 left, top, width, height = self.pos 1192 if not budgetOnly: 1193 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1194 displayY = budgetTop + ScaleDpiF(padTop + top) 1195 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1196 displayHeight = ScaleDpiF(height) 1197 self.displayRect = (displayX, 1198 displayY, 1199 displayWidth, 1200 displayHeight) 1201 return (budgetLeft, 1202 budgetTop, 1203 budgetWidth, 1204 budgetHeight) 1205 1206 @telemetry.ZONE_METHOD 1207 def UpdateToAllAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1208 if not budgetOnly: 1209 padLeft, padTop, padRight, padBottom = self.padding 1210 left, top, width, height = self.pos 1211 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1212 displayY = budgetTop + ScaleDpiF(padTop + top) 1213 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight + left + width) 1214 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom + top + height) 1215 self.displayRect = (displayX, 1216 displayY, 1217 displayWidth, 1218 displayHeight) 1219 return (budgetLeft, 1220 budgetTop, 1221 budgetWidth, 1222 budgetHeight) 1223 1224 @telemetry.ZONE_METHOD 1225 def UpdateAbsoluteAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1226 if not budgetOnly: 1227 left, top, width, height = self.pos 1228 displayX = ScaleDpiF(left) 1229 displayY = ScaleDpiF(top) 1230 displayWidth = ScaleDpiF(width) 1231 displayHeight = ScaleDpiF(height) 1232 self.displayRect = (displayX, 1233 displayY, 1234 displayWidth, 1235 displayHeight) 1236 return (budgetLeft, 1237 budgetTop, 1238 budgetWidth, 1239 budgetHeight) 1240 1241 @telemetry.ZONE_METHOD 1242 def UpdateTopLeftAlignment(self, budgetOnly, *budget): 1243 if not budgetOnly: 1244 padLeft, padTop, padRight, padBottom = self.padding 1245 left, top, width, height = self.pos 1246 displayX = ScaleDpiF(left + padLeft) 1247 displayY = ScaleDpiF(top + padTop) 1248 displayWidth = ScaleDpiF(width - padLeft - padRight) 1249 displayHeight = ScaleDpiF(height - padTop - padBottom) 1250 self.displayRect = (displayX, 1251 displayY, 1252 displayWidth, 1253 displayHeight) 1254 return budget 1255 1256 @telemetry.ZONE_METHOD 1257 def UpdateTopRightAlignment(self, budgetOnly, *budget): 1258 if not budgetOnly: 1259 padLeft, padTop, padRight, padBottom = self.padding 1260 left, top, width, height = self.pos 1261 parent = self.parent 1262 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1263 displayX = budgetWidth + ScaleDpiF(padLeft - width - left) 1264 displayY = ScaleDpiF(top + padTop) 1265 displayWidth = ScaleDpiF(width - padLeft - padRight) 1266 displayHeight = ScaleDpiF(height - padTop - padBottom) 1267 self.displayRect = (displayX, 1268 displayY, 1269 displayWidth, 1270 displayHeight) 1271 return budget 1272 1273 @telemetry.ZONE_METHOD 1274 def UpdateBottomRightAlignment(self, budgetOnly, *budget): 1275 if not budgetOnly: 1276 padLeft, padTop, padRight, padBottom = self.padding 1277 left, top, width, height = self.pos 1278 parent = self.parent 1279 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1280 displayX = budgetWidth + ScaleDpiF(padLeft - width - left) 1281 displayY = budgetHeight + ScaleDpiF(padTop - height - top) 1282 displayWidth = ScaleDpiF(width - padLeft - padRight) 1283 displayHeight = ScaleDpiF(height - padTop - padBottom) 1284 self.displayRect = (displayX, 1285 displayY, 1286 displayWidth, 1287 displayHeight) 1288 return budget 1289 1290 @telemetry.ZONE_METHOD 1291 def UpdateBottomLeftAlignment(self, budgetOnly, *budget): 1292 if not budgetOnly: 1293 padLeft, padTop, padRight, padBottom = self.padding 1294 left, top, width, height = self.pos 1295 parent = self.parent 1296 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1297 displayX = ScaleDpiF(left + padLeft) 1298 displayY = budgetHeight + ScaleDpiF(padTop - height - top) 1299 displayWidth = ScaleDpiF(width - padLeft - padRight) 1300 displayHeight = ScaleDpiF(height - padTop - padBottom) 1301 self.displayRect = (displayX, 1302 displayY, 1303 displayWidth, 1304 displayHeight) 1305 return budget 1306 1307 @telemetry.ZONE_METHOD 1308 def UpdateCenterAlignment(self, budgetOnly, *budget): 1309 if not budgetOnly: 1310 padLeft, padTop, padRight, padBottom = self.padding 1311 left, top, width, height = self.pos 1312 parent = self.parent 1313 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1314 displayX = (budgetWidth - ScaleDpiF(width)) / 2 + ScaleDpiF(left + padLeft) 1315 displayY = (budgetHeight - ScaleDpiF(height)) / 2 + ScaleDpiF(top + padTop) 1316 displayWidth = ScaleDpiF(width - padLeft - padRight) 1317 displayHeight = ScaleDpiF(height - padTop - padBottom) 1318 self.displayRect = (displayX, 1319 displayY, 1320 displayWidth, 1321 displayHeight) 1322 return budget 1323 1324 @telemetry.ZONE_METHOD 1325 def UpdateCenterPreserveAspectAlignment(self, budgetOnly, *budget): 1326 if not budgetOnly: 1327 padLeft, padTop, padRight, padBottom = self.padding 1328 left, top, _, _ = self.pos 1329 parent = self.parent 1330 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1331 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1332 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1333 if displayWidth / self._aspectRatio > displayHeight: 1334 displayWidth = displayHeight * self._aspectRatio 1335 else: 1336 displayHeight = displayWidth / self._aspectRatio 1337 displayX = (budgetWidth - displayWidth + ScaleDpiF(padLeft - padRight)) / 2 + ScaleDpiF(left) 1338 displayY = (budgetHeight - displayHeight + ScaleDpiF(padTop - padBottom)) / 2 + ScaleDpiF(top) 1339 self.displayRect = (displayX, 1340 displayY, 1341 displayWidth, 1342 displayHeight) 1343 return budget 1344 1345 @telemetry.ZONE_METHOD 1346 def UpdateCenterPreserveAspectClipAlignment(self, budgetOnly, *budget): 1347 if not budgetOnly: 1348 padLeft, padTop, padRight, padBottom = self.padding 1349 left, top, _, _ = self.pos 1350 parent = self.parent 1351 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1352 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1353 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1354 if displayWidth / self._aspectRatio > displayHeight: 1355 displayHeight = displayWidth / self._aspectRatio 1356 else: 1357 displayWidth = displayHeight * self._aspectRatio 1358 displayX = (budgetWidth - displayWidth + ScaleDpiF(padLeft - padRight)) / 2 + ScaleDpiF(left) 1359 displayY = (budgetHeight - displayHeight + ScaleDpiF(padTop - padBottom)) / 2 + ScaleDpiF(top) 1360 self.displayRect = (displayX, 1361 displayY, 1362 displayWidth, 1363 displayHeight) 1364 return budget 1365 1366 @telemetry.ZONE_METHOD 1367 def UpdateCenterBottomAlignment(self, budgetOnly, *budget): 1368 if not budgetOnly: 1369 padLeft, padTop, padRight, padBottom = self.padding 1370 left, top, width, height = self.pos 1371 parent = self.parent 1372 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1373 displayX = (budgetWidth - ScaleDpiF(width)) / 2 + ScaleDpiF(left + padLeft) 1374 displayY = budgetHeight - ScaleDpiF(height + top - padTop) 1375 displayWidth = ScaleDpiF(width - padLeft - padRight) 1376 displayHeight = ScaleDpiF(height - padTop - padBottom) 1377 self.displayRect = (displayX, 1378 displayY, 1379 displayWidth, 1380 displayHeight) 1381 return budget 1382 1383 @telemetry.ZONE_METHOD 1384 def UpdateCenterTopAlignment(self, budgetOnly, *budget): 1385 if not budgetOnly: 1386 padLeft, padTop, padRight, padBottom = self.padding 1387 left, top, width, height = self.pos 1388 parent = self.parent 1389 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1390 displayX = (budgetWidth - ScaleDpiF(width)) / 2 + ScaleDpiF(left + padLeft) 1391 displayY = ScaleDpiF(top + padTop) 1392 displayWidth = ScaleDpiF(width - padLeft - padRight) 1393 displayHeight = ScaleDpiF(height - padTop - padBottom) 1394 self.displayRect = (displayX, 1395 displayY, 1396 displayWidth, 1397 displayHeight) 1398 return budget 1399 1400 @telemetry.ZONE_METHOD 1401 def UpdateCenterLeftAlignment(self, budgetOnly, *budget): 1402 if not budgetOnly: 1403 padLeft, padTop, padRight, padBottom = self.padding 1404 left, top, width, height = self.pos 1405 parent = self.parent 1406 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1407 displayX = ScaleDpiF(left + padLeft) 1408 displayY = (budgetHeight - ScaleDpiF(height)) / 2 + ScaleDpiF(top + padTop) 1409 displayWidth = ScaleDpiF(width - padLeft - padRight) 1410 displayHeight = ScaleDpiF(height - padTop - padBottom) 1411 self.displayRect = (displayX, 1412 displayY, 1413 displayWidth, 1414 displayHeight) 1415 return budget 1416 1417 @telemetry.ZONE_METHOD 1418 def UpdateCenterRightAlignment(self, budgetOnly, *budget): 1419 if not budgetOnly: 1420 padLeft, padTop, padRight, padBottom = self.padding 1421 left, top, width, height = self.pos 1422 parent = self.parent 1423 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1424 displayX = budgetWidth - ScaleDpiF(width + left - padLeft) 1425 displayY = (budgetHeight - ScaleDpiF(height)) / 2 + ScaleDpiF(top + padTop) 1426 displayWidth = ScaleDpiF(width - padLeft - padRight) 1427 displayHeight = ScaleDpiF(height - padTop - padBottom) 1428 self.displayRect = (displayX, 1429 displayY, 1430 displayWidth, 1431 displayHeight) 1432 return budget 1433 1434 @telemetry.ZONE_METHOD 1435 def UpdateNoAlignment(self, budgetOnly, *budget): 1436 left, top, width, height = self.pos 1437 displayWidth = ScaleDpi(width) 1438 displayHeight = ScaleDpi(height) 1439 self.displayWidth = displayWidth 1440 self.displayHeight = displayHeight 1441 return budget 1442 1443 @telemetry.ZONE_METHOD 1444 def UpdateToLeftProportionalAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1445 padLeft, padTop, padRight, padBottom = self.padding 1446 left, top, width, height = self.pos 1447 if not budgetOnly: 1448 width = int(float(self.parent.displayWidth) * width) 1449 width = self._CheckClampDisplayWidth(width) 1450 left = int(float(self.parent.displayWidth) * left) 1451 displayX = budgetLeft + ScaleDpiF(padLeft) + left 1452 displayY = budgetTop + ScaleDpiF(padTop + top) 1453 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1454 displayWidth = width - ScaleDpiF(padLeft + padRight) 1455 self.displayRect = (displayX, 1456 displayY, 1457 displayWidth, 1458 displayHeight) 1459 widthUsed = left + ScaleDpiF(padLeft + padRight) + self.displayWidth 1460 budgetLeft += widthUsed 1461 budgetWidth -= widthUsed 1462 return (budgetLeft, 1463 budgetTop, 1464 budgetWidth, 1465 budgetHeight) 1466 1467 def _CheckClampValue(self, value, min_val, max_val): 1468 if min_val is not None: 1469 value = max(min_val, value) 1470 if max_val is not None: 1471 value = min(max_val, value) 1472 return value 1473 1474 def _CheckClampDisplayWidth(self, width): 1475 if self.minWidth == self.maxWidth == None: 1476 return width 1477 min_val = ScaleDpiF(self.minWidth) if self.minWidth else None 1478 max_val = ScaleDpiF(self.maxWidth) if self.maxWidth else None 1479 return self._CheckClampValue(width, min_val, max_val) 1480 1481 def _CheckClampDisplayHeight(self, height): 1482 if self.minHeight == self.maxHeight == None: 1483 return height 1484 min_val = ScaleDpiF(self.minHeight) if self.minHeight else None 1485 max_val = ScaleDpiF(self.maxHeight) if self.maxHeight else None 1486 return self._CheckClampValue(height, min_val, max_val) 1487 1488 def _CheckClampWidth(self, width): 1489 if self.minWidth == self.maxWidth == None: 1490 return width 1491 return self._CheckClampValue(width, self.minWidth, self.maxWidth) 1492 1493 def _CheckClampHeight(self, height): 1494 if self.minHeight == self.maxHeight == None: 1495 return height 1496 return self._CheckClampValue(height, self.minHeight, self.maxHeight) 1497 1498 @telemetry.ZONE_METHOD 1499 def UpdateToRightProportionalAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1500 padLeft, padTop, padRight, padBottom = self.padding 1501 left, top, width, height = self.pos 1502 if not budgetOnly: 1503 width = int(float(self.parent.displayWidth) * width) 1504 width = self._CheckClampDisplayWidth(width) 1505 left = int(float(self.parent.displayWidth) * left) 1506 displayX = budgetLeft + budgetWidth - width - ScaleDpiF(padRight - padLeft) - left 1507 displayY = budgetTop + ScaleDpiF(padTop + top) 1508 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1509 displayWidth = width - ScaleDpiF(padLeft + padRight) 1510 self.displayRect = (displayX, 1511 displayY, 1512 displayWidth, 1513 displayHeight) 1514 widthUsed = left + ScaleDpiF(padLeft + padRight) + self.displayWidth 1515 budgetWidth -= widthUsed 1516 return (budgetLeft, 1517 budgetTop, 1518 budgetWidth, 1519 budgetHeight) 1520 1521 @telemetry.ZONE_METHOD 1522 def UpdateToTopProportionalAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1523 padLeft, padTop, padRight, padBottom = self.padding 1524 left, top, width, height = self.pos 1525 if not budgetOnly: 1526 height = int(float(self.parent.displayHeight) * height) 1527 height = self._CheckClampDisplayHeight(height) 1528 top = int(float(self.parent.displayHeight) * top) 1529 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1530 displayY = budgetTop + ScaleDpiF(padTop) + top 1531 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1532 displayHeight = height - ScaleDpiF(padTop + padBottom) 1533 self.displayRect = (displayX, 1534 displayY, 1535 displayWidth, 1536 displayHeight) 1537 heightUsed = top + ScaleDpiF(padTop + padBottom) + self.displayHeight 1538 budgetTop += heightUsed 1539 budgetHeight -= heightUsed 1540 return (budgetLeft, 1541 budgetTop, 1542 budgetWidth, 1543 budgetHeight) 1544 1545 @telemetry.ZONE_METHOD 1546 def UpdateToBottomProportionalAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1547 padLeft, padTop, padRight, padBottom = self.padding 1548 left, top, width, height = self.pos 1549 if not budgetOnly: 1550 height = int(float(self.parent.displayHeight) * height) 1551 height = self._CheckClampDisplayHeight(height) 1552 top = int(float(self.parent.displayHeight) * top) 1553 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1554 displayY = budgetTop + budgetHeight - height - ScaleDpiF(padBottom) + top 1555 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1556 displayHeight = height - ScaleDpiF(padTop + padBottom) 1557 self.displayRect = (displayX, 1558 displayY, 1559 displayWidth, 1560 displayHeight) 1561 heightUsed = top + ScaleDpiF(padTop + padBottom) + self.displayHeight 1562 budgetHeight -= heightUsed 1563 return (budgetLeft, 1564 budgetTop, 1565 budgetWidth, 1566 budgetHeight) 1567 1568 @telemetry.ZONE_METHOD 1569 def UpdateTopLeftProportionalAlignment(self, budgetOnly, *budget): 1570 padLeft, padTop, padRight, padBottom = self.padding 1571 left, top, width, height = self.pos 1572 if not budgetOnly: 1573 parent = self.parent 1574 budgetWidth, budgetHeight = parent.displayWidth, parent.displayHeight 1575 if self._width < 1.0: 1576 displayWidth = width * budgetWidth - ScaleDpiF(padLeft + padRight) 1577 displayWidth = self._CheckClampDisplayWidth(displayWidth) 1578 else: 1579 displayWidth = ScaleDpiF(width - padLeft - padRight) 1580 if self._height < 1.0: 1581 displayHeight = height * budgetHeight - ScaleDpiF(padTop + padBottom) 1582 displayHeight = self._CheckClampDisplayHeight(displayHeight) 1583 else: 1584 displayHeight = ScaleDpiF(height - padTop - padBottom) 1585 if self._left <= 1.0: 1586 displayX = (budgetWidth - displayWidth) * (left + padLeft) 1587 else: 1588 displayX = ScaleDpiF(left + padLeft) 1589 if self._top <= 1.0: 1590 displayY = (budgetHeight - displayHeight) * (top + padTop) 1591 else: 1592 displayY = ScaleDpiF(top + padTop) 1593 self.displayRect = (displayX, 1594 displayY, 1595 displayWidth, 1596 displayHeight) 1597 return budget 1598 1599 @telemetry.ZONE_METHOD 1600 def UpdateHorizontalCenteredAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1601 _, padTop, _, padBottom = self.padding 1602 left, top, width, height = self.pos 1603 if not budgetOnly: 1604 displayY = budgetTop + ScaleDpiF(padTop + top) 1605 displayHeight = budgetHeight - ScaleDpiF(padTop + padBottom) 1606 if width < 1: 1607 width *= ReverseScaleDpi(budgetWidth) 1608 width = self._CheckClampWidth(width) 1609 displayWidth = ScaleDpiF(width) 1610 displayX = budgetLeft + (budgetWidth - displayWidth) * 0.5 * (1.0 + left) 1611 self.displayRect = (displayX, 1612 displayY, 1613 displayWidth, 1614 displayHeight) 1615 return (budgetLeft, 1616 budgetTop, 1617 budgetWidth, 1618 budgetHeight) 1619 1620 @telemetry.ZONE_METHOD 1621 def UpdateVerticalCenteredAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1622 padLeft, _, padRight, _ = self.padding 1623 left, top, width, height = self.pos 1624 if not budgetOnly: 1625 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1626 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1627 if height < 1: 1628 height *= ReverseScaleDpi(budgetHeight) 1629 height = self._CheckClampHeight(height) 1630 displayHeight = ScaleDpiF(height) 1631 if budgetHeight < displayHeight and self._overflowAnchoring: 1632 if self._overflowAnchoring == Align.TOBOTTOM: 1633 displayY = budgetHeight - displayHeight 1634 else: 1635 displayY = 0 1636 else: 1637 displayY = budgetTop + (budgetHeight - displayHeight) * 0.5 * (1.0 + top) 1638 self.displayRect = (displayX, 1639 displayY, 1640 displayWidth, 1641 displayHeight) 1642 return (budgetLeft, 1643 budgetTop, 1644 budgetWidth, 1645 budgetHeight) 1646 1647 def UpdateTotopStickyAlignment(self, budgetOnly, budgetLeft, budgetTop, budgetWidth, budgetHeight): 1648 padLeft, padTop, padRight, padBottom = self.padding 1649 left, top, width, height = self.pos 1650 if not budgetOnly: 1651 displayX = budgetLeft + ScaleDpiF(padLeft + left) 1652 clipper = self.GetClipper() 1653 displayY = budgetTop + ScaleDpiF(padTop + top) 1654 parent_absolute_top = ScaleDpiF(self.parent.GetAbsoluteTop()) 1655 clipper_absolute_top = ScaleDpiF(clipper.GetAbsoluteTop()) 1656 if clipper and clipper_absolute_top > parent_absolute_top + displayY: 1657 displayY = clipper_absolute_top - parent_absolute_top 1658 displayWidth = budgetWidth - ScaleDpiF(padLeft + padRight) 1659 displayHeight = ScaleDpiF(height) 1660 self.displayRect = (displayX, 1661 displayY, 1662 displayWidth, 1663 displayHeight) 1664 heightUsed = ScaleDpiF(padTop + height + top + padBottom) 1665 budgetTop += heightUsed 1666 budgetHeight -= heightUsed 1667 return (budgetLeft, 1668 budgetTop, 1669 budgetWidth, 1670 budgetHeight) 1671 1672 @telemetry.ZONE_METHOD 1673 def UpdateAlignmentAsRoot(self, caller = None): 1674 if self.destroyed or not self.display: 1675 return 1676 if self.align == uiconst.NOALIGN: 1677 self.UpdateAlignment(0, 0, ScaleDpi(self.width), ScaleDpi(self.height)) 1678 else: 1679 self.UpdateAlignment(0, 0, self.displayWidth, self.displayHeight) 1680 1681 def UpdateAlignment(self, budgetLeft = 0, budgetTop = 0, budgetWidth = 0, budgetHeight = 0, updateChildrenOnly = False): 1682 if self.destroyed: 1683 return (budgetLeft, 1684 budgetTop, 1685 budgetWidth, 1686 budgetHeight, 1687 False) 1688 forceUpdate = self._forceUpdateAlignment 1689 alignmentDirty = self._alignmentDirty 1690 self._alignmentDirty = False 1691 self._forceUpdateAlignment = False 1692 fullUpdate = alignmentDirty or forceUpdate 1693 sizeChange = False 1694 preDX, preDY, preDWidth, preDHeight = self.displayRect 1695 budgetLeft, budgetTop, budgetWidth, budgetHeight = self._alignFunc(self, not fullUpdate, budgetLeft, budgetTop, budgetWidth, budgetHeight) 1696 if fullUpdate: 1697 newDX, newDY, newDWidth, newDHeight = self.displayRect 1698 sizeChange = preDWidth != newDWidth or preDHeight != newDHeight 1699 posChange = preDX != newDX or preDY != newDY 1700 if sizeChange or posChange: 1701 if self._OnResize.__func__ != Base._OnResize.__func__: 1702 self._OnResize() 1703 if sizeChange: 1704 newWidth = ReverseScaleDpi(newDWidth) 1705 newHeight = ReverseScaleDpi(newDHeight) 1706 self._OnSizeChange_NoBlock(newWidth, newHeight) 1707 self._emit_on_size_changed(newWidth, newHeight) 1708 if posChange and self.__on_position_changed: 1709 new_left = ReverseScaleDpi(newDX) 1710 new_top = ReverseScaleDpi(newDY) 1711 self._emit_on_position_changed(new_left, new_top) 1712 return (budgetLeft, 1713 budgetTop, 1714 budgetWidth, 1715 budgetHeight, 1716 sizeChange) 1717 1718 def ScaleDpi(self, value): 1719 return ScaleDpi(value) 1720 1721 def ReverseScaleDpi(self, value): 1722 return ReverseScaleDpi(value) 1723 1724 def Toggle(self, *args): 1725 if self.IsHidden(): 1726 self.Show() 1727 else: 1728 self.Hide() 1729 1730 def Hide(self, *args): 1731 self.display = False 1732 1733 def Show(self, *args): 1734 self.display = True 1735 1736 def IsHidden(self): 1737 return not self.display 1738 1739 def FindParentByName(self, parentName): 1740 parent = self.GetParent() 1741 while parent: 1742 if parent.name == parentName: 1743 return parent 1744 parent = parent.GetParent() 1745 1746 @property 1747 def cursor(self): 1748 return self._cursor 1749 1750 @cursor.setter 1751 def cursor(self, value): 1752 self._cursor = value 1753 uicore.CheckCursor() 1754 1755 def _OnClose(self, *args, **kw): 1756 pass 1757 1758 def _OnResize(self, *args): 1759 pass 1760 1761 def _OnSizeChange_NoBlock(self, width, height): 1762 pass 1763 1764 def OnMouseUp(self, *args): 1765 pass 1766 1767 def OnMouseDown(self, *args): 1768 pass 1769 1770 def OnMouseEnter(self, *args): 1771 pass 1772 1773 def OnMouseExit(self, *args): 1774 pass 1775 1776 def OnMouseHover(self, *args): 1777 pass 1778 1779 def OnClick(self, *args): 1780 pass 1781 1782 def OnMouseMove(self, *args): 1783 pass 1784 1785 def UpdateUIScaling(self, value, oldValue): 1786 pass 1787 1788 def OnColorThemeChanged(self): 1789 pass 1790 1791 def OnWindowAboveSetActive(self): 1792 pass 1793 1794 def OnWindowAboveSetInactive(self): 1795 pass 1796 1797 def OnGlobalFontSizeChanged(self): 1798 pass 1799 1800 def OnGlobalFontShadowChanged(self): 1801 pass 1802 1803 def DelegateEvents(self, delegateTo): 1804 self._delegatingEvents = True 1805 for eventName in DELEGATE_EVENTNAMES: 1806 toHandler = getattr(delegateTo, eventName, None) 1807 if toHandler: 1808 setattr(self, eventName, toHandler) 1809 1810 def DelegateEventsNotImplemented(self, delegateTo): 1811 self._delegatingEvents = True 1812 for eventName in DELEGATE_EVENTNAMES: 1813 haveLocal = self.HasEventHandler(eventName) 1814 if not haveLocal: 1815 toHandler = getattr(delegateTo, eventName, None) 1816 if toHandler: 1817 setattr(self, eventName, toHandler) 1818 1819 @property 1820 def analyticContext(self): 1821 contextParts = [] 1822 parent = self.parent 1823 while parent is not None: 1824 context = getattr(parent, 'analyticID', None) 1825 if context: 1826 contextParts.append(context) 1827 parent = parent.parent 1828 1829 return '.'.join(reversed(contextParts)) 1830 1831 @property 1832 def __bluetype__(self): 1833 if self.__renderObject__: 1834 return self.__renderObject__().__bluetype__ 1835 1836 @property 1837 def __typename__(self): 1838 if self.__renderObject__: 1839 return self.__renderObject__().__typename__ 1840 1841 1842 ALIGN_AND_CONSUME_FUNCTIONS = {Align.TOPLEFT: (Base.UpdateTopLeftAlignment, uiconst.TOPLEFT in PUSHALIGNMENTS, uiconst.TOPLEFT in AFFECTEDBYPUSHALIGNMENTS), 1843 Align.TOALL: (Base.UpdateToAllAlignment, uiconst.TOALL in PUSHALIGNMENTS, uiconst.TOALL in AFFECTEDBYPUSHALIGNMENTS), 1844 Align.NOALIGN: (Base.UpdateNoAlignment, uiconst.NOALIGN in PUSHALIGNMENTS, uiconst.NOALIGN in AFFECTEDBYPUSHALIGNMENTS), 1845 Align.TOLEFT: (Base.UpdateToLeftAlignment, uiconst.TOLEFT in PUSHALIGNMENTS, uiconst.TOLEFT in AFFECTEDBYPUSHALIGNMENTS), 1846 Align.TORIGHT: (Base.UpdateToRightAlignment, uiconst.TORIGHT in PUSHALIGNMENTS, uiconst.TORIGHT in AFFECTEDBYPUSHALIGNMENTS), 1847 Align.TOTOP: (Base.UpdateToTopAlignment, uiconst.TOTOP in PUSHALIGNMENTS, uiconst.TOTOP in AFFECTEDBYPUSHALIGNMENTS), 1848 Align.TOBOTTOM: (Base.UpdateToBottomAlignment, uiconst.TOBOTTOM in PUSHALIGNMENTS, uiconst.TOBOTTOM in AFFECTEDBYPUSHALIGNMENTS), 1849 Align.TOLEFT_NOPUSH: (Base.UpdateToLeftAlignmentNoPush, uiconst.TOLEFT_NOPUSH in PUSHALIGNMENTS, uiconst.TOLEFT_NOPUSH in AFFECTEDBYPUSHALIGNMENTS), 1850 Align.TORIGHT_NOPUSH: (Base.UpdateToRightAlignmentNoPush, uiconst.TORIGHT_NOPUSH in PUSHALIGNMENTS, uiconst.TORIGHT_NOPUSH in AFFECTEDBYPUSHALIGNMENTS), 1851 Align.TOTOP_NOPUSH: (Base.UpdateToTopAlignmentNoPush, uiconst.TOTOP_NOPUSH in PUSHALIGNMENTS, uiconst.TOTOP_NOPUSH in AFFECTEDBYPUSHALIGNMENTS), 1852 Align.TOBOTTOM_NOPUSH: (Base.UpdateToBottomAlignmentNoPush, uiconst.TOBOTTOM_NOPUSH in PUSHALIGNMENTS, uiconst.TOBOTTOM_NOPUSH in AFFECTEDBYPUSHALIGNMENTS), 1853 Align.TOLEFT_PROP: (Base.UpdateToLeftProportionalAlignment, uiconst.TOLEFT_PROP in PUSHALIGNMENTS, uiconst.TOLEFT_PROP in AFFECTEDBYPUSHALIGNMENTS), 1854 Align.TORIGHT_PROP: (Base.UpdateToRightProportionalAlignment, uiconst.TORIGHT_PROP in PUSHALIGNMENTS, uiconst.TORIGHT_PROP in AFFECTEDBYPUSHALIGNMENTS), 1855 Align.TOTOP_PROP: (Base.UpdateToTopProportionalAlignment, uiconst.TOTOP_PROP in PUSHALIGNMENTS, uiconst.TOTOP_PROP in AFFECTEDBYPUSHALIGNMENTS), 1856 Align.TOBOTTOM_PROP: (Base.UpdateToBottomProportionalAlignment, uiconst.TOBOTTOM_PROP in PUSHALIGNMENTS, uiconst.TOBOTTOM_PROP in AFFECTEDBYPUSHALIGNMENTS), 1857 Align.ABSOLUTE: (Base.UpdateAbsoluteAlignment, uiconst.ABSOLUTE in PUSHALIGNMENTS, uiconst.ABSOLUTE in AFFECTEDBYPUSHALIGNMENTS), 1858 Align.TOPLEFT_PROP: (Base.UpdateTopLeftProportionalAlignment, uiconst.TOPLEFT_PROP in PUSHALIGNMENTS, uiconst.TOPLEFT_PROP in AFFECTEDBYPUSHALIGNMENTS), 1859 Align.TOPRIGHT: (Base.UpdateTopRightAlignment, uiconst.TOPRIGHT in PUSHALIGNMENTS, uiconst.TOPRIGHT in AFFECTEDBYPUSHALIGNMENTS), 1860 Align.BOTTOMRIGHT: (Base.UpdateBottomRightAlignment, uiconst.BOTTOMRIGHT in PUSHALIGNMENTS, uiconst.BOTTOMRIGHT in AFFECTEDBYPUSHALIGNMENTS), 1861 Align.BOTTOMLEFT: (Base.UpdateBottomLeftAlignment, uiconst.BOTTOMLEFT in PUSHALIGNMENTS, uiconst.BOTTOMLEFT in AFFECTEDBYPUSHALIGNMENTS), 1862 Align.CENTER: (Base.UpdateCenterAlignment, uiconst.CENTER in PUSHALIGNMENTS, uiconst.CENTER in AFFECTEDBYPUSHALIGNMENTS), 1863 Align.CENTERBOTTOM: (Base.UpdateCenterBottomAlignment, uiconst.CENTERBOTTOM in PUSHALIGNMENTS, uiconst.CENTERBOTTOM in AFFECTEDBYPUSHALIGNMENTS), 1864 Align.CENTERTOP: (Base.UpdateCenterTopAlignment, uiconst.CENTERTOP in PUSHALIGNMENTS, uiconst.CENTERTOP in AFFECTEDBYPUSHALIGNMENTS), 1865 Align.CENTERLEFT: (Base.UpdateCenterLeftAlignment, uiconst.CENTERLEFT in PUSHALIGNMENTS, uiconst.CENTERLEFT in AFFECTEDBYPUSHALIGNMENTS), 1866 Align.CENTERRIGHT: (Base.UpdateCenterRightAlignment, uiconst.CENTERRIGHT in PUSHALIGNMENTS, uiconst.CENTERRIGHT in AFFECTEDBYPUSHALIGNMENTS), 1867 Align.CENTER_PRESERVE_ASPECT: (Base.UpdateCenterPreserveAspectAlignment, Align.CENTER_PRESERVE_ASPECT in PUSHALIGNMENTS, Align.CENTER_PRESERVE_ASPECT in AFFECTEDBYPUSHALIGNMENTS), 1868 Align.CENTER_PRESERVE_ASPECT_CLIP: (Base.UpdateCenterPreserveAspectClipAlignment, Align.CENTER_PRESERVE_ASPECT_CLIP in PUSHALIGNMENTS, Align.CENTER_PRESERVE_ASPECT_CLIP in AFFECTEDBYPUSHALIGNMENTS), 1869 Align.VERTICALLY_CENTERED: (Base.UpdateVerticalCenteredAlignment, uiconst.VERTICALLY_CENTERED in PUSHALIGNMENTS, uiconst.VERTICALLY_CENTERED in AFFECTEDBYPUSHALIGNMENTS), 1870 Align.HORIZONTALLY_CENTERED: (Base.UpdateHorizontalCenteredAlignment, uiconst.HORIZONTALLY_CENTERED in PUSHALIGNMENTS, uiconst.HORIZONTALLY_CENTERED in AFFECTEDBYPUSHALIGNMENTS), 1871 Align.TOTOP_STICKY: (Base.UpdateTotopStickyAlignment, Align.TOTOP_STICKY in PUSHALIGNMENTS, Align.TOTOP_STICKY in AFFECTEDBYPUSHALIGNMENTS)}