Changeset 21956 in vbox
- Timestamp:
- Aug 4, 2009 1:37:40 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50653
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r21936 r21956 32 32 import time 33 33 34 # Simple implementation of IConsoleCallback, one can use it as skeleton 34 # Simple implementation of IConsoleCallback, one can use it as skeleton 35 35 # for custom implementations 36 36 class GuestMonitor: … … 39 39 40 40 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) 42 42 def onMouseCapabilityChange(self, supportsAbsolute, needsHostCursor): 43 43 print "%s: onMouseCapabilityChange: needsHostCursor=%d" %(self.mach.name, needsHostCursor) … … 102 102 def onMachineDataChange(self,id): 103 103 print "onMachineDataChange: %s" %(id) 104 104 105 105 def onExtraDataCanChange(self, id, key, value): 106 106 print "onExtraDataCanChange: %s %s=>%s" %(id, key, value) … … 110 110 print "onExtraDataChange: %s %s=>%s" %(id, key, value) 111 111 112 def onMediaRegist red(self, id, type, registred):113 print "onMediaRegist red: %s" %(id)114 115 def onMachineRegist red(self, id, registred):116 print "onMachineRegist red: %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) 117 117 118 118 def onSessionStateChange(self, id, state): … … 309 309 # We need to catch all exceptions here, otherwise callback will never be unregistered 310 310 except: 311 pass 311 pass 312 312 console.unregisterCallback(cb) 313 313 … … 350 350 print 'Trying to use local only functionality, ignored' 351 351 return 352 console=session.console 352 console=session.console 353 353 ops={'pause': lambda: console.pause(), 354 354 'resume': lambda: console.resume(), … … 637 637 aliases[args[1]] = args[2] 638 638 return 0 639 639 640 640 for (k,v) in aliases.items(): 641 641 print "'%s' is an alias for '%s'" %(k,v) … … 677 677 print "3D acceleration NOT available" 678 678 679 print "Network interfaces:" 679 print "Network interfaces:" 680 680 for ni in ctx['global'].getArray(host, 'networkInterfaces'): 681 681 print " %s (%s)" %(ni.name, ni.IPAddress) 682 682 683 print "DVD drives:" 683 print "DVD drives:" 684 684 for dd in ctx['global'].getArray(host, 'DVDDrives'): 685 685 print " %s - %s" %(dd.name, dd.description) 686 686 687 print "USB devices:" 687 print "USB devices:" 688 688 for ud in ctx['global'].getArray(host, 'USBDevices'): 689 689 print " %s (vendorId=%d productId=%d serial=%s) %s" %(ud.product, ud.vendorId, ud.productId, ud.serialNumber, getUSBStateString(ud.state)) … … 729 729 return None 730 730 else: 731 raise Exception("Unknown adapter type: "+type) 732 731 raise Exception("Unknown adapter type: "+type) 732 733 733 734 734 def portForwardCmd(ctx, args): … … 752 752 config = "VBoxInternal/Devices/" + adapterType + "/" 753 753 config = config + str(adapter.slot) +"/LUN#0/Config/" + profile_name 754 754 755 755 mach.setExtraData(config + "/Protocol", proto) 756 756 mach.setExtraData(config + "/HostPort", str(hostPort)) … … 759 759 mach.saveSettings() 760 760 session.close() 761 761 762 762 return 0 763 763 … … 996 996 # This file also will be read automatically on startup or 'reloadExt'. 997 997 # 998 # Also one can put shell extensions into ~/.VirtualBox/shexts and 998 # Also one can put shell extensions into ~/.VirtualBox/shexts and 999 999 # they will also be picked up, so this way one can exchange 1000 1000 # shell extensions easily. … … 1025 1025 addExtsFromFile(ctx, cmds, os.path.join(shextdir,e)) 1026 1026 1027 def interpret(ctx): 1027 def interpret(ctx): 1028 1028 if ctx['remote']: 1029 1029 commands['connect'] = ["Connect to remote VBox instance", connectCmd, 0] 1030 1030 commands['disconnect'] = ["Disconnect from remote VBox instance", disconnectCmd, 0] 1031 1031 1032 1032 vbox = ctx['vb'] 1033 1033 … … 1102 1102 ctx = {'global':g_virtualBoxManager, 1103 1103 'mgr':g_virtualBoxManager.mgr, 1104 'vb':g_virtualBoxManager.vbox, 1104 'vb':g_virtualBoxManager.vbox, 1105 1105 'ifaces':g_virtualBoxManager.constants, 1106 'remote':g_virtualBoxManager.remote, 1106 'remote':g_virtualBoxManager.remote, 1107 1107 'type':g_virtualBoxManager.type, 1108 1108 'run': lambda cmd,args: runCommandCb(ctx, cmd, args), 1109 'machById': lambda id: machById(ctx,id), 1109 'machById': lambda id: machById(ctx,id), 1110 1110 'progressBar': lambda p: progressBar(ctx,p), 1111 1111 '_machlist':None -
trunk/src/VBox/Main/glue/vboxapi.py
r21906 r21956 82 82 'values_as_string': pre-processed values ready for 'print' statement 83 83 """ 84 # Get around the problem with input arrays returned in output 84 # Get around the problem with input arrays returned in output 85 85 # parameters (see #3953) for MSCOM. 86 86 if self.isMscom: … … 108 108 109 109 def ComifyName(name): 110 return name[0].capitalize()+name[1:] 110 return name[0].capitalize()+name[1:] 111 111 112 112 _COMForward = { 'getattr' : None, 113 113 'setattr' : None} 114 114 115 115 def CustomGetAttr(self, attr): 116 116 # fastpath … … 197 197 VBOX_TLB_MAJOR = 1 198 198 VBOX_TLB_MINOR = 0 199 199 200 200 def __init__(self, params): 201 201 from win32com import universal … … 214 214 self.handles.append(handle) 215 215 _COMForward['getattr'] = DispatchBaseClass.__dict__['__getattr__'] 216 DispatchBaseClass.__dict__['__getattr__'] = CustomGetAttr 216 DispatchBaseClass.__dict__['__getattr__'] = CustomGetAttr 217 217 _COMForward['setattr'] = DispatchBaseClass.__dict__['__setattr__'] 218 DispatchBaseClass.__dict__['__setattr__'] = CustomSetAttr 218 DispatchBaseClass.__dict__['__setattr__'] = CustomSetAttr 219 219 win32com.client.gencache.EnsureDispatch('VirtualBox.Session') 220 220 win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox') … … 257 257 str = "" 258 258 str += "import win32com.server.util\n" 259 #str += "import win32com.server.register\n"260 #str += "from win32com import universal\n"261 259 str += "import pythoncom\n" 262 #str += "universal.RegisterInterfaces(tlb_guid, 0, 1, 0, ['"+iface+"'])\n"263 260 264 261 str += "class "+iface+"Impl(BaseClass):\n" … … 266 263 str += " _typelib_guid_ = tlb_guid\n" 267 264 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"273 265 274 266 # generate capitalized version of callbacks - that's how Python COM 275 267 # looks them up on Windows 276 268 for m in dir(impl): 277 if m.startswith("on"): 269 if m.startswith("on"): 278 270 str += " "+ComifyName(m)+"=BaseClass."+m+"\n" 279 271 280 272 str += " def __init__(self): BaseClass.__init__(self, arg)\n" 281 #str += "win32com.server.register.UseCommandLine("+iface+"Impl)\n"282 283 273 str += "result = win32com.server.util.wrap("+iface+"Impl())\n" 284 274 exec (str,d,d) … … 388 378 self.password = "" 389 379 self.url = None 390 self.vbox = None 391 392 def getSessionObject(self, vbox): 380 self.vbox = None 381 382 def getSessionObject(self, vbox): 393 383 return self.wsmgr.getSessionObject(vbox) 394 384 … … 466 456 else: 467 457 style = "XPCOM" 468 458 469 459 exec "self.platform = Platform"+style+"(platparams)" 470 460 471 461 self.constants = VirtualBoxReflectionInfo() 472 462 self.type = self.platform.getType() 473 463 self.remote = self.platform.getRemote() 474 self.style = style 464 self.style = style 475 465 self.mgr = SessionManager(self) 476 466 477 467 try: 478 468 self.vbox = self.platform.getVirtualBox() … … 527 517 528 518 def getPerfCollector(self, vbox): 529 return PerfCollector(self, vbox) 519 return PerfCollector(self, vbox)
Note:
See TracChangeset
for help on using the changeset viewer.