Re: [pygtk] Progress Cell Renderer

2004-06-24 Thread David M. Cook
On Wed, Jun 23, 2004 at 11:39:21AM -0300, Gustavo Niemeyer wrote:

> I haven't found this anywhere, so I thought someone else might
> be interested as well. Here is a cell renderer which mimicks
> progress bars, based on current gtk+ code.

Has anybody done a cell renderer for combo boxes?

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/


Re: [pygtk] Glade modal Window

2004-06-24 Thread Christian Robottom Reis
On Thu, Jun 24, 2004 at 07:29:33PM -0300, Adriano Del Vigna de Almeida wrote:
> How to set the parent window of a window loaded with the libglade? In
> one way that a second window (after the main app window) doesn't be
> shown in the task bar? I tried to add
> 'self.AddUser.set_parent_window(...)' right before
> 'self.AddUser.set_modal(gtk.TRUE)' line but it had no effect.

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

> Plus, how to prevent "self.xml = gtk.glade.XML(GLADE_PATH +
> 'interface.glade', 'windowAddUser')" to show the window without a
> subsequent call to 'hide()' method?

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

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
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] Glade modal Window

2004-06-24 Thread Adriano Del Vigna de Almeida
Hello,

How to make a window loaded with libglade to be modal? I'm using the
following code to load the window:

#-
class wndAddUser:
def __init__(self):
self.xml = gtk.glade.XML(GLADE_PATH + 'interface.glade',
'windowAddUser')
self.xml.signal_autoconnect({
'on_buttonCancel_clicked':self.Cancel,
'on_buttonAdd_clicked':self.Add
})
self.AddUser = self.xml.get_widget('windowAddUser')
self.AddUser.set_modal(gtk.TRUE)
   
 
def Cancel(self, widget = None, data = None):
self.AddUser.hide()
   
 
def Add(self, widget = None, data = None):
self.AddUser.hide()
#-

I set both, Glade and source code modal property to TRUE, but the window
remains a non-modal one. libglade doesn't honor all of the Glade's
window properties?

How to set the parent window of a window loaded with the libglade? In
one way that a second window (after the main app window) doesn't be
shown in the task bar? I tried to add
'self.AddUser.set_parent_window(...)' right before
'self.AddUser.set_modal(gtk.TRUE)' line but it had no effect.

Plus, how to prevent "self.xml = gtk.glade.XML(GLADE_PATH +
'interface.glade', 'windowAddUser')" to show the window without a
subsequent call to 'hide()' method?

-- 
Adriano Del Vigna de Almeida

Freesoftware - Brasil



signature.asc
Description: Esta =?ISO-8859-1?Q?=E9?= uma parte de mensagem	assinada digitalmente
___
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] communication between dialogs

2004-06-24 Thread Doug Quale
mirek binas <[EMAIL PROTECTED]> writes:

> i've got a dialog with ListStore widget. from this dialog is called
> another one, from which is possible to add new entries to this
> ListStore. after adding new entry - this will be stored into file.
> 
> how to synchronize this two dialogs? i want to refresh the ListStore
> dialog after the new entry was created. how can i do this?

Just pass the ListStore model to the second dialog.  When you create a
new entry, add it to the model it will show up in the original dialog,
just like magic.  The easiest way to synchronize is to share the
model.
___
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] Final PyGTK 0.6 release *candidate*

2004-06-24 Thread Christian Robottom Reis
On Wed, Jun 23, 2004 at 04:26:07PM -0300, Christian Robottom Reis wrote:
> On Wed, Jun 23, 2004 at 02:32:51PM -0400, Andrew Reid wrote:
> >   I've just run across a bug in the GtkScrolledWindow class,
> > present in both 0.6.9 and 0.6.11 of pygtk.  The bug is that
> > the __getattr__ function uses a local "attrs" dictionary,
> > and looks for keys in it using "attrs.has_attr", which fails --
> > it should be "attrs.has_key".
> 
> This has been fixed in CVS for over a year now. I should take some time
> and do a final 0.6 release now that I'm practically sure we won't be
> seeing any further bugfixes at this point.
> 
> Anybody have a 0.6 change that they want to see committed? Speak now or
> be silent for ever (really, *for ever*).

I have a release candidate tarball up for testing. Last chance to
complain about it before we go gold with this. And thanks to the 0.6ers
that are still out there for helping out with bug reports and
complaints.

http://www.async.com.br/~kiko/pygtk-0.6.12RC.tar.gz

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
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] communication between dialogs

2004-06-24 Thread george young
On Thu, 24 Jun 2004 17:41:02 +0200
mirek binas <[EMAIL PROTECTED]> threw this fish to the penguins:
> i've got a dialog with ListStore widget. from this dialog is called
> another one, from which is possible to add new entries to this
> ListStore. after adding new entry - this will be stored into file.
> 
> how to synchronize this two dialogs? i want to refresh the ListStore
> dialog after the new entry was created. how can i do this?

Sound like an application for the Observer software pattern.
google for python observer pattern.

-- George

-- 
"Are the gods not just?"  "Oh no, child.
What would become of us if they were?" (CSL)
___
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] software to help automate glade/pygtk development

2004-06-24 Thread Stephen Kennedy
Message-ID:  <[EMAIL PROTECTED]>
> Introspection allows you to specify the signal handlers in a natural
> way in your pygtk code and have them connected automatically.

> Controller classes automatically connect signals based on method names
> that match patterns like on_widget__signal and after_widget__signal.
> There is no need to specify the signal handlers in Glade since this
> information is not used.  To connect to another widget or signal you
> just write a new method with the appropriate name and no changes are
> needed to the Glade file.

This is really great advice, I've recently switched from using a method
like in the pygtk faq to this method and it's much cleaner and easier.

1) You get warnings for python typos because the connection code needs a
valid widget name and signal name.

2) It's much quicker to add new methods - there's no need to keep your
handlers declared in glade in sync with your python source.

Beautiful!
Stephen.
-- 
Stephen Kennedy <[EMAIL PROTECTED]>
http://meld.sf.net visual diff and merge

___
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] Progress Cell Renderer

2004-06-24 Thread Gustavo Niemeyer
Hi Kiko!

> Hey Gustavo, nice to see you around and hacking PyGTK bits.

I'm happy to see you here, and even happier because it looks like
you're an ancient here. :-)

> > I haven't found this anywhere, so I thought someone else might
> > be interested as well. Here is a cell renderer which mimicks
> > progress bars, based on current gtk+ code.
> 
> How interesting. What sort of application do you use this in? I'm trying
> to figure out what *I'd* use this for, though apparently my imagination is
> impaired enough to not find something after considering it for a minute.

Hehehe :-)

> Gustavo says something about download managers, but wouldn't you
> implement one of those more easily using a Table with labels to the left
> and a conventional ProgressBar to the right?

Yes, Gustavo (the other one :-) is right. I'm using this for a download
manager as well. It's quite usual to get progress bars in lists for
this purpose. Using a table in a scrolled viewport is certainly
possible, but I'm unsure about other issues (speed, memory consumption,
etc) once you start working with, say, one thousand items.

-- 
Gustavo Niemeyer
http://niemeyer.net
___
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] communication between dialogs

2004-06-24 Thread Christian Robottom Reis
On Thu, Jun 24, 2004 at 05:41:02PM +0200, mirek binas wrote:
> how to synchronize this two dialogs? i want to refresh the ListStore
> dialog after the new entry was created. how can i do this?

Is the second dialog modal (and runs in its own gtk.mainloop) or do you
have two windows that are supposed to be used simultaneously?

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
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] Progress Cell Renderer

2004-06-24 Thread Christian Robottom Reis
On Wed, Jun 23, 2004 at 11:39:21AM -0300, Gustavo Niemeyer wrote:
> Hello folks!

Hey Gustavo, nice to see you around and hacking PyGTK bits.

> I haven't found this anywhere, so I thought someone else might
> be interested as well. Here is a cell renderer which mimicks
> progress bars, based on current gtk+ code.

How interesting. What sort of application do you use this in? I'm trying
to figure out what *I'd* use this for, though apparently my imagination is
impaired enough to not find something after considering it for a minute.

Gustavo says something about download managers, but wouldn't you
implement one of those more easily using a Table with labels to the left
and a conventional ProgressBar to the right?

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
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] communication between dialogs

2004-06-24 Thread mirek binas
hello

i've got a dialog with ListStore widget. from this dialog is called
another one, from which is possible to add new entries to this
ListStore. after adding new entry - this will be stored into file.

how to synchronize this two dialogs? i want to refresh the ListStore
dialog after the new entry was created. how can i do this?

mirek
-- 
e-mail: [EMAIL PROTECTED]
icq: 113397932
jabber: [EMAIL PROTECTED]
homepage: http://www.intrak.sk/~binas

english:
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

slovak:
prosim, neposielajte mi prilohy vo formatoch .doc a .ppt (power point)
precitajte si http://www.fsf.org/philosophy/no-word-attachments.cs.html

___
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] Threading

2004-06-24 Thread Antoon Pardon
On Wed, Jun 23, 2004 at 07:52:38AM -0400, dave wrote:
> This is some of the code I use...it may not be perfect, but it does work 
> reliably on win32 and linux.
> 
> -dave
> 
>def handle_gui_queue(self,command,args):
>"""
>Callback the gui_queue uses whenever it recieves a command for us.
>command is a string
>args is a list of arguments for the command
>"""
>   
>#print "handle_gui_queue"
>if command=="set_label":
>#print "setting label"
>obj=args[0]
>label=args[1]
>obj.set_label(label)
>elif command=="do_listener_shell":
>lst=args[0]
>#print "doing a listener shell"
>self.do_listener_shell(listener=lst)
> 
> #gui_queue.py
> class gui_queue:
>"""wakes up the gui thread which then clears our queue"""
>def __init__(self,gui,listenport=0):
>"""If listenport is 0, we create a random port to listen on"""
>self.mylock=RLock()
>self.myqueue=[]
>if listenport==0:
>self.listenport=random.randint(1025,1)
>else:
>self.listenport=listenport
>print "Local GUI Queue listening on port %s"%self.listenport
>s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>s.bind(("", self.listenport)) 
>self.listensocket=s
>self.listensocket.listen(300) #listen for activity.
>#time.sleep(15)
>self.gui=gui
>return
>   
>def append(self,command,args):
>"""
>Append can be called by any thread
>"""
>self.mylock.acquire()
>self.myqueue.append((command,args))
>#this won't work on a host with a ZoneAlarm firewall or no 
> internet connectivity...
>s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>#small timeout will wake up the gui thread, but not
>#cause painful pauses if we are already in the gui thread.
>#important to note that we use timeoutsocket and it
>#is already loaded.
>s.set_timeout(0.01)
>#wakey wakey!
>#print "Connecting to port %d"%self.listenport
>try:
>s=s.connect(("localhost",self.listenport))
>except:
>#ignore timeouts
>pass
>self.mylock.release()
>return
> 
>def clearqueue(self):
>"""
>Clearqueue is only called by the main GUI thread
>Don't forget to return 1
>"""
>#print "Clearing queue"
>#clear this...TODO: add select call here.
>newconn,addr=self.listensocket.accept()
>for i in self.myqueue:
>(command,args)=i
>self.gui.handle_gui_queue(command,args)
>self.myqueue=[]
>return 1
> 

I think your code runs the risk of being overrun.
If your background tasks append commands faster
than the main thread can handle them, the main
thread can be stuck in the clearqueue an arbitrary
long time, making your application unresponsive.

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