Using juce and boost.python

Hi I am trying to extend some parts of my application to python. To do so, I have planed to use boost::python. So I put together a simple test application to expose a Window to python.

like so:

class cmWindow: private juce::DocumentWindow{

public:
	cmWindow();
	~cmWindow();
	void open();
	void close();
	void setPosition(int x, int y, int w, int h);
	void setSize(int w, int h);
};

cmWindow::cmWindow(): DocumentWindow ("controller",
												Stylo::appBG,
												DocumentWindow::allButtons,
												true)
{
	
};

cmWindow::~cmWindow()
{
}

void cmWindow::close()
{
	setVisible(true);
}

void cmWindow::open()
{
	setVisible(false);
}

void cmWindow::setPosition(int x, int y, int w, int h)
{
	setBounds(Rectangle<int>(x, y, w, h));
}

void cmWindow::setSize(int w, int h)
{
	
}

and


string version() {
  return CM_VERSION;
}

BOOST_PYTHON_MODULE(cm)
{
    def("version", version);
	class_<cmWindow>("Window")
	;
};

void initPyBind(){
	initcm();
}

This works with a Class that is not extending DocumentWindow. But as soon as I extend it, I get the following error:

./juce_amalgamated.h:54356: error: ‘juce::DocumentWindow::DocumentWindow(const juce::DocumentWindow&)’ is private
cm/cmwindow.h:6: error: within this context
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
                 from /usr/include/boost/python/object/value_holder.hpp:50,
                 from /usr/include/boost/python/object/class_metadata.hpp:11,
                 from /usr/include/boost/python/class.hpp:23,
                 from /usr/include/boost/python.hpp:18,
                 from /home/phwhitfield/programming/openFrameworks/apps/cppMixer/cppMixer/pyBind.cpp:2:
/usr/include/boost/python/object/value_holder.hpp: In constructor ‘boost::python::objects::value_holder<Value>::value_holder(PyObject*, A0) [with A0 = boost::reference_wrapper<const cmWindow>, Value = cmWindow]’:

Which points to a line that uses JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR. I don’t know too much about this macro. But is it possible, that somehow the leak detector prevents the class to be used by boost::python? Maybe because it’s trying to make an unsafe copy or whatsoever? Should I use a wrapper class to expose?

thanks
philip

you’re not really meant to subclass DocumentWindow, you create a content component and have the DocumentWindow display that.

Your boost class is clearly trying to call a copy constructor, but for obvious reasons, DocumentWindow doesn’t provide one of those.

(the DECLARE_NON_COPYABLE macro is just a quick way to declare a private copy constructor)