def AnimateBar(self, width): width = int(max(0, width)) uiEffects = uicls.UIEffects() if self.animateThread is not None: self.animateThread.kill() self.animateThread = None uiEffects = uicls.UIEffects() self.animateThread = uiEffects.MorphUI(self.barContainer, 'width', width, ifWidthConstrain=0, time=250.0)
def ApplyAttributes(self, attributes): self.uiEffects = uicls.UIEffects() uiprimitives.Container.ApplyAttributes(self, attributes) self.value = attributes.Get('value', 0.0) self.left = attributes.Get('left', 0) self.top = attributes.Get('top', 0) self.typeID = iconTypeID = attributes.Get('iconTypeID', 6) color = planetCommon.PLANET_COLOR_USED_PROCESSOR bgColor = (255 / 255.0, 128 / 255.0, 0 / 255.0, 0.15) self.icon = uicontrols.Icon(parent=self, pos=(2, 2, 16, 16), state=uiconst.UI_DISABLED, typeID=iconTypeID, size=16, ignoreSize=True) gaugeCont = uiprimitives.Container(parent=self, pos=(0, 0, self.width, self.width), align=uiconst.TOPLEFT) self.gauge = uiprimitives.Fill(parent=gaugeCont, align=uiconst.TOLEFT, width=0, color=color, state=uiconst.UI_DISABLED) uiprimitives.Fill(parent=gaugeCont, color=bgColor, state=uiconst.UI_DISABLED) self.subText = uicontrols.Label(text='', parent=self, top=22, state=uiconst.UI_DISABLED, fontsize=10) self.busy = False self.SetValue(self.value)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.main = ContainerAutoSize(parent=self.sr.main, name='main', padding=3, state=uiconst.UI_PICKCHILDREN, align=uiconst.TOTOP, alignMode=uiconst.TOTOP) self.planetUISvc = sm.GetService('planetUI') self.planetSvc = sm.GetService('planetSvc') self.pin = attributes.Get('pin', None) self.uiEffects = uicls.UIEffects() self.showingActionContainer = False self.currentRoute = None self.showNext = None self.lastCalled = None self.commodityToRoute = None self.buttonTextValue = '' infoCont = Container(parent=self.main, name='infoCont', padding=5, align=uiconst.TOTOP, height=self.INFO_CONT_HEIGHT) self.infoContLeft = Container(name='leftCol', parent=infoCont, align=uiconst.TOLEFT_PROP, width=0.5) self.infoContRight = Container(name='rightCol', parent=infoCont, align=uiconst.TOLEFT_PROP, width=0.5) self._GetInfoCont() self._UpdateInfoCont() self.buttonCont = GridContainer(parent=self.main, name='buttonCont', height=40, align=uiconst.TOTOP, padding=(-1, 0, -1, 0)) BumpedUnderlay(bgParent=self.buttonCont) self.buttonCont.lines = 1 self.buttonCont.columns = 6 self.buttonTextCont = self._DrawAlignTopCont(22, 'buttonTextCont') self.buttonText = EveLabelSmall(parent=self.buttonTextCont, align=uiconst.CENTER, color=(1.0, 1.0, 1.0, 1.0), state=uiconst.UI_NORMAL) self.buttonTextCont.height = max(22, self.buttonText.textheight) self.actionCont = Container(parent=self.sr.main, name='actionCont', padding=(6, 0, 6, 6), clipChildren=True) self.SetCaption(self._GetPinName()) self.main.SetSizeAutomatically() self.height = self.GetBaseHeight() self.LoadActionButtons(self._GetActionButtons()) uicore.animations.FadeTo(self, 0.0, 1.0, duration=0.3) self.updateInfoContTimer = base.AutoTimer(100, self._UpdateInfoCont) sm.GetService('audio').SendUIEvent( 'wise:/msg_pi_pininteraction_open_play') self.ResizeActionCont(None)
def Selected(self): uicls.UIEffects().MorphUI(self.mainPin, 'pinRadius', RADIUS_PIN * 1.5, time=250.0, float=1, newthread=1, maxSteps=100) parent = sm.GetService('planetUI').planetUIContainer self.UIContainer = DustBasePinContainer(parent=parent, pin=self)
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) orbitalItem = attributes.get('orbitalItem') if not util.IsOrbital(orbitalItem.categoryID): raise RuntimeError( 'Cannot open an orbital configuration window for a non-orbital' ) self.locationID = orbitalItem.locationID self.orbitalID = orbitalItem.itemID self.typeID = orbitalItem.typeID self.remoteOrbitalRegistry = moniker.GetPlanetOrbitalRegistry( self.locationID) self.orbitalData = self.remoteOrbitalRegistry.GetSettingsInfo( self.orbitalID) self.selectedHour, self.taxRateValues, self.standingLevel, self.allowAlliance, self.allowStandings = self.orbitalData self.taxRates = [ util.KeyVal(key='corporation'), util.KeyVal(key='alliance'), util.KeyVal(key='standingHorrible', standing=const.contactHorribleStanding), util.KeyVal(key='standingBad', standing=const.contactBadStanding), util.KeyVal(key='standingNeutral', standing=const.contactNeutralStanding), util.KeyVal(key='standingGood', standing=const.contactGoodStanding), util.KeyVal(key='standingHigh', standing=const.contactHighStanding) ] for taxRate in self.taxRates: taxRate.value = getattr(self.taxRateValues, taxRate.key) self.variance = sm.GetService('clientDogmaStaticSvc').GetTypeAttribute( self.typeID, const.attributeReinforcementVariance) self.reinforceHours = [ ('%.2d:00 - %.2d:00' % ((x - self.variance / 3600) % 24, (x + self.variance / 3600) % 24), x) for x in xrange(0, 24) ] ballpark = sm.GetService('michelle').GetBallpark() if ballpark is not None and self.orbitalID in ballpark.slimItems: planetName = cfg.evelocations.Get( ballpark.slimItems[self.orbitalID].planetID).name caption = localization.GetByLabel( 'UI/PI/Common/PlanetaryCustomsOfficeName', planetName=planetName) else: caption = localization.GetByLabel( 'UI/DustLink/OrbitalConfiguration') self.effects = uicls.UIEffects() self.scope = 'inflight' self.SetWndIcon(self.iconNum, size=32) self.SetMinSize([self.WIDTH_COLLAPSED, self.HEIGHT]) self.SetCaption(caption) self.MakeUnResizeable() self.Layout() self.Redraw()
def Unselected(self): uicls.UIEffects().MorphUI(self.mainPin, 'pinRadius', RADIUS_PIN, time=250.0, float=1, newthread=1, maxSteps=100) if self.UIContainer: sm.GetService('planetUI').planetUIContainer.children.remove( self.UIContainer)
def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) color = attributes.Get('color', util.Color.WHITE) backgroundColor = attributes.Get('backgroundColor', None) self.value = attributes.Get('value', 0.0) self.uiEffects = uicls.UIEffects() self.busy = False self.queuedSetValue = None self.gaugeCont = uiprimitives.Container(parent=self, name='gaugeCont', pos=(0, 0, self.width, self.height), align=uiconst.TOPLEFT) uicontrols.Frame(parent=self.gaugeCont, color=(1.0, 1.0, 1.0, 0.2)) self.gauge = uiprimitives.Fill(parent=self.gaugeCont, name='gauge', align=uiconst.TOLEFT, width=0, color=color) if backgroundColor is None: backgroundColor = util.Color(*color).SetAlpha(0.2).GetRGBA() uiprimitives.Fill(parent=self.gaugeCont, name='background', color=backgroundColor) testString = ''.join(self.HEXDIGITS) fontSize = 1 textHeight = uix.GetTextHeight(testString, fontsize=fontSize) while textHeight < self.height: fontSize += 1 textHeight = uix.GetTextHeight(testString, fontsize=fontSize) else: fontSize -= 1 textHeight = uix.GetTextHeight(testString, fontsize=fontSize) self.textCont = uiprimitives.Container(parent=self, name='textCont', pos=(0, 0, self.width, textHeight), align=uiconst.CENTER, clipChildren=True, idx=0) self.text = uicontrols.Label(parent=self.textCont, name='hackText', align=uiconst.TOALL, fontsize=fontSize, text='') hackText = random.choice(self.HEXDIGITS) while uix.GetTextWidth(hackText[1:], fontsize=fontSize) < self.width: hackText += random.choice(self.HEXDIGITS) self.text.text = hackText self.SetValueInstantly(self.value) self.hackStrings = ['Hacking Gibson...', 'Cracking Codes...', 'Inserting Rootkit...', 'Defeating ICE...', 'Circumventing Firewall...', 'Polymorphing Virii...', 'Erasing Logs...', 'Reticulating Splines...', 'Twisting Mersenne...', 'Curving Ellipses...', 'Analyzing Ciphers...', 'Factoring Primes...'] self.hackText = uicontrols.EveHeaderMedium(text='', parent=self, align=uiconst.CENTERBOTTOM, height=20, state=uiconst.UI_HIDDEN, top=-24) self.active = True uthread.new(self._CycleText)
def Startup(self, layerlist): sm.GetService('settings').LoadSettings() deviceSvc = sm.StartServiceAndWaitForRunningState('device') deviceSvc.CreateDevice() self.device = deviceSvc uicls._ExposeCoreClassesWithOutCorePostfix() self.uilib = self.event = uicls.Uilib() self.desktop = self.uilib.desktop self.LoadLayers(layerlist) for serviceName in [ 'font', 'registry', 'loading', 'audio', 'ime', 'cmd' ]: setattr(self, serviceName, sm.StartServiceAndWaitForRunningState(serviceName)) self.effect = uicls.UIEffects() self.animations = uicls.UIAnimations() trinity.device.RegisterResource(self) self.isRunning = True
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.facilityID = attributes.facilityID self.facilityName = attributes.facilityName self.facilitySvc = sm.GetService('facilitySvc') self.taxes = self.facilitySvc.GetFacilityTaxes(self.facilityID) self.taxRates = [ util.KeyVal(key='taxCorporation', value=self.taxes.taxCorporation), util.KeyVal(key='taxAlliance', value=self.taxes.taxAlliance), util.KeyVal(key='taxStandingsHorrible', standing=const.contactHorribleStanding, value=self.taxes.taxStandingsHorrible), util.KeyVal(key='taxStandingsBad', standing=const.contactBadStanding, value=self.taxes.taxStandingsBad), util.KeyVal(key='taxStandingsNeutral', standing=const.contactNeutralStanding, value=self.taxes.taxStandingsNeutral), util.KeyVal(key='taxStandingsGood', standing=const.contactGoodStanding, value=self.taxes.taxStandingsGood), util.KeyVal(key='taxStandingsHigh', standing=const.contactHighStanding, value=self.taxes.taxStandingsHigh) ] self.standingLevel = const.contactHorribleStanding for taxRate in self.taxRates[2:]: if taxRate.value is not None: self.standingLevel = taxRate.standing break self.effects = uicls.UIEffects() self.scope = 'all' self.SetWndIcon(self.iconNum, size=32) self.SetMinSize([self.WIDTH_COLLAPSED, self.HEIGHT]) self.SetCaption( localization.GetByLabel('UI/Menusvc/ConfigureFacility')) self.MakeUnResizeable() self.Layout() self.Redraw()
def ApplyAttributes(self, attributes): uicls.Container.ApplyAttributes(self, attributes) self.pin = attributes.Get('pin', None) pad = self.pad = 3 self.main = uicls.Container(parent=self, name='main', pos=(0, 0, 0, 0), padding=(pad, pad, pad, pad), state=uiconst.UI_PICKCHILDREN, align=uiconst.TOALL) pad = const.defaultPadding self.sr.footer = uicls.Container(name='footer', parent=self.main, align=uiconst.TOBOTTOM, pos=(0, 0, 0, 25), padding=(pad, pad, pad, pad)) self.sr.underlay = uicls.WindowUnderlay(parent=self) self.sr.underlay.state = uiconst.UI_DISABLED self.header = self._DrawAlignTopCont(18, 'headerCont') self.closeBtn = uicls.Icon(name='close', icon='ui_38_16_220', parent=self.header, pos=(0, 0, 16, 16), align=uiconst.TOPRIGHT) self.closeBtn.OnClick = lambda: sm.GetService( 'planetUI').myPinManager.PinUnselected() self.headerText = uicls.EveLabelMedium(parent=self.header, align=uiconst.CENTER, state=uiconst.UI_NORMAL) self.headerText.text = cfg.invtypes.Get(self.pin.GetTypeID()).typeName uicls.Line(parent=self.header, align=uiconst.TOBOTTOM) self.content = self._DrawAlignTopCont(180, 'contentCont', padding=(4, 4, 4, 4)) iconX = 180 itemHeight = 2 ownerID = self.pin.GetOwnerID() conflictState = eveDustCommon.planetSurface.GetConflictState( self.pin.pinKv.conflicts) conflictText = localization.GetByLabel(STATE_NAMES[conflictState]) self.conflictStateLabel = uicls.EveLabelMedium( parent=self.content, pos=(2, itemHeight, self.default_width - 10, 16)) self.conflictStateLabel.text = localization.GetByLabel( 'UI/PI/Planet/Dust/ConflictState', state=conflictText) itemHeight += 20 if ownerID: self.ownerLabel = uicls.EveLabelMedium(parent=self.content, pos=(2, itemHeight, iconX, 16)) self.ownerLabel.text = localization.GetByLabel( 'UI/PI/Planet/Dust/DustPinOwner', player=ownerID) self.ownerIcon = uicls.Container(parent=self.content, pos=(iconX, itemHeight, 64, 64), align=uiconst.RELATIVE) uiutil.GetLogoIcon(itemID=ownerID, parent=self.ownerIcon, name='ownercorplogo', acceptNone=False, align=uiconst.TOALL) itemHeight += 68 if ownerID == session.corpid and conflictState == const.objectiveStateCeasefire: uicls.Button( parent=self.sr.footer, label=localization.GetByLabel('UI/PI/Planet/Dust/DestroyPin'), func=self.Terminate) elif ownerID != session.corpid and eveDustCommon.planetSurface.GetConflictState( self.pin.pinKv.conflicts, session.corpid) == const.objectiveStateCeasefire: uicls.Button(parent=self.sr.footer, label=localization.GetByLabel( 'UI/PI/Planet/Dust/AttackInstallation'), func=self.Attack) dw = uicore.desktop.width dh = uicore.desktop.height self.height = self.default_height self.width = self.default_width self.left = settings.user.ui.Get('planetContPositionX', (dw - self.width) / 2) self.top = settings.user.ui.Get('planetContPositionY', (dh - self.height) / 2) if self.left < 0: self.left = 0 elif self.left > dw - self.width: self.left = dw - self.width if self.top < 0: self.top = 0 elif self.top > dh - self.height: self.top = dh - self.heigh uicls.UIEffects().MorphUI(self, 'opacity', 1.0, time=250.0, float=1, newthread=1, maxSteps=100)
def ApplyAttributes(self, attributes): uicls.Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) pad = self.pad = 3 self.main = uicls.Container(parent=self, name='main', pos=(0, 0, 0, 0), padding=(pad, pad, pad, pad), state=uiconst.UI_PICKCHILDREN, align=uiconst.TOALL) self.sr.underlay = uicls.WindowUnderlay(parent=self) self.sr.underlay.state = uiconst.UI_DISABLED self.planetUISvc = sm.GetService('planetUI') self.planetSvc = sm.GetService('planetSvc') self.pin = attributes.Get('pin', None) self.uiEffects = uicls.UIEffects() self.showingActionContainer = False self.currentRoute = None self.showNext = None self.lastCalled = None self.commodityToRoute = None self.buttonTextValue = '' self.header = self._DrawAlignTopCont(18, 'headerCont') self.closeBtn = uicls.Icon(name='close', icon='ui_38_16_220', parent=self.header, pos=(0, 0, 16, 16), align=uiconst.TOPRIGHT) self.closeBtn.OnClick = self.CloseByUser self.infoicon = uicls.InfoIcon(typeID=self.pin.typeID, size=16, parent=self.header, align=uiconst.CENTERLEFT, top=-1) self._DrawHorizLine() self.infoContRightColAt = 160 self.infoContPad = 5 self.infoCont = self._GetInfoCont() self._UpdateInfoCont() self._DrawHorizLine() self.buttonCont = self._DrawAlignTopCont(40, 'buttonCont') self._DrawHorizLine() self.buttonTextCont = self._DrawAlignTopCont(22, 'buttonTextCont') self.buttonText = uicls.EveLabelSmall(parent=self.buttonTextCont, align=uiconst.CENTER, color=(1.0, 1.0, 1.0, 1.0), state=uiconst.UI_NORMAL) self.buttonTextCont.height = max(22, self.buttonText.textheight) self.actionCont = self._DrawAlignTopCont(0, 'actionCont', padding=(3, 0, 3, 3)) captionTxt = self._GetPinName() caption = uicls.EveLabelSmall(parent=self.header, text=captionTxt, state=uiconst.UI_DISABLED) caption.left = 20 caption.top = 2 dw = uicore.desktop.width dh = uicore.desktop.height self.default_height = self.header.height + self.infoCont.height + self.infoContPad * 2 + self.buttonCont.height + self.actionCont.height + self.pad * 2 + self.buttonTextCont.height self.height = self.default_height self.width = self.default_width self.left = settings.user.ui.Get('planetContPositionX', (dw - self.width) / 2) self.top = settings.user.ui.Get('planetContPositionY', (dh - self.height) / 2) if self.left < 0: self.left = 0 elif self.left > dw - self.width: self.left = dw - self.width if self.top < 0: self.top = 0 elif self.top > dh - self.height: self.top = dh - self.height self.LoadActionButtons(self._GetActionButtons()) self.uiEffects.MorphUI(self, 'opacity', 1.0, time=250.0, float=1, newthread=1, maxSteps=1000) self.updateInfoContTimer = base.AutoTimer(100, self._UpdateInfoCont) sm.GetService('audio').SendUIEvent( 'wise:/msg_pi_pininteraction_open_play')