Re: [pygtk] applets & libglade

2003-03-07 Thread Martin Preishuber
Hi,well actually the visibility behaviour of the GtkWindows changed
from glade1 to glade2 ... I just was used to use .Show() and was suprised,
that the windows are visibile per default now ... and late in the night, I
didn't think of such a simple thing like checking the visibility setting
:|Martin

- Original Message From:
"Christian Reis" <[EMAIL PROTECTED]>To: "Martin Preishuber"
<[EMAIL PROTECTED]>Cc: "Johan Dahlin"
<[EMAIL PROTECTED]>, [EMAIL PROTECTED]Subject: Re: [pygtk]
applets & libgladeDate: 06/03/03 14:07On Wed, Mar 05, 2003 at 11:57:24PM +0100, Martin Preishuber
wrote:> > > 2.) I create some windows with glade (pygtk2
1.99.15), to use it I do> > > something like:> >
>> > > xml = gtk.glade.XML(gladefile)> >
>> > > this works fine, but it immidiately shows the window
... is there any> > > way to load it invisible and set it to
visible manually later ? I need> > > to fill some parts of the
window before it is visible.> >> > Go into glade, mark
the window, go the Common tab, uncheck Visible.>> thanks again
... how comes, that I feel somehow stupid now ? :|You shouldn't.
This is a very common problem when using liglade to builda complex
application -- the parse of the file has the side-effect ofrendering the
window when it's marked as visible.I've discussed this before, and
I'm not sure there is a good solution tothe problem. On one hand, you
could ignore the visible attribute fortop-level windows, but that would
be violating the 1-1 correspondencebetween gladefile and libglade tree
which is expected. On the otherhand, you could have Glade make
GtkWindows not visible my default; butthen you have a consistency issue
between windows and other widgets.I don't see solutions (beyond
stuff likeGladeXML("foo.glade", invisible_windows=1)which I
don't like very much). But maybe somebody else does.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/pygtkRead the
PyGTK FAQ: http://www.async.com.br/faq/pygtk/

___
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] applets & libglade

2003-03-06 Thread mekkaoui omar
Le jeu 06/03/2003 à 13:55, Christian Reis a écrit :
> On Wed, Mar 05, 2003 at 11:57:24PM +0100, Martin Preishuber wrote:
> > > > 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> > > > something like:
> > > > 
> > > > xml = gtk.glade.XML(gladefile)
> > > > 
> > > > this works fine, but it immidiately shows the window ... is there any
> > > > way to load it invisible and set it to visible manually later ? I need
> > > > to fill some parts of the window before it is visible.
> > > 
> > > Go into glade, mark the window, go the Common tab, uncheck Visible.
> > 
> > thanks again ... how comes, that I feel somehow stupid now ? :|
> 
> You shouldn't. This is a very common problem when using liglade to build
> a complex application -- the parse of the file has the side-effect of
> rendering the window when it's marked as visible.
> 
> I've discussed this before, and I'm not sure there is a good solution to
> the problem. On one hand, you could ignore the visible attribute for
> top-level windows, but that would be violating the 1-1 correspondence
> between gladefile and libglade tree which is expected. On the other
> hand, you could have Glade make GtkWindows not visible my default; but
> then you have a consistency issue between windows and other widgets.
> 
> I don't see solutions (beyond stuff like 
> 
> GladeXML("foo.glade", invisible_windows=1)
> 
> which I don't like very much). But maybe somebody else does.
> 


Hi,
Here is my approach to use glade for a complex application. I suppose an
application with two windows (window1 and an about widget).

def on_about_activate(obj):
about = XML("foo.glade", "about1").get_widget("about1")
about.show()

def start_foo():
global wTree
dic = {"gtk_main_quit": mainquit,
   "on_button1_clicked":on_about_activate}

gnome.init("foo.glade","2.0")
wTree = XML("foo.glade", "window1")
wTree.signal_autoconnect(dic)

"""At this level only window1 appear and when you button1 is
clicked the about1 widget appear too.
You haven't to specify anything for a GtkWidget like not
visible property. 
"""

if __name__ == "__main__":
start_foo()
mainloop()

Perhaps is not a correct approach but it works very well for.

___
Omar Mekkaoui
Thema, University of Cergy-Pontoise
France





___
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] applets & libglade

2003-03-06 Thread Christian Reis
On Wed, Mar 05, 2003 at 11:57:24PM +0100, Martin Preishuber wrote:
> > > 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> > > something like:
> > > 
> > >   xml = gtk.glade.XML(gladefile)
> > > 
> > > this works fine, but it immidiately shows the window ... is there any
> > > way to load it invisible and set it to visible manually later ? I need
> > > to fill some parts of the window before it is visible.
> > 
> > Go into glade, mark the window, go the Common tab, uncheck Visible.
> 
> thanks again ... how comes, that I feel somehow stupid now ? :|

You shouldn't. This is a very common problem when using liglade to build
a complex application -- the parse of the file has the side-effect of
rendering the window when it's marked as visible.

I've discussed this before, and I'm not sure there is a good solution to
the problem. On one hand, you could ignore the visible attribute for
top-level windows, but that would be violating the 1-1 correspondence
between gladefile and libglade tree which is expected. On the other
hand, you could have Glade make GtkWindows not visible my default; but
then you have a consistency issue between windows and other widgets.

I don't see solutions (beyond stuff like 

GladeXML("foo.glade", invisible_windows=1)

which I don't like very much). But maybe somebody else does.

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] applets & libglade

2003-03-05 Thread Johan Dahlin
ons 2003-03-05 klockan 19.24 skrev Martin Preishuber:
> Hi,
> 
> just 2 short questions related to gnome-python2 (1.99.15)
> 
> 1.) I try to create a panel applet with
> 
>   myapplet = gnome.applet.Applet()
> 
> and it just segfaults, is this the correct usage ?

I forgot this in my last mail.

This is not the expected behavior and is now fixed in CVS.

-- 
Johan Dahlin <[EMAIL PROTECTED]>
Async Open Source

___
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] applets & libglade

2003-03-05 Thread Martin Preishuber
On Wed, 2003-03-05 at 23:29, Johan Dahlin wrote:
> ons 2003-03-05 klockan 19.24 skrev Martin Preishuber:
> > Hi,
> > 
> > just 2 short questions related to gnome-python2 (1.99.15)
> > 
> > 1.) I try to create a panel applet with
> > 
> > myapplet = gnome.applet.Applet()
> > 
> > and it just segfaults, is this the correct usage ?
> 
> Something like this:
> 
> def sample_factory(applet, iid):
> label = gtk.Label("Success!")
> applet.add(label)
> 
> applet.show_all()
> return gtk.TRUE
> 
> gnome.applet.bonobo_factory("OAFIID:GNOME_PythonAppletSample_Factory", 
>  gnome.applet.Applet.__gtype__, 
>  "hello", "0", sample_factory)

thanks :)

> > 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> > something like:
> > 
> > xml = gtk.glade.XML(gladefile)
> > 
> > this works fine, but it immidiately shows the window ... is there any
> > way to load it invisible and set it to visible manually later ? I need
> > to fill some parts of the window before it is visible.
> 
> Go into glade, mark the window, go the Common tab, uncheck Visible.

thanks again ... how comes, that I feel somehow stupid now ? :|

Martin

-- 
Martin Preishuber <[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] applets & libglade

2003-03-05 Thread Johan Dahlin
ons 2003-03-05 klockan 19.24 skrev Martin Preishuber:
> Hi,
> 
> just 2 short questions related to gnome-python2 (1.99.15)
> 
> 1.) I try to create a panel applet with
> 
>   myapplet = gnome.applet.Applet()
> 
> and it just segfaults, is this the correct usage ?

Something like this:

def sample_factory(applet, iid):
label = gtk.Label("Success!")
applet.add(label)

applet.show_all()
return gtk.TRUE

gnome.applet.bonobo_factory("OAFIID:GNOME_PythonAppletSample_Factory", 
 gnome.applet.Applet.__gtype__, 
 "hello", "0", sample_factory)

> 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> something like:
> 
>   xml = gtk.glade.XML(gladefile)
> 
> this works fine, but it immidiately shows the window ... is there any
> way to load it invisible and set it to visible manually later ? I need
> to fill some parts of the window before it is visible.

Go into glade, mark the window, go the Common tab, uncheck Visible.

-- 
Johan Dahlin <[EMAIL PROTECTED]>
Async Open Source

___
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] applets & libglade

2003-03-05 Thread Martin Preishuber
Hi,

just 2 short questions related to gnome-python2 (1.99.15)

1.) I try to create a panel applet with

myapplet = gnome.applet.Applet()

and it just segfaults, is this the correct usage ?
2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
something like:

xml = gtk.glade.XML(gladefile)

this works fine, but it immidiately shows the window ... is there any
way to load it invisible and set it to visible manually later ? I need
to fill some parts of the window before it is visible.

thanks,

Martin

-- 
Martin Preishuber <[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/