Changeset 30516 in vbox for trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
- Timestamp:
- Jun 29, 2010 6:19:01 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63221
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r30492 r30516 431 431 vbox.unregisterCallback(cb) 432 432 433 def monitor VBox2(ctx, dur):433 def monitorSource(ctx, es, active, dur): 434 434 def handleEventImpl(ev): 435 435 print "got event: %s %s" %(ev, str(ev.type)) … … 446 446 handleEventImpl(ev) 447 447 448 vbox = ctx['vb']449 active = True450 448 if active: 451 449 listener = ctx['global'].createListener(EventListener) 452 450 else: 453 listener = vbox.eventSource.createListener()451 listener = es.createListener() 454 452 registered = False 455 453 if dur == -1: … … 457 455 dur = 100000 458 456 try: 459 vbox.eventSource.registerListener(listener, [ctx['global'].constants.VBoxEventType_Any], active)457 es.registerListener(listener, [ctx['global'].constants.VBoxEventType_Any], active) 460 458 registered = True 461 459 end = time.time() + dur … … 464 462 ctx['global'].waitForEvents(500) 465 463 else: 466 ev = vbox.eventSource.getEvent(listener, 500)464 ev = es.getEvent(listener, 500) 467 465 if ev: 468 466 handleEventImpl(ev) 469 467 # otherwise waitable events will leak (active listeners ACK automatically) 470 vbox.eventSource.eventProcessed(listener, ev)468 es.eventProcessed(listener, ev) 471 469 # We need to catch all exceptions here, otherwise listener will never be unregistered 472 470 except: 473 471 pass 474 472 if listener and registered: 475 vbox.eventSource.unregisterListener(listener)473 es.unregisterListener(listener) 476 474 477 475 … … 1427 1425 return 0 1428 1426 1427 def monitorGuest2Cmd(ctx, args): 1428 if (len(args) < 2): 1429 print "usage: monitorGuest2 name (duration)" 1430 return 0 1431 mach = argsToMach(ctx,args) 1432 if mach == None: 1433 return 0 1434 dur = 5 1435 if len(args) > 2: 1436 dur = float(args[2]) 1437 active = True 1438 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx,mach,console,args: monitorSource(ctx, console.eventSource, active, dur)]) 1439 return 0 1440 1429 1441 def monitorVBoxCmd(ctx, args): 1430 1442 if (len(args) > 2): … … 1444 1456 if len(args) > 1: 1445 1457 dur = float(args[1]) 1446 monitorVBox2(ctx, dur) 1458 vbox = ctx['vb'] 1459 active = True 1460 monitorSource(ctx, vbox.eventSource, active, dur) 1447 1461 return 0 1448 1462 … … 2914 2928 'guest':['Execute command for guest: guest Win32 \'console.mouse.putMouseEvent(20, 20, 0, 0, 0)\'', guestCmd, 0], 2915 2929 'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest Win32 10', monitorGuestCmd, 0], 2930 'monitorGuest2':['Monitor what happens with the guest for some time: monitorGuest2 Win32 10', monitorGuest2Cmd, 0], 2916 2931 'monitorVBox':['Monitor what happens with Virtual Box for some time: monitorVBox 10', monitorVBoxCmd, 0], 2917 2932 'monitorVBox2':['(temp)Monitor what happens with Virtual Box for some time: monitorVBox2 10', monitorVBox2Cmd, 0],
Note:
See TracChangeset
for help on using the changeset viewer.