diff --git a/src/gepetto/corbaserver/client.py b/src/gepetto/corbaserver/client.py index 7c503908b7788b12e2a24813fda1e59ed34dbf8e..1e1c496bd7ad3b5795bf8b0253ed9ff25c07e0f9 100644 --- a/src/gepetto/corbaserver/client.py +++ b/src/gepetto/corbaserver/client.py @@ -74,6 +74,15 @@ class Client: for client in clients: self.makeClient (client) + # In the python interpreter of gepetto-gui, gui.createWindow + # crashes for an obscure reason. This hack makes it work. + try: + self.gui.createWindow = lambda x: mainWindow.createView(x).wid() + # At this point, we are in the python interpreter of gepetto-gui + except: + # At this point, we are NOT in the python interpreter of gepetto-gui + pass + def _getIIOPurl (): """ Returns "corbaloc:iiop:<host>:<port>/NameService" diff --git a/src/gui/pythonwidget.cc b/src/gui/pythonwidget.cc index cd95e9aede06ed02d0cc0a5e153c23856d57f246..3c94982cf23138a12a188e6cdc33992a5b2745b2 100644 --- a/src/gui/pythonwidget.cc +++ b/src/gui/pythonwidget.cc @@ -70,6 +70,10 @@ namespace gepetto { toggleViewAction()->setShortcut(gepetto::gui::DockKeyShortcutBase + Qt::Key_A); connect(button_, SIGNAL(clicked()), SLOT(browseFile())); + + // Hack to make "createWindow" function work properly + PythonQtObjectPtr client = PythonQt::self()->importModule ("gepetto.corbaserver.client"); + client.addObject ("mainWindow", MainWindow::instance()); } PythonWidget::~PythonWidget()