Re: [pygtk] PyGNOME2 panel applets

2002-11-01 Thread Martin Grimme
The topic of panel applets in pygnome2 has been raised before, and 
seemingly, answered succinctly:
	http://www.daa.com.au/pipermail/pygtk/2002-September/003393.html
However, I'm still confused.  Using the files attached to the above post,
I put GNOME_HelloApplet.server in /home/btonkes/lib/oaf which is in the oaf
path:
	$ oaf-sysconf --display-directories
	OAF configuration file contains:
	/home/btonkes/lib/oaf
and python-applet in /home/btonkes/src/pyapplet, changing the PATH TO PYTHON
APPLET string in GNOME_HelloApplet.server to
/home/btonkes/src/pyapplet/python-applet.  My question: what next?  Running
python-applet seems to do nothing.  Am I doing something fundamentally wrong?

You have to start the applet by adding it to the panel like any other
applet. It should appear in the panel menu for adding applets.

Btw, panel applets are Bonobo Controls now. So they are a little bit
different from the applets in GNOME 1.x.

Bye, Martin Grimme - http://www.pycage.de

___
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] updating with combo-entry

2002-11-01 Thread mekkaoui omar


 Original message 
Date : Thu, 31 Oct 2002 09:52:14 -0300
De : Christian Reis [EMAIL PROTECTED]  
Objet : Re: [pygtk] updating with combo-entry  
A : David M. Cook [EMAIL PROTECTED], [EMAIL PROTECTED]

On Wed, Oct 30, 2002 at 04:40:11PM -0800, David M. Cook 
wrote:
 On Wed, Oct 30, 2002 at 11:45:23AM +0100, mekkaoui omar 
wrote:
 
  I would like to update information on a window after 
  selecting an entry in the combo.  But, I don't know 
which 
  signal I will use to associate it to an updating 
function.
 
 The simplest way is to add a button to do this, of course, 
but to save mouse
 clicks the following seems to work for me:

What's wrong with

combo.entry.connect(insert_text, my_handler)
combo.entry.connect(delete_text, my_handler)

?

For this moment, I opt for using a button to update 
information. In the futur, I prefer to update using mouse 
button like David M. Cook hase suggested.

Thanks to all for their help.
Omar Mekkaoui
THEMA - University de Cergy-Pontoise
Economie des Transports
___
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] updating with combo-entry

2002-11-01 Thread Christian Reis
On Thu, Oct 31, 2002 at 05:45:54PM -0800, David M. Cook wrote:
 On Thu, Oct 31, 2002 at 09:52:14AM -0300, Christian Reis wrote:
 
  What's wrong with
  
  combo.entry.connect(insert_text, my_handler)
  combo.entry.connect(delete_text, my_handler)
 
 Won't this signal be send everytime a character is inserted or deleted?  I'm
 not sure that's what he wants.

Yeah, you're right. But it's guaranteed to work and is simple to filter.
The truth is Combo and OptionMenu in gtk-1.2 suck.

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] error messages

2002-11-01 Thread James Henstridge
Jay Graves wrote:


Hello
I have created a test app with pygtk and glade.  When I run the app the
window appears however there are many errors written to the terminal.
Can anyone tell me what these mean, and how to get rid of them.
Also, for bonus points, how come the app quits when I do a File | Quit
but not when I close the window?

I have attached the app the glade file and a file with the list of
errors.


Your glade file makes use of GNOME widgets, but you have not initialised 
the GNOME libraries.  You need to call gnome.init(progname, version) 
after importing the libs you want (gnome.ui, bonobo.ui, etc).

James.

--
Email: [EMAIL PROTECTED]  | Linux.conf.au   http://linux.conf.au/
WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Australia. 




___
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] multiple selection in treeview

2002-11-01 Thread george young
On 18 Oct 2002 15:57:38 +1300
Rob Brown-Bayliss [EMAIL PROTECTED] wrote:
 Hi.  How do you do multiple selection in treeview widgets?
 
 I have been going over and over the docs looking for something like
 set_multi_select or what ever and it's either missing for the docs or
 their is some other way to handle selecting multiple rows in a tree.

tree_sel = my_treeview.get_selection()
tree_sel.set_mode(gtk.SELECTION_MULTIPLE)

See the docs:
http://www.gnome.org/~james/pygtk-docs/class-gtktreeview.html#method-gtktreeview--get-selection
http://www.gnome.org/~james/pygtk-docs/class-gtktreeselection.html#method-gtktreeselection--set-mode
-- 
 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
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] updating with combo-entry

2002-11-01 Thread Christian Reis
On Fri, Nov 01, 2002 at 03:34:41PM +0100, mekkaoui omar wrote:
 What's wrong with
 
 combo.entry.connect(insert_text, my_handler)
 combo.entry.connect(delete_text, my_handler)
 
 ?
 
 For this moment, I opt for using a button to update 
 information. In the futur, I prefer to update using mouse 
 button like David M. Cook hase suggested.

Note that a button for updating information is bad usability, and the
mouse button is probably a good solution to this problem, though I see
issues with it being overly complex.

The real solution is (gasp, Johan) to upgrade to gtk-1.2, which provides
decent signals for this case.

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/



[pygtk] GtkTextIter

2002-11-01 Thread Diego Anzoátegui
Hello,
When i read the pygtk-docs, says that create_tag take 2 arguments, but the 
python interpreter raise an error saying that create_tag takes exactly one 
argument. Another one: to insert text in TextBuffer i need a TextIter object, 
but i can't create it with the gtk.TextIter class 'cause it's an abstract 
widget. Can someone post an example of a TextBuffer example usage? Thanks a 
lot


___
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] ending application

2002-11-01 Thread Christian Reis
On Fri, Nov 01, 2002 at 11:45:53AM -0400, LDC - Pablo Endres Lozada wrote:
 
   This is a mixed question, has some python and pytk
 
   I have my python app and it's gui (pygtk), the app
   has it's own threads so when I exit the gui with
   gtk.mainquit() it doesn't end all the app.

As a shortcut, why not sys.exit() when you gtk.mainquit() and kill the
app outright? Okay, not as clean, but simple :)

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] ending application

2002-11-01 Thread Rob Brown-Bayliss
On Sat, 2002-11-02 at 04:45, LDC - Pablo Endres Lozada wrote:
   This is a mixed question, has some python and pytk
 
   I have my python app and it's gui (pygtk), the app
   has it's own threads so when I exit the gui with
   gtk.mainquit() it doesn't end all the app.
 
   How can I see all the threads and kill them form the interface?
 
   Any Ideas

From the python docs for threading.Thread:

there are no priorities, no thread groups, and threads cannot be
destroyed, stopped, suspended, resumed, or interrupted


As far as I know you cant kill them all, sys.exit() is probbly your only
choice if the threads wont abort on their own.



-- 

*  Rob Brown-Bayliss
*  =
*  zoism.org
___
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] Crash in pygtk_generic_cell_renderer_get_size()

2002-11-01 Thread Joe Shaw
Hi,

I came across a crash in pygtk_generic_cell_renderer_get_size().  It
doesn't check to see if the arguments passed in are NULL before passing
them to PyArg_ParseTuple(), which dereferences them and crashes.

I've filed bug #97436 about it, and attached this patch to it.

Joe

Index: pygtkcellrenderer.c
===
RCS file: /cvs/gnome/gnome-python/pygtk/gtk/pygtkcellrenderer.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 pygtkcellrenderer.c
--- pygtkcellrenderer.c	20 Jul 2002 05:44:37 -	1.2
+++ pygtkcellrenderer.c	1 Nov 2002 20:16:26 -
@@ -94,6 +94,7 @@ pygtk_generic_cell_renderer_get_size (Gt
   gint*height)
 {
 PyObject *self, *py_ret, *py_widget, *py_cell_area;
+gint my_x, my_y, my_width, my_height;
 
 g_return_if_fail(PYGTK_IS_GENERIC_CELL_RENDERER (cell));
 
@@ -117,13 +118,26 @@ pygtk_generic_cell_renderer_get_size (Gt
 Py_DECREF(py_widget);
 Py_DECREF(py_cell_area);
 
-if (!PyArg_ParseTuple(py_ret, , x_offset, y_offset, width, height)) {
+if (!PyArg_ParseTuple(py_ret, ,
+			  my_x, my_y, my_width, my_height)) {
 	PyErr_Clear();
 	Py_DECREF(py_ret);
 	g_warning(could not parse return value of get_size() method.  
 		  Should be of form (x_offset, y_offset, width, height));
 	return;
 }
+
+if (x_offset)
+	*x_offset = my_x;
+
+if (y_offset)
+	*y_offset = my_y;
+
+if (width)
+	*width = my_width;
+
+if (height)
+	*height = my_height;
 /* success */
 }
 



Re: [pygtk] ending application

2002-11-01 Thread Andrew W. Schmeder
quote who=LDC - Pablo Endres Lozada
   I have my python app and it's gui (pygtk), the app
   has it's own threads so when I exit the gui with
   gtk.mainquit() it doesn't end all the app.

   How can I see all the threads and kill them form the interface?

What I do is;

1) All thread objects get stored in a list, threads = [thread1, thread2, ...]

2) Each thread is running a loop in its run() method.  Each time the thread
executes an iteration of the loop, it checks a variable called threads_exit. 
If threads_exit == 1 then the thread breaks the loop and returns (effectively
ending the thread).

3) To quit the application, first I use gtk.mainquit(), then I set
threads_exit = 1.  Usually some of the threads are idle because there is
nothing to do... and those threads are blocked on a condition so I use
notifyAll() on the condition to wake them up.  Then I use for t in threads:
t.join() which will block until all the threads have exited, and then the app
will quit.

The most common problem with this is that an exception will happen somewhere
and a thread will die w/o releasing some locks.  Then when I try to quit the
application will hang (blocked on the join() of a stuck thread) and I use
killall -9 to force it to quit.  This can usually be avoided by using try:
except: blocks to release locks after an exception is thrown.  Using this I am
actually able to keep the application running smoothly in spite of errors.

Its a complicated solution, but it is necessary for my application.  If you
want to try it, be prepared to spend about a week getting all the threading
problems worked out. :)



---
Andrew W. Schmeder


___
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] error messages

2002-11-01 Thread Jay Graves
 Your glade file makes use of GNOME widgets, but you have not initialised 
 the GNOME libraries.  You need to call gnome.init(progname, version) 
 after importing the libs you want (gnome.ui, bonobo.ui, etc).

Thank you very much for your help but I am still a bit confused.
if I 
import pygtk, gnome
pygtk.require('2.0')
import gtk, gtk.glade

then gnome.init() is not a valid method
-- 

Jay Graves 
[EMAIL PROTECTED]
jay.skabber.com

   O__
  _/`.\
  `=( '




msg04688/pgp0.pgp
Description: PGP signature