inSpaceBracketTooltip.py (23461B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\inflight\bracketsAndTargets\inSpaceBracketTooltip.py 2 from itertools import chain 3 import blue 4 import uthread 5 import trinity 6 from carbonui.control.scrollContainer import ScrollContainer 7 from carbonui.primitives.container import Container 8 from carbonui.primitives.fill import Fill 9 from carbon.common.script.util.format import FmtDist 10 from carbon.common.script.util.timerstuff import AutoTimer 11 from carbonui import uiconst 12 from carbonui.primitives.layoutGrid import LayoutGridRow, LayoutGrid 13 from carbonui.primitives.sprite import Sprite 14 from carbonui.uianimations import animations 15 from carbonui.uicore import uicore 16 from carbonui.util.mouseTargetObject import MouseTargetObject 17 from eve.client.script.parklife import states as state 18 from eve.client.script.ui.control.eveLabel import EveLabelSmall 19 from eve.client.script.ui.control.tooltips import TooltipPersistentPanel 20 from eve.client.script.ui.inflight.bracketsAndTargets.bracketVarious import MAXOVERLAP_TOOLTIP_ENTRIES 21 from eve.client.script.ui.inflight.spaceObjectIcon import SpaceObjectIcon 22 from eve.client.script.ui.shared.fleet import fleetBroadcastConst 23 from eveservices.menu import GetMenuService 24 from sensorsuite.overlay.bookmarks import BookmarkSiteData 25 TOOLTIPLABELCUTOFF = 150 26 TOOLTIPLABELCUTOFFFADELENGTH = 20 27 TOOLTIPPANEL_HEIGHTCAP = 200 28 TOOLTIPPANEL_ENTRIESCAP = 10 29 TOOLTIP_OPACITY = 0.8 30 MINENTRYHEIGHT = 26 31 32 class PersistentInSpaceBracketTooltip(TooltipPersistentPanel): 33 __notifyevents__ = ['OnStateChange'] 34 isCompact = False 35 sideContainer = None 36 scroll = None 37 scrollEnabled = False 38 loaded = False 39 overlaps = None 40 overlapSites = None 41 debugShowInterest = False 42 43 def ApplyAttributes(self, attributes): 44 TooltipPersistentPanel.ApplyAttributes(self, attributes) 45 self.align = uiconst.ABSOLUTE 46 self.rowsByItemIDs = {} 47 sm.RegisterNotify(self) 48 uicore.uilib.RegisterForTriuiEvents(uiconst.UI_MOUSEDOWN, self.OnGlobalMouseDown) 49 MouseTargetObject(self) 50 51 def Close(self, *args): 52 TooltipPersistentPanel.Close(self, *args) 53 if self.overlaps or self.overlapSites: 54 for each in chain(self.overlaps, self.overlapSites): 55 each.opacity = 1.0 56 each.pickState = uiconst.TR2_SPS_ON 57 58 for layer in (uicore.layer.inflight, uicore.layer.sensorSuite): 59 animations.FadeTo(layer, startVal=layer.opacity, endVal=1.0, duration=0.05) 60 61 if self.sideContainer: 62 self.sideContainer.Close() 63 64 def IsOverlapBracket(self, bracket): 65 return bracket in self.overlaps or bracket in self.overlapSites 66 67 def GetNumberOfBrackets(self): 68 return len(self.overlaps) + len(self.overlapSites) 69 70 def CloseWithFade(self, *args): 71 self.Close() 72 73 def OnGlobalMouseDown(self, uiObject, *args, **kwds): 74 if self.destroyed: 75 return False 76 if uiObject.IsUnder(self) or uiObject.IsUnder(uicore.layer.menu): 77 return True 78 if self.sideContainer and uiObject.IsUnder(self.sideContainer): 79 return True 80 self.CloseWithFade() 81 return False 82 83 def OnStateChange(self, itemID, flag, status, *args): 84 entry = self.GetBracketEntryByID(itemID) 85 if entry: 86 if flag in (state.targeted, state.targeting, state.activeTarget): 87 entry.UpdateIcon() 88 elif flag == state.selected: 89 entry.SetSelected(status) 90 elif flag == state.mouseOver: 91 entry.SetHilited(status) 92 93 def GetBracketEntryByID(self, itemID): 94 return self.rowsByItemIDs.get(itemID, None) 95 96 def OnMouseEnter(self, *args): 97 self.LoadEntries() 98 99 def LoadTooltip(self, bracket, overlaps, boundingBox, overlapSites, *args, **kwds): 100 self.overlaps = overlaps 101 self.overlapSites = overlapSites 102 self.scrollEnabled = False if self.GetNumberOfBrackets() <= 15 else True 103 bracket.SetOrder(0) 104 self.SetBackgroundAlpha(TOOLTIP_OPACITY) 105 isFloating = bracket.IsFloating() 106 if isFloating: 107 self.isCompact = settings.user.ui.Get('bracketmenu_floating', True) 108 else: 109 self.isCompact = settings.user.ui.Get('bracketmenu_docked', False) 110 self.LoadGeneric1ColumnTemplate() 111 scroll = ScrollContainer(align=uiconst.TOPLEFT, parent=self) 112 scroll.isTabStop = False 113 scroll._scrollbar_vertical.padLeft = 0 114 self.scroll = scroll 115 subGrid = LayoutGrid(parent=scroll, align=uiconst.TOPLEFT, columns=1 if self.isCompact else 3, name='bracketTooltipSubGrid') 116 self.subGrid = subGrid 117 if self.isCompact: 118 self.sideContainer = BracketTooltipSidePanel(align=uiconst.TOPLEFT, parent=self.parent, idx=self.parent.children.index(self)) 119 self.sideContainer.display = False 120 uthread.new(self.UpdateSideContainer) 121 self.LoadEntries() 122 self.state = uiconst.UI_NORMAL 123 124 def LoadEntries(self): 125 if self.loaded: 126 return 127 self.loaded = True 128 self.subGrid.Flush() 129 overlaps = self.overlaps 130 self.margin = 1 131 rowOrder = [] 132 for bracket in overlaps: 133 row = self.subGrid.AddRow(rowClass=BracketTooltipRow, bracket=bracket, isCompact=self.isCompact, sideContainer=self.sideContainer) 134 self.rowsByItemIDs[bracket.itemID] = row 135 rowOrder.append(row) 136 137 for bracket in self.overlapSites: 138 row = self.subGrid.AddRow(rowClass=SensorOverlaySiteTooltipRow, bracket=bracket, isCompact=self.isCompact, sideContainer=self.sideContainer) 139 data = bracket.data 140 self.rowsByItemIDs[data.GetSiteType(), data.siteID] = row 141 rowOrder.append(row) 142 143 self.subGrid.RefreshGridLayout() 144 MAXVISIBLE = MAXOVERLAP_TOOLTIP_ENTRIES 145 totalHeight = 0 146 for row in rowOrder[:MAXVISIBLE]: 147 totalHeight += row.height 148 149 self.scroll.width = self.subGrid.width + (8 if len(rowOrder) > MAXVISIBLE else 0) 150 self.scroll.height = totalHeight 151 self.state = uiconst.UI_NORMAL 152 153 def IsOwnerPickable(self): 154 owner = self.owner 155 if not owner: 156 return False 157 for row in self.rowsByItemIDs.values(): 158 if row.GetBracket(): 159 break 160 else: 161 return False 162 163 prestate = owner.state 164 owner.state = uiconst.UI_NORMAL 165 try: 166 ol, ot, ow, oh = owner.GetTooltipPosition() 167 ol = uicore.ScaleDpiF(ol) 168 ot = uicore.ScaleDpiF(ot) 169 ow = uicore.ScaleDpiF(ow) 170 oh = uicore.ScaleDpiF(oh) 171 renderObject, pyObject = uicore.uilib.PickScreenPosition(int(ol + ow / 2), int(ot + oh / 2)) 172 if pyObject and (pyObject.IsUnder(uicore.layer.menu) or pyObject.IsUnder(uicore.layer.bracket) or pyObject.IsUnder(uicore.layer.sensorSuite)): 173 return True 174 if pyObject is not owner: 175 tryPick = ((ol + 1, ot + oh / 2), 176 (ol + ow - 1, ot + oh / 2), 177 (ol + ow / 2, ot + 1), 178 (ol + ow / 2, ot + oh - 1)) 179 hits = 0 180 for x, y in tryPick: 181 renderObject, pyObject = uicore.uilib.PickScreenPosition(int(x), int(y)) 182 if pyObject is owner: 183 hits += 1 184 if hits == 2: 185 return True 186 if pyObject and pyObject.IsUnder(uicore.layer.menu): 187 return True 188 189 finally: 190 owner.state = prestate 191 192 return pyObject is owner 193 194 def UpdateSideContainer(self): 195 rightAligned = (uiconst.POINT_RIGHT_1, uiconst.POINT_RIGHT_2, uiconst.POINT_RIGHT_3) 196 while not self.destroyed: 197 if not hasattr(self, 'menuPointFlag'): 198 blue.pyos.synchro.SleepWallclock(1) 199 continue 200 if self.menuPointFlag in rightAligned or self.left + self.width + self.sideContainer.width > uicore.desktop.width: 201 self.sideContainer.SetContentAlign(uiconst.TORIGHT) 202 self.sideContainer.left = self.left - self.sideContainer.width 203 for row in self.rowsByItemIDs.values(): 204 row.UpdateDynamicValues() 205 206 else: 207 self.sideContainer.SetContentAlign(uiconst.TOLEFT) 208 self.sideContainer.left = self.left + self.width 209 self.sideContainer.top = self.top 210 self.sideContainer.height = self.height 211 self.sideContainer.grid.top = self.scroll.mainCont.top 212 self.sideContainer.opacity = self.opacity 213 if self.beingDestroyed: 214 self.sideContainer.display = False 215 else: 216 self.sideContainer.display = True 217 blue.pyos.synchro.SleepWallclock(1) 218 219 220 class BracketShadowLabel(Container): 221 default_align = uiconst.TOPLEFT 222 default_state = uiconst.UI_NORMAL 223 mainLabel = None 224 mainShadowLabel = None 225 sideMargins = (0, 0) 226 227 def ApplyAttributes(self, attributes): 228 Container.ApplyAttributes(self, attributes) 229 mainLabel = EveLabelSmall(parent=self, state=uiconst.UI_DISABLED, color=(1, 1, 1, 1), width=attributes.width or 0, autoFitToText=attributes.autoFitToText or False) 230 mainShadowLabel = EveLabelSmall(parent=self, state=uiconst.UI_DISABLED, color=(0, 0, 0, 1), width=attributes.width or 0, autoFitToText=attributes.autoFitToText or False) 231 mainShadowLabel.renderObject.spriteEffect = trinity.TR2_SFX_BLUR 232 self.mainLabel = mainLabel 233 self.mainShadowLabel = mainShadowLabel 234 self.text = attributes.text 235 236 def SetSideMargins(self, leftMargin = 0, rightMargin = 0): 237 self.sideMargins = (leftMargin, rightMargin) 238 239 @apply 240 def text(): 241 242 def fset(self, value): 243 self.mainLabel.text = value 244 self.mainShadowLabel.text = value 245 leftMargin, rightMargin = self.sideMargins 246 self.mainLabel.left = -self.mainLabel.mincommitcursor + leftMargin 247 self.mainShadowLabel.left = -self.mainLabel.mincommitcursor + leftMargin 248 self.width = self.mainLabel.textwidth + leftMargin + rightMargin - self.mainLabel.mincommitcursor 249 self.height = self.mainLabel.height 250 251 def fget(self): 252 return self.mainLabel.text 253 254 return property(**locals()) 255 256 257 class BracketTooltipSidePanel(Container): 258 default_state = uiconst.UI_PICKCHILDREN 259 default_align = uiconst.TOPLEFT 260 default_clipChildren = True 261 262 def ApplyAttributes(self, attributes): 263 Container.ApplyAttributes(self, attributes) 264 self.textLabels = [] 265 self.grid = LayoutGrid(parent=self, columns=3, margin=3, OnGridSizeChanged=self.OnGridSizeChanged) 266 267 def OnGridSizeChanged(self, width, height): 268 self.width = width 269 270 def CreateBracketEntry(self): 271 self.grid.AddCell(cellObject=Container(align=uiconst.TOPLEFT, pos=(0, 272 0, 273 2, 274 MINENTRYHEIGHT))) 275 label = BracketShadowLabel(align=uiconst.CENTERLEFT) 276 self.grid.AddCell(cellObject=label) 277 self.textLabels.append(label) 278 self.grid.AddCell(cellObject=Container(align=uiconst.TOPLEFT, pos=(0, 279 0, 280 2, 281 MINENTRYHEIGHT))) 282 return label 283 284 def SetContentAlign(self, contentAlign): 285 for textlabel in self.textLabels: 286 if contentAlign == uiconst.TOLEFT: 287 textlabel.align = uiconst.CENTERLEFT 288 else: 289 textlabel.align = uiconst.CENTERRIGHT 290 291 def Close(self, *args): 292 Container.Close(self, *args) 293 self.textLabels = None 294 295 296 class BracketTooltipRowBase(LayoutGridRow): 297 selectedSprite = None 298 radialMenuSprite = None 299 mainShadowLabel = None 300 mainLabel = None 301 sideEntry = None 302 isCompact = False 303 default_state = uiconst.UI_NORMAL 304 305 def ApplyAttributes(self, attributes): 306 LayoutGridRow.ApplyAttributes(self, attributes) 307 self.isCompact = attributes.isCompact or False 308 bracket = attributes.bracket 309 self.bracket = bracket 310 if not self.IsBracketStillValid(): 311 return 312 self.hilite = Fill(bgParent=self, color=(1, 1, 1, 0.0)) 313 self.iconParent = Container(align=uiconst.CENTER, pos=(0, 314 0, 315 26, 316 MINENTRYHEIGHT), parent=self) 317 self.iconObj = self.CreateIcon() 318 self.radialMenuSprite = None 319 if self.isCompact: 320 self.mainLabel = attributes.sideContainer.CreateBracketEntry() 321 self.mainLabel.DelegateEvents(self) 322 else: 323 self.mainLabel = BracketShadowLabel(text='', align=uiconst.CENTERLEFT, width=TOOLTIPLABELCUTOFF, autoFitToText=True, state=uiconst.UI_DISABLED) 324 self.AddCell(cellObject=self.mainLabel, cellPadding=(2, 2, 6, 2)) 325 self.distanceLabel = EveLabelSmall(parent=self, align=uiconst.CENTERRIGHT, left=4) 326 self.dynamicsUpdateTimer = None 327 328 def UpdateDynamicValues(self): 329 pass 330 331 def StartDynamicUpdates(self): 332 self.UpdateDynamicValues() 333 self.dynamicsUpdateTimer = AutoTimer(500, self.UpdateDynamicValues) 334 335 def CreateIcon(self): 336 return None 337 338 def IsBracketStillValid(self): 339 return True 340 341 def Close(self, *args): 342 LayoutGridRow.Close(self, *args) 343 self.bracket = None 344 self.mainLabel = None 345 self.dynamicsUpdateTimer = None 346 347 def ShowRadialMenuIndicator(self, slimItem = None, *args): 348 if not self.radialMenuSprite: 349 self.radialMenuSprite = Sprite(name='radialMenuSprite', parent=self.iconParent, texturePath='res:/UI/Texture/classes/RadialMenu/bracketHilite.png', pos=(0, 0, 20, 20), color=(0.5, 0.5, 0.5, 0.5), align=uiconst.CENTER, state=uiconst.UI_DISABLED) 350 self.radialMenuSprite.display = True 351 352 def HideRadialMenuIndicator(self, slimItem = None, *args): 353 if self.radialMenuSprite: 354 self.radialMenuSprite.display = False 355 356 def GetBracket(self): 357 bracket = self.bracket 358 if bracket and not bracket.destroyed: 359 return bracket 360 if self.destroyed: 361 return 362 self.state = uiconst.UI_DISABLED 363 self.opacity = 0.2 364 self.bracket = None 365 if self.isCompact and not self.mainLabel.destroyed: 366 self.mainLabel.state = uiconst.UI_DISABLED 367 self.mainLabel.opacity = 0.2 368 369 def SetHilited(self, hiliteState): 370 bracket = self.GetBracket() 371 if not bracket: 372 return 373 if hiliteState: 374 self.hilite.opacity = 0.2 375 if self.mainLabel: 376 self.mainLabel.opacity = 1.5 377 else: 378 self.hilite.opacity = 0.0 379 if self.mainLabel: 380 self.mainLabel.opacity = 0.8 381 382 def OnClick(self, *args): 383 bracket = self.GetBracket() 384 if bracket: 385 return bracket.OnClick() 386 387 def OnMouseDown(self, *args): 388 bracket = self.GetBracket() 389 if bracket: 390 return bracket.OnMouseDown() 391 392 def OnMouseEnter(self, *args): 393 self.SetHilited(True) 394 uthread.new(self.WhileMouseOver) 395 bracket = self.GetBracket() 396 if bracket: 397 bracket.OnMouseEnter() 398 399 def WhileMouseOver(self): 400 while uicore.uilib.mouseOver is self or uicore.uilib.mouseOver is self.mainLabel: 401 blue.pyos.synchro.SleepWallclock(10) 402 if self.destroyed: 403 break 404 405 self.SetHilited(False) 406 407 def OnMouseExit(self, *args): 408 bracket = self.GetBracket() 409 if bracket: 410 bracket.OnMouseExit() 411 412 def AlignContent(self, align = uiconst.TOLEFT): 413 if not self.isCompact: 414 return 415 if align == uiconst.TOLEFT: 416 self.mainLabel.align = uiconst.CENTERLEFT 417 else: 418 self.mainLabel.align = uiconst.CENTERRIGHT 419 if self.mainShadowLabel: 420 self.mainShadowLabel.align = self.mainLabel.align 421 422 def GetMenu(self, *args): 423 bracket = self.GetBracket() 424 if bracket: 425 return bracket.GetMenu() 426 427 428 class BracketTooltipRow(BracketTooltipRowBase): 429 subLabel = None 430 fleetBroadcastSprite = None 431 fleetBroadcastType = None 432 433 def ApplyAttributes(self, attributes): 434 BracketTooltipRowBase.ApplyAttributes(self, attributes) 435 self.selectedSprite = None 436 if self.bracket.slimItem: 437 selected, hilited = sm.GetService('stateSvc').GetStates(self.bracket.slimItem, [state.selected, state.mouseOver]) 438 self.SetSelected(selected) 439 self.SetHilited(hilited) 440 self.StartDynamicUpdates() 441 442 def CreateIcon(self): 443 self.iconObj = SpaceObjectIcon(state=uiconst.UI_DISABLED, pos=(0, 0, 16, 16), align=uiconst.CENTER, parent=self.iconParent) 444 self.UpdateIcon() 445 return self.iconObj 446 447 def IsBracketStillValid(self): 448 ball = self.bracket.ball 449 slimItem = self.bracket.slimItem 450 return ball or slimItem 451 452 def UpdateIcon(self): 453 if not self.bracket or self.bracket.destroyed: 454 return 455 ball = self.bracket.ball 456 slimItem = self.bracket.slimItem 457 if slimItem: 458 self.iconObj.UpdateSpaceObjectIcon(slimItem, ball) 459 self.iconObj.UpdateSpaceObjectIconColor(slimItem) 460 self.iconObj.UpdateSpaceObjectState(slimItem, ball) 461 self.iconObj.UpdateSpaceObjectFlagAndBackgroundColor(slimItem, ball) 462 else: 463 iconNo = getattr(self.bracket, 'iconNo', None) 464 if iconNo: 465 self.iconObj.iconSprite.LoadIcon(iconNo) 466 467 def SetSelected(self, selectedState): 468 if selectedState: 469 if not self.selectedSprite: 470 self.selectedSprite = Sprite(parent=self.iconObj, pos=(0, 0, 30, 30), name='selection', state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/Bracket/selectionCircle.png', align=uiconst.CENTER, color=(1, 1, 1, 0.5)) 471 self.selectedSprite.display = True 472 elif self.selectedSprite: 473 self.selectedSprite.display = False 474 475 def UpdateDynamicValues(self): 476 if self.destroyed: 477 return 478 bracket = self.GetBracket() 479 if not bracket or bracket.destroyed: 480 self.dynamicsUpdateTimer = None 481 return 482 distance = None 483 if getattr(bracket, 'showDistance', 1): 484 distance = bracket.GetDistance() 485 if distance: 486 if not self.isCompact: 487 self.distanceLabel.text = FmtDist(distance) 488 rightAligned = self.mainLabel.align != uiconst.CENTERLEFT 489 fleetBroadcastType = getattr(bracket, 'fleetBroadcastType', None) 490 if fleetBroadcastType: 491 if fleetBroadcastType != self.fleetBroadcastType: 492 self.fleetBroadcastType = fleetBroadcastType 493 icon = fleetBroadcastConst.iconsByBroadcastType[fleetBroadcastType] 494 if not self.fleetBroadcastSprite: 495 self.fleetBroadcastSprite = Sprite(parent=self.mainLabel, pos=(0, 0, 16, 16), state=uiconst.UI_NORMAL, align=uiconst.CENTERLEFT, idx=0) 496 self.fleetBroadcastSprite.DelegateEvents(self) 497 self.fleetBroadcastSprite.LoadTexture(icon) 498 if rightAligned: 499 self.mainLabel.SetSideMargins(0, 18) 500 self.fleetBroadcastSprite.align = uiconst.CENTERRIGHT 501 else: 502 self.mainLabel.SetSideMargins(18, 0) 503 elif self.fleetBroadcastSprite: 504 self.fleetBroadcastSprite.Close() 505 self.fleetBroadcastSprite = None 506 self.fleetBroadcastType = None 507 self.mainLabel.SetSideMargins() 508 tagAndTargetStr = getattr(bracket, 'tagAndTargetStr', None) 509 subinfoString = None 510 if hasattr(bracket, 'GetSubLabelCallback'): 511 subinfoCallback = bracket.GetSubLabelCallback() 512 if subinfoCallback: 513 subinfoString = subinfoCallback() 514 combinedString = '' 515 if rightAligned: 516 combinedString = '<right>' 517 combinedString += bracket.displayName 518 if self.isCompact and distance: 519 combinedString += ' ' + FmtDist(distance) 520 if subinfoString or tagAndTargetStr: 521 combinedString += '<br>' 522 if tagAndTargetStr: 523 combinedString += '<b>' + tagAndTargetStr + '</b>' 524 if subinfoString: 525 if tagAndTargetStr: 526 combinedString += ' ' 527 combinedString += '[' + subinfoString + ']' 528 self.mainLabel.text = combinedString 529 self.iconParent.height = max(MINENTRYHEIGHT, self.mainLabel.height) 530 531 532 class SensorOverlaySiteTooltipRow(BracketTooltipRowBase): 533 534 def ApplyAttributes(self, attributes): 535 BracketTooltipRowBase.ApplyAttributes(self, attributes) 536 Fill(bgParent=self, color=self.bracket.outerColor, opacity=0.25) 537 self.displayName = self.bracket.GetBracketLabelText() 538 self.SetHilited(False) 539 self.StartDynamicUpdates() 540 541 def CreateIcon(self): 542 return Sprite(state=uiconst.UI_DISABLED, pos=(0, 0, 16, 16), align=uiconst.CENTER, parent=self.iconParent, texturePath=self.bracket.innerIconResPath) 543 544 def IsBracketStillValid(self): 545 return True 546 547 def AlignContent(self, align = uiconst.TOLEFT): 548 if not self.isCompact: 549 return 550 if align == uiconst.TOLEFT: 551 self.mainLabel.align = uiconst.CENTERLEFT 552 else: 553 self.mainLabel.align = uiconst.CENTERRIGHT 554 if self.mainShadowLabel: 555 self.mainShadowLabel.align = self.mainLabel.align 556 557 def UpdateDynamicValues(self): 558 if self.destroyed: 559 return 560 bracket = self.GetBracket() 561 if not bracket or bracket.destroyed: 562 self.dynamicsUpdateTimer = None 563 return 564 distance = None 565 if getattr(bracket, 'showDistance', 1): 566 distance = bracket.GetDistance() 567 if distance: 568 if not self.isCompact: 569 self.distanceLabel.text = FmtDist(distance) 570 rightAligned = self.mainLabel.align != uiconst.CENTERLEFT 571 combinedString = '' 572 if rightAligned: 573 combinedString = '<right>' 574 combinedString += self.GetDisplayName() 575 if self.isCompact and distance: 576 combinedString += ' ' + FmtDist(distance) 577 self.mainLabel.text = combinedString 578 self.iconParent.height = max(MINENTRYHEIGHT, self.mainLabel.height) 579 580 def GetMenu(self, *args): 581 bracket = self.GetBracket() 582 if bracket: 583 return bracket.GetMenu() 584 585 def OnClick(self, *args): 586 bracket = self.GetBracket() 587 if bracket: 588 return bracket.OnClick() 589 590 def OnMouseDown(self, *args): 591 bracket = self.GetBracket() 592 if bracket: 593 itemID = bracket.GetItemID() 594 bookmarkInfo = bracket.data.bookmark if isinstance(bracket.data, BookmarkSiteData) else None 595 GetMenuService().TryExpandActionMenu(itemID, self, siteData=bracket.data, bookmarkInfo=bookmarkInfo) 596 597 def GetDisplayName(self): 598 return self.displayName