Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.otherPinManager.Close()
self.otherPinManager = planet.ui.OtherPinManager()
if self.eventManager:
self.eventManager.Close()
self.eventManager = planet.ui.EventManager()
self.planetNav.Startup()
if newScene:
self.planetNav.zoom = 1.0
else:
self.planetNav.zoom = settings.char.ui.Get('planet_camera_zoom', 1.0)
self.zoom = sm.GetService('planetUI').planetNav.camera.zoom
self.eventManager.OnPlanetViewOpened()
self.myPinManager.OnPlanetViewOpened()
self.otherPinManager.OnPlanetViewOpened()
self.ClosePlanetModeContainer()
self.modeController = planet.ui.PlanetModeContainer(parent=uicore.layer.neocom.GetChild('neocomLeftside'), align=uiconst.TOTOP, pos=(0, 0, 0, 355))
def AddHead(self, headID, surfacePoint):
extractionHead = planet.ui.ExtractionHeadPin(surfacePoint, self.transform, self.pin, headID, self.pin.headRadius or planetCommon.RADIUS_DRILLAREAMIN)
self.extractionHeadsByNum[headID] = extractionHead
link = planet.ui.LinkBase('linksExtraction', surfacePoint, self.surfacePoint, color=planetCommon.PLANET_COLOR_EXTRACTIONLINK)
self.linksByHeadID[headID] = link
def LoadActionButtons(self, buttons):
iconWidth = 32
w = self.width - 6
maxIcons = 7.0
n = float(len(buttons))
pad = 5 + 1 * iconWidth * (1.0 - n / maxIcons)
w -= 2 * pad
space = (w - n * iconWidth) / n
for (i, b,) in enumerate(buttons):
(iconPath, cerberusPath,) = planetCommon.PANELDATA[b.id]
panelName = localization.GetByLabel(cerberusPath)
if i == 0:
self.defaultPanel = b.panelCallback
self.defaultPanelName = panelName
x = pad + space / 2.0 + i * (space + iconWidth)
ib = planet.ui.IconButton(icon=iconPath, size=32, parent=self.buttonCont, align=uiconst.TOPLEFT, pos=(int(x),
4,
iconWidth,
iconWidth), name=panelName, hint=b.Get('hint', ''))
ib.OnMouseEnter = (self.OnIconButtonMouseEnter, ib)
ib.OnMouseExit = (self.OnIconButtonMouseExit, ib)
ib.OnClick = (self._OnIconButtonClicked, b.panelCallback, panelName)
def RenderCommandCentersOfOtherCharacters(self):
if not settings.user.ui.Get('planetShowOtherCharactersPins', True):
return
commandCenters = self.GetCommandCentersOfOtherCharacters()
for (charid, cc,) in commandCenters.iteritems():
if charid == session.charid:
continue
sp = planet.SurfacePoint(theta=cc.longitude, phi=cc.latitude)
pin = planet.ui.OtherPlayersPin(sp, cc.pinID, cc.typeID, cc.ownerID, self.planetUISvc.pinOthersTransform)
self.otherPlayerPinsByPinID[cc.pinID] = pin
self.planetUISvc.curveLineDrawer.SubmitLineset('otherLinks')
import uix
import uiconst
import util
import planetCommon
import math
import uicls
import planet
import blue
import uthread
import const
import uiutil
import listentry
import localization
import form
class ECUContainer(planet.ui.BasePinContainer):
__guid__ = 'planet.ui.ECUContainer'
default_name = 'ECUContainer'
def ApplyAttributes(self, attributes):
planet.ui.BasePinContainer.ApplyAttributes(self, attributes)
def _GetActionButtons(self):
btns = [util.KeyVal(id=planetCommon.PANEL_SURVEYFORDEPOSITS, panelCallback=self.OpenSurveyWindow), util.KeyVal(id=planetCommon.PANEL_PRODUCTS, panelCallback=self.PanelShowProducts)]
btns.extend(planet.ui.BasePinContainer._GetActionButtons(self))
return btns
def _GetInfoCont(self):
import planet
import util
import planetCommon
import localization
class ObsoletePinContainer(planet.ui.BasePinContainer):
__guid__ = 'planet.ui.ObsoletePinContainer'
def _GetActionButtons(self):
typeObj = cfg.invtypes.Get(self.pin.typeID)
btns = [util.KeyVal(id=planetCommon.PANEL_DECOMMISSION, panelCallback=self.PanelDecommissionPin, hint=localization.GetByLabel('UI/PI/Common/ObsoletePinReimbursementHint', pinName=typeObj.typeName, iskAmount=util.FmtISK(typeObj.basePrice)))]
return btns
def SubPanelSelectedSchematic(self, parent, schematic):
cont = uicls.Container(parent=parent, pos=(0, 0, 0, 140), align=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN)
left = self.infoContRightColAt
output = schematic.outputs[0]
schematicTxt = localization.GetByLabel('UI/PI/Common/ItemAmount', amount=int(output.quantity), itemName=output.name)
planet.ui.CaptionAndSubtext(parent=cont, caption=localization.GetByLabel('UI/PI/Common/OutputProduct'), subtext=schematicTxt, iconTypeID=output.typeID, left=5, top=0)
planet.ui.CaptionAndSubtext(parent=cont, caption=localization.GetByLabel('UI/PI/Common/CycleTime'), subtext=localization.GetByLabel('UI/PI/Common/TimeHourMinSec', time=schematic.cycleTime * SEC), left=5, top=40)
outputVolumeTxt = localization.GetByLabel('UI/PI/Common/CapacityAmount', amount=schematic.outputVolume)
planet.ui.CaptionAndSubtext(parent=cont, caption=localization.GetByLabel('UI/PI/Common/OutputPerHour'), subtext=outputVolumeTxt, left=5, top=80)
for (i, input,) in enumerate(schematic.inputs):
topPos = i * 40
caption = localization.GetByLabel('UI/PI/Common/InputNumberX', inputNum=i + 1)
subtext = localization.GetByLabel('UI/PI/Common/ItemAmount', amount=int(input.quantity), itemName=cfg.invtypes.Get(input.typeID).name)
planet.ui.CaptionAndSubtext(parent=cont, caption=caption, subtext=subtext, iconTypeID=input.typeID, left=left, top=topPos)
btns = [[localization.GetByLabel('UI/PI/Common/InstallSchematic'), self.InstallSchematic, ()]]
self.buttons = uicls.ButtonGroup(btns=btns, parent=cont, line=False, alwaysLite=True)
return cont
def AddLink(self, parentID, childID, linkTypeID):
colony = self.planetUISvc.planet.GetColony(session.charid)
if colony is None:
log.LogError('Unable to render link for planet without a colony')
return
par = colony.GetPin(parentID)
child = colony.GetPin(childID)
if par is None or child is None:
log.LogWarn('Trying to render link for non-existing pin', parentID, childID)
return
p1 = planet.SurfacePoint(theta=par.longitude, phi=par.latitude)
p2 = planet.SurfacePoint(theta=child.longitude, phi=child.latitude)
planetLink = colony.colonyData.GetLink(parentID, childID)
link = planet.ui.Link(p1, p2, parentID, childID, linkTypeID, planetLink)
self.linksByPinIDs[(parentID, childID)] = link
self.linksByPinIDs[(childID, parentID)] = link
self.links.append(link)
(linkGraphicID1, linkGraphicID2,) = link.GetGraphicIDs()
self.linksByGraphicID[linkGraphicID1] = link
self.linksByGraphicID[linkGraphicID2] = link
def CreateLayout(self):
self.headerContainer = uicls.Container(parent=self.content, name='headerContainer', align=uiconst.TOTOP, pos=(0, 0, 0, 40))
self.editModeContainer = uicls.Container(parent=self.content, name='buttonContainer', align=uiconst.TOTOP, state=uiconst.UI_HIDDEN, padding=(0, 0, 0, 5))
self.editModeContent = uicls.Container(parent=self.editModeContainer, name='editModeContent', align=uiconst.TOALL, padding=(10, 6, 10, 6))
uicls.Fill(parent=self.editModeContainer, color=util.Color.GetGrayRGBA(0.0, 0.3))
uicls.Frame(parent=self.editModeContainer, color=util.Color.GetGrayRGBA(0.0, 0.2))
self.tabButtonContainer = uicls.Container(parent=self.content, name='tabButtonContainer', align=uiconst.TOTOP, pos=(0, 0, 0, 28))
self.tabPanelContainer = uicls.Container(parent=self.content, name='tabPanelContainer', align=uiconst.TOALL, padTop=4)
self.heading = uicls.EveLabelMedium(text=localization.GetByLabel('UI/PI/Common/ViewingPlanet'), name='heading', parent=self.headerContainer, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED)
self.planetName = uicls.EveHeaderLarge(parent=self.headerContainer, top=self.heading.textheight, state=uiconst.UI_NORMAL)
self.resourceControllerTab = planet.ui.ResourceController(parent=self.tabPanelContainer)
self.editModeTab = planet.ui.PlanetEditModeContainer(parent=self.tabPanelContainer)
tabs = [[localization.GetByLabel('UI/Common/Build'),
self.editModeTab,
self,
None,
'editModeTab'], [localization.GetByLabel('UI/PI/Common/Scan'),
self.resourceControllerTab,
self,
None,
'resourceControllerTab']]
self.modeButtonGroup = uicls.FlatButtonGroup(parent=self.tabButtonContainer, align=uiconst.TOTOP, height=28, toggleEnabled=False)
self.modeButtonGroup.Startup(tabs, selectedArgs=['editModeTab'])
BTNSIZE = 24
exitBtn = uicls.Button(parent=self.content, align=uiconst.TOPRIGHT, pos=(0,
0,
BTNSIZE,
def LoadPI(self, newScene = True):
self.InitTrinityTransforms()
self.InitUIContainers()
self.InitLinesets()
if self.myPinManager:
self.myPinManager.Close()
self.myPinManager = planet.ui.MyPinManager()
if self.otherPinManager:
self.otherPinManager.Close()
self.otherPinManager = planet.ui.OtherPinManager()
if self.eventManager:
self.eventManager.Close()
self.eventManager = planet.ui.EventManager()
self.planetNav.Startup()
if newScene:
self.planetNav.zoom = 1.0
else:
self.planetNav.zoom = settings.char.ui.Get('planet_camera_zoom', 1.0)
self.zoom = sm.GetService('planetUI').planetNav.camera.zoom
self.eventManager.OnPlanetViewOpened()
self.myPinManager.OnPlanetViewOpened()
self.otherPinManager.OnPlanetViewOpened()
self.ClosePlanetModeContainer()