VirtualBox

Changeset 30533 in vbox for trunk/src


Ignore:
Timestamp:
Jun 30, 2010 4:15:55 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63241
Message:

Python: active callbacks with Windows Python

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r30516 r30533  
    432432
    433433def monitorSource(ctx, es, active, dur):
    434     def handleEventImpl(ev):
    435          print "got event: %s %s" %(ev, str(ev.type))
     434    def handleEventImpl(ev):         
     435         print "got event: %s" %(str(ev.type))
    436436         if ev.type == ctx['global'].constants.VBoxEventType_OnMachineStateChange:
    437437             scev = ctx['global'].queryInterface(ev, 'IMachineStateChangeEvent')
     
    444444
    445445     def handleEvent(self, ev):
    446          handleEventImpl(ev)
    447 
     446         try:
     447            # a bit convoluted QI to make it work with MS COM
     448            handleEventImpl(ctx['global'].queryInterface(ev, 'IEvent'))
     449         except:
     450            traceback.print_exc()
     451            pass
     452 
    448453    if active:
    449454        listener = ctx['global'].createListener(EventListener)
  • trunk/src/VBox/Main/glue/vboxapi.py

    r30492 r30533  
    295295        str += "   HandleEvent=BaseClass.handleEvent\n"
    296296        str += "   def __init__(self): BaseClass.__init__(self, arg)\n"
    297         str += "result = ListenerImpl()\n"
     297        str += "result = win32com.server.util.wrap(ListenerImpl())\n"
    298298        exec (str,d,d)
    299299        return d['result']
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