Changeset 20693 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 18, 2009 4:37:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r20630 r20693 156 156 def onShowWindow(self, winId): 157 157 print "%s: onShowWindow: %d" %(self.mach.name, winId) 158 159 class VBoxMonitor: 160 def __init__(self, vbox): 161 self.vbox = vbox 162 pass 163 164 def onMachineStateChange(self, id, state): 165 print "onMachineStateChange: %s %d" %(id, state) 166 167 def onMachineDataChange(self,id): 168 print "onMachineDataChange: %s" %(id) 169 170 def onExtraDataCanChange(self, id, key, value): 171 print "onExtraDataCanChange: %s %s=>%s" %(id, key, value) 172 return true 173 174 def onExtraDataChange(self, id, key, value): 175 print "onExtraDataChange: %s %s=>%s" %(id, key, value) 176 177 def onMediaRegistred(self, id, type, registred): 178 print "onMediaRegistred: %s" %(id) 179 180 def onMachineRegistred(self, id, registred): 181 print "onMachineRegistred: %s" %(id) 182 183 def onSessionStateChange(self, id, state): 184 print "onSessionStateChange: %s %d" %(id, state) 185 186 def onSnapshotTaken(self, mach, id): 187 print "onSnapshotTaken: %s %s" %(mach, id) 188 189 def onSnapshotDiscarded(self, mach, id): 190 print "onSnapshotDiscarded: %s %s" %(mach, id) 191 192 def onSnapshotChange(self, mach, id): 193 print "onSnapshotChange: %s %s" %(mach, id) 194 195 def onGuestPropertyChange(self, id, val1, val2, val3): 196 print "onGuestPropertyChange: %s" %(id) 197 198 158 199 159 200 g_hasreadline = 1 … … 304 345 def monitorGuest(ctx, machine, console, dur): 305 346 import time 306 import xpcom307 347 cb = ctx['global'].createCallback('IConsoleCallback', GuestMonitor, machine) 308 348 console.registerCallback(cb) … … 319 359 console.unregisterCallback(cb) 320 360 321 361 362 def monitorVbox(ctx, dur): 363 import time 364 vbox = ctx['vb'] 365 cb = ctx['global'].createCallback('IVirtualBoxCallback', VBoxMonitor, vbox) 366 vbox.registerCallback(cb) 367 if dur == -1: 368 # not infinity, but close enough 369 dur = 100000 370 try: 371 end = time.time() + dur 372 while time.time() < end: 373 ctx['global'].waitForEvents(500) 374 # We need to catch all exceptions here, otherwise callback will never be unregistered 375 except Exception,e: 376 print e 377 if g_verbose: 378 traceback.print_exc() 379 pass 380 vbox.unregisterCallback(cb) 322 381 323 382 def cmdExistingVm(ctx,mach,cmd,args): … … 561 620 return 0 562 621 622 def monitorVboxCmd(ctx, args): 623 if (len(args) > 2): 624 print "usage: monitorVbox (duration)" 625 return 0 626 dur = 5 627 if len(args) > 1: 628 dur = float(args[1]) 629 monitorVbox(ctx, dur) 630 return 0 631 563 632 def evalCmd(ctx, args): 564 633 expr = ' '.join(args[1:]) … … 597 666 'guest':['Execute command for guest: guest Win32 console.mouse.putMouseEvent(20, 20, 0, 0)', guestCmd], 598 667 'monitorGuest':['Monitor what happens with the guest for some time: monitorGuest Win32 10', monitorGuestCmd], 668 'monitorVbox':['Monitor what happens with Virtual Box for some time: monitorVbox 10', monitorVboxCmd], 599 669 } 600 670
Note:
See TracChangeset
for help on using the changeset viewer.