VirtualBox

Changeset 29556 in vbox


Ignore:
Timestamp:
May 17, 2010 2:46:22 PM (15 years ago)
Author:
vboxsync
Message:

Python shell: prettier colors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r29544 r29556  
    282282    return colored(vm, 'blue')
    283283
    284 def colPath(ctx,vm):
    285     return colored(vm, 'green')
    286 
     284def colPath(ctx,p):
     285    return colored(p, 'green')
     286
     287def colSize(ctx,m):
     288    return colored(m, 'red')
     289
     290def colSizeM(ctx,m):
     291    return colored(str(m)+'M', 'red')
    287292
    288293def createVm(ctx,name,kind,base):
     
    16851690      verbose = False
    16861691   hdds = ctx['global'].getArray(ctx['vb'], 'hardDisks')
    1687    print "Hard disks:"
     1692   print colCat(ctx,"Hard disks:")
    16881693   for hdd in hdds:
    16891694       if hdd.state != ctx['global'].constants.MediumState_Created:
    16901695           hdd.refreshState()
    1691        print "   %s (%s)%s %dM [logical %dM]" %(hdd.location, hdd.format, optId(verbose,hdd.id),asSize(hdd.size, True), asSize(hdd.logicalSize, False))
     1696       print "   %s (%s)%s %s [logical %s]" %(colPath(ctx,hdd.location), hdd.format, optId(verbose,hdd.id),colSizeM(ctx,asSize(hdd.size, True)), colSizeM(ctx,asSize(hdd.logicalSize, False)))
    16921697
    16931698   dvds = ctx['global'].getArray(ctx['vb'], 'DVDImages')
    1694    print "CD/DVD disks:"
     1699   print colCat(ctx,"CD/DVD disks:")
    16951700   for dvd in dvds:
    16961701       if dvd.state != ctx['global'].constants.MediumState_Created:
    16971702           dvd.refreshState()
    1698        print "   %s (%s)%s %dM" %(dvd.location, dvd.format,optId(verbose,hdd.id),asSize(hdd.size, True))
     1703       print "   %s (%s)%s %s" %(colPath(ctx,dvd.location), dvd.format,optId(verbose,hdd.id),colSizeM(ctx,asSize(hdd.size, True)))
    16991704
    17001705   floppys = ctx['global'].getArray(ctx['vb'], 'floppyImages')
    1701    print "Floopy disks:"
     1706   print colCat(ctx,"Floppy disks:")
    17021707   for floppy in floppys:
    17031708       if floppy.state != ctx['global'].constants.MediumState_Created:
    17041709           floppy.refreshState()
    1705        print "   %s (%s)%s %dM" %(floppy.location, floppy.format,optId(verbose,hdd.id), asSize(hdd.size, True))
     1710       print "   %s (%s)%s %s" %(colPath(ctx,floppy.location), floppy.format,optId(verbose,hdd.id), colSizeM(ctx,asSize(hdd.size, True)))
    17061711
    17071712   return 0
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