Re: [pygtk] Patch to those who use glc.py (Python Glade Code Generator)

2001-10-25 Thread Russell Nelson

Christian Robottom Reis writes:
 > Why _not_ libglade, btw?

The user has to have it installed.

-- 
-russ nelson <[EMAIL PROTECTED]>  http://russnelson.com
Crynwr sells support for free software  | PGPok | It's a crime, not an act
521 Pleasant Valley Rd. | +1 315 268 1925 voice | of war.  For my take, see:
Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | http://quaker.org/crime.html
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] Patch to those who use glc.py (Python Glade CodeGenerator)

2001-10-25 Thread Brian Gallew

On Wed, 2001-10-24 at 23:46, Christian Robottom Reis wrote:
> Why _not_ libglade, btw?

Because debugging libglade code that segfaults is a pain in the butt?  I
think it's *much* easier to just write the GUI by hand using gtk.py. 
OTOH,I've been writing GUIs in Tk for a long time, so the learning curve
isn't nearly as steep as it could be.

-- 
=
| JAVA must have been developed in the wilds of West Virginia.  |
| After all, why else would it support only single inheritance??|
=
| Finger [EMAIL PROTECTED] for my public key. |
=

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] Emitting signal

2001-10-25 Thread Arun

> > If its with emit function, what are the parameters other than the
> > signal name.
> 
> Arguments to be passed as the signal's arguments. See
> 
> gtk/gtk-signals.html
> 
> in the gtk documentation.

Thanks for replying,

I had looked into that. the problem is function tries to find a GdkEvent 
object and I could find a way to create the same. 

But some wher in the gtk list a comment said its not a good idea to
generate events like keypress from the program. 

Is there any alternate ? I want to have focus change on Enter keypress.

Regards,
Arun.
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] weird gdb/python/gtk/pango interaction?

2001-10-25 Thread Skip Montanaro


Folks,

I'm no longer able to run PyGtk scripts from gdb under some circumstances.
I am using the CVS HEAD of glib, atk, pango, gtk+ and pygtk.  The following
simple Python script works fine when run from gdb:

#!/usr/bin/env python

import gtk

w = gtk.Window()
w.connect("destroy", gtk.mainquit)
#lbl = gtk.Label("hi")
#w.add(lbl)

w.show_all()
gtk.mainloop()

with the following output:

(gdb) r basic.py
Starting program: /usr/local/bin/python basic.py
[New Thread 1024 (LWP 19044)]
Gtk-Message: YOU ARE USING THE DEVEL BRANCH 1.3.x OF GTK+ WHICH IS CURRENTLY
UNDER HEAVY DEVELOPMENT AND FREQUENTLY INTRODUCES INSTABILITIES.   
 if you don't know why you are getting this, you probably want to  
  use the stable branch which can be retrieved from
ftp://ftp.gtk.org/pub/gtk/v1.2/ or via CVS with
cvs checkout -r glib-1-2 glib; cvs checkout -r gtk-1-2 gtk+

Program exited normally.

If I uncomment the two lines involving lbl, however, I get this mess:

(gdb) r basic.py
Starting program: /usr/local/bin/python basic.py
[New Thread 1024 (LWP 19127)]
Gtk-Message: YOU ARE USING THE DEVEL BRANCH 1.3.x OF GTK+ WHICH IS CURRENTLY
UNDER HEAVY DEVELOPMENT AND FREQUENTLY INTRODUCES INSTABILITIES.   
 if you don't know why you are getting this, you probably want to  
  use the stable branch which can be retrieved from
ftp://ftp.gtk.org/pub/gtk/v1.2/ or via CVS with
cvs checkout -r glib-1-2 glib; cvs checkout -r gtk-1-2 gtk+

basic.py (pid:19127): GRuntime-CRITICAL **: file gparamspecs.c: line 1687 
(g_param_spec_float): assertion `default_value >= minimum && default_value <= maximum' 
failed

basic.py (pid:19127): GRuntime-CRITICAL **: file gobject.c: line 270 
(g_object_class_install_property): assertion `G_IS_PARAM_SPEC (pspec)' failed

basic.py (pid:19127): ** WARNING **: Couldn't load font "Sans -2.09715e+06" 
falling back to "Sans -2.09715e+06"

basic.py (pid:19127): ** WARNING **: Couldn't load font "Sans -2.09715e+06" 
falling back to "Sans -2.09715e+06"

basic.py (pid:19127): ** WARNING **: All font failbacks failed

Program exited with code 01.

If I change the Label to an EventBox, everything works, presumably because
no font rendering is involved.  Also when I run the script from the bash
prompt it works as expected (no Gtk warnings).  The equivalent C program:

#include 

int main( int   argc,
  char *argv[] )
{
GtkWidget *window;
GtkWidget *label;

gtk_init(&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
gtk_window_set_title (GTK_WINDOW (window), "");

label = gtk_label_new("hi");
gtk_container_add(GTK_CONTAINER(window), label);

gtk_widget_show_all (GTK_WIDGET(window));
gtk_main();

return(0);
}

works as expected, both from the command line and if run from the gdb
prompt.

This wouldn't be such a big deal, except in a more complex script I get
segfaults in some circumstances, and this makes debugging that problem a bit
difficult.

Any idea what's going on?

-- 
Skip Montanaro ([EMAIL PROTECTED])
http://www.mojam.com/
http://www.musi-cal.com/
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] leave_notify event?

2001-10-25 Thread george young

On Thu, 25 Oct 2001 16:20:40 -0200 (BRST)
Christian Robottom Reis <[EMAIL PROTECTED]> wrote:

> On Thu, 25 Oct 2001, george young wrote:
> > >I have some text and entry widgets, and when the user changes the
> > >value in one of them and moves on to another widget in the GUI,

> > Yes, thank you.  The focus_out_event is much more what I want.
> > I still get two of these events when the focus leaves the widget,
> > and the event objects seem to be nearly indistinguishable.  Any idea why I get
> > this event twice?  The callback shows different gtktext objects as it's first 
>argument.
> 
> Have you tried returning gtk.TRUE from the handler? And if that fails,
> have you tried a emit_stop_by_name()?

No, I had not tried that, and YES -- returning gtk.TRUE from the callback works!
Thank you very much!

-- George

-- 
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
-- Sherlock Holmes in "The Dying Detective"
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] leave_notify event?

2001-10-25 Thread Christian Robottom Reis

On Thu, 25 Oct 2001, george young wrote:

> Yes, thank you.  The focus_out_event is much more what I want.
> I still get two of these events when the focus leaves the widget,
> and the event objects seem to be nearly indistinguishable.  Any idea why I get
> this event twice?  The callback shows different gtktext objects as it's first 
>argument.

Have you tried returning gtk.TRUE from the handler? And if that fails,
have you tried a emit_stop_by_name()?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] leave_notify event?

2001-10-25 Thread george young

On Thu, 25 Oct 2001 12:13:52 +1000
James Henstridge <[EMAIL PROTECTED]> wrote:
> george young wrote:
> >[pygtk-0.6.6, gtk+-1.2.7, python 2.1, i86 linux 2.2.16]
> >
> >I have some text and entry widgets, and when the user changes the
> >value in one of them and moves on to another widget in the GUI,
> >I need to grab the changes and put them in the database. 

> >self.comment_text.connect('leave_notify_event', self.leave_event, 
>self.comment_text)
...
> >but I get this event on entering AND twice on leaving the widget!
^
...
> For this sort of thing, you are probably more interested in keyboard 
> focus, rather than mouse focus.  enter/leave notify events get triggered 
> as the mouse pointer crosses window boundaries.
> 
> If you want to know when the keyboard focus enters or leaves a widget 
> (which is a different thing), use focus_in_event and focus_out_event.

Yes, thank you.  The focus_out_event is much more what I want.
I still get two of these events when the focus leaves the widget,
and the event objects seem to be nearly indistinguishable.  Any idea why I get
this event twice?  The callback shows different gtktext objects as it's first argument.
The widget is actually *derived from* gtktext... does this
cause two events, one for the base and one for the inherited object?

class Neat_Text(gtk.GtkText):
'''A GtkText box with vertical size set to exactly fit the given text.
Desperately need a way to dynamically determine the width of this box.'''

def __init__(self, txt, fnt, width_px, editable=0):
gtk.GtkText.__init__(self)
self.set_editable(editable)
self.set_sensitive(1)
self.txt = txt
self.font = fnt
self.set_word_wrap(1)
str = txt or ''
self.height = self.calculate_lines(str, width_px, fnt) * (fnt.ascent + 
fnt.descent) + 5
self.insert(fnt, None, None, str)
self.set_usize(width_px, self.height)

Thanks,
-- George
-- 
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
-- Sherlock Holmes in "The Dying Detective"
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] How to use GnomeDialog from an applet

2001-10-25 Thread Akos Polster

On Thu, 2001-10-25 at 06:02, Christian Robottom Reis wrote:
> On 23 Oct 2001, Akos Polster wrote:
> 
> > This is what happens: I create a GnomeDialog with a Close button,
> > then call run_and_close. run_and_close returns when I press Close,
> > but the dialog, instead of being destroyed, stays on the screen,
> > and becomes unresponsive, together with the rest of the applet.
> 
> Do the buttons click, or is the app frozen? Does the app redraw when
> covered with another window or not?

The dialog and the app freeze; they don't redraw

 - Akos.


-- 
Akos Polster
mailto:[EMAIL PROTECTED]
http://akos.pipacs.com

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk