VirtualBox

Changeset 21956 in vbox


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

Python: spaces cleanup, fixed typo in callback names

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r21936 r21956  
    3232import time
    3333
    34 # Simple implementation of IConsoleCallback, one can use it as skeleton 
     34# Simple implementation of IConsoleCallback, one can use it as skeleton
    3535# for custom implementations
    3636class GuestMonitor:
     
    3939
    4040    def onMousePointerShapeChange(self, visible, alpha, xHot, yHot, width, height, shape):
    41         print  "%s: onMousePointerShapeChange: visible=%d" %(self.mach.name, visible) 
     41        print  "%s: onMousePointerShapeChange: visible=%d" %(self.mach.name, visible)
    4242    def onMouseCapabilityChange(self, supportsAbsolute, needsHostCursor):
    4343        print  "%s: onMouseCapabilityChange: needsHostCursor=%d" %(self.mach.name, needsHostCursor)
     
    102102    def onMachineDataChange(self,id):
    103103        print "onMachineDataChange: %s" %(id)
    104    
     104
    105105    def onExtraDataCanChange(self, id, key, value):
    106106        print "onExtraDataCanChange: %s %s=>%s" %(id, key, value)
     
    110110        print "onExtraDataChange: %s %s=>%s" %(id, key, value)
    111111
    112     def onMediaRegistred(self, id, type, registred):
    113         print "onMediaRegistred: %s" %(id)
    114 
    115     def onMachineRegistred(self, id, registred):
    116         print "onMachineRegistred: %s" %(id)
     112    def onMediaRegistered(self, id, type, registered):
     113        print "onMediaRegistered: %s" %(id)
     114
     115    def onMachineRegistered(self, id, registred):
     116        print "onMachineRegistered: %s" %(id)
    117117
    118118    def onSessionStateChange(self, id, state):
     
    309309    # We need to catch all exceptions here, otherwise callback will never be unregistered
    310310    except:
    311         pass   
     311        pass
    312312    console.unregisterCallback(cb)
    313313
     
    350350        print 'Trying to use local only functionality, ignored'
    351351        return
    352     console=session.console   
     352    console=session.console
    353353    ops={'pause':           lambda: console.pause(),
    354354         'resume':          lambda: console.resume(),
     
    637637        aliases[args[1]] = args[2]
    638638        return 0
    639    
     639
    640640    for (k,v) in aliases.items():
    641641        print "'%s' is an alias for '%s'" %(k,v)
     
    677677       print "3D acceleration NOT available"
    678678
    679    print "Network interfaces:" 
     679   print "Network interfaces:"
    680680   for ni in ctx['global'].getArray(host, 'networkInterfaces'):
    681681       print "  %s (%s)" %(ni.name, ni.IPAddress)
    682682
    683    print "DVD drives:" 
     683   print "DVD drives:"
    684684   for dd in ctx['global'].getArray(host, 'DVDDrives'):
    685685       print "  %s - %s" %(dd.name, dd.description)
    686686
    687    print "USB devices:" 
     687   print "USB devices:"
    688688   for ud in ctx['global'].getArray(host, 'USBDevices'):
    689689       print "  %s (vendorId=%d productId=%d serial=%s) %s" %(ud.product, ud.vendorId, ud.productId, ud.serialNumber, getUSBStateString(ud.state))
     
    729729        return None
    730730    else:
    731         raise Exception("Unknown adapter type: "+type)   
    732    
     731        raise Exception("Unknown adapter type: "+type)
     732
    733733
    734734def portForwardCmd(ctx, args):
     
    752752    config = "VBoxInternal/Devices/" + adapterType + "/"
    753753    config = config + str(adapter.slot)  +"/LUN#0/Config/" + profile_name
    754  
     754
    755755    mach.setExtraData(config + "/Protocol", proto)
    756756    mach.setExtraData(config + "/HostPort", str(hostPort))
     
    759759    mach.saveSettings()
    760760    session.close()
    761    
     761
    762762    return 0
    763763
     
    996996# This file also will be read automatically on startup or 'reloadExt'.
    997997#
    998 # Also one can put shell extensions into ~/.VirtualBox/shexts and 
     998# Also one can put shell extensions into ~/.VirtualBox/shexts and
    999999# they will also be picked up, so this way one can exchange
    10001000# shell extensions easily.
     
    10251025        addExtsFromFile(ctx, cmds, os.path.join(shextdir,e))
    10261026
    1027 def interpret(ctx):   
     1027def interpret(ctx):
    10281028    if ctx['remote']:
    10291029        commands['connect'] = ["Connect to remote VBox instance", connectCmd, 0]
    10301030        commands['disconnect'] = ["Disconnect from remote VBox instance", disconnectCmd, 0]
    1031    
     1031
    10321032    vbox = ctx['vb']
    10331033
     
    11021102    ctx = {'global':g_virtualBoxManager,
    11031103           'mgr':g_virtualBoxManager.mgr,
    1104            'vb':g_virtualBoxManager.vbox, 
     1104           'vb':g_virtualBoxManager.vbox,
    11051105           'ifaces':g_virtualBoxManager.constants,
    1106            'remote':g_virtualBoxManager.remote, 
     1106           'remote':g_virtualBoxManager.remote,
    11071107           'type':g_virtualBoxManager.type,
    11081108           'run': lambda cmd,args: runCommandCb(ctx, cmd, args),
    1109            'machById': lambda id: machById(ctx,id), 
     1109           'machById': lambda id: machById(ctx,id),
    11101110           'progressBar': lambda p: progressBar(ctx,p),
    11111111           '_machlist':None
  • trunk/src/VBox/Main/glue/vboxapi.py

    r21906 r21956  
    8282        'values_as_string': pre-processed values ready for 'print' statement
    8383        """
    84         # Get around the problem with input arrays returned in output 
     84        # Get around the problem with input arrays returned in output
    8585        # parameters (see #3953) for MSCOM.
    8686        if self.isMscom:
     
    108108
    109109def ComifyName(name):
    110     return name[0].capitalize()+name[1:]   
     110    return name[0].capitalize()+name[1:]
    111111
    112112_COMForward = { 'getattr' : None,
    113113                'setattr' : None}
    114          
     114
    115115def CustomGetAttr(self, attr):
    116116    # fastpath
     
    197197    VBOX_TLB_MAJOR = 1
    198198    VBOX_TLB_MINOR = 0
    199    
     199
    200200    def __init__(self, params):
    201201            from win32com import universal
     
    214214            self.handles.append(handle)
    215215            _COMForward['getattr'] = DispatchBaseClass.__dict__['__getattr__']
    216             DispatchBaseClass.__dict__['__getattr__'] = CustomGetAttr           
     216            DispatchBaseClass.__dict__['__getattr__'] = CustomGetAttr
    217217            _COMForward['setattr'] = DispatchBaseClass.__dict__['__setattr__']
    218             DispatchBaseClass.__dict__['__setattr__'] = CustomSetAttr           
     218            DispatchBaseClass.__dict__['__setattr__'] = CustomSetAttr
    219219            win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
    220220            win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
     
    257257        str = ""
    258258        str += "import win32com.server.util\n"
    259         #str += "import win32com.server.register\n"
    260         #str += "from win32com import universal\n"
    261259        str += "import pythoncom\n"
    262         #str += "universal.RegisterInterfaces(tlb_guid, 0, 1, 0, ['"+iface+"'])\n"
    263260
    264261        str += "class "+iface+"Impl(BaseClass):\n"
     
    266263        str += "   _typelib_guid_ = tlb_guid\n"
    267264        str += "   _typelib_version_ = 1, 0\n"
    268         #str += "   _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER\n"
    269         #str += "   _reg_clsid_ = '{F21202A2-959A-4149-B1C3-68B9013F3335}'\n"
    270         #str += "   _reg_progid_ = 'VirtualBox."+iface+"Impl'\n"
    271         #str += "   _reg_desc_ = 'Generated callback implementation class'\n"
    272         #str += "   _reg_policy_spec_ = 'win32com.server.policy.EventHandlerPolicy'\n"
    273265
    274266        # generate capitalized version of callbacks - that's how Python COM
    275267        # looks them up on Windows
    276268        for m in dir(impl):
    277            if m.startswith("on"):     
     269           if m.startswith("on"):
    278270             str += "   "+ComifyName(m)+"=BaseClass."+m+"\n"
    279271
    280272        str += "   def __init__(self): BaseClass.__init__(self, arg)\n"
    281         #str += "win32com.server.register.UseCommandLine("+iface+"Impl)\n"
    282 
    283273        str += "result = win32com.server.util.wrap("+iface+"Impl())\n"
    284274        exec (str,d,d)
     
    388378            self.password = ""
    389379            self.url = None
    390         self.vbox = None       
    391 
    392     def getSessionObject(self, vbox):       
     380        self.vbox = None
     381
     382    def getSessionObject(self, vbox):
    393383        return self.wsmgr.getSessionObject(vbox)
    394384
     
    466456            else:
    467457                style = "XPCOM"
    468        
     458
    469459        exec "self.platform = Platform"+style+"(platparams)"
    470            
     460
    471461        self.constants = VirtualBoxReflectionInfo()
    472462        self.type = self.platform.getType()
    473463        self.remote = self.platform.getRemote()
    474         self.style = style 
     464        self.style = style
    475465        self.mgr = SessionManager(self)
    476        
     466
    477467        try:
    478468            self.vbox = self.platform.getVirtualBox()
     
    527517
    528518    def getPerfCollector(self, vbox):
    529         return PerfCollector(self, vbox)       
     519        return PerfCollector(self, vbox)
Note: See TracChangeset for help on using the changeset viewer.

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