summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--generate/gtklists.defs3
-rw-r--r--generate/gtkmenus.defs3
-rw-r--r--gtk.py22
-rw-r--r--gtkmodule.c30
-rw-r--r--pyglade/build.py3
6 files changed, 65 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 89e49326..7c47fd29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+1999-07-12 James Henstridge <james@daa.com.au>
+
+ * gtk.py: fixed a few bugs reported by Ville Lauriki.
+
+ * generate/gtkmenus.defs (gtk_item_factory_add_foreign): fix a typo.
+
+ * gtkmodule.c: fixed problems if gdk_atom_name returns NULL.
+
+ (_wrap_gtk_main_iteration, _wrap_gtk_events_pending): added
+ GDK_THREADS_LEAVE() and GDK_THREADS_ENTER() calls round these
+ functions. Without this, it deadlocks if threads are enabled.
+
+ * generate/gtklists.defs (GtkTreeItem): added wrapper for
+ treeitem->subtree attribute.
+
+ * pyglade/build.py (text_new): small fix.
+
1999-05-19 James Henstridge <james@daa.com.au>
* NEWS: added news about changes in this version.
diff --git a/generate/gtklists.defs b/generate/gtklists.defs
index 6d1c598a..584c4308 100644
--- a/generate/gtklists.defs
+++ b/generate/gtklists.defs
@@ -1,5 +1,6 @@
; -*- scheme -*-
-(define-object GtkTreeItem (GtkItem))
+(define-object GtkTreeItem (GtkItem)
+ (fields (GtkWidget subtree)))
(define-func gtk_tree_item_new
GtkWidget
diff --git a/generate/gtkmenus.defs b/generate/gtkmenus.defs
index 0f805000..1e4f391d 100644
--- a/generate/gtkmenus.defs
+++ b/generate/gtkmenus.defs
@@ -286,8 +286,9 @@
none
((GtkWidget accel_widget)
(string full_path)
+ (GtkAccelGroup accel_group)
(uint keyval)
- (GtkModifierType modifiers)))
+ (GdkModifierType modifiers)))
(define-func gtk_item_factory_from_widget
GtkItemFactory
diff --git a/gtk.py b/gtk.py
index 7039effb..1a8687a2 100644
--- a/gtk.py
+++ b/gtk.py
@@ -47,6 +47,10 @@ class GtkObject:
def __setitem__(self, key, v):
if hasattr(v, '_o') and type(v._o) == _gtk.GtkObjectType:
v = v._o
+ elif hasattr(v, '_ag') and type(v._ag)==_gtk.GtkAccelGroupType:
+ v = v._ag
+ elif hasattr(v, '_im'):
+ v = v._im
_gtk.gtk_object_set(self._o, {key: v});
def __cmp__(self, other):
if hasattr(other, '_o'):
@@ -110,9 +114,13 @@ class GtkObject:
for i in range(len(args)):
if type(args[i]) == _gtk.GtkObjectType:
a[i] = _obj2inst(args[i])
+ elif type(args[i]) == _gtk.GtkAccelGroupType:
+ a[i] = GtkAccelGroup(_obj=args[i])
a = tuple(a)
ret = apply(self.func, a)
if hasattr(ret, '_o'): ret = ret._o
+ elif hasattr(ret, '_ag'): ret = ret._ag
+ elif hasattr(ret, '_im'): ret = ret._im
return ret
def connect(self, name, f, *extra):
callback = self.__cnv(f)
@@ -137,6 +145,7 @@ class GtkObject:
for i in args:
if hasattr(i, '_o'): params.append(i._o)
elif hasattr(i, '_ag'): params.append(i._ag)
+ elif hasattr(i, '_im'): params.append(i._im)
else: params.append(i)
return _gtk.gtk_signal_emitv_by_name(self._o,signal,params)
def emit_stop_by_name(self, sig):
@@ -165,7 +174,7 @@ class GtkAdjustment(GtkData):
'page_increment': _gtk.gtk_adjustment_get_page_increment,
'page_size': _gtk.gtk_adjustment_get_page_size
}
- if attr in attrs.keys():
+ if attrs.has_key(attr):
return attrs[attr](self._o)
return GtkData.__getattr__(self, attr)
def set_value(self, value):
@@ -752,6 +761,13 @@ class GtkTreeItem(GtkItem):
self._o = _gtk.gtk_tree_item_new()
else:
self._o = _gtk.gtk_tree_item_new_with_label(label)
+ def __getattr__(self, attr):
+ attrs = {
+ 'subtree': _gtk.gtk_tree_item_get_subtree,
+ }
+ if attrs.has_key(attrs):
+ return attrs[attr](self._o)
+ return GtkItem.__getattr__(self, attr)
def set_subtree(self, subtree):
_gtk.gtk_tree_item_set_subtree(self._o, subtree._o)
def select(self, obj=None):
@@ -774,7 +790,7 @@ class GtkViewport(GtkBin):
self._o = _gtk.gtk_viewport_new(ha, va)
def get_hadjustment(self):
return _obj2inst(_gtk.gtk_viewport_get_hadjustment(self._o))
- def get_vdjustment(self):
+ def get_vadjustment(self):
return _obj2inst(_gtk.gtk_viewport_get_vadjustment(self._o))
def set_hadjustment(self, ha):
_gtk.gtk_viewport_set_hadjustment(self._o, ha._o)
@@ -962,8 +978,6 @@ class GtkBox(GtkContainer):
def set_child_packing(self, child, expand, fill, padding, pack_type):
_gtk.gtk_box_set_child_packing(self._o, child._o, expand, fill,
padding, pack_type)
- def reorder_child(self, child, pos):
- _gtk.gtk_box_reorder_child(self._o, child._o, pos)
class GtkHBox(GtkBox):
get_type = _gtk.gtk_hbox_get_type
diff --git a/gtkmodule.c b/gtkmodule.c
index 5440fff6..b86a71aa 100644
--- a/gtkmodule.c
+++ b/gtkmodule.c
@@ -1946,7 +1946,7 @@ PyGdkAtom_Repr(PyGdkAtom_Object *self) {
char buf[256];
if (!self->name) self->name = gdk_atom_name(self->atom);
g_snprintf(buf, 256, "<GdkAtom 0x%lx = '%s'>", (unsigned long)self->atom,
- self->name);
+ self->name?self->name:"(null)");
return PyString_FromString(buf);
}
@@ -1968,9 +1968,11 @@ PyGdkAtom_Coerce(PyObject **self, PyObject **other) {
} else if (PyString_Check(*other)) {
if (!old->name)
old->name = gdk_atom_name(old->atom);
- *self = PyString_FromString(old->name);
- Py_INCREF(*other);
- return 0;
+ if (old->name) {
+ *self = PyString_FromString(old->name);
+ Py_INCREF(*other);
+ return 0;
+ }
}
return 1; /* don't know how to convert */
}
@@ -2008,7 +2010,10 @@ PyGdkAtom_Hex(PyGdkAtom_Object *self) {
static PyObject *
PyGdkAtom_Str(PyGdkAtom_Object *self) {
if (!self->name) self->name = gdk_atom_name(self->atom);
- return PyString_FromString(self->name);
+ if (self->name)
+ return PyString_FromString(self->name);
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyNumberMethods PyGdkAtom_Number = {
@@ -3296,9 +3301,11 @@ static PyObject *_wrap_gtk_main_iteration(PyObject *self, PyObject *args) {
if(!PyArg_ParseTuple(args,"|i:gtk_main_iteration", &block))
return NULL;
+ GDK_THREADS_LEAVE();
PyGTK_UNBLOCK_THREADS
ret = gtk_main_iteration_do(block);
PyGTK_BLOCK_THREADS
+ GDK_THREADS_ENTER();
#ifdef WITH_THREAD
g_assert(_blockcount == 1);
_blockcount = 1;
@@ -3306,6 +3313,18 @@ static PyObject *_wrap_gtk_main_iteration(PyObject *self, PyObject *args) {
return PyInt_FromLong(ret);
}
+static PyObject *_wrap_gtk_events_pending(PyObject *self, PyObject *args) {
+ int ret;
+ if (!PyArg_ParseTuple(args, ":gtk_events_pending"))
+ return NULL;
+ GDK_THREADS_LEAVE();
+ PyGTK_UNBLOCK_THREADS
+ ret = gtk_events_pending();
+ PyGTK_BLOCK_THREADS
+ GDK_THREADS_ENTER();
+ return PyInt_FromLong(ret);
+}
+
static PyObject *
_wrap_gtk_timeout_add(PyObject *self, PyObject *args) {
guint32 interval;
@@ -5592,6 +5611,7 @@ static PyMethodDef _gtkmoduleMethods[] = {
{ "gtk_init", _wrap_gtk_init, 1 },
{ "gtk_main", _wrap_gtk_main, 1 },
{ "gtk_main_iteration", _wrap_gtk_main_iteration, 1 },
+ { "gtk_events_pending", _wrap_gtk_events_pending, 1 },
{ "gtk_timeout_add", _wrap_gtk_timeout_add, 1 },
{ "gtk_idle_add", _wrap_gtk_idle_add, 1 },
{ "gtk_idle_add_priority", _wrap_gtk_idle_add_priority, 1 },
diff --git a/pyglade/build.py b/pyglade/build.py
index c20a53ae..d3970731 100644
--- a/pyglade/build.py
+++ b/pyglade/build.py
@@ -237,8 +237,7 @@ def entry_new(node):
return ent
def text_new(node):
text = GtkText()
- if not node.get_bool('editable', TRUE):
- text.get_editable(FALSE)
+ text.set_editable(node.get_bool('editable', FALSE))
t = node.get('text', '')
if t:
text.insert_text(t)