Esempio n. 1
0
class ButtonTooltipRow(LayoutGridRow):
    default_state = uiconst.UI_NORMAL
    callback = None
    buttonID = None

    def ApplyAttributes(self, attributes):
        LayoutGridRow.ApplyAttributes(self, attributes)
        self.callback = attributes.callback
        self.buttonID = attributes.buttonID
        self.icon = ButtonIcon(pos=(0, 0, 16, 16),
                               texturePath=attributes.texturePath,
                               state=uiconst.UI_DISABLED)
        self.AddCell(cellObject=self.icon, cellPadding=(3, 2, 3, 2))
        label = EveLabelMedium(text=attributes.label, align=uiconst.CENTERLEFT)
        self.AddCell(cellObject=label, cellPadding=(0, 1, 6, 1))
        self.highLight = Fill(bgParent=self,
                              color=(1, 1, 1, 0.1),
                              state=uiconst.UI_HIDDEN)

    def Close(self, *args):
        LayoutGridRow.Close(self, *args)
        self.callback = None

    def OnMouseEnter(self, *args):
        self.icon.OnMouseEnter()
        self.highLight.display = True

    def OnMouseExit(self, *args):
        self.icon.OnMouseExit()
        self.highLight.display = False

    def OnClick(self, *args):
        if self.callback:
            self.callback(self.buttonID)
Esempio n. 2
0
 def LoadActionButtons(self, buttons):
     iconSize = 32
     w = self.width - 6
     maxIcons = 7.0
     n = float(len(buttons))
     pad = 5 + 1 * iconSize * (1.0 - n / maxIcons)
     w -= 2 * pad
     space = (w - n * iconSize) / n
     self.buttonCont.columns = len(buttons)
     for i, b in enumerate(buttons):
         iconPath, cerberusPath = planetCommonUI.PANELDATA[b.id]
         panelName = localization.GetByLabel(cerberusPath)
         if i == 0:
             self.defaultPanel = b.panelCallback
             self.defaultPanelID = b.id
         cont = Container(name=panelName, parent=self.buttonCont)
         ib = ButtonIcon(texturePath=iconPath,
                         parent=cont,
                         align=uiconst.CENTER,
                         name=panelName,
                         hint=b.Get('hint', ''),
                         width=iconSize,
                         height=iconSize,
                         iconSize=iconSize,
                         func=self._OnIconButtonClicked,
                         args=(b.panelCallback, b.id))
         ib.OnMouseEnter = (self.OnIconButtonMouseEnter, ib)
         ib.OnMouseExit = (self.OnIconButtonMouseExit, ib)
 def LoadActionButtons(self, buttons):
     iconSize = 32
     w = self.width - 6
     maxIcons = 7.0
     n = float(len(buttons))
     pad = 5 + 1 * iconSize * (1.0 - n / maxIcons)
     w -= 2 * pad
     space = (w - n * iconSize) / n
     self.buttonCont.columns = len(buttons)
     for i, b in enumerate(buttons):
         iconPath, cerberusPath = planetCommonUI.PANELDATA[b.id]
         panelName = localization.GetByLabel(cerberusPath)
         if i == 0:
             self.defaultPanel = b.panelCallback
             self.defaultPanelID = b.id
         cont = Container(name=panelName, parent=self.buttonCont)
         ib = ButtonIcon(texturePath=iconPath, parent=cont, align=uiconst.CENTER, name=panelName, hint=b.Get('hint', ''), width=iconSize, height=iconSize, iconSize=iconSize, func=self._OnIconButtonClicked, args=(b.panelCallback, b.id))
         ib.OnMouseEnter = (self.OnIconButtonMouseEnter, ib)
         ib.OnMouseExit = (self.OnIconButtonMouseExit, ib)
Esempio n. 4
0
 def OnIconButtonMouseExit(self, iconButton, *args):
     ButtonIcon.OnMouseExit(iconButton, *args)
     self.buttonText.text = self.buttonTextValue