Commit 314d7f0c authored by Aleksey R.'s avatar Aleksey R.

+ virtualbox 5.2 api support

parent 0ae60df8
......@@ -6,6 +6,11 @@ import os
from vboxapi import VirtualBoxManager
_vboxmgr = VirtualBoxManager()
try:
_vbox = _vboxmgr.vbox
except AttributeError:
# virtualbox 5.2 api
_vbox = _vboxmgr.platform.getVirtualBox()
_ACTIVE_DEBUGGERS = dict()
......@@ -15,7 +20,7 @@ def get_ini_option(option_name):
return config.get("General", option_name)
def start_debugger(machine_id):
machine = _vboxmgr.vbox.findMachine(machine_id)
machine = _vbox.findMachine(machine_id)
connect_options = machine.getExtraData("KD/ConnectOptions")
if not connect_options:
......@@ -78,19 +83,19 @@ class WaitableEvent:
self._cv.release()
def thread_routine(event_thread_ready, flag_stop_thread):
listener = _vboxmgr.vbox.eventSource.createListener()
_vboxmgr.vbox.eventSource.registerListener( listener,
[_vboxmgr.constants.VBoxEventType_OnMachineStateChanged],
False )
listener = _vbox.eventSource.createListener()
_vbox.eventSource.registerListener( listener,
[_vboxmgr.constants.VBoxEventType_OnMachineStateChanged],
False )
event_thread_ready.set()
while flag_stop_thread.is_set() == False:
event = _vboxmgr.vbox.eventSource.getEvent(listener, 500)
event = _vbox.eventSource.getEvent(listener, 500)
if event:
on_machine_state_changed(event)
_vboxmgr.vbox.eventSource.unregisterListener(listener)
_vbox.eventSource.unregisterListener(listener)
def main():
event_thread_ready = WaitableEvent()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment