示例#1
0
 def CreateCell(self, parent, height, width, backgroundColorTuple,
                foregroundColorTuple):
     newCell = uicls.Container(
         parent=parent,
         name='hackingCell',
         align=uiconst.TOLEFT,
         state=uiconst.UI_DISABLED,
         pos=(0, 0, width, height),
         padding=(self.cellPaddingHorizontal, self.cellPaddingVertical,
                  self.cellPaddingHorizontal, self.cellPaddingVertical))
     newCell.sr.background = uicls.Fill(parent=newCell,
                                        color=backgroundColorTuple)
     newCellFill = uicls.Container(
         parent=newCell,
         name='hackFill',
         align=uiconst.TOPLEFT,
         pos=(0, 0, width, height),
         padding=(self.cellPaddingHorizontal, self.cellPaddingVertical,
                  self.cellPaddingHorizontal, self.cellPaddingVertical))
     newCellFill.sr.background = uicls.Fill(parent=newCellFill,
                                            color=foregroundColorTuple)
     newCellFill.opacity = 0.0
     newCell.sr.fill = newCellFill
     newCell.sr.text = uicls.EveHeaderMedium(text=random.choice(
         self.cellGlyphs),
                                             parent=newCell,
                                             align=uiconst.CENTER,
                                             fontsize=self.cellTextSize,
                                             height=height,
                                             state=uiconst.UI_DISABLED)
     return newCell
示例#2
0
 def RenderText(self, text, name):
     txt = uicls.EveHeaderMedium(text=text,
                                 parent=None,
                                 state=uiconst.UI_NORMAL)
     hb = trinity.Tr2HostBitmap(txt.actualTextWidth, txt.actualTextHeight,
                                1, trinity.PIXEL_FORMAT.B8G8R8A8_UNORM)
     txt.measurer.DrawToHostBitmap(hb)
     fileName = 'cache:/Temp/%s.dds' % name
     hb.SaveAsync(blue.paths.ResolvePathForWriting(fileName))
     hb.WaitForSave()
示例#3
0
 def CreateLayout(self):
     icon = 'ui_44_32_7'
     commandPinObject = sm.GetService('planetUI').GetCurrentPlanet().GetCommandCenterForCharacter(session.charid)
     commandPin = commandPinObject is not None and not commandPinObject.IsInEditMode()
     buttonList = [(const.groupExtractionControlUnitPins, 'ui_77_32_26'),
      (const.groupProcessPins, 'ui_77_32_30'),
      (const.groupStoragePins, 'ui_77_32_25'),
      (const.groupSpaceportPins, 'ui_77_32_27'),
      (const.groupPlanetaryLinks, 'ui_77_32_31')]
     if not commandPin:
         buttonList.insert(0, (const.groupCommandPins, 'ui_77_32_29'))
     for groupID, icon in buttonList:
         groupEnabled = commandPin or groupID == const.groupCommandPins
         if groupEnabled:
             color = self.COLOR_ENABLED
         else:
             color = self.COLOR_DISABLED
         buildEntry = uicls.Container(parent=self.buildContainer, name='buildEntry' + str(groupID), align=uiconst.TOTOP, pos=(0,
          0,
          0,
          ICON_SIZE), state=uiconst.UI_NORMAL)
         buildEntry.groupID = groupID
         buildEntry.headerContainer = header = uicls.Container(parent=buildEntry, name='buildHeaderContainer', align=uiconst.TOTOP, pos=(0,
          0,
          0,
          ICON_SIZE))
         buildEntry.iconButton = iconButton = planet.ui.IconButton(parent=header, name='pin_' + str(groupID), icon=icon, align=uiconst.TOLEFT, pos=(0,
          0,
          ICON_SIZE,
          0), state=uiconst.UI_NORMAL, size=ICON_SIZE, color=color)
         iconButton.OnMouseEnter = (self.OnBuildIconButtonMouseEnter, buildEntry)
         iconButton.OnMouseExit = (self.OnBuildIconButtonMouseExit, buildEntry)
         if commandPin:
             iconButton.OnClick = (self.OnBuildIconButtonClicked, buildEntry)
         buildEntry.heading = uicls.EveHeaderMedium(parent=header, text='<b>' + cfg.invgroups.Get(groupID).name + '</b>', state=uiconst.UI_NORMAL, hilightable=1, pos=(ICON_SIZE + 4,
          6,
          200,
          ICON_SIZE), color=color)
         buildEntry.heading.OnMouseEnter = (self.OnBuildIconButtonMouseEnter, buildEntry)
         buildEntry.heading.OnMouseExit = (self.OnBuildIconButtonMouseExit, buildEntry)
         buildEntry.heading.OnClick = (self.OnBuildIconButtonClicked, buildEntry)
         buildEntry.structureScroll = uicls.Scroll(parent=buildEntry, name='structureScroll', padLeft=ICON_SIZE)
         buildEntry.structureScroll.state = uiconst.UI_HIDDEN
         buildEntry.structureScroll.HideBackground()
         buildEntry.structureScroll.RemoveActiveFrame()
         buildEntry.structureScroll.scrollEnabled = 0
         buildEntry.structureScroll.multiSelect = False
         try:
             self.LoadStructureScroll(buildEntry, commandPin, color)
         except AttributeError:
             if buildEntry.destroyed or not self or self.destroyed:
                 return
             raise 
示例#4
0
    def ApplyAttributes(self, attributes):
        uicls.Window.ApplyAttributes(self, attributes)
        self.shipid = util.GetActiveShip()
        self.shipItem = self.GetShipItem()
        self.SetCaption(
            localization.GetByLabel('UI/Ship/ShipConfig/ShipConfig'))
        self.SetTopparentHeight(72)
        self.SetWndIcon()
        self.SetMinSize([300, 200])
        self.sr.top = uicls.Container(name='top',
                                      align=uiconst.TOTOP,
                                      parent=self.sr.topParent,
                                      pos=(const.defaultPadding,
                                           const.defaultPadding,
                                           const.defaultPadding, 64))
        icon = uicls.Icon(parent=self.sr.top,
                          align=uiconst.TOLEFT,
                          left=const.defaultPadding,
                          size=64,
                          state=uiconst.UI_NORMAL,
                          typeID=self.shipItem.typeID)
        icon.GetMenu = self.ShipMenu
        uicls.Container(name='push',
                        align=uiconst.TOLEFT,
                        pos=(5, 0, 5, 0),
                        parent=self.sr.top)
        uicls.EveHeaderMedium(name='label',
                              text=cfg.evelocations.Get(
                                  self.shipItem.itemID).name,
                              parent=self.sr.top,
                              align=uiconst.TOTOP,
                              bold=True,
                              state=uiconst.UI_NORMAL)
        uicls.EveLabelMedium(name='label',
                             text=cfg.invtypes.Get(self.shipItem.typeID).name,
                             parent=self.sr.top,
                             align=uiconst.TOTOP,
                             state=uiconst.UI_NORMAL)
        self.ship = moniker.GetShipAccess()
        self.conf = self.ship.GetShipConfiguration(self.shipid)
        modules = self.GetShipModules()
        for module in modules:
            self.sr.Set(
                '%sPanel' % module.lower(),
                uicls.Container(name=module,
                                align=uiconst.TOALL,
                                state=uiconst.UI_HIDDEN,
                                parent=self.sr.main,
                                pos=(0, 0, 0, 0)))

        tabs = [[
            name,
            self.sr.Get('%sPanel' % module.lower(), None), self, module
        ] for module, name in modules.iteritems()
                if self.sr.Get('%sPanel' % module.lower())]
        if tabs:
            self.sr.maintabs = uicls.TabGroup(name='tabparent',
                                              align=uiconst.TOTOP,
                                              height=18,
                                              parent=self.sr.main,
                                              idx=0,
                                              tabs=tabs,
                                              groupID='pospanel')
        else:
            uicls.CaptionLabel(
                text=localization.GetByLabel('UI/Ship/ShipConfig/ShipConfig'),
                parent=self.sr.main,
                size=18,
                uppercase=0,
                left=const.defaultPadding,
                width=const.defaultPadding,
                top=const.defaultPadding)
示例#5
0
    def ApplyAttributes(self, attributes):
        uicls.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 = uicls.Container(parent=self,
                                         name='gaugeCont',
                                         pos=(0, 0, self.width, self.height),
                                         align=uiconst.TOPLEFT)
        uicls.Frame(parent=self.gaugeCont, color=(1.0, 1.0, 1.0, 0.2))
        self.gauge = uicls.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()
        uicls.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 = uicls.Container(parent=self,
                                        name='textCont',
                                        pos=(0, 0, self.width, textHeight),
                                        align=uiconst.CENTER,
                                        clipChildren=True,
                                        idx=0)
        self.text = uicls.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 = uicls.EveHeaderMedium(text='',
                                              parent=self,
                                              align=uiconst.CENTERBOTTOM,
                                              height=20,
                                              state=uiconst.UI_HIDDEN,
                                              top=-24)
        self.active = True
        uthread.new(self._CycleText)
示例#6
0
 def ApplyAttributes(self, attributes):
     uicls.InfoPanelBase.ApplyAttributes(self, attributes)
     sm.RegisterNotify(self)
     self.lastInfluence = None
     self.headerTextCont = uicls.Container(name='headerTextCont',
                                           parent=self.headerCont,
                                           align=uiconst.TOALL)
     self.title = self.headerCls(
         name='title',
         text=
         '<color=white url=localsvc:service=journal&method=ShowIncursionTab&constellationID=%d&open=1>%s</url>'
         % (session.constellationid, localization.GetByLabel(self.label)),
         parent=self.headerTextCont,
         align=uiconst.CENTERLEFT,
         state=uiconst.UI_NORMAL)
     self.subTitle = uicls.EveHeaderMedium(name='subtitle',
                                           parent=self.headerTextCont,
                                           left=self.title.width + 4,
                                           align=uiconst.CENTERLEFT,
                                           state=uiconst.UI_NORMAL,
                                           top=3)
     self.bossIcon = uicls.IncursionBossIcon(name='bossIcon',
                                             parent=self.headerCont,
                                             align=uiconst.CENTERRIGHT,
                                             left=8)
     self.headerInfluenceBar = uicls.SystemInfluenceBar(
         parent=self.headerCont,
         state=uiconst.UI_HIDDEN,
         align=uiconst.TOALL,
         height=0,
         padding=(0, 6, 24, 6))
     self.headerInfluenceBar.OnClick = self.topCont.OnClick
     self.headerInfluenceBar.OnMouseEnter = self.topCont.OnMouseEnter
     self.headerInfluenceBar.OnMouseExit = self.topCont.OnMouseExit
     self.influenceBar = uicls.SystemInfluenceBar(parent=self.mainCont,
                                                  padding=(0, 0, 0, 2))
     self.bottomContainer = uicls.Container(name='bottomContainer',
                                            parent=self.mainCont,
                                            align=uiconst.TOTOP,
                                            height=33)
     self.severityIcon = uicls.Icon(name='severityIcon',
                                    parent=self.bottomContainer,
                                    align=uiconst.RELATIVE,
                                    color=COLOR_ENABLED,
                                    pos=(0, 0, 32, 32),
                                    ignoreSize=True,
                                    size=48,
                                    state=uiconst.UI_NORMAL)
     iconCont = uicls.ContainerAutoSize(name='iconCont',
                                        parent=self.bottomContainer,
                                        align=uiconst.CENTERLEFT,
                                        pos=(45, 0, 0, 22))
     iconParams = {
         'align': uiconst.TOLEFT,
         'parent': iconCont,
         'color': COLOR_ENABLED,
         'width': iconCont.height,
         'padRight': 6
     }
     self.effects = [
         uicls.Sprite(name='effectIcon_cyno',
                      texturePath=
                      'res:/UI/Texture/classes/InfluenceBar/effectCyno.png',
                      hint=localization.GetByLabel(
                          'UI/Incursion/HUD/SystemEffectCynoHint'),
                      **iconParams),
         uicls.Sprite(name='effectIcon_tax',
                      texturePath=
                      'res:/UI/Texture/classes/InfluenceBar/effectTax.png',
                      hint=localization.GetByLabel(
                          'UI/Incursion/HUD/SystemEffectTaxHint'),
                      **iconParams),
         uicls.Sprite(
             name='effectIcon_tank',
             texturePath=
             'res:/UI/Texture/classes/InfluenceBar/effectResistance.png',
             hint=localization.GetByLabel(
                 'UI/Incursion/HUD/SystemEffectTankingHint'),
             **iconParams),
         uicls.Sprite(
             name='effectIcon_damage',
             texturePath=
             'res:/UI/Texture/classes/InfluenceBar/effectDamage.png',
             hint=localization.GetByLabel(
                 'UI/Incursion/HUD/SystemEffectDamageHint'),
             **iconParams)
     ]
     uthread.new(self.UpdateInfluenceThread)