VirtualBox

Ignore:
Timestamp:
Jan 29, 2009 1:37:40 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
42210
Message:

removed stale XPCOM attribute from info command implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/python/sample/shellcommon.py

    r13205 r16366  
    1818    def __init__(self, vb):
    1919        """ Initializes the instance.
    20        
     20
    2121        Pass an instance of IVirtualBox as parameter.
    2222        """
    23         self.collector = vb.performanceCollector 
     23        self.collector = vb.performanceCollector
    2424
    2525    def setup(self, names, objects, period, nsamples):
     
    100100        in self.namespace that match.
    101101        """
    102        
     102
    103103        matches = []
    104104        n = len(text)
     
    112112        try:
    113113            for m in getMachines(self.ctx):
    114                 # although it has autoconversion, we need to cast 
     114                # although it has autoconversion, we need to cast
    115115                # explicitly for subscripts to work
    116116                word = str(m.name)
     
    132132  if  not g_hasreadline:
    133133      return
    134  
     134
    135135  comps = {}
    136136  for (k,v) in commands.items():
     
    144144def split_no_quotes(s):
    145145   return s.split()
    146    
     146
    147147def startVm(mgr,vb,mach,type,perf):
    148148    session = mgr.getSessionObject(vb)
     
    154154    print "Completed:", completed, "rc:",rc
    155155    if int(rc) == 0:
    156         # we ignore exceptions to allow starting VM even if 
     156        # we ignore exceptions to allow starting VM even if
    157157        # perf collector cannot be started
    158158        try:
     
    197197    if ctx['remote'] and cmd == 'stats2':
    198198        print 'Trying to use local only functionality, ignored'
    199         return       
     199        return
    200200    console=session.console
    201201    ops={'pause' :     lambda: console.pause(),
     
    236236        print "Help page:"
    237237        for i in commands:
    238             print "   ",i,":", commands[i][0] 
     238            print "   ",i,":", commands[i][0]
    239239    else:
    240240        c = commands.get(args[1], None)
     
    254254        print "usage: info [vmname|uuid]"
    255255        return 0
    256     mach = argsToMach(ctx,args) 
     256    mach = argsToMach(ctx,args)
    257257    if mach == None:
    258258        return 0
     
    263263    print "  RAM:  %dM" %(mach.memorySize)
    264264    print "  VRAM:  %dM" %(mach.VRAMSize)
    265     print "  Monitors:  %d" %(mach.MonitorCount)
    266265    print "  Clipboard mode:  %d" %(mach.clipboardMode)
    267266    print "  Machine status: " ,mach.sessionState
     
    273272    print "  Last changed: ",mach.lastStateChange
    274273
    275     return 0 
     274    return 0
    276275
    277276def startCmd(ctx, args):
    278     mach = argsToMach(ctx,args) 
     277    mach = argsToMach(ctx,args)
    279278    if mach == None:
    280279        return 0
     
    287286
    288287def pauseCmd(ctx, args):
    289     mach = argsToMach(ctx,args) 
     288    mach = argsToMach(ctx,args)
    290289    if mach == None:
    291290        return 0
     
    294293
    295294def powerdownCmd(ctx, args):
    296     mach = argsToMach(ctx,args) 
     295    mach = argsToMach(ctx,args)
    297296    if mach == None:
    298297        return 0
     
    301300
    302301def resumeCmd(ctx, args):
    303     mach = argsToMach(ctx,args) 
     302    mach = argsToMach(ctx,args)
    304303    if mach == None:
    305304        return 0
     
    308307
    309308def statsCmd(ctx, args):
    310     mach = argsToMach(ctx,args) 
     309    mach = argsToMach(ctx,args)
    311310    if mach == None:
    312311        return 0
     
    318317        print "usage: setvar [vmname|uuid] expr value"
    319318        return 0
    320     mach = argsToMach(ctx,args) 
     319    mach = argsToMach(ctx,args)
    321320    if mach == None:
    322321        return 0
     
    341340
    342341def aliasesCmd(ctx, args):
    343     for (k,v) in aliases.items(): 
     342    for (k,v) in aliases.items():
    344343        print "'%s' is an alias for '%s'" %(k,v)
    345344    return 0
     
    356355   for i in range(0,cnt):
    357356      print "Processor #%d speed: %dMHz" %(i,host.getProcessorSpeed(i))
    358                
     357
    359358   for metric in ctx['perf'].query(["*"], [host]):
    360359       print metric['name'], metric['values_as_string']
     
    373372   return 0
    374373
    375 aliases = {'s':'start', 
     374aliases = {'s':'start',
    376375           'i':'info',
    377376           'l':'list',
     
    397396
    398397def runCommand(ctx, cmd):
    399     if len(cmd) == 0: return 0 
     398    if len(cmd) == 0: return 0
    400399    args = split_no_quotes(cmd)
    401     if len(args) == 0: return 0 
     400    if len(args) == 0: return 0
    402401    c = args[0]
    403402    if aliases.get(c, None) != None:
     
    430429            done = runCommand(ctx, cmd)
    431430            if done != 0: break
    432         except KeyboardInterrupt:           
     431        except KeyboardInterrupt:
    433432            print '====== You can type quit or q to leave'
    434433            break
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette