示例#1
0
def Reboot(reason=''):
    for arg in blue.pyos.GetArg()[1:]:
        if arg.startswith('/ssoToken'):
            lg.Info('appUtils.Reboot',
                    'suppressing reboot due to single sign-on')
            lg.Info('appUtils.Reboot', 'rebooting due to ' + reason)
            bluepy.Terminate(reason)

    lg.Info('appUtils.Reboot', 'About to reboot the client because:' + reason)
    prefs.SetValue('rebootReason', reason)
    prefs.SetValue('rebootTime', blue.os.GetWallclockTime())
    allargs = blue.pyos.GetArg()
    cmd = allargs[0]
    args = []
    for arg in allargs[1:]:
        arg = arg.strip()
        if arg.find(' ') >= 0 or arg.find('\t') >= 0:
            arg = '"""' + arg + '"""'
        args.append(arg)

    args = ' '.join(args)
    lg.Info('appUtils.Reboot', 'About to reboot the client with:' + str(
        (0, None, cmd, args)))
    try:
        blue.win32.ShellExecute(0, None, cmd, args)
    except Exception as e:
        lg.Error('appUtils.Reboot', 'Failed with: ' + str(e))
        raise

    bluepy.Terminate(reason)
示例#2
0
文件: slot.py 项目: R4M80MrX/eve-1
    def OnDropData(self, dragObj, nodes):
        shipID = self.GetShipID()
        if self.module is not None and not self.shell.SlotExists(
                shipID, self.module.flagID):
            return
        chargeTypeID = None
        chargeItems = []
        for node in nodes:
            if node.__guid__ not in ('listentry.InvItem', 'xtriui.InvItem'):
                continue
            item = node.rec
            if not getattr(item, 'typeID', None):
                lg.Info('fittingUI', 'Dropped a non-item here', item)
                return
            if self.isChargeable and self.IsCharge(item.typeID):
                if chargeTypeID is None:
                    chargeTypeID = item.typeID
                if chargeTypeID == item.typeID:
                    chargeItems.append(item)
            elif self.shell.IsInWeaponBank(item.locationID, item.itemID):
                ret = eve.Message(
                    'CustomQuestion', {
                        'header':
                        localization.GetByLabel('UI/Common/Confirm'),
                        'question':
                        localization.GetByLabel('UI/Fitting/ClearGroupModule')
                    }, uiconst.YESNO)
                if ret == uiconst.ID_YES:
                    eve.Message('DragDropSlot')
                    uthread.new(self.Add, item)
            elif item.categoryID == const.categorySubSystem and getattr(
                    self, 'module', None) is not None:
                uthread.new(self.Add, item)
            else:
                eve.Message('DragDropSlot')
                uthread.new(self.Add, item)

        if len(chargeItems):
            chargeTypeID = chargeItems[0].typeID
            self.shell.DropLoadChargeToModule(self.module.itemID, chargeTypeID,
                                              chargeItems)
示例#3
0
 def LogInfo(self, *args):
     lg.Info(self.__guid__, *args)
 def LogInfo(self, *args):
     lg.Info('listentry.CorpMemberRoleEntry', *args)
示例#5
0
 def LogInfo(self, *k, **v):
     lg.Info('ime', *k, **v)
示例#6
0
文件: slot.py 项目: R4M80MrX/eve-1
 def SetFitting(self, invItem, shell=None, putOnline=0):
     if self.destroyed:
         return
     lg.Info('fitting', 'SetFitting', self.flag, invItem
             and cfg.invtypes.Get(invItem.typeID).Group().name)
     if invItem is None:
         self.DisableDrag()
     else:
         self.EnableDrag()
     self.shell = shell or self.shell
     if invItem and self.IsCharge(invItem.typeID):
         self.charge = invItem
         chargeQty = self.shell.GetQuantity(invItem.itemID)
         if self.module is None:
             portion = 1.0
         else:
             cap = self.shell.GetCapacity(self.module.locationID,
                                          const.attributeCapacity,
                                          self.flag)
             if cap.capacity == 0:
                 portion = 1.0
             else:
                 portion = cap.used / cap.capacity
         step = max(0, min(4, int(portion * 5.0)))
         self.sr.chargeIndicator.rectTop = 10 * step
         self.sr.chargeIndicator.state = uiconst.UI_NORMAL
         self.sr.chargeIndicator.hint = '%s %d%%' % (cfg.invtypes.Get(
             self.charge.typeID).name, portion * 100)
     elif invItem is None:
         self.id = None
         self.isChargeable = 0
         self.typeID = None
         self.module = None
         self.charge = None
         self.fitted = 0
         self.isChargeable = 0
         self.HideUtilButtons(1)
         self.sr.chargeIndicator.state = uiconst.UI_HIDDEN
     else:
         self.id = invItem.itemID
         self.typeID = invItem.typeID
         self.module = invItem
         self.fitted = 1
         self.charge = None
         if invItem.groupID in cfg.__chargecompatiblegroups__:
             self.isChargeable = 1
             self.sr.chargeIndicator.rectTop = 0
             self.sr.chargeIndicator.state = uiconst.UI_NORMAL
             self.sr.chargeIndicator.hint = localization.GetByLabel(
                 'UI/Fitting/NoCharge')
         else:
             self.isChargeable = 0
             self.sr.chargeIndicator.state = uiconst.UI_HIDDEN
     if self.typeID:
         modulehint = cfg.invtypes.Get(self.typeID).name
         if self.charge:
             modulehint += '<br>%s' % localization.GetByLabel(
                 'UI/Fitting/ChargeQuantity',
                 charge=self.charge.typeID,
                 chargeQuantity=chargeQty)
         shipID = self.GetShipID()
         if not self.shell.SlotExists(shipID, self.module.flagID):
             modulehint = localization.GetByLabel(
                 'UI/Fitting/SlotDoesNotExist')
     else:
         modulehint = self._emptyHint
     self.backupHint = modulehint
     self.opacity = 1.0
     self.state = uiconst.UI_NORMAL
     self.PrepareUtilButtons()
     if putOnline:
         uthread.new(self.DelayedOnlineAttempt, eve.session.shipid,
                     invItem.itemID)
     icon = self.sr.flagIcon
     icon.SetAlign(uiconst.CENTER)
     iconSize = int(48 * self.scaleFactor)
     icon.SetSize(iconSize, iconSize)
     icon.SetPosition(0, 0)
     if self.charge or self.module:
         icon.LoadIconByTypeID((self.charge or self.module).typeID,
                               ignoreSize=True)
         icon.parent.SetRotation(-self.GetRotation())
     else:
         rev = 0
         slotIcon = {
             const.flagSubSystemSlot0: 'ui_81_64_9',
             const.flagSubSystemSlot1: 'ui_81_64_10',
             const.flagSubSystemSlot2: 'ui_81_64_11',
             const.flagSubSystemSlot3: 'ui_81_64_12',
             const.flagSubSystemSlot4: 'ui_81_64_13'
         }.get(self.flag, None)
         if slotIcon is None:
             slotIcon = {
                 const.effectLoPower: 'ui_81_64_5',
                 const.effectMedPower: 'ui_81_64_6',
                 const.effectHiPower: 'ui_81_64_7',
                 const.effectRigSlot: 'ui_81_64_8'
             }.get(self.powerType, None)
         else:
             rev = 1
         if slotIcon is not None:
             icon.LoadIcon(slotIcon, ignoreSize=True)
         if rev:
             icon.parent.SetRotation(mathUtil.DegToRad(180.0))
         else:
             icon.parent.SetRotation(0.0)
     icon.state = uiconst.UI_PICKCHILDREN
     self.SetGroup()
     self.UpdateOnlineDisplay()
     self.Hilite(0)
示例#7
0
文件: map2D.py 项目: R4M80MrX/eve-1
    def Draw(self, ids, idlevel, drawlevel, needsize, sprite = None, solarsystem = None):
        _settings = (ids,
         idlevel,
         drawlevel,
         needsize)
        if _settings == self.settings:
            return
        self.settings = _settings
        lg.Info('2Dmaps', 'Drawing map, ids/idlevel/drawlevel:', ids, idlevel, drawlevel)
        if drawlevel <= idlevel:
            return
        if drawlevel == DRAWLVLSYS and len(ids) > 1:
            ids = ids[:1]
        SIZE = needsize
        if sprite is None:
            sprite = self.sprite
        _ids = {}
        for id in ids:
            _ids[id] = ''

        ids = _ids.keys()
        endid = ''
        if len(ids) > 1:
            endid = '%s_' % ids[-1]
        self.ids = ids
        self.idlevel = idlevel
        self.drawlevel = drawlevel
        self.needsize = needsize
        imageid = '%s_%s_%s_%s_%s_%s' % (ids[0],
         '_' * max(0, len(ids) - 2),
         endid,
         idlevel,
         drawlevel,
         self.fillSize)
        imageid = imageid.replace('.', '')
        if self.drawlevel == DRAWLVLSYS:
            imageid += '_' + str(settings.user.ui.Get('solarsystemmapabstract', 0))
        lg.Info('2Dmaps', 'MapID is: %s' % imageid)
        for each in self.overlays.children:
            if each.name == 'destinationline':
                each.renderObject = None
                each.Close()

        self.cordsAsPortion = {}
        mapitems = self.mapitems = self.GetMapData(ids, idlevel, drawlevel)
        if drawlevel == 4:
            self.DrawSolarsystem(sprite, ids, imageid, mapitems, SIZE)
            self.CheckMyLocation(solarsystem=solarsystem)
            return
        connections, outsideitems = self.GetConnectionData(ids, idlevel, drawlevel)
        self.outsideitems = outsideitems
        minx = 1e+100
        maxx = -1e+100
        minz = 1e+100
        maxz = -1e+100
        for item in mapitems:
            minx = min(minx, item.x)
            maxx = max(maxx, item.x)
            minz = min(minz, item.z)
            maxz = max(maxz, item.z)

        mw = -minx + maxx
        mh = -minz + maxz
        if not (mw and mh):
            return
        SIZE = SIZE * 2
        drawarea = DrawArea()
        drawarea.setTransparentColor(-1)
        drawarea.setSize(SIZE, SIZE, 4278190080L)
        dotrad = [2,
         3,
         4,
         5,
         6][idlevel]
        sizefactor = min(SIZE / mw, SIZE / mh) * self.portion
        cords = {}
        for item in mapitems[:]:
            if item.groupID == const.groupRegion:
                if drawlevel != 1:
                    continue
            if item.groupID == const.groupConstellation:
                if drawlevel != 2:
                    continue
            x = int(item.x * sizefactor - int(minx * sizefactor) + (SIZE - mw * sizefactor) / 2)
            y = int(item.z * sizefactor - int(minz * sizefactor) + (SIZE - mh * sizefactor) / 2)
            cords[item.itemID] = (x,
             SIZE - y,
             dotrad,
             1,
             16777215)

        for item in self.outsideitems:
            x = int(item.x * sizefactor - int(minx * sizefactor) + (SIZE - mw * sizefactor) / 2)
            y = int(item.z * sizefactor - int(minz * sizefactor) + (SIZE - mh * sizefactor) / 2)
            cords[item.itemID] = (x,
             SIZE - y,
             dotrad,
             0,
             None)

        done = []
        i = 0
        lineWidth = 2.0
        for jumptype in connections:
            for pair in jumptype:
                fr, to = pair
                if (fr, to) in done:
                    continue
                if fr in cords and to in cords:
                    drawarea.line(cords[fr][0], cords[fr][1], cords[to][0], cords[to][1], [43520, 255, 16711680][i], lineWidth)
                    drawarea.line(cords[fr][0] + 1, cords[fr][1], cords[to][0] + 1, cords[to][1], [43520, 255, 16711680][i], lineWidth)
                    drawarea.line(cords[fr][0], cords[fr][1] + 1, cords[to][0], cords[to][1] + 1, [43520, 255, 16711680][i], lineWidth)

            i += 1

        for x, y, dotrad, cordtype, col in cords.itervalues():
            if cordtype == 0:
                dotrad = dotrad / 2
            drawarea.circle(x, y, dotrad, dotrad, 16777215, 16777215)

        self.areas = [ (cords[id][0],
         cords[id][1],
         cords[id][2],
         id) for id in cords.iterkeys() ]
        self.cordsAsPortion = {}
        for id in cords.iterkeys():
            self.cordsAsPortion[id] = (cords[id][0] / float(SIZE), cords[id][1] / float(SIZE))

        self.CheckMyLocation(solarsystem=solarsystem)
        self.CheckDestination()
        self.PlaceMap(sprite, drawarea, SIZE)