From 21cc635c1e7676c240b71223dfc8f2c6a8b54304 Mon Sep 17 00:00:00 2001
From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Wed, 21 Apr 2010 13:13:34 +0000
Subject: [PATCH] New sip exports for ToolOptionsWin

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2085 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/gui/pymod/export_gosty.cc           | 12 ++----
 modules/gui/pymod/export_tool.cc            | 15 +++----
 modules/gui/pymod/scene/inspector_widget.py |  2 +-
 modules/gui/pymod/tool_options_win_proxy.hh | 46 ---------------------
 4 files changed, 13 insertions(+), 62 deletions(-)
 delete mode 100644 modules/gui/pymod/tool_options_win_proxy.hh

diff --git a/modules/gui/pymod/export_gosty.cc b/modules/gui/pymod/export_gosty.cc
index 6a654ff69..039843d1f 100644
--- a/modules/gui/pymod/export_gosty.cc
+++ b/modules/gui/pymod/export_gosty.cc
@@ -33,7 +33,6 @@ using namespace boost::python;
 #include "transfer_ownership.hh"
 #include "sip_handler.hh"
 
-#include "tool_options_win_proxy.hh"
 #if OST_IMG_ENABLED
 #include "data_viewer_proxy.hh"
 using namespace ost::img::gui;
@@ -44,11 +43,6 @@ using namespace ost::gui;
 
 namespace {
 
-ToolOptionsWinProxy app_get_tool_options_win(GostyApp* app)
-{
-  return ToolOptionsWinProxy(app->GetToolOptionsWin());
-}
-
 #if OST_IMG_ENABLED
 DataViewerProxyPtr app_create_data_viewer1(GostyApp* app, const ost::img::Data& d, const QString& name)
 {
@@ -101,8 +95,10 @@ void export_Gosty()
         return_value_policy<reference_existing_object>())
     .add_property("seq_viewer", make_function(&GostyApp::GetSequenceViewer,
         return_value_policy<reference_existing_object>()))
-    .def("GetToolOptionsWin", &app_get_tool_options_win)
-    .add_property("tool_options_win", &app_get_tool_options_win)     
+    .def("GetToolOptionsWin", &GostyApp::GetToolOptionsWin,
+        return_value_policy<reference_existing_object>())
+    .add_property("tool_options_win", make_function(&GostyApp::GetToolOptionsWin,
+        return_value_policy<reference_existing_object>()))
      #if OST_IMG_ENABLED
     .def("CreateDataViewer", &app_create_data_viewer1)
     .def("CreateDataViewer", &app_create_data_viewer2)
diff --git a/modules/gui/pymod/export_tool.cc b/modules/gui/pymod/export_tool.cc
index a0b4090ff..730673364 100644
--- a/modules/gui/pymod/export_tool.cc
+++ b/modules/gui/pymod/export_tool.cc
@@ -23,14 +23,13 @@
 #include <boost/python/register_ptr_to_python.hpp>
 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
 
-#include <iostream>
-using namespace boost::python;
-
 #include <ost/gui/tools/tool.hh>
 #include <ost/gui/tools/tool_manager.hh>
-#include "tool_options_win_proxy.hh"
+#include <ost/gui/tools/tool_options_win.hh>
+#include "sip_handler.hh"
 #include "qptr.hh"
 
+using namespace boost::python;
 using namespace ost::gui;
 using namespace ost;
 
@@ -246,9 +245,11 @@ void export_Tool()
     .def("FindToolByName", &ToolManager::FindToolByName,
          return_value_policy<reference_existing_object>())
   ;
-  class_<ToolOptionsWinProxy, bases<SipHandlerBase> >("ToolOptionsWin")
-    .def("Show", &ToolOptionsWinProxy::Show)
-    .def("Hide", &ToolOptionsWinProxy::Hide)
+  class_<ToolOptionsWin, boost::noncopyable>("ToolOptionsWin", no_init)
+    .def("Show", &ToolOptionsWin::show)
+    .def("Hide", &ToolOptionsWin::hide)
+    .def("GetQObject",&get_py_qobject<ToolOptionsWin>)
+    .add_property("qobject", &get_py_qobject<ToolOptionsWin>)
   ;
 
   class_<gfx::NodePtrList>("NodePtrList", init<>())
diff --git a/modules/gui/pymod/scene/inspector_widget.py b/modules/gui/pymod/scene/inspector_widget.py
index 68215c661..4e7e7f761 100644
--- a/modules/gui/pymod/scene/inspector_widget.py
+++ b/modules/gui/pymod/scene/inspector_widget.py
@@ -39,7 +39,7 @@ class InspectorWidget(ToolBarOptionsWidget):
                 [InspectorWidget.ICONS_PATH+"render_icon.png",RenderOptionsWidget(self),None], 
                 [InspectorWidget.ICONS_PATH+"color_icon.png",ColorOptionsWidget(self),None],
                 [InspectorWidget.ICONS_PATH+"preset_icon.png", PresetWidget(self),None],
-                [InspectorWidget.ICONS_PATH+"tool_icon.png",sip.wrapinstance(app.GetToolOptionsWin().GetSipHandle(),QtGui.QWidget),"Tool Options"]
+                [InspectorWidget.ICONS_PATH+"tool_icon.png",app.tool_options_win.qobject,"Tool Options"]
               ]
     for o in options:
       ToolBarOptionsWidget.AddWidget(self,o[0], o[1], o[2])
diff --git a/modules/gui/pymod/tool_options_win_proxy.hh b/modules/gui/pymod/tool_options_win_proxy.hh
deleted file mode 100644
index e4862944d..000000000
--- a/modules/gui/pymod/tool_options_win_proxy.hh
+++ /dev/null
@@ -1,46 +0,0 @@
-//------------------------------------------------------------------------------
-// This file is part of the OpenStructure project <www.openstructure.org>
-//
-// Copyright (C) 2008-2010 by the OpenStructure authors
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License as published by the Free
-// Software Foundation; either version 3.0 of the License, or (at your option)
-// any later version.
-// This library is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-// details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this library; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-//------------------------------------------------------------------------------
-#ifndef OST_GUI_TOOL_OPTIONS_WIN_PROXY_HH
-#define OST_GUI_TOOL_OPTIONS_WIN_PROXY_HH
-
-#include <ost/gui/tools/tool_options_win.hh>
-
-#include "sip_handler.hh"
-
-namespace ost { namespace gui {
-
-class  ToolOptionsWinProxy : public SipHandler<ToolOptionsWin> {
-public:
-  ToolOptionsWinProxy(ToolOptionsWin* gl_win=NULL):
-    SipHandler<ToolOptionsWin>(gl_win)
-  { }
-  
-  void Show()  
-  {
-    return Me()->show();
-  }
-  void Hide()  
-  {
-    return Me()->hide();
-  }  
-};
-
-}}
-
-#endif
-- 
GitLab