def PrepareNavigationButtons(self): buttonTop = Container(name='buttonTop', parent=self.navigationBar, padRight=const.defaultPadding, align=uiconst.TOLEFT, idx=0) for btnLabel, btnFunc, btnRectLeft, btnName, localizationLabel in self.browserButtons: if btnLabel is None: buttonTop.width += 6 continue if localization.IsValidLabel(localizationLabel): thehint = localization.GetByLabel(localizationLabel) else: thehint = '' button = uicls.ImageButton( parent=buttonTop, name=btnLabel, width=20, height=20, align=uiconst.RELATIVE, top=2, left=buttonTop.width, idleIcon='res:/UI/Texture/classes/Browser/%sIdle.png' % btnName, mouseoverIcon='res:/UI/Texture/classes/Browser/%sMouseOver.png' % btnName, mousedownIcon='res:/UI/Texture/classes/Browser/%sIdle.png' % btnName, onclick=btnFunc, hint=thehint) button.flag = btnLabel setattr(self.sr, '%sButton' % btnLabel, button) buttonTop.width += 20
def EnterDragMode(self, *args): self.dragFill = uiprimitives.Sprite( parent=self, name='dragFill', texturePath='res:/UI/Texture/classes/Neocom/buttonDown.png', state=uiconst.UI_DISABLED, align=uiconst.TOALL, idx=2) func = sm.GetService('logger').MoveNotifications import uicls self.exitMoveModeBtn = uicls.ImageButton( name='close', parent=self, align=uiconst.TOPRIGHT, state=uiconst.UI_NORMAL, pos=(0, 0, 16, 16), idleIcon='ui_38_16_220', mouseoverIcon='ui_38_16_220', mousedownIcon='ui_38_16_220', onclick=lambda: func(False), expandonleft=True, hint=localization.GetByLabel( 'UI/Accessories/Log/ExitMessageMovingMode'), idx=0) self.state = uiconst.UI_NORMAL self.inDragMode = True uicore.animations.SpSwoopBlink(self.dragFill, rotation=math.pi - 0.5, duration=1.5, loops=10)
def ApplyAttributes(self, attributes): uicls.Container.ApplyAttributes(self, attributes) self.blinkSprite = uicls.Sprite(bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/buttonDown.png', state=uiconst.UI_DISABLED) uicls.Frame(name='pointerFrame', bgParent=self, color=TutorialColor.HINT_FRAME) uicls.Fill(name='UIPointerImg', bgParent=self, color=TutorialColor.BACKGROUND) uicore.animations.SpSwoopBlink(self.blinkSprite, rotation=math.pi - 0.5, duration=3.0, loops=TutorialConstants.NUM_BLINKS) self.headerButtons = uicls.Container(name='headerButtons', state=uiconst.UI_PICKCHILDREN, align=uiconst.TOPRIGHT, parent=self, pos=(5, 0, 15, 15), idx=0, display=False) uicls.ImageButton(name='close', parent=self.headerButtons, align=uiconst.TOPRIGHT, state=uiconst.UI_NORMAL, pos=(0, 0, 16, 16), idleIcon='ui_38_16_220', mouseoverIcon='ui_38_16_220', mousedownIcon='ui_38_16_220', onclick=lambda : getattr(self, 'OnCloseContainer')(), expandonleft=True, hint=localization.GetByLabel('UI/Common/Buttons/Close')) self.headerButtons.Hide()
def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) text = attributes.get('text', '') self.pointDirections = attributes.get('pointDirections', (0, 0, 0)) self.arrowPositionModifier = attributes.get('arrowPositionModifier', 0) pointUp, pointDown, pointLeft = self.pointDirections self.innerCont = uiprimitives.Container(parent=self, align=uiconst.TOALL, name='innerCont') self.blinkSprite = uiprimitives.Sprite( bgParent=self.innerCont, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/buttonDown.png', state=uiconst.UI_DISABLED) bgColor = (0.0, 0.0, 0.0, 0.8) backgroundFill = uiprimitives.Fill(name='UIPointerImg', bgParent=self.innerCont, color=bgColor) self.arrowSprite = uiprimitives.Sprite(name='arrow', parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, color=bgColor) maxTextWidth = UIPOINTER_WIDTH - 23 self.pointerLabel = uicontrols.EveCaptionSmall( text=text, parent=self.innerCont, align=uiconst.CENTER, width=maxTextWidth, state=uiconst.UI_DISABLED, idx=0) if self.pointerLabel.textwidth < maxTextWidth: self.pointerLabel.left = (maxTextWidth - self.pointerLabel.textwidth) / 2 self.headerButtons = uiprimitives.Container( name='headerButtons', state=uiconst.UI_PICKCHILDREN, align=uiconst.TOPRIGHT, parent=self.innerCont, pos=(5, 0, 15, 15), idx=0, display=False) uicls.ImageButton( name='close', parent=self.headerButtons, align=uiconst.TOPRIGHT, state=uiconst.UI_NORMAL, pos=(0, 0, 16, 16), idleIcon='ui_38_16_220', mouseoverIcon='ui_38_16_220', mousedownIcon='ui_38_16_220', onclick=lambda: getattr(self, 'OnClosePointer')(), expandonleft=True, hint=localization.GetByLabel('UI/Common/Buttons/Close')) self.headerButtons.Hide()
def Prepare_Tabsmenu_(self): tri = uicls.ImageButton(icon='ui_1_16_14', parent=self, align=uiconst.BOTTOMLEFT, idx=0, state=uiconst.UI_NORMAL, pos=(0, 2, 16, 16), idleIcon='ui_1_16_14', mouseoverIcon='ui_1_16_30', mousedownIcon='ui_1_16_46', getmenu=self.GetTabLinks, expandonleft=True) self.sr.tabsmenu = tri
def Prepare_Diode_(self): if not self.sr.diode: self.sr.diode = uicls.ImageButton(name='diode', parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, pos=(0, 0, 16, 16), icon='ui_1_16_111', idx=0) if self._groupName: icon = 111 uiutil.MapIcon(self.sr.active, 'ui_1_16_157') else: icon = 112 uiutil.MapIcon(self.sr.active, 'ui_1_16_158') if self._checked: icon -= 2 self.sr.diode.SetRGB(1.0, 1.0, 1.0, 1.0) else: self.sr.diode.SetRGB(1.0, 1.0, 1.0, 0.7) self.sr.diode.SetMouseIdleIcon('ui_1_16_%s' % icon) self.sr.diode.SetMouseOverIcon('ui_1_16_%s' % (icon + 16)) self.sr.diode.SetMouseDownIcon('ui_1_16_%s' % (icon + 32))
def Prepare_HeaderButtons_(self): self.sr.headerButtons = uicls.Container(name='headerButtons', state=uiconst.UI_PICKCHILDREN, align=uiconst.TOPRIGHT, parent=self.sr.maincontainer, pos=(5, 0, 0, 30), idx=0) isStack = isinstance(self, self.GetStackClass()) if isStack: closeHint = localization.GetByLabel('UI/Control/EveWindow/CloseStack') minimizeHint = localization.GetByLabel('UI/Control/EveWindow/MinimizeStack') else: closeHint = localization.GetByLabel('UI/Common/Buttons/Close') minimizeHint = localization.GetByLabel('UI/Control/EveWindow/Minimize') helpHint = localization.GetByLabel('UI/Control/EveWindow/Help') pinFunc = self.TogglePinState if self.IsPinned(): pinhint = localization.GetByLabel('UI/Control/EveWindow/Unpin') else: pinhint = localization.GetByLabel('UI/Control/EveWindow/Pin') if self.IsCompact(): compactHint = localization.GetByLabel('/Carbon/UI/Controls/Window/DisableCompactMode') compactFunc = self.UnCompact compactIcon = 'ui_38_16_258' else: compactHint = localization.GetByLabel('/Carbon/UI/Controls/Window/EnableCompactMode') compactFunc = self.Compact compactIcon = 'ui_38_16_259' w = 0 for icon, name, hint, showflag, clickfunc, menufunc in [('ui_38_16_220', 'close', closeHint, self.IsKillable(), self.CloseByUser, None), ('ui_38_16_221', 'minimize', minimizeHint, self.IsMinimizable(), self.Minimize, None), ('ui_38_16_222', 'pin', pinhint, self.IsPinable(), pinFunc, None), ('ui_38_16_219', 'contextHelp', helpHint, self.showhelp, None, self.Help), (compactIcon, 'compact', compactHint, self.IsCompactable(), compactFunc, None)]: if not showflag: continue btn = uicls.ImageButton(name=name, parent=self.sr.headerButtons, align=uiconst.TOPRIGHT, state=uiconst.UI_NORMAL, pos=(w, 0, 16, 16), idleIcon=icon, mouseoverIcon=icon, mousedownIcon=icon, onclick=clickfunc, getmenu=menufunc, expandonleft=True, hint=hint) w += 15 self.sr.headerButtons.width = w if self.sr.captionParent: self.sr.captionParent.padRight = w + 6