def ApplyAttributes(self, attributes): SE_BaseClassCore.ApplyAttributes(self, attributes) left = Container(parent=self, align=uiconst.TOLEFT_PROP, width=0.5) right = Container(parent=self, align=uiconst.TOALL) self.label = Label(parent=left) self.value = Label(parent=right, autoUpdate=True) self.GetValue = None
def _construct_float_news_label(self): self.season_floating_news_content_container.Flush() self.floating_news_label = Label( name='floating_news_label', parent=self.season_floating_news_content_container, align=uiconst.CENTERLEFT) self.floating_news_label.color = FLOATING_NEWS_COLOR
def AddRow(self, idx): labelPath, what, iconNo, labelHintPath = rowsInfo[idx] rowName = 'row_%s' % what row = Container(name='row_%s' % rowName, parent=self, align=uiconst.TOTOP, height=32) mainIcon = Icon(icon=iconNo, parent=row, pos=(0, 0, 32, 32), ignoreSize=True) mainIcon.hint = GetByLabel(labelPath) statusLabel = Label(text='', parent=row, left=mainIcon.left + mainIcon.width, state=uiconst.UI_NORMAL, align=uiconst.CENTERLEFT, width=62) statusLabel.hint = GetByLabel(labelHintPath) self.statsLabelsByIdentifier[what] = statusLabel dmgContainer = Container(parent=row, name='dmgContainer', left=self.col1Width) gaugeCont = DamageGaugeContainerFitting(parent=dmgContainer) self.statsContsByIdentifier[what] = gaugeCont
def Prepare_Text_(self): uiAlignment = self.GetUIAlignment(self.currentTextAlignment) notificationFontSize = settings.user.ui.Get('dmgnotifictions_fontsize', 12) for i in xrange(6): name = 'L%s' % i message = Label(text='', name=name, parent=self, left=6, top=5, align=uiAlignment, state=uiconst.UI_DISABLED, fontsize=notificationFontSize, dropShadow=True) message.display = False message.msgIndex = i setattr(self, 'message%s' % i, message) self.allLabels.append(message)
def SearchTree(self): self.searchThread = None self.filterString = self.searchInput.GetValue() if not self.filterString: self.searchResultParent.Hide() self.searchResultParent.Flush() return self.searchResultParent.Flush() res = [] searchFor = self.filterString.lower() def Crawl(obj, path): if obj is self: return if searchFor in obj.name.lower(): if path: res.append((obj, path + '/ <b>' + obj.name + '</b>')) else: res.append((obj, '<b>' + obj.name + '</b>')) if hasattr(obj, 'children'): for each in obj.children: if path: Crawl(each, path + '/' + obj.name) else: Crawl(each, obj.name) for root in uicore.uilib.rootObjects: Crawl(root, '') if res: for obj, path in res[:20]: label = Label(parent=self.searchResultParent, align=uiconst.TOTOP, text=path, state=uiconst.UI_NORMAL, padding=(10, 2, 10, 2)) label._searchObj = obj label.hint = path label.OnClick = (self.OnSearchResultClick, obj) if len(res) > 20: Label(parent=self.searchResultParent, align=uiconst.TOTOP, text='and even more... (%s found)' % len(res), padding=(10, 2, 10, 2)) else: Label(parent=self.searchResultParent, align=uiconst.TOTOP, text='No Match!', padding=(10, 3, 10, 3)) self.searchResultParent.Show()
def ApplyAttributes(self, attributes): LayoutGrid.ApplyAttributes(self, attributes) self.activityType = None self.jobData = None self.countCaption = Label(color=Color.GRAY, fontsize=10, top=2) self.AddCell(self.countCaption, cellPadding=(0, 0, 5, 0)) self.countLabel = Label() cell = self.AddCell(self.countLabel, cellPadding=(5, 0, 5, 3)) self.slotsErrorFrame = ErrorFrame(parent=cell, align=uiconst.TOALL, state=uiconst.UI_DISABLED, padBottom=3) label = Label(text=localization.GetByLabel('UI/Industry/ControlRange'), color=Color.GRAY, fontsize=10, top=2) self.AddCell(label, cellPadding=(0, 0, 5, 0)) self.rangeLabel = Label() cell = self.AddCell(self.rangeLabel, cellPadding=(5, 0, 5, 0)) self.rangeErrorFrame = ErrorFrame(parent=cell, align=uiconst.TOALL, state=uiconst.UI_DISABLED)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) Sprite( parent=self, align=uiconst.TOLEFT, width=259, texturePath='res:/UI/Texture/classes/shipTree/frame/bottomLeft.png' ) cont = ContainerAutoSize(parent=self, align=uiconst.TOLEFT, padLeft=4) Label(parent=cont, align=uiconst.TOPLEFT, text=GetByLabel('UI/ShipTree/Showing'), uppercase=True, top=38, fontsize=9, color=COLOR_FONT) Label(parent=self, text='V1.%s.%s' % (len(cfg.shiptypes), macho.version), uppercase=True, top=43, left=82, fontsize=10, color=COLOR_FONT) Label(parent=cont, align=uiconst.TOPLEFT, text=GetByLabel('UI/ShipTree/MilitaryAndIndustrialVessels'), uppercase=True, top=49, fontsize=9, color=COLOR_FONT) self.AddSeperator(uiconst.TOLEFT) self.AddSeperator(uiconst.TORIGHT) Label(parent=ContainerAutoSize(align=uiconst.TORIGHT, parent=self, padLeft=4), align=uiconst.TOPLEFT, text=GetByLabel('UI/ShipTree/CourtesyLabel'), uppercase=True, top=49, fontsize=9, color=COLOR_FONT) self.AddSeperator(uiconst.TORIGHT) StretchSpriteHorizontal( parent=Container(parent=self, padding=(4, 0, 4, 0)), align=uiconst.TOBOTTOM, texturePath='res:/UI/Texture/classes/ShipTree/frame/bottomLine.png', leftEdgeSize=20, rightEdgeSize=20, height=2)
def PopulateJumpColumns(self): self.jumpColumn.Flush() text = self.controller.GetNumJumps() Label(parent=self.jumpColumn, text=text, align=uiconst.CENTERLEFT, left=6)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetWndIcon(None) self.SetCaption('Window manager') self.SetTopparentHeight(10) self.SetMinSize([360, 220]) options = [] for wndCls in Window.__subclasses__(): options.append((wndCls.__name__, wndCls)) options.sort() topCont = Container(name='params', parent=self.sr.main, align=uiconst.TOTOP, pad=(5, 5, 5, 5), pos=(0, 10, 0, 30)) self.mainCont = Container(name='params', parent=self.sr.main, align=uiconst.TOTOP, pos=(0, 0, 0, 50), padding=(5, 15, 5, 5)) self.extrasCont = Container(name='params', parent=self.sr.main, align=uiconst.TOALL, padding=(5, 15, 5, 5)) self.combo = Combo(parent=topCont, label='Select window', options=options, name='', select=settings.user.ui.Get('windowManagerOpenWindow'), callback=self.OnComboChanged, pos=(5, 0, 0, 0), width=150, align=uiconst.TOPLEFT) self.startupArgs = SinglelineEdit(name='', label='attributes', parent=topCont, setvalue='', align=uiconst.TOPLEFT, left=165, width=100) Button(parent=topCont, label='Load', align=uiconst.RELATIVE, func=self.OpenWindow, pos=(300, 0, 0, 0)) self.filenameEdit = SinglelineEdit(name='', label='Location', parent=self.mainCont, setvalue='', align=uiconst.TOTOP, top=15, readonly=True) Label(text='RELOAD', parent=self.extrasCont, top=10, state=uiconst.UI_NORMAL) Line(parent=self.extrasCont, align=uiconst.TOTOP) buttonCont = Container(name='buttonCont', parent=self.extrasCont, align=uiconst.TOTOP, pos=(0, 30, 0, 30)) Button(parent=buttonCont, label='ShipUI', align=uiconst.TOLEFT, func=self.ReloadShipUI) Button(parent=buttonCont, label='NEOCOM', align=uiconst.TOLEFT, func=self.ReloadNeocom, padLeft=1) Button(parent=buttonCont, label='Info Panels', align=uiconst.TOLEFT, func=self.ReloadInfoPanels, padLeft=1) Button(parent=buttonCont, label='Lobby', align=uiconst.TOLEFT, func=self.ReloadLobby, padLeft=1) Button(parent=buttonCont, label='Overview', align=uiconst.TOLEFT, func=self.ReloadOverview, padLeft=1) Button(parent=buttonCont, label='Mapbrowser', align=uiconst.TOLEFT, func=self.ReloadMapBrowser, padLeft=1) self.UpdateInfo(self.combo.GetKey(), self.combo.GetValue())
def AddAttributeIcons(self, data): rowCont = Container(parent=self, align=uiconst.TOTOP, padTop=3) labelCont = Container(parent=rowCont, align=uiconst.TOPLEFT, height=TraitAttributeIcon.default_height, width=40) text = localization.GetByLabel( 'UI/InfoWindow/TraitWithoutNumber', color=util.Color.RGBtoHex(*COLOR_TEXT_HILITE), bonusText='') label = Label(parent=labelCont, text=text, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, color=COLOR_TEXT, tabs=(40, ), tabMargin=3) iconCont = FlowContainer(parent=rowCont, align=uiconst.TOTOP, padLeft=43, contentSpacing=(1, 1), autoHeight=True) old_OnSizeChange_NoBlock = iconCont._OnSizeChange_NoBlock def OnSizeChange_NoBlock_Hook(newWidth, newHeight): old_OnSizeChange_NoBlock(newWidth, newHeight) rowCont.height = newHeight iconCont._OnSizeChange_NoBlock = OnSizeChange_NoBlock_Hook for _, attributeID in data.iteritems(): TraitAttributeIcon(parent=iconCont, align=uiconst.NOALIGN, attributeID=attributeID)
def ApplyAttributes(self, attributes): InfoBubble.ApplyAttributes(self, attributes) self.typeID = attributes.typeID self.caption.text = cfg.invtypes.Get(self.typeID).name self.icon = Icon(name='icon', parent=self.iconCont, pos=(0, 0, 80, 80), typeID=self.typeID, ignoreSize=True, cursor=uiconst.UICURSOR_MAGNIFIER) self.icon.OnClick = self.OnIconClicked fsdType = cfg.fsdTypeOverrides.Get(self.typeID) if hasattr(fsdType, 'infoBubbleTypeElement'): self.ConstructElements(fsdType.infoBubbleTypeElement) isTrialRestricted = sm.GetService('skills').IsTrialRestricted( self.typeID) if isTrialRestricted: TrialRestrictionButton(parent=self.mainContent, align=uiconst.TOTOP, padding=(0, 8, 0, 8), callback=self.OpenSubscriptionPage, message='UI/ShipTree/ShipTrialRestricted') TraitsContainer(parent=self.mainContent, typeID=self.typeID) price = cfg.invtypes.Get(self.typeID).averagePrice or 0 text = GetByLabel('UI/Inventory/EstIskPrice', iskString=FmtISKAndRound(price, False)) Label(parent=self.topRightCont, text=text, align=uiconst.TOTOP, padTop=7) uicore.animations.FadeTo(self.icon, 1.5, 1.0, duration=0.6) self.AnimShow() sm.GetService('shipTree').LogIGS('HoverType')
def DrawItem(self): iconCont = Container(parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) self.iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTERLEFT, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=self.iconInnerCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=self.iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) self.icon = Icon(parent=self.iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, ignoreSize=True, pos=(0, 0, 32, 32)) GetTechLevelIcon(self.techIcon, 1, self.typeID) itemName = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=self.itemName, info=('showinfo', self.typeID, self.item.itemID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self._value = attributes.value self._propertyName = attributes.propertyName self._propertyIndex = attributes.propertyIndex self._uiObject = attributes.uiObject self._editType = type(self._value) self._label = Label(parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT, color=(1.0, 1.0, 1.0, 0.75), text=str(self._value)) if self._propertyName in COMBOPROPERTIES: self._label.text = COMBOPROPERTIES[self._propertyName].get( self._value, 'Unknown value!') self.expandOnLeft = True self.GetMenu = self.GetComboOptions elif self._editType == float: self.hint = 'MouseDown and Drag to change value<br>ALT for 1/100, ALT-SHIFT for 1/1000' if -1 <= self._value <= 1: self._label.text = '%.3f' % self._value elif self._editType == int: self.hint = 'MouseDown and Drag to change value' elif self._editType == type: try: text = repr(self._value).replace("<class '", '').replace("'>", '') self._label.text = text print 'text', type(self._value), text except: pass self.UpdateSize()
def LoadLargeText(self, text, *args, **kwargs): label = Label(parent=self.mainContent, text=text, align=uiconst.TOTOP, fontsize=18, color=(1, 1, 1, 1), **kwargs)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(0) optionsContainer = Container(parent=self.sr.main, align=uiconst.TOBOTTOM, height=24, padding=4) Label(parent=optionsContainer, text='<b>Threshold:</b>', align=uiconst.TOLEFT, padLeft=10, padTop=1) for text, value in OPTIONS: isChecked = blue.logInMemory.threshold == value Checkbox(parent=optionsContainer, text=text, groupname='threshold', align=uiconst.TOLEFT, width=100, checked=isChecked, callback=self.OnLogThresholdRadioButtons, retval=value) ButtonGroup(parent=optionsContainer, line=False, btns=[['Copy', self.ExportLogInMemory, (), 51], ['Attach', self.AttachToLogServer, (), 51], ['Save', self.SaveLogsToFile, (), 51]]) self.scroll = Scroll(parent=self.sr.main, id='logviewerscroll', align=uiconst.TOALL) self.logSaveHandle = None self.PopulateScroll() blue.pyos.SetLogEchoFunction(blue.logInMemory.threshold, self._log_echo)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.streamBtn = None self.topCont = ContainerAutoSize(name='topCont', parent=self.sr.main, align=uiconst.TOTOP, padding=(10, 10, 10, 0)) self.loginCont = Container(name='loginCont', parent=self.sr.main, align=uiconst.TOTOP, height=120, padding=5) self.settingsCont = ContainerAutoSize(name='settingsCont', parent=self.sr.main, align=uiconst.TOTOP, padding=5) self.ConstructTopCont() self.ConstructLoginCont() self.ConstructSettingsCont() self.ConstructBottomButtons() self.bottomGradient = GradientSprite(bgParent=self.btnGroup, rotation=-pi / 2, rgbData=[(0, (0.3, 0.3, 0.3))], alphaData=[(0, 0.3), (0.9, 0.0)]) self.UpdateState() self.CheckEnableStreamBtn() if bool(session.role & ROLE_PROGRAMMER): self.debugLabel = Label(parent=self.topCont, align=uiconst.TOPLEFT, top=120)
def EnterDragMode(self, *args): for label in self.allLabels: if label.display and label.opacity > 0.05: break else: uiAlignment = self.GetUIAlignment(self.currentTextAlignment) self.fakeText = Label(text='', name='faketext', parent=self, left=6, top=5, align=uiAlignment, state=uiconst.UI_DISABLED, fontsize=12, width=380) text = localization.GetByLabel('UI/Accessories/Log/ExampleText') self.fakeText.text = '<%s>%s' % (self.currentTextAlignment, text) self.fakeText.cleanText = text self.height = self.fakeText.textheight + 20 self.width = 400 self.border = Frame(parent=self, frameConst=uiconst.FRAME_BORDER1_CORNER5, state=uiconst.UI_DISABLED, color=(1.0, 1.0, 1.0, 0.25), top=-5) MessageParentClass.EnterDragMode(self, *args) self.dragFill.top = -5 self.exitMoveModeBtn.top = -5 self.SetParent(uicore.layer.abovemain)
def CreateInfoBox(self, upperText, lowerText, upperSize, lowerSize): textLayer = Container(name='TextLayer', parent=self, align=uiconst.TOALL) infoBox = ContainerAutoSize(name='InfoBox', parent=textLayer, align=uiconst.TOBOTTOM, height=INFO_BOX_HEIGHT, state=uiconst.UI_DISABLED, bgColor=OFFER_TEXT_BOX_COLOR) Label(parent=infoBox, align=uiconst.TOTOP, text=upperText, fontsize=upperSize, padding=(INFO_PADDING, 2, INFO_PADDING, -2), fontStyle=fontConst.STYLE_HEADER, uppercase=True, lineSpacing=-0.15) AurAmountContainer(parent=infoBox, align=uiconst.TOTOP, height=20, amount=self.offer.price, baseAmount=self.offer.basePrice, padLeft=8, padBottom=2)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.oldCamID = None self.mainCont = Container(parent=self.sr.main, padding=5) Button(parent=self.mainCont, align=uiconst.TOTOP, label='Toggle Debug Camera', func=self.ToggleDebugCam, hint=BUTTONHINT) self.atLabel = Label(parent=self.mainCont, align=uiconst.TOTOP) stateCont = Container(parent=self.mainCont, align=uiconst.TOTOP, height=20, padTop=5) self.orbitLabel = StateCont(parent=stateCont, align=uiconst.TOLEFT, text='ORBIT', padRight=2) self.zoomLabel = StateCont(parent=stateCont, align=uiconst.TOLEFT, text='ZOOM', padRight=2) self.fovZoomLabel = StateCont(parent=stateCont, align=uiconst.TOLEFT, text='FOVZOOM', padRight=2) self.panLabel = StateCont(parent=stateCont, align=uiconst.TOLEFT, text='PAN', padRight=2) self.rotateLabel = StateCont(parent=stateCont, align=uiconst.TOLEFT, text='ROTATE', padRight=2) uthread.new(self.Update)
def PopulateSecurityColumn(self): self.securityColumn.Flush() text = self.controller.GetSecurityWithColor() Label(parent=self.securityColumn, text=text, align=uiconst.CENTERLEFT, left=6)
def ConstructOutputSection(self): self.CloseOutputSection() blue.pyos.synchro.Sleep(1000) self.CloseOutputSection() self.outputSection = Container(name='outputSection', parent=self.mainContainer, align=uiconst.TOTOP_PROP, height=0.5, padding=(5, 0, 5, 0)) self.outputHeader = Container(name='outputHeader', parent=self.outputSection, align=uiconst.TOTOP, height=50) Label(parent=self.outputHeader, text=GetByLabel( 'UI/Inflight/SpaceComponents/ItemTrader/DeliveredItems', itemCount=2), fontsize=25, align=uiconst.CENTER) Line(parent=self.outputHeader, align=uiconst.TOBOTTOM) self.outputListSection = ScrollContainer(name='outputListSection', parent=self.outputSection, align=uiconst.TOTOP, height=128) self.PopulateItemsToScroll(self.outputListSection, self.itemTrader.GetOutputItems())
def PopulateProfileNameColumn(self): self.profileNameColumn.Flush() profileName = self._GetProfileName(self.slimProfileController) Label(parent=self.profileNameColumn, text=profileName, align=uiconst.CENTERLEFT, left=6)
def AddCaption(self, text): Label(parent=self, text=text, align=uiconst.TOTOP, padTop=8 if self.children else 0, bold=True, color=COLOR_CAPTION)
def ConstructLoginCont(self): Line(parent=self.loginCont, align=uiconst.TOTOP, padBottom=10, opacity=0.1) EveCaptionSmall(parent=self.loginCont, align=uiconst.TOTOP, text=GetByLabel('UI/Twitch/LoginCaption')) twitchSvc = sm.GetService('twitch') username = twitchSvc.GetUsername() if username is None or not twitchSvc.HasToken(): password = None else: password = PASSWORD_IF_HAS_TOKEN self.usernameCont = EditWithLabel(parent=self.loginCont, text=GetByLabel('UI/Login/Username'), value=username, OnChange=self.CheckEnableStreamBtn) self.passwordCont = EditWithLabel(parent=self.loginCont, text=GetByLabel('UI/Login/Password'), OnReturn=self.StartStream, OnChange=self.CheckEnableStreamBtn, OnSetFocus=self.OnPasswordContFocus) self.passwordCont.edit.SetPasswordChar(u'\u2022') self.passwordCont.edit.SetValue(password) Label(parent=self.loginCont, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padding=(LABELWIDTH, 7, 0, 0), text=GetByLabel('UI/Twitch/SignupLink'), fontsize=10) Line(parent=self.loginCont, align=uiconst.TOBOTTOM, idx=0, opacity=0.1)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) Sprite( parent=self, align=uiconst.TOLEFT, width=126, texturePath='res:/UI/Texture/classes/shipTree/frame/topLeft.png') cont = ContainerAutoSize( parent=self, align=uiconst.TOLEFT, alignMode=uiconst.TOPLEFT, bgTexturePath='res:/UI/Texture/classes/shipTree/frame/topMiddle.png' ) Label(parent=cont, text=GetByLabel('UI/ShipTree/InterbusShipIdentificationSystem'), color=COLOR_BG, top=3, fontsize=12, uppercase=True, bold=True, padRight=4) StretchSpriteHorizontal( parent=Container(parent=self), align=uiconst.TOTOP, texturePath='res:/UI/Texture/classes/ShipTree/frame/topRight.png', leftEdgeSize=40, rightEdgeSize=5, height=26)
def AddColumnBlueprintLabel(self): col = self.AddColumnContainer() texturePath, hint = uix.GetTechLevelIconPathAndHint( self.jobData.blueprint.blueprintTypeID) if texturePath: techIconSize = 16 if self.viewMode == VIEWMODE_ICONLIST else 12 Sprite(name='techIcon', parent=col, texturePath=texturePath, hint=hint, width=techIconSize, height=techIconSize) if self.viewMode == VIEWMODE_ICONLIST: iconSize = 32 Icon(parent=col, typeID=self.jobData.blueprint.blueprintTypeID, isCopy=not self.jobData.blueprint.original, ignoreSize=True, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, width=iconSize, height=iconSize, left=2) else: iconSize = 0 Label(parent=col, text=self.jobData.blueprint.GetLabel(), align=uiconst.CENTERLEFT, left=iconSize + 4, idx=0)
def ApplyAttributes(self, attributes): BaseFramedContainer.ApplyAttributes(self, attributes) self.labelCont = Container(parent=self.contentCont, align=uiconst.CENTERLEFT, left=8, width=237, height=38) IndustryCaptionLabel(parent=self.labelCont, align=uiconst.TOTOP, text=localization.GetByLabel('UI/Industry/Facility')) self.label = Label(parent=self.labelCont, align=uiconst.TOTOP, fontsize=10) self.icon = Icon(name='installationIcon', parent=self.contentCont, align=CENTERRIGHT, state=UI_DISABLED, pos=(1, 0, 43, 42)) self.removeIcon = Sprite(parent=self.contentCont, align=uiconst.TOPRIGHT, state=uiconst.UI_DISABLED, texturePath='res:/ui/texture/icons/73_16_45.png', pos=(46, 2, 12, 12), color=Color.RED, opacity=0.0)
def AddColumnText(self, text): """ Add a standard label column """ column = self.AddColumnContainer() return Label(parent=column, text=text, align=uiconst.CENTERLEFT, left=6)
def _FormatBonusLine(self, data): colorHex = util.Color.RGBtoHex(*COLOR_TEXT_HILITE) if hasattr(data, 'bonus'): value = round(data.bonus, 1) if int(data.bonus) == data.bonus: value = int(data.bonus) text = localization.GetByLabel( 'UI/InfoWindow/TraitWithNumber', color=colorHex, value=value, unit=cfg.dgmunits.Get(data.unitID).displayName, bonusText=localization.GetByMessageID(data.nameID)) else: text = localization.GetByLabel( 'UI/InfoWindow/TraitWithoutNumber', color=colorHex, bonusText=localization.GetByMessageID(data.nameID)) Label(parent=self, text=text, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padTop=3, color=COLOR_TEXT, tabs=(40, ), tabMargin=3)
def ApplyAttributes(self, attributes): super(RenderJobProfiler, self).ApplyAttributes(attributes) self.SetCaption('Render Job Profiler') self._renderJob = None self.SetTopparentHeight(0) parent = self.GetMainArea() parent.SetAlign(uiconst.TOALL) parent.padding = 5 top = Container(parent=parent, align=uiconst.TOTOP, height=20) Label(text='Render Job', parent=top, align=uiconst.TOLEFT, padding=4) combo = Combo(parent=top, options=[(rj.name, rj) for rj in trinity.renderJobs.recurring], callback=self._OnRenderJob, align=uiconst.TOALL) bottom = Container(parent=parent, align=uiconst.TOBOTTOM, height=20, padding=2) Button(parent=bottom, align=uiconst.CENTER, label='Copy', func=self._Copy, args=()) self._scroll = Scroll(parent=parent, align=uiconst.TOALL, top=4) self._OnRenderJob(None, None, combo.selectedValue) uthread2.StartTasklet(self._UpdateTiming)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.isSelected = False self.typeID = attributes.typeID self.invType = cfg.invtypes.Get(self.typeID) typeName = self.invType.name self.quantity = attributes.quantity self.stacksize = attributes.get('stacksize', None) self.itemState = attributes.get('itemState', None) singleton = attributes.get('singleton', 0) isBlueprint = cfg.invtypes.Get(self.typeID).categoryID == const.categoryBlueprint isCopy = isBlueprint and singleton == const.singletonBlueprintCopy self.stateIcon = None self.spriteCont = self.spriteCont = Container(name='spriteCont', parent=self, align=CENTER, width=ICON_SIZE, height=ICON_SIZE, state=uiconst.UI_PICKCHILDREN) self.icon = Icon(name=typeName, parent=self.spriteCont, width=ICON_SIZE, height=ICON_SIZE, align=CENTER, state=uiconst.UI_DISABLED, saturation=1.0, effectOpacity=0.0, spriteEffect=trinity.TR2_SFX_SOFTLIGHT) self.icon.LoadIconByTypeID(typeID=self.typeID, ignoreSize=True, isCopy=isCopy) self.hint = typeName self.techIcon = Sprite(name='techIcon', parent=self.spriteCont, width=16, height=16, idx=0, saturation=1.0, effectOpacity=0.0, spriteEffect=trinity.TR2_SFX_SOFTLIGHT) uix.GetTechLevelIcon(self.techIcon, 0, self.typeID) if self.itemState: resPath, stateColor = self.GetStateResPathAndColor(self.itemState) self.stateIcon = Sprite(name='stateIcon', parent=self.spriteCont, width=32, height=32, idx=0, left=-4, top=-4, align=uiconst.TOPRIGHT, texturePath=resPath, color=stateColor, state=uiconst.UI_DISABLED) self.entryHilite = Sprite(name='hilite', align=uiconst.TOALL, parent=self.spriteCont, texturePath='res:/UI/Texture/classes/InvItem/bgHover.png', blendMode=trinity.TR2_SBM_ADD, opacity=0.0, idx=0, state=uiconst.UI_DISABLED) self.entryHilite.hint = typeName self.quantityParent = Container(parent=self, idx=0, name='qtyCont', pos=(3, 38, 32, 11), align=uiconst.TOPRIGHT, bgColor=(0, 0, 0, 0.95), state=uiconst.UI_HIDDEN) self.qtyLabel = Label(parent=self.quantityParent, left=2, maxLines=1, fontsize=9) self._SetQtyText()