Re: [pygtk] gnome_program_init()

2005-04-13 Thread Christian Robottom Reis
On Wed, Apr 13, 2005 at 09:00:00PM +0200, Stefan Elwesthål wrote:
> I've just tried to use simple-glade-codegen.py to generate a neat
> GnomeApp but immediatly I get:
> "GnomeUI-ERROR **: You must call gnome_program_init() before creating
> a GnomeApp"

You need to init your gnome program. Isn't this a FAQ? At least

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

covered a solution for 0.6 -- anyone up for updating it?

> Hmm, what should one do to get the hang of this, there aren't much to
> read and when google can't help you your kind of lost? 

Persist. The IRC channel, this mailing list, the FAQ, the tutorial, the
reference, the source code and the creator are all here to help you, and
once you get the hang of it PyGTK is a _lot_ easier than any other
toolkit out there.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] gnome_program_init()

2005-04-13 Thread Stefan Elwesthål
Hi, it's the nagging little swede (not the nice one - he's busy working;)

I've just tried to use simple-glade-codegen.py to generate a neat
GnomeApp but immediatly I get:
"GnomeUI-ERROR **: You must call gnome_program_init() before creating
a GnomeApp"

Sure - a nice error message, but google won't help me out there. Did
find some old posts from 2002 but I doubt that they are valid, so how
do I know where to put what?

Hmm, what should one do to get the hang of this, there aren't much to
read and when google can't help you your kind of lost? Maybe I should
jump the bandwagon and go for mono/Gtk# instead, since there are a
couple of books to read. (Not that I'm experienced in C#, but it looks
like Java and I've spent some years over there).

I love the green snake, but Java feels easier when there's a GUI
involved for sure!

/Stefan - who likes to throw himself on sharp rocks now and then
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] threading

2005-04-13 Thread John K Luebs
On Tue, Apr 12, 2005 at 09:08:47PM -0700, Brian wrote:
> Is it possible to run the mainloop of our program from another thread?
> Is it dfficult/not advisable? 

It's ok for Windows as long as you do ALL your gtk calls in that one
thread.

 -jkl
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] where is the control transfered ?

2005-04-13 Thread Christian Reis
On Sun, Apr 03, 2005 at 10:33:22PM +0200, Leeuw van der, Tim wrote:
> try:
> # call server
> except:
> # Do exception handling


Except you don't want to do 

except:
...

ever, but

except FooError:
...

Always trap specific exceptions, or you will not pass GO (neither will
you collect $200).

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] values not being refreshed in an event handler

2005-04-13 Thread Christian Reis
On Wed, Mar 30, 2005 at 10:49:45AM -0500, Saurabh Wagh wrote:
> A very strange problem.  I am designing an application to display the
> contents of a three dimensional data structure.( residing on server
> side )
[...]
> But When i click on any object ( say man, present on line 3 of buffer,
> ) not only the man ( result[3] ) is printed , but also animal ( which
> was at that position in the variable during prev iteration )

I didn't see if you got answered, bug isn't the problem here the fact
that you are connect()ing to a signal every time your main function is
called? You want to have each signal connected to once only.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] threading

2005-04-13 Thread Brian
On Wed, 2005-13-04 at 09:16 -0400, John Ehresman wrote:
> Brian wrote:
> >>try setting the environment variable PYGTK_USE_GIL_STATE_API to true 
> >>before calling gobject.threads_init()
> >>
> >>Johan
> > 
> > 
> > It locks up at another thread that produces the data needed for a
> > different view.
> 
> What version of Python and of pygtk are you using?  What platform are 
> you on?
> 
> Thanks,
> 
> John

python-2.3.4, pygtk-2.6.1, gtk+-2.6.4

There are things in that thread are are a no-no.  When I re-wrote it to
add a bunch of things I call some other code that builds a gtk.TreeStore
then it traverses it to build the data (another gtk.TreeStore) I need.
It wasn't till I was nearly finished debugging that I realized I was
multi-threading gtk calls.  I tried adding the gtk.thread_enter/leave()
pair but I think things froze up.

I have not had the time nor have I been able to get my brain to
concentrate on re-writing a version that is thread friendly.

But interestingly enough, that thread has never otherwise caused a
crash.

Thanks everyone.
-- 
Brian <[EMAIL PROTECTED]>

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


Re: [pygtk] threading

2005-04-13 Thread John Ehresman
Brian wrote:
try setting the environment variable PYGTK_USE_GIL_STATE_API to true 
before calling gobject.threads_init()

Johan

It locks up at another thread that produces the data needed for a
different view.
What version of Python and of pygtk are you using?  What platform are 
you on?

Thanks,
John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] threading

2005-04-13 Thread Antoon Pardon
On Tue, Apr 12, 2005 at 09:08:47PM -0700, Brian wrote:
> I have a problem in that another python program (not under our
> development) we import is not thread friendly.  The problem I have is
> that mostly it is imported and used from the base thread, but there are
> several areas of code that need to run from a thread so as to not tie up
> the mainloop and general gui operations.  The result is intermittent
> segfaults/ lately it does:
> 
> Fatal Python error: PyThreadState_Get: no current thread
> Killed
> 
>   I have thought of recoding and spawning a process that imports the
> program to act as a server, but that would entail pickling/unpickling
> the python data types to pass thru pipes, etc..
> 
> Is it possible to run the mainloop of our program from another thread?

As far as I understand this shouldn't be a problem for linux and
other unix variants. But I have only tried it once and that was
with a very small test program. If you want more I have a number
of demo programs that shouldn't be difficult to adapt for testing
this out. Maybe I can find some time this week.

> Is it dfficult/not advisable? 

Just start a thread where you call gtk.main.

-- 
Antoon Pardon
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/