Commit 2d3021c9 authored by Xavier Ordoquy's avatar Xavier Ordoquy Committed by Xavier Ordoquy

searches for the gtk.def file

2004-08-27  Xavier Ordoquy  <xordoquy@linovia.com>

	* configure.in:
	searches for the gtk.def file

	* python/Makefile.am:
	includes the gtk.def file while generating the wrapper.

	* python/planner.defs:
	regenerated the PlannerWindow wrapper.

	* python/planner-types.defs:
	* python/planner.override:
	reflect the move to GtkUIManager

	* python/python-demo.py:
	demo to show a bit python scripting abilities.
parent 879fb324
2004-08-27 Xavier Ordoquy <xordoquy@linovia.com>
* configure.in:
searches for the gtk.def file
* python/Makefile.am:
includes the gtk.def file while generating the wrapper.
* python/planner.defs:
regenerated the PlannerWindow wrapper.
* python/planner-types.defs:
* python/planner.override:
reflect the move to GtkUIManager
* python/python-demo.py:
demo to show a bit python scripting abilities.
2004-08-27 Xavier Ordoquy <xordoquy@linovia.com>
* data/ui/sql-plugin.ui:
......
......@@ -195,6 +195,10 @@ if test "x$enable_python" != "xno"; then
have_python=no
fi
fi
AC_MSG_CHECKING(for pygtk defs)
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
AC_SUBST(PYGTK_DEFSDIR)
AC_MSG_RESULT($PYGTK_DEFSDIR)
else
have_python=no
fi
......
......@@ -34,6 +34,7 @@ EXTRA_DIST = \
&& $(PYGTK_CODEGEN) \
--override $*.override \
--load-types planner-arg-types.py \
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
--prefix $* $*.defs) > gen-$*.c \
&& cp gen-$*.c $*.c \
&& rm -f gen-$*.c
......@@ -79,7 +79,7 @@
(define-object Window
(in-module "Planner")
(parent "BonoboWindow")
(parent "GtkWindow")
(c-name "PlannerWindow")
(gtype-id "PLANNER_TYPE_MAIN_WINDOW")
)
......
......@@ -1422,6 +1422,42 @@
)
;; From ../src/planner-application.h
(define-function planner_application_get_type
(c-name "planner_application_get_type")
(return-type "GType")
)
(define-function planner_application_new
(c-name "planner_application_new")
(is-constructor-of "PlannerApplication")
(return-type "PlannerApplication*")
)
(define-method new_window
(of-object "PlannerApplication")
(c-name "planner_application_new_window")
(return-type "GtkWidget*")
)
(define-method exit
(of-object "PlannerApplication")
(c-name "planner_application_exit")
(return-type "none")
)
(define-method get_recent_model
(of-object "PlannerApplication")
(c-name "planner_application_get_recent_model")
(return-type "EggRecentModel*")
)
(define-function planner_application_get_gconf_client
(c-name "planner_application_get_gconf_client")
(return-type "GConfClient*")
)
;; From ../src/planner-window.h
......@@ -1448,10 +1484,10 @@
)
)
(define-method get_ui_container
(define-method get_ui_manager
(of-object "PlannerWindow")
(c-name "planner_window_get_ui_container")
(return-type "BonoboUIContainer*")
(c-name "planner_window_get_ui_manager")
(return-type "GtkUIManager*")
)
(define-method get_project
......@@ -1496,42 +1532,13 @@
(return-type "PlannerCmdManager*")
)
;; From ../src/planner-application.h
(define-function planner_application_get_type
(c-name "planner_application_get_type")
(return-type "GType")
)
(define-function planner_application_new
(c-name "planner_application_new")
(is-constructor-of "PlannerApplication")
(return-type "PlannerApplication*")
)
(define-method new_window
(of-object "PlannerApplication")
(c-name "planner_application_new_window")
(return-type "GtkWidget*")
)
(define-method exit
(of-object "PlannerApplication")
(c-name "planner_application_exit")
(define-method set_status
(of-object "PlannerWindow")
(c-name "planner_window_set_status")
(return-type "none")
)
(define-method get_recent_model
(of-object "PlannerApplication")
(c-name "planner_application_get_recent_model")
(return-type "EggRecentModel*")
)
(define-function planner_application_get_gconf_client
(c-name "planner_application_get_gconf_client")
(return-type "GConfClient*")
(parameters
'("const-gchar*" "message")
)
)
......@@ -7,7 +7,7 @@ headers
#include <libplanner/planner.h>
#include <libplanner/mrp-storage-module.h>
#include <bonobo.h>
#include <gtk/gtk.h>
#include "planner-application.h"
#include "planner-window.h"
......@@ -19,7 +19,9 @@ init
modulename planner
%%
import gobject.GObject as PyGObject_Type
import bonobo.ui.Window as PyBonoboWindow_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.Window as PyGtkWindow_Type
import gtk.UIManager as PyGtkUIManager_Type
%%
ignore-glob
*_get_type
......
#
# This file is a small demo for the planner/python integration
# Copy it under ~/.gnome2/planner/python/ and restart planner.
# You'll notice a new entry in the file->export menu :)
#
import pygtk
pygtk.require('2.0')
import gtk
import planner
print '***************'
ui_string = """
<ui>
<menubar name="MenuBar">
<menu action="File">
<menu action="Import">
<placeholder name="Import placeholder">
<menuitem action="Python import"/>
</placeholder>
</menu>
</menu>
</menubar>
</ui>
"""
def import_python(*args):
action = args[0]
print 'Activated the action:',action.get_name()
project = window.get_project()
t1 = planner.Task()
t1.set_name('Python demo')
t1.set_property('work', 8*60*60)
project.insert_task(task=t1)
python_actions = [
('Python import', None, '_Python', None, 'Python demo', import_python),
]
group = gtk.ActionGroup('PythonImport')
group.add_actions(python_actions)
ui = window.get_ui_manager()
ui.insert_action_group(group,0)
ui.add_ui_from_string(ui_string)
ui.ensure_update()
print '***************'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment