aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtUiTools
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-03-24 19:24:14 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-03-30 17:15:59 -0300
commit771c2be893567c8f6bd0deda87ff0e95322923a2 (patch)
tree6261470efc60cce784be617887c2852082ba40a5 /PySide/QtUiTools
parent7107c2fef5b5a0eba19c513945d8698bc8d962bb (diff)
Initial bindings for QtUiTools.
Diffstat (limited to 'PySide/QtUiTools')
-rw-r--r--PySide/QtUiTools/CMakeLists.txt40
-rw-r--r--PySide/QtUiTools/typesystem_uitools.xml52
2 files changed, 92 insertions, 0 deletions
diff --git a/PySide/QtUiTools/CMakeLists.txt b/PySide/QtUiTools/CMakeLists.txt
new file mode 100644
index 00000000..1145f976
--- /dev/null
+++ b/PySide/QtUiTools/CMakeLists.txt
@@ -0,0 +1,40 @@
+project(QtUiTools)
+
+set(QtUiTools_SRC
+ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/qtuitools_module_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/quiloader_wrapper.cpp
+)
+
+execute_generator(uitools QtUiTools_SRC "${CMAKE_CURRENT_BINARY_DIR}:${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${QtXml_SOURCE_DIR}:${QtUiTools_SOURCE_DIR}")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+ ${QT_QTCORE_INCLUDE_DIR}
+ ${QT_QTGUI_INCLUDE_DIR}
+ ${QT_QTXML_INCLUDE_DIR}
+ ${QT_QTUITOOLS_INCLUDE_DIR}
+ ${PYTHON_INCLUDE_PATH}
+ ${SHIBOKEN_INCLUDE_DIR}
+ ${libpyside_SOURCE_DIR}
+ ${QtCore_BINARY_DIR}/PySide/QtCore/
+ ${QtXml_BINARY_DIR}/PySide/QtXml/
+ ${QtGui_BINARY_DIR}/PySide/QtGui/
+ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools)
+
+add_library(QtUiTools MODULE ${QtUiTools_SRC})
+set_target_properties(QtUiTools PROPERTIES PREFIX "")
+target_link_libraries(QtUiTools
+ pyside
+ ${PYTHON_LIBRARIES}
+ ${QT_QTCORE_LIBRARY}
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTXML_LIBRARY}
+ ${QT_QTUITOOLS_LIBRARY})
+
+add_dependencies(QtUiTools QtGui QtXml)
+
+# install
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/QtUiTools.so
+ DESTINATION ${SITE_PACKAGE}/PySide)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/pyside_qtuitools_python.h
+ DESTINATION include/PySide/QtUiTools/)
+
diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml
new file mode 100644
index 00000000..c155bff9
--- /dev/null
+++ b/PySide/QtUiTools/typesystem_uitools.xml
@@ -0,0 +1,52 @@
+<typesystem package="PySide.QtUiTools">
+
+ <load-typesystem name="typesystem_gui.xml" generate="no" />
+ <load-typesystem name="typesystem_xml.xml" generate="no" />
+
+ <object-type name="QUiLoader">
+ <modify-function signature="createAction(QObject *, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="createActionGroup(QObject *, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="createLayout(const QString&amp;,QObject *, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="createWidget(const QString&amp;,QWidget*, const QString&amp;)">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <modify-function signature="load(QIODevice*, QWidget*)">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+
+ <!-- Syntax sugar -->
+ <add-function signature="load(const char*, QWidget*)" return-type="QWidget*">
+ <modify-argument index="return">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ <inject-code>
+ QFile f(%1);
+ if (f.open(QIODevice::ReadOnly | QIODevice::Text))
+ %PYARG_0 = %CONVERTTOPYTHON[QWidget*](%CPPSELF.load(&amp;f, %2));
+ else
+ PyErr_SetString(PyExc_RuntimeError, "Unable to open ui file");
+ </inject-code>
+ </add-function>
+ </object-type>
+
+</typesystem>