[vbox-dev] Accessing the enums from python
narf at mundo-r.com
Tue May 26 00:38:47 PDT 2009
Thank you. I'll use xpcom.components.interfaces for now (I'm using
xpcom in vboxgtk-svn anyway) and change it when vboxapi.py is
On Mon, May 25, 2009 at 9:39 PM, Nikolay Igotti <Nikolay.Igotti at sun.com> wrote:
> Hi Narf,
> Yes, it is possible, and there are two approaches to that:
> - platform (COM/XPCOM/webservices) specific (not recommended for XPCOM, not
> available for MSCOM, OK for webservices)
> - platform neutral (implemented in recent SVN tree) - (recommended)
> First approach it to use component technology's specific mechanism to access
> constants data available in typelib.
> To do that, for XPCOM xpcom.components.interfaces can be used, such as
> For webservices, one can use g_reflectionInfo in VirtualBox_wrappers
> For MS COM there's no reliable mechanism to do that
> doesn't work entirely expected way).
> Second approach, is to use pregenerated constants file, and rely on
> universal wrapper vboxapi.py to access constants, like this:
> virtualBoxManager = VirtualBoxManager(None, None)
> Note underscore in constant's name.
> Class VirtualBoxManager hides platform-specific implementation details, and
> allow to write the same Python code for Windows, Linux and webservices.
> Will work on improving of Python sections in SDK documentation .
> Narf wrote:
>> Is it possible to access the enums (MachineState, HardDiskType, etc)
>> from python? I'm programming a python interface to virtualbox and I
>> feel stupid hardcoding the numbers. And the python section in the sdk
>> documentation is not... erm... very helpful :)
>> vbox-dev mailing list
>> vbox-dev at virtualbox.org
More information about the vbox-dev