summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2008-08-22 17:40:44 +0200
committerGuillaume Seguin <guillaume@segu.in>2008-08-22 17:40:44 +0200
commitd4fa3be039b200f14dab49ebb8c3e154dad51f97 (patch)
tree19bacd37d07353de80fa3ec6d29284fd8762749b
parent1e85295300eeef90494fd56567829fea18de5ca6 (diff)
downloadgmathlib-d4fa3be039b200f14dab49ebb8c3e154dad51f97.tar.gz
gmathlib-d4fa3be039b200f14dab49ebb8c3e154dad51f97.tar.bz2
* Import GMathSelector python bindings
-rw-r--r--bindings/python/pygmathselector/CMakeLists.txt40
-rw-r--r--bindings/python/pygmathselector/gmathselector.defs45
-rw-r--r--bindings/python/pygmathselector/gmathselector.override37
-rw-r--r--bindings/python/pygmathselector/gmathselectormodule.c57
4 files changed, 179 insertions, 0 deletions
diff --git a/bindings/python/pygmathselector/CMakeLists.txt b/bindings/python/pygmathselector/CMakeLists.txt
new file mode 100644
index 0000000..6e4f9fc
--- /dev/null
+++ b/bindings/python/pygmathselector/CMakeLists.txt
@@ -0,0 +1,40 @@
+include_directories (
+ ${gMathLib_SOURCE_DIR}/include
+ ${GLIB_INCLUDE_DIRS}
+ ${PYTHON_INCLUDE_PATH}
+ ${GTK_INCLUDE_DIRS}
+ ${PYGTK_INCLUDE_DIRS}
+ ${PYOBJECT_INCLUDE_DIRS}
+)
+
+link_directories (
+ ${GLIB_LINK_DIRS}
+ ${GTK_LINK_DIRS}
+ ${PYGTK_LINK_DIRS}
+ ${PYOBJECT_LINK_DIRS}
+)
+
+add_custom_command (
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gmathselector.c
+ COMMAND ${PYGTK_CODEGEN_EXECUTABLE}
+ --override ${CMAKE_CURRENT_SOURCE_DIR}/gmathselector.override
+ -p gmathselector
+ ${CMAKE_CURRENT_SOURCE_DIR}/gmathselector.defs
+ > ${CMAKE_CURRENT_BINARY_DIR}/gmathselector.c
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gmathselector.override
+ ${CMAKE_CURRENT_SOURCE_DIR}/gmathselector.defs
+)
+
+add_library (pygmathselector SHARED gmathselectormodule.c gmathselector.c)
+target_link_libraries (
+ pygmathselector ${PYTHON_LIBRARIES} ${GLIB_LIBRARIES} ${GTK_LIBRARIES}
+ ${PYGTK_LIBRARIES} ${PYGOBJECT_LIBRARIES}
+ gmathlib gmathselector
+)
+set_target_properties (pygmathselector PROPERTIES PREFIX "")
+set_target_properties (pygmathselector PROPERTIES OUTPUT_NAME "gmathselector")
+
+install (
+ TARGETS pygmathselector
+ DESTINATION lib/${PYTHON_VERSION_DIR}/site-packages/
+)
diff --git a/bindings/python/pygmathselector/gmathselector.defs b/bindings/python/pygmathselector/gmathselector.defs
new file mode 100644
index 0000000..ab89726
--- /dev/null
+++ b/bindings/python/pygmathselector/gmathselector.defs
@@ -0,0 +1,45 @@
+;; -*- scheme -*-
+; boxed definitions ...
+
+; interface definitions ...
+
+; object definitions ...
+(define-object MathSelector
+ (in-module "GMathSelector")
+ (parent "GtkVBox")
+ (c-name "GMathSelector")
+ (gtype-id "G_TYPE_MATH_SELECTOR")
+)
+
+; pointer definitions ...
+
+;; Enumerations and Flags ...
+
+
+;; From gmathselector.h
+
+(define-function new
+ (c-name "g_math_selector_new")
+ (is-constructor-of "GMathSelector")
+ (return-type "GtkWidget*")
+)
+
+(define-method add_category
+ (of-object "GMathSelector")
+ (c-name "g_math_selector_add_category")
+ (return-type "none")
+ (parameters
+ '("gchar*" "category")
+ )
+)
+
+(define-method add_symbol
+ (of-object "GMathSelector")
+ (c-name "g_math_selector_add_symbol")
+ (return-type "none")
+ (parameters
+ '("gchar*" "symbol")
+ '("gchar*" "value")
+ '("gchar*" "category")
+ )
+)
diff --git a/bindings/python/pygmathselector/gmathselector.override b/bindings/python/pygmathselector/gmathselector.override
new file mode 100644
index 0000000..d71a381
--- /dev/null
+++ b/bindings/python/pygmathselector/gmathselector.override
@@ -0,0 +1,37 @@
+/*
+ * gMathSelector, mathematic symbol selector widget
+ *
+ * # Python bindings overrides
+ *
+ * Author : Guillaume Seguin
+ * Email : guillaume@segu.in
+ *
+ * Copyright (c) 2007 Guillaume Seguin <guillaume@segu.in>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+%%
+headers
+#define NO_IMPORT_PYGOBJECT
+#include "pygobject.h"
+
+#include <gmathselector.h>
+
+%%
+modulename gmathselector
+
+%%
+import gtk.VBox as PyGtkVBox_Type
diff --git a/bindings/python/pygmathselector/gmathselectormodule.c b/bindings/python/pygmathselector/gmathselectormodule.c
new file mode 100644
index 0000000..b85b204
--- /dev/null
+++ b/bindings/python/pygmathselector/gmathselectormodule.c
@@ -0,0 +1,57 @@
+/*
+ * gMathView, mathematic expressions viewing & editing widget
+ *
+ * # Python bindings module source
+ *
+ * Author : Guillaume Seguin
+ * Email : guillaume@segu.in
+ *
+ * Copyright (c) 2007 Guillaume Seguin <guillaume@segu.in>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <pygobject.h>
+#include <pygtk/pygtk.h>
+#include "pygmathselector.h"
+
+void gmathselector_register_classes (PyObject *d);
+void gmathselector_add_constants (PyObject *module, const gchar *strip_prefix);
+
+extern PyMethodDef gmathselector_functions[];
+
+DL_EXPORT (void)
+initgmathselector (void)
+{
+ PyObject *m, *d;
+
+ m = Py_InitModule ("gmathselector", gmathselector_functions);
+ d = PyModule_GetDict (m);
+
+ init_pygobject ();
+ init_pygtk ();
+
+ gmathselector_register_classes (d);
+
+ PyModule_AddObject (m, "gmathselector_version",
+ Py_BuildValue ("iii",
+ PYGMATHSELECTOR_MAJOR_VERSION,
+ PYGMATHSELECTOR_MINOR_VERSION,
+ PYGMATHSELECTOR_MICRO_VERSION));
+
+ if (PyErr_Occurred ())
+ Py_FatalError ("can't initialise module gmathselector");
+}