Re: [pygtk] TypeError: destroy() takes no arguments (1 given)

2003-07-30 Thread James Henstridge
On 31/07/2003 1:27 AM, Dusausoy Bruno wrote:

Hi, 

I'm quite new to pygtk and I have a problem. I've connected the
"clicked" signal to a button and it should normally call
exit_window.destroy() function. But Python gives me this error:
TypeError: destroy() takes no arguments (1 given)
 

The first argument passed to a signal handler is the object that the 
signal was emitted on.  the destroy() method takes no arguments, so you 
get the exception.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Is there a way to use GnomeCanvasBpath?

2003-07-30 Thread Francisco Miguel Colaço
  I need to use GnomeCanvasBpath from pygtk, in order to draw an arc.  I
can use it successfully from C, but I find no way to insert bpath at
construction time.

  Is there a way to use that item?

  Thanks in advance.

   Francisco Colaço

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] bug in TreeView?

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 11:39:52PM +0200, Pere Pujal i Carabantes wrote:
> > Before submitting reports of crashers, it would be really nice if you
> > could test against CVS HEAD. A lot goes in between releases and the team
> > is very small to be able to triage all reports that come in.
> Just build the CVS HEAD, but how to ensure python is using it instead of
> the supplied with the distribution when both coexist?

The PYTHONPATH (or sys.path) must be set correctly.

> > A stack trace would be great too.
> 
> If for stack trace you mean the output of 'strace' here are one for the
> crash:
> http://perso.wanadoo.es/perepujal/trace_with_python2.2.gz

No, the output of gdb's 'where' or 'bt' command, after the dump. 

http://users.actcom.co.il/~choo/lupg/tutorials/debugging/debugging-with-gdb.html

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] bug in TreeView?

2003-07-30 Thread Pere Pujal i Carabantes
El dc, 30 de 07 de 2003 a las 18:37, Christian Reis escribió: 
> On Wed, Jul 30, 2003 at 06:19:00PM +0200, Emanuele Olivetti wrote:
> > Executing the Lars Wirzenius's example about gtk.TreeView in:
> > http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html
> > 
> > if you select a node, click 'Choose parent' and select the same
> > node in the parent list you get a core.
> > 
There is another extrange behavior here:
step 1: Select folder 2 and choose folder 1 as parent
step 2: Select folder 1 and choose folder 0 as parent

Result folder 2 disappears


> Before submitting reports of crashers, it would be really nice if you
> could test against CVS HEAD. A lot goes in between releases and the team
> is very small to be able to triage all reports that come in.
Just build the CVS HEAD, but how to ensure python is using it instead of
the supplied with the distribution when both coexist?

> A stack trace would be great too.

If for stack trace you mean the output of 'strace' here are one for the
crash:
http://perso.wanadoo.es/perepujal/trace_with_python2.2.gz

Yours

Pere
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] TreeView

2003-07-30 Thread David Mortensen
Possibly silly question:

I have created an interface with gtk.ListStore and gtk.TreeView into which 
users drop data.  The data should be copied into the cells.  All of this 
works quite well, except that the x,y coordinates sent to the callback seem 
to point to the following row, rather than the current row.  I can compensate 
with this with simple row arithmetic (what I have done as a stop-gap 
solution) but this obviously presents a problem when one gets to the first or 
last row in a table.  I could also heuristically tweak the value of y, but 
this seems almost as inelegant.  I suspect that there is a simple way of 
changing this behavior for the whole table (TreeView.set_drag_dest_row()?) 
(that is, changing it so the x, y coords returned reflect the row the mouse 
cursor is hovering over) but I haven't figured out how to do it.  Any hints?

-- 
David Mortensen
STEDT/Department of Linguistics
1203 Dwinelle Hall; University of California at Berkeley
Berkeley, CA 94720-2650
OFFICE: (510)643-9910
  CELL: (510)427-2952
   AIM: vamchoj

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Patch for rare segfault

2003-07-30 Thread John Ehresman
Christian Reis wrote:
To avoid dropped patches, it's the best idea to file a bug on
bugzilla.gnome.org and attach it there. That way we can make sure it's
not read with the D key when everybody's too busy to try it.
Done as http://bugzilla.gnome.org/show_bug.cgi?id=118699

Thanks,

John

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] TypeError: destroy() takes no arguments (1 given)

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 07:27:07PM +0200, Dusausoy Bruno wrote:
> Hi, 
> 
> I'm quite new to pygtk and I have a problem. I've connected the
> "clicked" signal to a button and it should normally call
> exit_window.destroy() function. But Python gives me this error:
> 
> TypeError: destroy() takes no arguments (1 given)

Note also FAQ 3.12:

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq03.012.htp

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Patch for rare segfault

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 11:20:49AM -0400, John Ehresman wrote:
> Here's a patch for a segfault that I managed to trigger once.  I can't 
> seem to reproduce how I trigged it, but I'm fairly sure the patch is 
> correct.  The problem is that without the patch, the ob_type slot of 
> PyGObjectDoc_Type in pygtype.c is never set to &PyType_Type.
> 
> John
> 
> Index: pygtype.c
> ===
> RCS file: /home/cvs/src/ide/external/gtk2/pygtk/pygtype.c,v
> retrieving revision 1.1
> diff -u -r1.1 pygtype.c
> --- pygtype.c   29 Mar 2003 00:06:22 -  1.1
> +++ pygtype.c   30 Jul 2003 15:25:43 -
> @@ -1107,6 +1107,9 @@
>  {
>  static PyObject *doc_descr = NULL;
> 
> +if (PyGObjectDoc_Type.ob_type == NULL)
> +   PyGObjectDoc_Type.ob_type = &PyType_Type;
> +
>  if (!doc_descr) {
> doc_descr = PyObject_NEW(PyObject, &PyGObjectDoc_Type);
> if (doc_descr == NULL)

To avoid dropped patches, it's the best idea to file a bug on
bugzilla.gnome.org and attach it there. That way we can make sure it's
not read with the D key when everybody's too busy to try it.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] custom widget in GLADE?

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 09:52:31AM +0100, Ross Burton wrote:
> On Tue, 2003-07-29 at 23:29, Jon Willeke wrote:
> > This question appears a couple of times in the archives with no 
> > satisfactory answer: how do I use a GLADE custom widget?
> 
> As I wrote this patch I guess I should document it somewhere...

Added as FAQ 22.7, thanks.

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.007.htp

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] converting an Numeric array to a Pixbuf

2003-07-30 Thread Christian Reis
On Tue, Jul 29, 2003 at 09:27:45AM +1200, Tim Evans wrote:
> Anthony Joseph Seward wrote:
> 
> >I am trying to figure out a simple way of converting a Numeric array to
> >a gtk.gdk.Pixbuf without depending on PIL.

[snip]

> Assuming that you have a (n,m,3) or (n,m,4) shape 'b' type array of RGB 
> or RGBA values called 'data', you would do this:
> 
> w,h = data.shape[:2]
> hasalpha = shape.shape[3] == 4
> p = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, hasalpha, 8, w, h)
> p.pixel_array[:] = data

Added as FAQ 8.3, thanks:

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq08.003.htp

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] TypeError: destroy() takes no arguments (1 given)

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 07:32:26PM +0200, Dusausoy Bruno wrote:
> Le mer 30/07/2003 à 19:27, Dusausoy Bruno a écrit :
> > Hi, 
> > 
> > I'm quite new to pygtk and I have a problem. I've connected the
> > "clicked" signal to a button and it should normally call
> > exit_window.destroy() function. But Python gives me this error:
> > 
> > TypeError: destroy() takes no arguments (1 given)
> > 
> > with this code :
> 
> Really sorry, i pressed the wrong button :)
> 
> Here's the code :
> 
> button = gtk.Button("Cancel", gtk.STOCK_CANCEL)
> button.connect("clicked", exit_window.destroy)
> exit_window.action_area.pack_start(button, gtk.FALSE, gtk.FALSE,
> 0)
> button.show()

[snip] 
 
> Is there another way ? I mean, something more clean ?

A callback for a signal needs to have a certain signature. This means
that the callback for "clicked" specifies a certain number of arguments,
and that number of arguments may not be (and is not) the same as the
number of arguments for GtkWindow.destroy(). 

In this case, the only approach is to use a proxy function as a callback
and have that function call destroy(). That's not necessarily a bad
thing, though; you'll realize sooner or later that destroy() alone
wasn't what you wanted to call, and that you need to do that "one extra
thing" when closing that window.

The lambda solution is a simplified way of providing that proxy, but I
swear by defining explicit callback functions, even if all they do is
call a gtk method.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] TypeError: destroy() takes no arguments (1 given)

2003-07-30 Thread Dusausoy Bruno
Le mer 30/07/2003 à 19:27, Dusausoy Bruno a écrit :
> Hi, 
> 
> I'm quite new to pygtk and I have a problem. I've connected the
> "clicked" signal to a button and it should normally call
> exit_window.destroy() function. But Python gives me this error:
> 
> TypeError: destroy() takes no arguments (1 given)
> 
> with this code :

Really sorry, i pressed the wrong button :)

Here's the code :

button = gtk.Button("Cancel", gtk.STOCK_CANCEL)
button.connect("clicked", exit_window.destroy)
exit_window.action_area.pack_start(button, gtk.FALSE, gtk.FALSE,
0)
button.show()

I've searched on google and found a mail sent to this mailing list : 

"Manish Jethani manish.jethani at oracle.com 
 Fri May 9 07:26:56 WST 2003
 
 To fix this, I changed it to:

  self.button.connect("clicked",
lambda x: self.window.destroy())

 connect_object has been replaced with connect.  This works fine
 i.e. calls destroy() successfully.  Does this look ok?"

Is there another way ? I mean, something more clean ?

Thanks. 
-- 
Dusausoy Bruno <[EMAIL PROTECTED]>
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] bug in TreeView?

2003-07-30 Thread David M. Cook
On Wed, Jul 30, 2003 at 06:19:00PM +0200, Emanuele Olivetti wrote:

> if you select a node, click 'Choose parent' and select the same
> node in the parent list you get a core.
> 
> Configuration: LinuxBox with gtk+-2.0.9 and pygtk-1.99.16

Seems to work OK with gtk+-2.2.1.  gtk+-2.0 had all sorts of treeview bugs.
Even gtk+-2.2.0 had some severe ones.

Dave Cook
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] TypeError: destroy() takes no arguments (1 given)

2003-07-30 Thread Dusausoy Bruno
Hi, 

I'm quite new to pygtk and I have a problem. I've connected the
"clicked" signal to a button and it should normally call
exit_window.destroy() function. But Python gives me this error:

TypeError: destroy() takes no arguments (1 given)

with this code :
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] bug in TreeView?

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 06:19:00PM +0200, Emanuele Olivetti wrote:
> Executing the Lars Wirzenius's example about gtk.TreeView in:
> http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html
> 
> if you select a node, click 'Choose parent' and select the same
> node in the parent list you get a core.
> 
> Configuration: LinuxBox with gtk+-2.0.9 and pygtk-1.99.16

Before submitting reports of crashers, it would be really nice if you
could test against CVS HEAD. A lot goes in between releases and the team
is very small to be able to triage all reports that come in.

A stack trace would be great too.

If anybody else can help test, we'd appreciate it.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] custom widget in GLADE?

2003-07-30 Thread Ross Burton
On Wed, 2003-07-30 at 17:23, Jon Willeke wrote:
> Once I realized that PyGTK is maintained as part of gnome-python, I found 
> CVS and bugzilla.  I got the patch from GNOME bug 113271.
> 
> Having seen messages in the archives from 2000 and 2001 that custom widget 
> support would be "in the next version," I thought I must have been doing 
> something wrong.  Now I see that this hasn't made it out of CVS, yet.
> 
> Thanks for the patch.

Hrm, I thought there had been a release since I committed the patch.
Obviously not.

Ross
-- 
Ross Burton mail: [EMAIL PROTECTED]
  jabber: [EMAIL PROTECTED]
 www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF


signature.asc
Description: This is a digitally signed message part
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] custom widget in GLADE?

2003-07-30 Thread Jon Willeke
Once I realized that PyGTK is maintained as part of gnome-python, I found 
CVS and bugzilla.  I got the patch from GNOME bug 113271.

Having seen messages in the archives from 2000 and 2001 that custom widget 
support would be "in the next version," I thought I must have been doing 
something wrong.  Now I see that this hasn't made it out of CVS, yet.

Thanks for the patch.

At 7/30/2003, Jon Willeke wrote:
Where can I get this patch?  I get an AttributeError in PyGTK 1.99.14 and 
1.99.16.  The function name doesn't appear in a grep of the 0.6.11 and 
1.99.16 sources.

At 7/30/2003, Ross Burton wrote:
On Tue, 2003-07-29 at 23:29, Jon Willeke wrote:
> This question appears a couple of times in the archives with no
> satisfactory answer: how do I use a GLADE custom widget?
The important call is gtk.glade.set_custom_widget_callbacks(), which
takes a dictionary of function names->functions (so locals() works).
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] bug in TreeView?

2003-07-30 Thread Emanuele Olivetti
Executing the Lars Wirzenius's example about gtk.TreeView in:
http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html

if you select a node, click 'Choose parent' and select the same
node in the parent list you get a core.

Configuration: LinuxBox with gtk+-2.0.9 and pygtk-1.99.16

I don't know if it is a gtk or pygtk problem.

Hope this helps,

Emanuele

P.S.: here follows the TreeView example (it is short enough
to be here, in my opinion)

# This is an example for demonstrating use of the GtkTreeView widget.
# The code in this example is not particularly good: it is written to
# concentrate on widget usage demonstration, not for maintainability.

import pygtk
pygtk.require("2.0")
import gtk
import gobject

view = None
choose_parent_view = None
dialog = None

def move(old_iter, new_parent, model):
if old_iter:
folder = model.get_value(old_iter, 0)
model.remove(old_iter)
new_iter = model.insert_before(new_parent, None)
model.set_value(new_iter, 0, folder)
model.set_value(new_iter, 1, folder["name"])

def dialog_ok(*args):
dialog.hide()
model, parent_iter = choose_parent_view.get_selection().get_selected()
model, old_iter = view.get_selection().get_selected()
if parent_iter and old_iter:
move(old_iter, parent_iter, model)

def dialog_cancel(*args):
dialog.hide()

def choose_parent(*args):
dialog.show()

def move_to_top(*args):
model, old_iter = view.get_selection().get_selected()
if old_iter:
move(old_iter, None, model)

def quit(*args):
gtk.main_quit()

def make_view(model):
# Create the view itself.
view = gtk.TreeView(model)
renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn("Folder", renderer, text=1)
view.append_column(column)
view.show()

# Create scrollbars around the view.
scrolled = gtk.ScrolledWindow()
scrolled.add(view)
scrolled.show()

return view, scrolled

def make_buttons(list):
buttonbox = gtk.HBox()
for label, func in list:
button = gtk.Button()
button.set_label(label)
button.connect("clicked", func)
button.show()
buttonbox.pack_start(button, expand=gtk.FALSE, fill=gtk.FALSE)
buttonbox.show()
return buttonbox

def main():
# Create the model.
model = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)

# Populate the model with data. We represent folders with Python
# dicts (hash tables or hashmaps in other languages), for simplicity.
# In a real program, they would be programmer defined classes.
for i in range(100):
folder = { "name": "folder %d" % i, "files": ["foo", "bar"] }
iter = model.insert_before(None, None)
model.set_value(iter, 0, folder)
model.set_value(iter, 1, folder["name"])

# Create the main view.
global view
view, scrolled = make_view(model)
view.set_reorderable(gtk.TRUE)

# Create some command buttons.
buttonbox = make_buttons([("Quit", quit), ("Choose parent", choose_parent),
  ("Move to top", move_to_top)])

# Create a vertical box to hold the above stuff.
vbox = gtk.VBox()
vbox.pack_start(buttonbox, expand=gtk.FALSE, fill=gtk.FALSE)
vbox.pack_start(scrolled, expand=gtk.TRUE, fill=gtk.TRUE)
vbox.show()

# Create toplevel window to show it all.
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.connect("delete_event", quit)
win.add(vbox)
win.show()
win.resize(300, 500)

# Create the GtkTreeView for choosing a parent.
global choose_parent_view
choose_parent_view, scrolled = make_view(model)

buttonbox = make_buttons([("OK", dialog_ok), ("Cancel", dialog_cancel)])

vbox = gtk.VBox()
vbox.pack_start(scrolled, expand=gtk.TRUE, fill=gtk.TRUE)
vbox.pack_start(buttonbox, expand=gtk.FALSE, fill=gtk.FALSE)
vbox.show()

global dialog
dialog = gtk.Window(gtk.WINDOW_TOPLEVEL)
dialog.set_default_size(200, 400)
dialog.add(vbox)

# Run the Gtk+ main loop.
gtk.main()

if __name__ == "__main__":
main()

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] gtk.FontSelection pb with set_font_name

2003-07-30 Thread Jean-Baptiste Cazier
Hi !

I am trying to use gtk.FontSelection. I can read the choice from the dialog box all 
right with get_font_name,
but set_font_name just does not set anything and return false. I am not sure if it is 
a pygtk or gtk bug.
Any idea would be appreciated to fix it:

Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> my_font=gtk.FontSelection()
>>> my_font.get_font_name()
'Sans 10'
>>> my_font.set_font_name('Sans 12')
0
>>> my_font.get_font_name()
'Sans 10'


I am using this on RedHaT 9.0 with 
gtk2-2.2.1-4
pygtk2-1.99.14-4
python-2.2.2-26



Thanks

Jena-Baptiste


-- 
-
[EMAIL PROTECTED]

Department of Statistics
deCODE genetics Sturlugata,8
570 2993  101 Reykjavík

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] connect_while_alive() in pygtk2?

2003-07-30 Thread John Ehresman
John Ehresman wrote:
There is a g_signal_handler_is_connected() function, though theoretically
handler id's can be reused according to the g_signal_handler_disconnect()  
docs.  I doubt that it's a practical problem after looking at the current
implementation in gsignal.c (handler id's are obtained by incrementing a
global integer counter), so I'll probably wrap handler_is_connected() and
use that.
I uploaded a patch that adds the wrapper for 
GObject.handler_is_connected() to bugzilla.  It's at 
http://bugzilla.gnome.org/show_bug.cgi?id=118676

John

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Patch for rare segfault

2003-07-30 Thread John Ehresman
Here's a patch for a segfault that I managed to trigger once.  I can't 
seem to reproduce how I trigged it, but I'm fairly sure the patch is 
correct.  The problem is that without the patch, the ob_type slot of 
PyGObjectDoc_Type in pygtype.c is never set to &PyType_Type.

John

Index: pygtype.c
===
RCS file: /home/cvs/src/ide/external/gtk2/pygtk/pygtype.c,v
retrieving revision 1.1
diff -u -r1.1 pygtype.c
--- pygtype.c   29 Mar 2003 00:06:22 -  1.1
+++ pygtype.c   30 Jul 2003 15:25:43 -
@@ -1107,6 +1107,9 @@
 {
 static PyObject *doc_descr = NULL;
+if (PyGObjectDoc_Type.ob_type == NULL)
+   PyGObjectDoc_Type.ob_type = &PyType_Type;
+
 if (!doc_descr) {
doc_descr = PyObject_NEW(PyObject, &PyGObjectDoc_Type);
if (doc_descr == NULL)
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] custom widget in GLADE?

2003-07-30 Thread Jon Willeke
Where can I get this patch?  I get an AttributeError in PyGTK 1.99.14 and 
1.99.16.  The function name doesn't appear in a grep of the 0.6.11 and 
1.99.16 sources.

At 7/30/2003, Ross Burton wrote:
On Tue, 2003-07-29 at 23:29, Jon Willeke wrote:
> This question appears a couple of times in the archives with no
> satisfactory answer: how do I use a GLADE custom widget?
The important call is gtk.glade.set_custom_widget_callbacks(), which
takes a dictionary of function names->functions (so locals() works).
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] custom widget in GLADE?

2003-07-30 Thread Ross Burton
On Tue, 2003-07-29 at 23:29, Jon Willeke wrote:
> This question appears a couple of times in the archives with no 
> satisfactory answer: how do I use a GLADE custom widget?

As I wrote this patch I guess I should document it somewhere...

This is a working example:

import pygtk
pygtk.require("2.0")
import gtk
import gtk.glade
 
def create_source_cd_dropdown():
return gtk.Label("source")
 
gtk.glade.set_custom_widget_callbacks(locals())
glade = gtk.glade.XML("cd-copier.glade")
window = glade.get_widget ("window")
window.show_all()
gtk.main()

The important call is gtk.glade.set_custom_widget_callbacks(), which
takes a dictionary of function names->functions (so locals() works).

Ross
-- 
Ross Burton mail: [EMAIL PROTECTED]
  jabber: [EMAIL PROTECTED]
 www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF


signature.asc
Description: This is a digitally signed message part
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/