Exemplo n.º 1
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     typeID = attributes.Get('typeID', None)
     iskAmount = attributes.Get('iskAmount', 0)
     amount = attributes.Get('amount', 0)
     typeName = evetypes.GetName(typeID)
     mainCont = Container(name='mainCont', parent=self)
     iconCont = Container(name='iconCont',
                          parent=mainCont,
                          align=uiconst.TOLEFT,
                          width=18)
     textCont = Container(name='textCont',
                          parent=mainCont,
                          align=uiconst.TOALL,
                          padding=const.defaultPadding)
     icon = Icon(parent=iconCont,
                 align=uiconst.TOALL,
                 size=18,
                 typeID=typeID,
                 ignoreSize=True)
     icon.OnClick = (self.ShowInfo, None, typeID)
     icon.hint = typeName
     iskLabel = EveLabelSmall(text=FmtISK(iskAmount, 0),
                              parent=textCont,
                              align=uiconst.TORIGHT,
                              maxLines=1)
     amountLabel = EveLabelSmall(text='%ix' % amount,
                                 parent=textCont,
                                 align=uiconst.TOLEFT,
                                 maxLines=1)
     if amount == 0:
         mainCont.opacity = 0.5
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     typeID = attributes.Get('typeID', None)
     iskAmount = attributes.Get('iskAmount', 0)
     amount = attributes.Get('amount', 0)
     typeName = evetypes.GetName(typeID)
     mainCont = Container(name='mainCont', parent=self)
     iconCont = Container(name='iconCont', parent=mainCont, align=uiconst.TOLEFT, width=18)
     textCont = Container(name='textCont', parent=mainCont, align=uiconst.TOALL, padding=const.defaultPadding)
     icon = Icon(parent=iconCont, align=uiconst.TOALL, size=18, typeID=typeID, ignoreSize=True)
     icon.OnClick = (self.ShowInfo, None, typeID)
     icon.hint = typeName
     iskLabel = EveLabelSmall(text=FmtISK(iskAmount, 0), parent=textCont, align=uiconst.TORIGHT, maxLines=1)
     amountLabel = EveLabelSmall(text='%ix' % amount, parent=textCont, align=uiconst.TOLEFT, maxLines=1)
     if amount == 0:
         mainCont.opacity = 0.5
Exemplo n.º 3
0
 def Load(self, attributeValues, mouseExitFunc=None, onClickFunc=None):
     if not attributeValues:
         return
     self.attributeValues = attributeValues
     self.innerContainers = {}
     self.Flush()
     containerPercentage = 1.0 / len(attributeValues)
     for attributeID, value in attributeValues:
         innerCont = Container(parent=self,
                               name='container_%s' % attributeID,
                               width=containerPercentage,
                               align=uiconst.TOLEFT_PROP,
                               clipChildren=True)
         self.innerContainers[attributeID] = innerCont
         iconCont = Container(parent=innerCont,
                              name='iconCont',
                              width=self.iconSize,
                              align=uiconst.TOLEFT,
                              state=uiconst.UI_PICKCHILDREN)
         icon = Icon(parent=iconCont,
                     pos=(0, 0, self.iconSize, self.iconSize),
                     align=uiconst.CENTERLEFT,
                     idx=0,
                     ignoreSize=True,
                     state=uiconst.UI_NORMAL)
         if mouseExitFunc:
             icon.OnMouseExit = mouseExitFunc
         if onClickFunc:
             icon.OnClick = (onClickFunc, attributeID)
         labelText = value or '-'
         innerCont.label = EveLabelSmall(parent=innerCont,
                                         text=labelText,
                                         align=uiconst.CENTERLEFT,
                                         left=self.iconSize)
         attributeInfo = cfg.dgmattribs.Get(attributeID)
         iconID = attributeInfo.iconID
         icon.LoadIcon(iconID, ignoreSize=True)
         icon.hint = attributeInfo.displayName
         tooltipTitleText, tooltipDescriptionText = GetAttributeTooltipTitleAndDescription(
             attributeID)
         if tooltipDescriptionText:
             SetTooltipHeaderAndDescription(
                 targetObject=icon,
                 headerText=tooltipTitleText,
                 descriptionText=tooltipDescriptionText)