diff options
author | James Henstridge <james@daa.com.au> | 2000-03-03 08:41:57 +0000 |
---|---|---|
committer | James Henstridge <jamesh@src.gnome.org> | 2000-03-03 08:41:57 +0000 |
commit | 8f84b9a48f2295b8f9368185f6416bc99bab4bf9 (patch) | |
tree | d43beb664b29a885426079370d019fa1ca909888 | |
parent | 4ca56efa67a6c39f47d8e40a01df5d87163b6fd1 (diff) | |
download | pygtk-8f84b9a48f2295b8f9368185f6416bc99bab4bf9.tar.gz |
The following is from Paul Clifford <paul@plasma.demon.co.uk>extension-class-branch-anchor
2000-03-03 James Henstridge <james@daa.com.au>
The following is from Paul Clifford <paul@plasma.demon.co.uk>
* libglade.py (GladeXML.signal_autoconnect): pass all the extra
arguments to autoconnect.
* libglademodule.c (connect_many): don't exit if the handler is
a tuple instead of a function.
The following fixes are from John Ehresman <jpe@archaeopteryx.com>
* gtk.py (GtkWidget.set_scroll_adjustments): return the value to
user.
* gtkmodule.c (GtkArg_AsPyObject): check if GtkObject is not NULL.
(_wrap_gtk_clist_get_pixmap, _gtk_clist_get_pixtext): check that
returned pixmap is not NULL.
(_wrap_gtk_ctree_node_get_pixmap, _gtk_ctree_node_get_pixtext): check
that returned pixmap is not NULL.
* gtk.py (GtkToolbar): wrap callbacks when inserting a toolbar item.
(GtkNotebook.set_menu_label_text): fixed typo
(GtkTreeItem.__getattr__): wrap subtree attribute.
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | gtk.py | 26 | ||||
-rw-r--r-- | gtkmodule.c | 49 | ||||
-rw-r--r-- | libglade.py | 2 | ||||
-rw-r--r-- | libglademodule.c | 2 |
5 files changed, 85 insertions, 19 deletions
@@ -1,3 +1,28 @@ +2000-03-03 James Henstridge <james@daa.com.au> + + The following is from Paul Clifford <paul@plasma.demon.co.uk> + + * libglade.py (GladeXML.signal_autoconnect): pass all the extra + arguments to autoconnect. + + * libglademodule.c (connect_many): don't exit if the handler is + a tuple instead of a function. + + The following fixes are from John Ehresman <jpe@archaeopteryx.com> + + * gtk.py (GtkWidget.set_scroll_adjustments): return the value to + user. + + * gtkmodule.c (GtkArg_AsPyObject): check if GtkObject is not NULL. + (_wrap_gtk_clist_get_pixmap, _gtk_clist_get_pixtext): check that + returned pixmap is not NULL. + (_wrap_gtk_ctree_node_get_pixmap, _gtk_ctree_node_get_pixtext): check + that returned pixmap is not NULL. + + * gtk.py (GtkToolbar): wrap callbacks when inserting a toolbar item. + (GtkNotebook.set_menu_label_text): fixed typo + (GtkTreeItem.__getattr__): wrap subtree attribute. + 2000-02-21 James Henstridge <james@daa.com.au> * gtk.py (GtkTable.resize): added missing function. Patch from @@ -430,7 +430,8 @@ class GtkWidget(GtkObject): def set_parent_window(self, parent): _gtk.gtk_widget_set_parent_window(self._o, parent) def set_scroll_adjustments(self, hadj, vadj): - _gtk.gtk_widget_set_scroll_adjustments(self._o,hadj._o,vadj._o) + return _gtk.gtk_widget_set_scroll_adjustments(self._o, hadj._o, + vadj._o) def set_sensitive(self, s): _gtk.gtk_widget_set_sensitive(self._o, s) def set_state(self, s): @@ -786,8 +787,12 @@ class GtkTreeItem(GtkItem): else: self._o = _gtk.gtk_tree_item_new_with_label(label) def __getattr__(self, attr): + def subtree_wrap(obj): + o = _gtk.gtk_tree_item_get_subtree(obj) + if o == None: return None + return _obj2inst(o) attrs = { - 'subtree': _gtk.gtk_tree_item_get_subtree, + 'subtree': subtree_wrap, } if attrs.has_key(attrs): return attrs[attr](self._o) @@ -1707,7 +1712,8 @@ class GtkNotebook(GtkContainer): _gtk.gtk_notebook_set_menu_label(self._o, child._o, menu_label._o) def set_menu_label_text(self, child, menu_text): - _gtk.gtk_notebook_set_menu_label(self._o, child._o, menu_text) + _gtk.gtk_notebook_set_menu_label_text(self._o, child._o, + menu_text) def query_tab_label_packing(self, child): # returns (expand,fill,pack_type) return _gtk.gtk_notebook_query_tab_label_packing(self._o, @@ -1900,27 +1906,35 @@ class GtkTree(GtkContainer): class GtkToolbar(GtkContainer): get_type = _gtk.gtk_toolbar_get_type + class __wrap_cb: + def __init__(self, cb): + self.cb = cb + def __call__(self, widget): + return self.cb(_obj2inst(widget)) def __init__(self, orientation=ORIENTATION_HORIZONTAL, style=TOOLBAR_ICONS, _obj=None): if _obj: self._o = _obj; return self._o = _gtk.gtk_toolbar_new(orientation, style) def append_item(self, text, tooltip, tp, icon, callback): return _obj2inst(_gtk.gtk_toolbar_append_item( - self._o, text, tooltip, tp, icon._o, callback)) + self._o, text, tooltip, tp, icon._o, + self.__wrap_cb(callback))) def append_space(self): _gtk.gtk_toolbar_append_space(self._o) def append_widget(self, w, tooltip, tp): _gtk.gtk_toolbar_append_widget(self._o, w._o, tooltip, tp) def insert_item(self, text, tooltip, tp, icon, callback, pos): return _obj2inst(_gtk.gtk_toolbar_insert_item( - self._o, text, tooltip, tp, icon._o, callback, pos)) + self._o, text, tooltip, tp, icon._o, + self.__wrap_cb(callback), pos)) def insert_space(self, pos): _gtk.gtk_toolbar_insert_space(self._o, pos) def insert_widget(self, w, tooltip, tp, pos): _gtk.gtk_toolbar_insert_widget(self._o, w._o, tooltip, tp, pos) def prepend_item(self, text, tooltip, tp, icon, callback): return _obj2inst(_gtk.gtk_toolbar_prepend_item( - self._o, text, tooltip, tp, icon._o, callback)) + self._o, text, tooltip, tp, icon._o, + self.__wrap_cb(callback))) def prepend_space(self): _gtk.gtk_toolbar_prepend_space(self._o) def prepend_widget(self, w, tooltip, tp): diff --git a/gtkmodule.c b/gtkmodule.c index 714ac376..ef6eebb7 100644 --- a/gtkmodule.c +++ b/gtkmodule.c @@ -2824,7 +2824,12 @@ static PyObject *GtkArg_AsPyObject(GtkArg *arg) { return GtkArgs_AsTuple(GTK_VALUE_ARGS(*arg).n_args, GTK_VALUE_ARGS(*arg).args); case GTK_TYPE_OBJECT: - return PyGtk_New(GTK_VALUE_OBJECT(*arg)); + if (GTK_VALUE_OBJECT(*arg) != NULL) + return PyGtk_New(GTK_VALUE_OBJECT(*arg)); + else { + Py_INCREF(Py_None); + return Py_None; + } case GTK_TYPE_POINTER: return PyCObject_FromVoidPtr(GTK_VALUE_POINTER(*arg), NULL); case GTK_TYPE_BOXED: @@ -4413,7 +4418,7 @@ static PyObject *_wrap_gtk_clist_get_text(PyObject *self, PyObject *args) { } static PyObject *_wrap_gtk_clist_get_pixmap(PyObject *self, PyObject *args) { - PyObject *o, *mask; + PyObject *o, *pixmap, *mask; int r, c; GdkPixmap *p; GdkBitmap *m; @@ -4425,17 +4430,23 @@ static PyObject *_wrap_gtk_clist_get_pixmap(PyObject *self, PyObject *args) { PyErr_SetString(PyExc_ValueError, "can't get pixmap value"); return NULL; } + if (p) + pixmap = PyGdkWindow_New(p); + else { + Py_INCREF(Py_None); + pixmap = Py_None; + } if (m) mask = PyGdkWindow_New(m); else { Py_INCREF(Py_None); mask = Py_None; } - return Py_BuildValue("(NN)", PyGdkWindow_New(p), mask); + return Py_BuildValue("(NN)", pixmap, mask); } static PyObject *_wrap_gtk_clist_get_pixtext(PyObject *self, PyObject *args) { - PyObject *o, *mask; + PyObject *o, *pixmap, *mask; int r, c; guint8 spacing; char *text; @@ -4450,14 +4461,19 @@ static PyObject *_wrap_gtk_clist_get_pixtext(PyObject *self, PyObject *args) { PyErr_SetString(PyExc_ValueError, "can't get pixtext value"); return NULL; } + if (p) + pixmap = PyGdkWindow_New(p); + else { + Py_INCREF(Py_None); + pixmap = Py_None; + } if (m) mask = PyGdkWindow_New(m); else { Py_INCREF(Py_None); mask = Py_None; } - return Py_BuildValue("(siNN)", text, (int)spacing, - PyGdkWindow_New(p), mask); + return Py_BuildValue("(siNN)", text, (int)spacing, pixmap, mask); } static PyObject *_wrap_gtk_clist_prepend(PyObject *self, PyObject *args) { @@ -6047,7 +6063,7 @@ static PyObject *_wrap_gtk_ctree_node_get_text(PyObject *self, PyObject *args) { } static PyObject *_wrap_gtk_ctree_node_get_pixmap(PyObject *self, PyObject *args) { - PyObject *ctree, *node, *mask; + PyObject *ctree, *node, *pixmap, *mask; int col; GdkPixmap *p; GdkBitmap *m; @@ -6060,17 +6076,23 @@ static PyObject *_wrap_gtk_ctree_node_get_pixmap(PyObject *self, PyObject *args) PyErr_SetString(PyExc_ValueError, "can't get pixmap value"); return NULL; } + if (p) + pixmap = PyGdkWindow_New(p); + else { + Py_INCREF(Py_None); + pixmap = Py_None; + } if (m) mask = PyGdkWindow_New(m); else { Py_INCREF(Py_None); mask = Py_None; } - return Py_BuildValue("(NN)", PyGdkWindow_New(p), mask); + return Py_BuildValue("(NN)", pixmap, mask); } static PyObject *_wrap_gtk_ctree_node_get_pixtext(PyObject *self, PyObject *args) { - PyObject *ctree, *node, *mask; + PyObject *ctree, *node, *pixmap, *mask; int col; guint8 spacing; char *text; @@ -6086,14 +6108,19 @@ static PyObject *_wrap_gtk_ctree_node_get_pixtext(PyObject *self, PyObject *args PyErr_SetString(PyExc_ValueError, "can't get pixtext value"); return NULL; } + if (p) + pixmap = PyGdkWindow_New(p); + else { + Py_INCREF(Py_None); + pixmap = Py_None; + } if (m) mask = PyGdkWindow_New(m); else { Py_INCREF(Py_None); mask = Py_None; } - return Py_BuildValue("(siNN)", text, (int)spacing, - PyGdkWindow_New(p), mask); + return Py_BuildValue("(siNN)", text, (int)spacing, pixmap, mask); } static PyObject *_wrap_gtk_ctree_get_node_info(PyObject *self, PyObject *args) { diff --git a/libglade.py b/libglade.py index fa5adfca..e88b7c4a 100644 --- a/libglade.py +++ b/libglade.py @@ -39,7 +39,7 @@ class GladeXML(_gtk.GtkData): for key, value in dict.items(): if type(value) == type(()) and len(value) >= 2: hdict[key] = (self.__cnv(value[0]).__call__, - value[1]) + value[1:]) else: hdict[key] = self.__cnv(value).__call__ _libglade.glade_xml_signal_autoconnect(self._o, hdict) diff --git a/libglademodule.c b/libglademodule.c index 0b740309..a18f8257 100644 --- a/libglademodule.c +++ b/libglademodule.c @@ -63,7 +63,7 @@ static void connect_many(const gchar *handler_name, GtkObject *obj, PyErr_Clear(); return; } - if (!PyCallable_Check(callback)) + if (!PyCallable_Check(callback) && !PyTuple_Check(callback)) return; if (connect_object) { |