class ReprocessingOutputItemContainer(ReprocessingItemContainer): """ This class draws an output reprocessing item """ def ApplyAttributes(self, attributes): ReprocessingItemContainer.ApplyAttributes(self, attributes) self.outputFrame = Frame(name='outputFrame', bgParent=self.spriteCont, texturePath='res:/UI/Texture/Reprocessing/Dash_Frame_48.png') self.outputFrame.SetRGB(*COL_YELLOW) qtyInfo = attributes.qtyInfo typeInfo = attributes.fromTypeInfo self._SetInfo(qtyInfo, typeInfo) def LoadTooltipPanel(self, tooltipPanel, *args): tooltipPanel.LoadGeneric1ColumnTemplate() subGrid1 = LayoutGrid() icon = Icon(width=64, height=64, align=CENTER) icon.LoadIconByTypeID(typeID=self.typeID, ignoreSize=True) subGrid1.AddCell(cellObject=icon) subGrid1.AddCell(EveLabelMedium(text=cfg.invtypes.Get(self.typeID).name, width=170, autoFitToText=True, left=6, top=4, bold=True)) tooltipPanel.AddCell(subGrid1) subGrid = LayoutGrid() subGrid.columns = 2 l1 = EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessedFrom'), color=COL_BLUE, bold=True) subGrid.AddCell(l1, colSpan=2) for typeID, quantity in self.typeInfo.iteritems(): subGrid.AddCell(EveLabelMedium(text=FmtAmt(quantity, showFraction=0), align=uiconst.TORIGHT, padRight=3, color=COL_LIGHTBLUE, bold=True)) subGrid.AddCell(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessedFromType', typeName=GetTypeName(typeID)), padLeft=3)) subGrid.AddCell(EveLabelMedium(text=FmtAmt(self.stationQty, showFraction=0), colSpan=1, align=uiconst.TORIGHT, padRight=2, color=COL_RED, bold=True)) subGrid.AddCell(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/OutputTaxHint'), colSpan=1, padLeft=2)) subGrid.AddCell(EveLabelMedium(text=FmtAmt(self.unrecoverableQty, showFraction=0), colSpan=1, align=uiconst.TORIGHT, padRight=2, color=COL_RED, bold=True)) subGrid.AddCell(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/NotRecoverableHint'), colSpan=1, padLeft=2)) subGrid.AddCell(EveLabelMedium(text=FmtAmt(self.quantity, showFraction=0), colSpan=1, align=uiconst.TORIGHT, padRight=2, color=COL_GREEN, bold=True)) subGrid.AddCell(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/TotalOutputHint'), colSpan=1, padLeft=2)) tooltipPanel.AddCell(subGrid) def Update(self, qtyInfo, fromItemIDs, fromTypeInfo): self._SetInfo(qtyInfo, fromTypeInfo) def _SetInfo(self, qtyInfo, typeInfo): self.quantity, self.stationQty, self.unrecoverableQty = qtyInfo self.typeInfo = typeInfo self._SetQtyText()
class FilterBtn(ButtonIcon): default_colorSelected = (0.5, 0.5, 0.5, 0.1) checkmarkTexturePath = 'res:/ui/Texture/classes/Fitting/checkSmall.png' def ApplyAttributes(self, attributes): attributes.args = (self, ) + attributes.args ButtonIcon.ApplyAttributes(self, attributes) self.loadingWheel = None self.menuFunc = attributes.menuFunc self.hintFunc = attributes.hintFunc self.hintLabelPath = attributes.hintLabelPath self.colorSelected = sm.GetService('uiColor').GetUIColor( uiconst.COLORTYPE_UIHILIGHT) self.checkmark = None self.buttonType = attributes.buttonType self.frame = Frame(bgParent=self, color=NOT_SELECTED_FRAME_COLOR) self.hint = self.buttonType self.btnSettingConfig = attributes.btnSettingConfig if attributes.isChecked: self.SetSelected() def OnClick(self, *args): if not self.enabled: return if self.isSelected: self.SetDeselected() else: self.SetSelected() ButtonIcon.OnClick(self, args) def SetSelected(self): ButtonIcon.SetSelected(self) self.ConstructCheckmark() self.checkmark.display = True self.frame.SetRGB(*SELECTED_FRAME_COLOR) def SetDeselected(self): ButtonIcon.SetDeselected(self) if self.checkmark: self.checkmark.display = False self.frame.SetRGB(*NOT_SELECTED_FRAME_COLOR) def ConstructCheckmark(self): if self.checkmark: return self.checkmark = Container(name='checkmark', parent=self, pos=(0, 0, 12, 12), align=uiconst.BOTTOMRIGHT, idx=0) Fill(bgParent=self.checkmark, color=self.colorSelected) Sprite(parent=self.checkmark, texturePath=self.checkmarkTexturePath, align=uiconst.CENTER, pos=(0, 0, 12, 12), state=uiconst.UI_DISABLED) def IsChecked(self): return bool(self.isSelected) def GetMenu(self): if self.menuFunc: return self.menuFunc(self) def ShowLoading(self): if not self.loadingWheel: self.loadingWheel = LoadingWheel(name='myLoadingWheel', parent=self, align=uiconst.CENTER, width=self.width * 1.5, height=self.height * 1.5, opacity=0.5) self.loadingWheel.display = True def HideLoading(self): if self.loadingWheel: self.loadingWheel.display = False def GetHint(self): if self.hintFunc: return self.hintFunc(self) return GetByLabel(self.hintLabelPath)