def BuildTopParentUI(self): self.sr.topParent.padding = (2 * const.defaultPadding, 0, 2 * const.defaultPadding, 0) self.shipIcon = Icon(name='shipIcon', parent=self.sr.topParent, state=uiconst.UI_NORMAL, size=64, ignoreSize=True) self.shipIcon.GetDragData = self.GetFittingDragData self.shipIcon.OnClick = self.OpenFitting self.shipIcon.hint = GetByLabel('UI/Fitting/ShowFitting') self.techSprite = Sprite(name='techIcon', parent=self.sr.topParent, align=uiconst.RELATIVE, width=16, height=16, idx=0) self.fitNameEdit = SinglelineEdit( name='fitNameEdit', parent=self.sr.topParent, left=72, width=150, maxLength=20, hint=GetByLabel('UI/Common/ShipName')) top = self.fitNameEdit.top + self.fitNameEdit.height + 5 self.shipNameLabel = EveLabelMedium(name='shipNameLabel', parent=self.sr.topParent, left=77, top=top, state=uiconst.UI_NORMAL)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.value = 0.0 iconPath = attributes.iconPath iconSize = attributes.iconSize minValue = attributes.minValue maxValue = attributes.maxValue showBG = attributes.get('showBG', True) isCompact = attributes.get('isCompact', False) self.jobData = attributes.jobData self.gauge = Gauge(parent=self, align=uiconst.TOBOTTOM, state=uiconst.UI_DISABLED, height=6, gaugeHeight=6, padTop=1, backgroundColor=(1.0, 1.0, 1.0, 0.05)) if isCompact: self.icon = None self.valueLabel = None return mainCont = Container(name='mainCont', parent=self) if showBG: self.bg = StretchSpriteHorizontal(bgParent=mainCont, texturePath='res:/UI/Texture/Classes/Industry/Center/bgMETE.png') FillThemeColored(bgParent=self, opacity=0.5) else: self.bg = None left = 8 if showBG else 2 self.icon = Sprite(name='icon', parent=mainCont, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, pos=(left, 3, self.ICONSIZE, self.ICONSIZE), texturePath=self.ICONPATH, opacity=0.6) self.valueLabel = EveLabelMediumBold(parent=mainCont, align=uiconst.TOPRIGHT, top=4, left=left) self.removeIcon = Sprite(parent=mainCont, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, texturePath='res:/ui/texture/icons/73_16_45.png', pos=(0, 0, 12, 12), color=Color.RED, hint=localization.GetByLabel('UI/Industry/PreviewModeHint')) self.removeIcon.OnClick = self.OnRemoveIconClick self.previewEdit = SinglelineEdit(name='previewEdit', parent=mainCont, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, ints=(0, self.MAXVAL), OnChange=self.OnPreviewEdit, pos=(12, 0, 34, 20)) self.errorFrame = ErrorFrame(bgParent=self, padding=(1, 1, 1, 8))
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) mainArea = self.GetMainArea() mainArea.padding = 6 self._selectedObject = None self.SetTopparentHeight(0) self._infoContainer = Container(parent=mainArea, align=uiconst.TOTOP, height=72) self.searchInput = SinglelineEdit(parent=self._infoContainer, align=uiconst.BOTTOMRIGHT, left=4, top=8, width=100, OnChange=self.OnSearchInputChange, hinttext='Search') self.searchInput.SetHistoryVisibility(False) self.searchInput.ShowClearButton() m = UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=self._infoContainer, align=uiconst.TOPRIGHT, GetUtilMenu=self.SettingMenu) self._infoLabel = Label(parent=self._infoContainer, state=uiconst.UI_DISABLED, color=(1.0, 1.0, 1.0, 0.75), left=2) self.searchResultParent = ContainerAutoSize(parent=mainArea, align=uiconst.TOTOP_NOPUSH, padding=(26, -6, 4, 0), bgColor=(0.5, 0.5, 0.5, 1)) self.attributeScroll = Scroll(parent=mainArea, align=uiconst.TOBOTTOM, name='attributeScroll') self.attributeScroll.height = min(self.height / 2, max(72, settings.user.ui.Get('uitree_attributeScroll_height', 200))) settings.user.ui.Set('uitree_attributeScroll_height', self.attributeScroll.height) self.divider = Divider(align=uiconst.TOBOTTOM, parent=mainArea, height=11, state=uiconst.UI_NORMAL) self.divider.OnChange_ = self.OnDividerMove self.divider.OnChangeStart_ = self.OnDividerMoveStart Fill(parent=self.divider, align=uiconst.CENTER, pos=(0, 0, 20, 1)) self.scroll = Scroll(parent=mainArea, name='treeScroll') self._hiliteFrame = Fill(parent=uicore.desktop, align=uiconst.ABSOLUTE, color=(0, 1, 0, 0.3), idx=0, state=uiconst.UI_DISABLED) self._selectedFrame = Frame(parent=uicore.desktop, align=uiconst.ABSOLUTE, color=(0, 1, 0, 0.3), idx=0, state=uiconst.UI_DISABLED) self.ReloadUIRoots() uthread.new(self.UpdateInfo) self._keyDownCookie = uicore.uilib.RegisterForTriuiEvents([uiconst.UI_KEYDOWN], self.OnGlobalKeyDown)
def DrawQty(self): qty = self.item.stacksize self.qtyEdit = SinglelineEdit(name='qtyEdit', parent=self.qtyCont, align=uiconst.TOTOP, top=11, padLeft=4) self.qtyEdit.IntMode(*(1, long(qty))) self.qtyEdit.SetValue(qty) self.qtyEdit.OnChange = self.OnChange self.qtyEdit.hint = GetByLabel('UI/Common/Quantity')
def BuildNumToFitUI(self): maxShipsAllowed = int( sm.GetService('machoNet').GetGlobalConfig().get( 'bulkFit_maxShips', 30)) numCont = Container(name='numCont', align=uiconst.TOTOP, height=30, padLeft=LEFT_EDGE) text = GetByLabel( 'UI/Fitting/FittingWindow/FittingManagement/NumShipsToFit') self.numToFitLabel = EveLabelLarge(name='numToFitLabel', parent=numCont, text=text, width=250, autoFitToText=True) left = self.numToFitLabel.left + self.numToFitLabel.textwidth + 10 self.numToFitEdit = SinglelineEdit(name='numToFitEdit', parent=numCont, ints=[1, maxShipsAllowed], OnChange=self.OnNumChanged, left=left, align=uiconst.CENTERLEFT) numCont.height = max(self.numToFitLabel.textheight, self.numToFitEdit.height) self.layoutGrid.AddCell(cellObject=numCont, colSpan=self.layoutGrid.columns)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.itemID = attributes.itemID self.typeID = attributes.typeID self.nameFilter = None self.stateManager = sm.GetService('godma').GetStateManager() self.SetCaption('Attribute Inspector') self.SetWndIcon(None) self.SetTopparentHeight(0) main = Container(name='main', parent=uiutil.GetChild(self, 'main'), pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) top = Container(name='top', parent=main, height=20, align=uiconst.TOTOP) Button(parent=top, label='Refresh', align=uiconst.TORIGHT, func=self.Refresh) self.input = SinglelineEdit(name='itemID', parent=top, width=-1, height=-1, align=uiconst.TOALL) self.input.readonly = not eve.session.role & ROLE_GMH self.input.OnReturn = self.Refresh self.input.SetValue(str(self.itemID)) Container(name='div', parent=main, height=5, align=uiconst.TOTOP) self.scroll = Scroll(parent=main) self.Refresh()
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnResizeable() self.controller = attributes.controller self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0, line=True) self.btnGroup.AddButton(GetByLabel(self.confirmLabelPath), self.OnConfirmClicked) self.btnGroup.AddButton(GetByLabel('UI/Commands/Cancel'), self.Cancel) self.groupNameField = SinglelineEdit(parent=self.sr.main, align=uiconst.TOTOP, label=GetByLabel( self.nameLabelPath), padding=4, top=10, maxLength=30) EveLabelSmall(name='titleHeader', parent=self.sr.main, text=GetByLabel(self.descriptionLabelPath), align=uiconst.TOTOP, top=6, padLeft=4) self.groupDescField = EditPlainText(parent=self.sr.main, padding=(4, 0, 4, 4), maxLength=200) self.PopulateFields()
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.defaultText = attributes.get('defaultText', None) self.currentText = attributes['text'] hint = attributes.get('hint', None) self.configName = attributes['configName'] self.maxLength = attributes.get('maxLength', None) self.minLength = attributes.get('minLength', None) self.editField = SinglelineEdit(name='editField', parent=self, align=uiconst.CENTERLEFT, pos=(0, 0, 100, 0), setvalue=self.currentText, OnFocusLost=self.OnEditFieldLostFocus, OnChange=self.OnEditFieldChanged, OnReturn=self.OnEditFieldLostFocus, maxLength=self.maxLength) self.editField.display = False self.textLabel = Label(name='textLabel', parent=self, left=SinglelineEdit.TEXTLEFTMARGIN + self.editField._textClipper.padLeft, state=uiconst.UI_NORMAL, maxLines=1, align=uiconst.CENTERLEFT, fontsize=self.editField.sr.text.fontsize, text=self.currentText) self.textLabel.color.SetRGBA(1.0, 1.0, 1.0, 1.0) self.textLabel.cursor = uiconst.UICURSOR_IBEAM self.editField.width = self.textLabel.textwidth + 20 self.width = self.editField.width self.height = self.editField.height self.textLabel.OnClick = self.OnLabelClicked if hint: self.textLabel.hint = hint
def CreateBuyLayout(self, offer, aurumBalance): self.buyContainer = Container(name='buyContainer', parent=self, align=uiconst.TOTOP, height=BUY_PANEL_HEIGHT) self.priceLabel = AurLabelLarge(parent=self.buyContainer, align=uiconst.TOLEFT, amount=offer.price, baseAmount=offer.basePrice, padding=(10, 7, 0, 6)) self.button = DetailButton(parent=self.buyContainer, align=uiconst.TORIGHT, left=TEXT_PADDING, padTop=8, padBottom=8) self.UpdateButton(offer.price) self.quantityEdit = SinglelineEdit( parent=self.buyContainer, integermode=True, width=40, fontsize=VGS_FONTSIZE_MEDIUM, align=uiconst.TORIGHT, left=TEXT_PADDING, padTop=6, padBottom=10, bgColor=TAG_COLOR, OnChange=self.OnQuantityChange, maxLength=2, hint=localization.GetByLabel('UI/Common/Quantity')) self.quantityEdit.IntMode(minint=QUANTITY_MIN, maxint=QUANTITY_MAX) self.quantityEdit.sr.background.Hide()
def CreateSecurityFilter(self): secCont = Container(parent=self.sr.main, height=20, padding=2, align=uiconst.TOTOP) EveLabelSmall(parent=secCont, text='Security Band:', align=uiconst.TOLEFT, padding=4) EveLabelSmall(parent=secCont, text='Min Security', align=uiconst.TOLEFT, padding=4) self.minSecEdit = SinglelineEdit(parent=secCont, name='minSec', width=30, floats=(-1.0, 1.0, 1), align=uiconst.TOLEFT, padTop=-3, setvalue='-1.0') EveLabelSmall(parent=secCont, text='Max Security', align=uiconst.TOLEFT, padding=4) self.maxSecEdit = SinglelineEdit(parent=secCont, name='maxSec', width=30, floats=(-1.0, 1.0, 1), align=uiconst.TOLEFT, padTop=-3, setvalue='1.0')
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 ApplyAttributes(self, attributes): self._ready = False self.detailsWindow = None Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(8) self.settingsContainer = Container(parent=self.sr.main, align=uiconst.TOTOP, height=16, padding=8) self.filterEdit = SinglelineEdit(parent=self.settingsContainer, align=uiconst.TOLEFT, width=150, label='Filter:', OnReturn=self.PopulateScroll) Button(parent=self.settingsContainer, label='Reset', align=uiconst.TORIGHT, func=self.Reset, padRight=8) Button(parent=self.settingsContainer, label='Refresh', align=uiconst.TORIGHT, func=self.PopulateScroll, padRight=8) self.scroll = Scroll(parent=self.sr.main, id='pythonobjectscroll', align=uiconst.TOALL) self.Reset() self._ready = True
def ConstructLayout(self): cont = uiprimitives.Container(parent=self.sr.main, align=uiconst.TOALL, pos=(const.defaultPadding, 16, const.defaultPadding, const.defaultPadding)) self.newName = SinglelineEdit(name='namePopup', parent=cont, label=self.label, setvalue=self.setvalue, align=uiconst.TOTOP, maxLength=self.maxLength, passwordCharacter=self.passwordChar, autoselect=True, OnReturn=self.Confirm) uicore.registry.SetFocus(self.newName)
def PanelCreateRoute(self, typeID, amount): cont = Container(parent=self.actionCont, pos=(0, 0, 0, 130), align=uiconst.TOTOP, state=uiconst.UI_HIDDEN) cont._OnClose = self.OnPanelCreateRouteClosed w = self.width - 5 self.sourceMaxAmount = amount self.routeMaxAmount = amount self.commodityToRoute = typeID self.commoditySourceMaxAmount = amount self.currRouteCycleTime = self.pin.GetCycleTime() resourceTxt = localization.GetByLabel( 'UI/PI/Common/ItemAmount', itemName=evetypes.GetName(typeID), amount=int(self.routeMaxAmount)) CaptionAndSubtext( parent=cont, caption=localization.GetByLabel('UI/PI/Common/CommodityToRoute'), subtext=resourceTxt, iconTypeID=typeID, top=0, width=w) CaptionAndSubtext( parent=cont, caption=localization.GetByLabel('UI/PI/Common/QtyAmount'), width=w, top=30, state=uiconst.UI_DISABLED) self.routeAmountEdit = SinglelineEdit( name='routeAmountEdit', parent=cont, setvalue=self.routeMaxAmount, height=14, width=56, align=uiconst.TOPLEFT, top=44, ints=(0, self.routeMaxAmount), OnChange=self.OnRouteAmountEditChanged) self.routeAmountText = EveLabelSmall(parent=cont, left=60, top=46, state=uiconst.UI_NORMAL) self.routeDestText = CaptionAndSubtext( parent=cont, caption=localization.GetByLabel('UI/Common/Destination'), top=70, width=w) btns = [[ localization.GetByLabel('UI/PI/Common/CreateRoute'), self.SubmitRoute, () ]] self.createRouteButton = ButtonGroup(btns=btns, parent=cont, line=False, alwaysLite=True) self.UpdatePanelCreateRoute() return cont
def DrawPrice(self): self.priceEdit = SinglelineEdit(name='priceEdit', parent=self.priceCont, align=uiconst.TOTOP, top=11, padLeft=8) self.priceEdit.FloatMode(*(0.01, 9223372036854.0, 2)) self.priceEdit.SetValue(self.bestPrice) self.priceEdit.OnChange = self.OnChange self.priceEdit.hint = GetByLabel('UI/Market/MarketQuote/AskPrice')
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.title = attributes.title self.channelID = attributes.channelID self.channelName = attributes.channelName self.displayName = attributes.displayName self.SetMinSize([250, 250]) self.SetCaption(localization.GetByLabel('UI/Menusvc/PasswordRequired')) self.SetTopparentHeight(0) self.tries = 0 settings.user.ui.Set('%sPassword' % self.channelName, '') parentGrid = LayoutGrid(parent=self.sr.main, columns=1, state=uiconst.UI_PICKCHILDREN, align=uiconst.TOPLEFT, left=10, top=4) topLabel = EveLabelMedium(text=attributes.title, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, width=300) parentGrid.AddCell(cellObject=topLabel) passwordLabel = localization.GetByLabel( 'UI/Menusvc/PleaseEnterPassword') self.passwordLabel = EveLabelMedium(text=passwordLabel, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, padTop=10) parentGrid.AddCell(cellObject=self.passwordLabel) self.passwordEdit = SinglelineEdit(name='passwordEdit', align=uiconst.TOTOP, passwordCharacter=u'\u2022', top=4) parentGrid.AddCell(cellObject=self.passwordEdit) savePasswordLabel = localization.GetByLabel('UI/Chat/SavePassword') self.rememberPwdCb = Checkbox(text=savePasswordLabel, configName='rememberPwdCb', retval=1, checked=0, groupname=None, align=uiconst.TOTOP) parentGrid.AddCell(cellObject=self.rememberPwdCb) parentGrid.RefreshGridLayout() self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0) self.btnGroup.AddButton( localization.GetByLabel('UI/Chat/ChannelWindow/JoinChannel'), self.TryPassword, ()) self.btnGroup.AddButton(localization.GetByLabel('UI/Common/Cancel'), self.Close, ()) self.height = self.btnGroup.height + parentGrid.height + self.sr.headerParent.height + parentGrid.top + 10 self.width = parentGrid.width + 2 * parentGrid.left self.MakeUnResizeable() self.MakeUnMinimizable() self.MakeUncollapseable()
def ApplyAttributes(self, attributes): self._ready = False Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(8) self.settingsContainer = Container(parent=self.sr.main, align=uiconst.TOTOP, height=16, padding=8) self.filterEdit = SinglelineEdit(parent=self.settingsContainer, align=uiconst.TOLEFT, width=150, label='Filter:') Button(parent=self.settingsContainer, label='Reset', align=uiconst.TORIGHT, func=self.Reset, padRight=8) self.scroll = Scroll(parent=self.sr.main, id='livecountscroll', align=uiconst.TOALL) self.Reset() self._ready = True uthread2.StartTasklet(self.Refresh)
def SetCategories(self, categories): logger.debug('SetCategories %s', categories) self.categoryContainer.Flush() searchContainer = Container(name='SearchBox', parent=self.categoryContainer, width=SEARCH_BOX_WIDTH, align=uiconst.TORIGHT) categoryButtonsContainer = GridContainer(name='ButtonGrid', parent=self.categoryContainer, align=uiconst.TOALL, columns=len(categories), lines=1) tagById = self.store.GetTags() self.categoryButtons = [] for category in categories: button = CategoryButton(parent=categoryButtonsContainer, categoryId=category.id, label=category.name, align=uiconst.TOALL, onClick=self.OnClickCategory, padRight=1) self.categoryButtons.append(button) tags = [] for tagId in category.tagIds: tag = tagById.get(tagId) if tag: tags.append(Tag(tag.id, tag.name)) self.tagsByCategoryId[category.id] = tags iconContainer = Container(name='SearchIconContainer', parent=searchContainer, width=CATEGORIES_HEIGHT, align=uiconst.TOLEFT, bgColor=CATEGORY_COLOR) Sprite(parent=iconContainer, texturePath='res:/UI/Texture/Vgs/Search_icon.png', width=32, height=32, align=uiconst.CENTER) self.searchEdit = SinglelineEdit(parent=searchContainer, align=uiconst.TORIGHT, pos=(0, 0, SEARCH_BOX_WIDTH - CATEGORIES_HEIGHT - 2, 0), fontsize=16, padding=(1, 0, 0, 0), OnChange=self.Search, bgColor=TAG_COLOR) self.searchEdit.ShowClearButton( icon='res:/UI/Texture/Icons/73_16_45.png') self.searchEdit.SetHistoryVisibility(False) self.searchEdit.sr.background.Hide()
class NamePopupWnd(Window): __guid__ = 'form.NamePopupWnd' default_width = 240 default_height = 90 default_minSize = (default_width, default_height) default_windowID = 'setNewName' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.DefineButtons(uiconst.OKCANCEL, okFunc=self.Confirm, cancelFunc=self.Cancel) caption = attributes.get('caption', localization.GetByLabel('UI/Common/Name/TypeInName')) if caption is None: caption = localization.GetByLabel('UI/Common/Name/TypeInName') self.SetCaption(caption) self.SetTopparentHeight(0) self.MakeUnResizeable() self.label = attributes.get('label', localization.GetByLabel('UI/Common/Name/TypeInName')) if self.label is None: self.label = localization.GetByLabel('UI/Common/Name/TypeInName') self.setvalue = attributes.get('setvalue', '') self.maxLength = attributes.get('maxLength', None) self.passwordChar = attributes.get('passwordChar', None) self.funcValidator = attributes.validator or self.CheckName self.ConstructLayout() def ConstructLayout(self): cont = uiprimitives.Container(parent=self.sr.main, align=uiconst.TOALL, pos=(const.defaultPadding, 16, const.defaultPadding, const.defaultPadding)) self.newName = SinglelineEdit(name='namePopup', parent=cont, label=self.label, setvalue=self.setvalue, align=uiconst.TOTOP, maxLength=self.maxLength, passwordCharacter=self.passwordChar, autoselect=True, OnReturn=self.Confirm) uicore.registry.SetFocus(self.newName) def CheckName(self, name, *args): name = self.newName.GetValue() if not len(name) or len(name) and len(name.strip()) < 1: return localization.GetByLabel('UI/Common/PleaseTypeSomething') def Confirm(self, *args): if not hasattr(self, 'newName'): return newName = self.newName.GetValue() error = self.funcValidator(newName) if error: eve.Message('CustomInfo', {'info': error}) else: self.result = newName self.SetModalResult(1) def Cancel(self, *args): self.result = None self.SetModalResult(0)
def ConstructLayout(self, oldSetupName): cont = uicontrols.ContainerAutoSize(parent=self.sr.main, align=uiconst.TOTOP, padding=(const.defaultPadding, 0, const.defaultPadding, const.defaultPadding), alignMode=uiconst.TOTOP) if oldSetupName: label = localization.GetByLabel( 'UI/Fleet/FleetWindow/StoreFleetSetupTextWithLastLoaded', oldFleetSetupName=oldSetupName) else: label = localization.GetByLabel( 'UI/Fleet/FleetWindow/StoreFleetSetupText') nameLabel = uicontrols.EveLabelSmall(parent=cont, name='nameLabel', align=uiconst.TOTOP, text=label, padLeft=6) self.newName = SinglelineEdit(name='namePopup', parent=cont, align=uiconst.TOTOP, maxLength=self.maxLength, OnReturn=self.Confirm, padLeft=6) motdText = localization.GetByLabel('UI/Fleet/FleetWindow/IncludeMotd') self.motdCb = uicontrols.Checkbox(text=motdText, parent=cont, configName='motdCb', checked=False, padLeft=6, align=uiconst.TOTOP) voiceText = localization.GetByLabel( 'UI/Fleet/FleetWindow/IncludeVoiceEnabledSetting') self.voiceCb = uicontrols.Checkbox(text=voiceText, parent=cont, configName='voiceCb', checked=False, padLeft=6, align=uiconst.TOTOP) freeMoveText = localization.GetByLabel( 'UI/Fleet/FleetWindow/IncludeFreeMoveSetting') self.freeMoveCb = uicontrols.Checkbox(text=freeMoveText, parent=cont, configName='freeMoveCb', checked=False, padLeft=6, align=uiconst.TOTOP) cw, ch = cont.GetAbsoluteSize() self.height = ch + 50 uicore.registry.SetFocus(self.newName)
def ApplyAttributes(self, attributes): SinglelineEdit.ApplyAttributes(self, attributes) self.OnChange = self.OnSearchInputChange self.GetSearchEntries = attributes.GetSearchEntries self.OnSearchEntrySelected = attributes.OnSearchEntrySelected self.CloseMenuCallback = attributes.OnResultMenuClosed uicore.uilib.RegisterForTriuiEvents([uiconst.UI_MOUSEDOWN], self.OnGlobalMouseDown)
def Close(self, *args, **kwds): self.OnSearchEntrySelected = None self.GetSearchEntries = None self.OnInsert = None self.searchThread = None self.CloseResultMenu() SinglelineEdit.Close(self, *args, **kwds)
class MethodCallsMonitor(Window): default_caption = 'Method Calls' default_windowID = 'methodcalls' default_minSize = (400, 300) refreshDelay = 0.5 def ApplyAttributes(self, attributes): self._ready = False Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(4) self.settingsContainer = Container(parent=self.sr.main, align=uiconst.TOTOP, height=16, padding=8) self.filterEdit = SinglelineEdit(parent=self.settingsContainer, align=uiconst.TOLEFT, width=150, label='Filter:') Button(parent=self.settingsContainer, label='Reset', align=uiconst.TORIGHT, func=self.Reset) self.scroll = Scroll(parent=self.sr.main, id='methodcallsscroll', align=uiconst.TOALL) self.Reset() self._ready = True uthread2.StartTasklet(self.Refresh) def Reset(self, *args): self.filterEdit.SetText('') self.PopulateScroll() def Refresh(self): while not self.destroyed: uthread2.Sleep(self.refreshDelay) self.PopulateScroll() def PopulateScroll(self, *args): contentList = [] history = list(base.methodCallHistory) history.reverse() filter = self.filterEdit.text count = 0 for ct in history: method = ct[0] if filter and filter not in method.lower(): continue t = ct[1] label = '%s<t>%s<t>%s' % (method, util.FmtDate( t, 'nl'), ct[2] / const.MSEC) contentList.append( ScrollEntryNode(decoClass=SE_GenericCore, label=label)) count += 1 if count == 100: break self.scroll.Load(contentList=contentList, headers=['method', 'time', 'ms'])
def CreateShipSelector(self): cont = Container(parent=self.sr.main, name='ship_options', align=uiconst.TOTOP, height=20) self.spawnShipCheckbox = Checkbox(parent=cont, align=uiconst.TOLEFT, text='Spawn new ship', checked=False, padLeft=8, callback=self.OnChangeSpawnShip, width=150) Container(parent=cont, width=16, align=uiconst.TOLEFT) EveLabelSmall(parent=cont, text='DNA', align=uiconst.TOLEFT, padding=4) self.dnaEdit = SinglelineEdit(parent=cont, setvalue='DNA:593:2528:20197', align=uiconst.TOLEFT, width=200)
def AddToLocationCont(self): self.locationCont.height = 28 self.orderMultiplierEdit = SinglelineEdit( name='orderMultiplierEdit', parent=self.locationCont, align=uiconst.TOPRIGHT, label=GetByLabel('UI/Market/MarketQuote/NumberOfOrders'), adjustWidth=True, ints=[1, 1000], left=const.defaultPadding, OnChange=self.OnMultiplierEditChange) self.stationCombo = Combo( parent=self.locationCont, callback=self.OnStationChanged, left=const.defaultPadding, width=200, noChoiceLabel=GetByLabel( 'UI/Market/MarketQuote/NotStationsAvailable')) self.LoadStationOptions()
def OnKeyDown(self, vkey, flag): if vkey in (uiconst.VK_DOWN, uiconst.VK_UP): if self.searchResultMenu: searchResultMenu = self.searchResultMenu() if searchResultMenu and not searchResultMenu.destroyed: if vkey == uiconst.VK_UP: searchResultMenu.searchScroll.OnUp() else: searchResultMenu.searchScroll.OnDown() SinglelineEdit.OnKeyDown(self, vkey, flag)
def CreateSystemPass(self, passNumber): def GetLocationsMenu(menuParent): passConfig = GetPassConfig()[passNumber] menuParent.AddHeader(text='Locations to visit') for groupId in (const.groupAsteroidBelt, const.groupStargate, const.groupStation): menuParent.AddCheckBox( text=cfg.invgroups.Get(groupId).groupName, checked=groupId in passConfig['locations'], callback=(ToggleLocationGroupForPass, passNumber, groupId)) menuParent.AddDivider() menuParent.AddHeader(text='Actions') menuParent.AddCheckBox(text='Nuke location', checked=passConfig['nuke'], callback=(ToggleNuke, passNumber)) passConfig = { 'locations': {const.groupAsteroidBelt}, 'nuke': False, 'enabled': passNumber == 1, 'minTime': 1 } GetPassConfig()[passNumber] = passConfig menuCont = Container(name='pass%d' % passNumber, parent=self.sr.main, align=uiconst.TOTOP, height=20, padLeft=4) cont = Container(parent=menuCont, width=100, align=uiconst.TOLEFT) Checkbox(parent=cont, text='Enable Pass %s' % passNumber, align=uiconst.CENTERLEFT, checked=passConfig['enabled'], callback=lambda checkbox: SetPass(checkbox, passNumber), width=200) cont = Container(parent=menuCont, width=100, align=uiconst.TOLEFT) EveLabelSmall(parent=cont, text='Min time (sec)', align=uiconst.CENTERRIGHT, left=4) SinglelineEdit( parent=menuCont, ints=(1, 999), OnChange=lambda textValue: SetPassMinTime(textValue, passNumber), setvalue=passConfig['minTime'], align=uiconst.TOLEFT, width=50) UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=menuCont, align=uiconst.TOLEFT, GetUtilMenu=GetLocationsMenu, label='Options', texturePath='res:/UI/Texture/Icons/38_16_229.png', closeTexturePath='res:/UI/Texture/Icons/38_16_230.png')
class NameAndDescBaseWnd(Window): default_name = 'nameAndDescBaseWnd' default_windowID = 'NameAndDescBaseWnd' default_width = 200 default_height = 200 default_topParentHeight = 0 confirmLabelPath = '' nameLabelPath = '' descriptionLabelPath = '' def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnResizeable() self.controller = attributes.controller self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0, line=True) self.btnGroup.AddButton(GetByLabel(self.confirmLabelPath), self.OnConfirmClicked) self.btnGroup.AddButton(GetByLabel('UI/Commands/Cancel'), self.Cancel) self.groupNameField = SinglelineEdit(parent=self.sr.main, align=uiconst.TOTOP, label=GetByLabel( self.nameLabelPath), padding=4, top=10, maxLength=30) EveLabelSmall(name='titleHeader', parent=self.sr.main, text=GetByLabel(self.descriptionLabelPath), align=uiconst.TOTOP, top=6, padLeft=4) self.groupDescField = EditPlainText(parent=self.sr.main, padding=(4, 0, 4, 4), maxLength=200) self.PopulateFields() def PopulateFields(self): pass def OnConfirmClicked(self, *args): name = self.groupNameField.GetValue().strip() desc = self.groupDescField.GetValue().strip() if name: self.Confirm(name, desc) self.CloseByUser() else: uicore.Message('uiwarning03') def Confirm(self, name, desc): pass def Cancel(self, *args): self.CloseByUser()
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.controller = attributes.controller searchWidth, rotation = self.GetWidthAndRotation() texturePath = 'res:/UI/Texture/WindowIcons/peopleandplaces.png' searchIconHint = GetByLabel( 'UI/Structures/AccessGroups/SearchButtonHint') self.searchIcon = ButtonIcon(name='searchIcon', parent=self, align=uiconst.CENTERRIGHT, pos=(2, 0, 24, 24), iconSize=24, texturePath=texturePath, func=self.OnSearchBtnClicked, hint=searchIconHint) arrowTexturePath = 'res:/UI/Texture/Icons/1_16_99.png' self.arrowCont = Transform(name='arrowCont', parent=self, pos=(24, 0, 16, 16), align=uiconst.CENTERRIGHT, rotation=rotation) self.expandArrow = ButtonIcon(name='expandArrow', parent=self.arrowCont, pos=(0, 0, 16, 16), iconSize=16, texturePath=arrowTexturePath, func=self.OnExpanderClicked) hintText = GetByLabel('UI/Structures/AccessGroups/SearchFieldHint') self.searchField = SinglelineEdit(parent=self, align=uiconst.CENTERRIGHT, pos=(40, 0, searchWidth, 0), OnReturn=self.DoSearch, hinttext=hintText, isCharCorpOrAllianceField=True) self.searchField.OnClearButtonClick = self.OnClearingSearchField self.searchField.ShowClearButton(hint=GetByLabel('UI/Inventory/Clear')) self.memberNamesByMemberID = {} self.height = max(self.searchField.height, self.searchIcon.height) self.width = self.searchField.left + EXPANDED_SEARCH_WIDTH + 10
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.label = EveLabelSmall(text=attributes.text, parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT, width=LABELWIDTH) self.edit = SinglelineEdit(name='passwordEdit', parent=self, maxLength=64, align=uiconst.TOLEFT, padLeft=LABELWIDTH, width=140, setvalue=attributes.value, OnReturn=attributes.OnReturn, OnChange=attributes.OnChange, OnSetFocus=attributes.OnSetFocus) self.incorrectFill = GradientSprite(bgParent=self.edit, opacity=0.0, rgbData=[(0, (0.55, 0.0, 0.0))], alphaData=[(0, 0.5), (0.949, 0.75), (0.95, 1.0), (1.0, 1.0)])