Re: [pygtk] Pixmap transparency in a GdkDrawable?

2000-10-04 Thread James Henstridge

On Wed, 4 Oct 2000, Martin Grimme wrote:

 Hello,
 again I've got a weird question:
 
 When I draw pixmaps onto a GdkDrawable using draw_pixmap(),
 transparency will be completely ignored. Is there any way around
 this? I want to draw pixmaps _with_ transparency onto a GdkPixmap.
 
 It seems to be possible for GdkPixmaps to have transparent areas.
 Consider the following piece of code:
 
   from gtk import *
   import _gtk
 
   win = GtkWindow()
   win.show()
   pix = win.get_window()
   root = _gtk.gdk_get_root_win()  # _root_window() doesn't work...
   gc = root.new_gc()
   draw_pixmap(root, gc, pix, 0, 0, 0, 0, 200, 200)
 
 This puts the background of the window into the root window.
 But if there are parts of the window covered or otherwise out of view,
 those parts are not copied to the root window, thus I assume there
 is transparency possible for GdkPixmaps (the covered parts seem
 to be transparent).

Pixmaps do not have an alpha channel, so by default, they won't be drawn
shaped.  When you load a pixmap in pygtk, you may have noticed that you
get both a pixmap and the corresponding mask.  If you are not using the
mask when doing your drawing, then you are doing something wrong :)

To use the mask returned when creating the pixmap, you need to assign it
to the clip_mask attribute of the GC before drawing.  Also, you will need
to set clip_x_origin and clip_y_origin attributes if you aren't going to
draw the pixmap at (0,0).  Now anything you draw with that GC will be
clipped to the mask.

 
 Please help, if you can!
 Thank you.
 
 Martin Grimme - http://www.pycage.de

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] GtkCTreeNode bug in 0.6.6

2000-10-01 Thread James Henstridge

On Sat, 30 Sep 2000, Alexandre Fayolle wrote:

 Hi,
 
 I'm experiencing incoherent behaviour in pygtk 0.6.6 with GtkCTreeNode
 objects. Depending on where they come from, they do not behave in the same
 fashion. Specifically, it is not possible to access the attributes
 described in description.py from the GtkCTreeNode obtained by
 tree.selection (where tree is a GtkCTree):
   File "Narval/narval/gui/XmlEditor.py", line 125, in
 add_attribute_activated
 if self.tree.selection.children:
 AttributeError: children

ctree.selection is a list of GtkCTreeNode objects.  Lists do not have
attributes named children.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Questions about accelerators.

2000-09-28 Thread James Henstridge

On Thu, 28 Sep 2000, Dave Belfer-Shevett wrote:

 Hey folks.  I sent this to glade-users, and perhaps its more appropriate
 for this list.  Any ideas?
 
 ---.   Web-based problem management: www.stonekeep.com
 Dave Belfer-Shevett .
 [EMAIL PROTECTED]  /My idea of an agreeable person is a person who\
 --  agrees with me. (Benjamin Disreali)   |
\__/
 
 -- Forwarded message --
 Date: Thu, 28 Sep 2000 16:09:38 -0400 (EDT)
 From: Dave Belfer-Shevett [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Questions about accelerators.
 
 
 Hi folks.  I'm writing a GTK app using libglade in Python.  So far thinks
 are going okay, but I'm having some difficulty connecting accelerators and
 trapping signals from them.
 
 I've defined an accelerator within a GtkText widget (call it 'ctrl-f1'),
 and bound it to the key.  I save it, and in the Glade file, I have:
 
 [shevett@cheetah]:~/python/spanker/proj1$ ./spanker.py
 
 Gtk-WARNING **: gtk_accel_group_add(): could not find signal "ctrl-f1"in
 the `GtkText' class ancestry
 
 Gtk-WARNING **: gtk_signal_connect_full(): could not find signal
 "enter" in the `GtkText' class ancestry
 
 Okay, fine, that means I need to use a signal that exists.  (I
 think).  But what I -rally- want to do is link 'Ctrl-f1' to the 'clicked'
 signal on a button elsewhere.  
 
 How do I do this - specifically in python/Glade.  :)

This is not pygtk problem.  You can't just invent signal names like
that.  Accelerators have to activate an existing signal on an object.  If
you just want to catch some other key presses on a particular widget, then
connect to its key_press_event signal, and handle the key presses there.

 
 Thanks!

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] gpointer data on callback

2000-09-27 Thread James Henstridge

On Wed, 27 Sep 2000, D-Man wrote:

 
 What if Python switched to gc instead of ref counting?
 
 I have heard of a good gc freely available for C/C++ written by Hans Boehm. 
 From what I've read it works about as good as the malloc/free implementations, but
 without the developer's headaches with memory leaks.  
 
 The intire interpreter, not just the python code, could use the collector to
 make memory management easier.  Then you wouldn't have these problems with the
 callbacks and the ref count.

There is almost no chance of adding another GC to the mix for pygtk.  Both
python and gtk do reference counted garbage collection.  The objects in
question are python objects, so are using reference counting already, and
there is no way to change that.

 
 -D

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] gpointer data on callback

2000-09-27 Thread James Henstridge

On Wed, 27 Sep 2000, David Arnold wrote:

 --"James" == James Henstridge [EMAIL PROTECTED] writes:
   James On Wed, 27 Sep 2000, D-Man wrote:
 
 What if Python switched to gc instead of ref counting?
 
   James There is almost no chance of adding another GC to the mix for
   James pygtk.  Both python and gtk do reference counted garbage
   James collection.  The objects in question are python objects, so
   James are using reference counting already, and there is no way to
   James change that.
 
 note that as of 2.0b1 (available now, 2.0 final scheduled for 10/10),
 the interpreter includes garbage collection (for Python objects).
 
 reference counting is still used, but cycles are (optionally)
 collected by the gc.

And this issue is not related to cyclic references.  It is simply the case
that the functions in question give no means to know when the callback
object should be unref'd.  Hence the leak.  I have thought this problem
through.  It would be much better to fix gnome-libs in this case (it may
have already been fixed in the 2.0 branch).  In the meantime, I don't want
to encourage people to use those functions, as they will see leaks.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] gpointer data on callback

2000-09-26 Thread James Henstridge

On Tue, 26 Sep 2000, Hilaire Fernandes wrote:

 Hi,
 
 I wish that in futur vesion of PyGnome it will be possible to pass
 user data in the ok_cancel, question, request_string methods of the
 GnomeApp object, it's a very elegant way of passing user data to the
 callback and a miss feature in the actual binding.

Those particular functions are very evil, and not designed for
bindings.  They don't provide any way of getting notified when the
callback should be destroyed.  As it is, every call to one of these
functions adds an extra reference to the function.  If we were going to
allow passing in user data, that would also get referenced, and hence
never destroyed.  I am a bit weary of putting more effort into the
bindings for these functions.

 
 Keep the good work.
 
 Hilaire Fernandes

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] GtkCTree Doesn't Work

2000-09-18 Thread James Henstridge

On Mon, 18 Sep 2000, Eric Gillespie, Jr. wrote:

 With Gnome-Python 1.0.53 from Debian unstable, i can't seem to
 attach any data to a row in a CTree. I don't know of any other
 way to find what the user selected. Even if i were to catch the
 selection signal, i would still have the same problem of mapping
 the node to useful data. Am i missing something obvious?
 
 Anyway, i've attached a small program demonstrating the problem.
 The error message i get is below.
 
 Traceback (innermost last):
   File "hey.py", line 11, in ?
 ctree.set_row_data(node, "hey")
   File "/usr/lib/python1.5/site-packages/gtk.py", line 1278, in set_row_data
 _gtk.gtk_clist_set_row_data(self._o, row, data)
 TypeError: illegal argument type for built-in operation

You should be using the node_set_row_data() method, rather than the clist
set_row_data() method.  This method takes a GtkCTreeNode rather than a row
number.

I think this is probably covered in the gtk reference documentation.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] problem appending data to Clist using libglade

2000-09-06 Thread James Henstridge

On Wed, 6 Sep 2000, Hugo Varotto wrote:

 
 Hi to all,
 
 while writing a small program in Python using GTK and libglade, I found
 a strange behaviour with CLists created with libglade. If I try to
 append data to a clist, no matter what string I put in the "append"
 instruction, the clist only shows up the first lettter of the string.
 I'm very puzzled at this, and I'm no sure if I should initialize
 beforehand the width of the clist column or whatever.
 
 I've attached a very small Python program that will load a very small
 .glade XML file and attemt to add ( append ) some data to it. In my
 machine at least it shows only the first letter 9 for all the rows ).
 I'm also attaching the .glade file ( hope I'm not breaking any mailing
 list rule by attaching these text files ). I'll apreciate if somebody
 could take a look at them to see what's wrong.
 
 Now the usual stuff: I'm running RedHat 6.2, python is 1.5 and the
 versions of PyGTK is 0.6.6, pygnome is 1.0.53 and libglade is 0.14
 ( I believe the latest ones distributed by Helixcode GNOME ).
 
 I'm fairly new to the Python and libglade world ( 3 days ago I haven't
 even tried to start python neither using libglade ), so it might be very
 possible that I'm doing something very wrong.
 
 Thanks in advance,

The append method takes a sequence of strings as its argument.  So, pass
in ['blah'] rather than 'blah'.  'blah' looks like a sequence of one
character strings (it is equivalent to ['b', 'l', 'a', 'h']).

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] CTree silly question

2000-09-05 Thread James Henstridge

On Tue, 5 Sep 2000, Alexandre Fayolle wrote:

 How can I get the parent of a node in a CTree ?
 I want to insert a node as a sibling of the node that's been clicked, but
 tree.insert_node cannot take a None parameter for the parent and a
 non-None parameter for the sibling (I get Gtk-CRITICAL **: file
 gtkctree.c: line 3644 (gtk_ctree_insert_node): assertion `GTK_CTREE_ROW
 (sibling)-parent == parent' failed.).
 
 Using Gtk, I would be able to use the GTK_TREE_ROW to get the row from the
 node, and then look at the parent field of the row. Is there somethoing
 similar in pygtk somewhere ? (even if it's an ugly workaround, I'm
 interested...)

parent = node.parent

There are descriptions of most of the types that are defined in the C part
of pygtk in the description.py file included in the tarball.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] GDK bindings?

2000-09-01 Thread James Henstridge

On Fri, 1 Sep 2000, Martijn Faassen wrote:

 Hi there,
 
 Yesterday I was playing with PyGTK again. Since I was doing some
 formatting of fonts on the canvas, eventually I was interested in
 getting information about the font dimensions and such. 
 Unfortunately, much (most?) of GDK does not appear to be exposed to
 Python, which was a problem when I wanted to use gdk_string_extends().
 
 Is there any work on these bindings, or what are my prospects here?

If you have a GdkFont object, use its extents(str) method, which returns
the tuple (lbearing,rbearing,width,ascent,descent).

 
 Regards,
 
 Martijn

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Accelerators

2000-08-29 Thread James Henstridge

On Tue, 29 Aug 2000, Martin Glueck wrote:

 
   Is there any other possibility to react on a special key-combination
   ?
   I know that I could use the `KEY_DOWN' signal and check the code, but
   this seams to be very inefficient (especially if you use it for an
   entry)
  
  In the case of the Entry widget, you can connect to focus_out. That will
  be sent when the Entry looses to focus and you will get it after, Up, Down
  and Tab or when the User clicks somewhere outside the Entry.
 
 But that is not really what I want to achieve.
 
 I want to implement a kind of word completion when somebody press
 ALT-SPACE, for example.
 
 So is there any other way than connecting to `KEY_DOWN' and using the
 mask and key code ?

It would probably be best to do this with a key_press_event signal
handler.  From within the signal handler, check to see if your key has
been pressed, and if so a widget.emit_stop_by_name("key_press_event") to
prevent the normal handling from occuring, do your completion and return
TRUE.  Otherwise just return FALSE.

This should be fast enough (how fast do you think people actually type?)

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] How to get widget size?

2000-08-28 Thread James Henstridge

On Mon, 28 Aug 2000, Martin Grimme wrote:

 Hello,
 
 I want to get the current size of a container widget (like GtkHBox or GtkLayout).
 Is there any possibility to get these values at runtime?
 
 I can get the size of a window by using the configure-event, but this doesn't seem
 to work for other widgets...

After the widget has been allocated some space, you should be able to use
the get_allocation() method.

 
 Please help me!
 
 Bye,
 Martin Grimme

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



[pygtk] Re: GdkColormap.alloc()

2000-08-22 Thread James Henstridge

On Tue, 22 Aug 2000, Frank Warmerdam wrote:

 James,
 
 I have encountered a problem using GdkColormap.alloc() on IRIX and Sun systems, 
 and I believe it is because of your unwarranted assumption that the red, green,
 and blue components of a GdkColor are ints, when they are in fact shorts.
 
 struct _GdkColor
 {
   gulong  pixel;
   gushort red;
   gushort green;
   gushort blue;
 };
 
 While I actually applied my patch against pygtk-0.6.4, the code for the
 function seems identical in 0.6.6 which is the most recent release (right?).
 Anyways, here is one patch.  I would really appreciate this making it into
 the next pygtk release.  In the meantime I will need to hand build pygtk for
 distribution with OpenEV (openev.sourceforge.net). 
 
 static PyObject *
 PyGdkColor_Alloc(PyGdkColormap_Object *self, PyObject *args) {
   GdkColor color = {0, 0, 0, 0};
   int   red, green, blue;
   gchar *color_name;
   if (!PyArg_ParseTuple(args, "iii:GdkColormap.alloc",
 (red), (green), (blue))) {
 PyErr_Clear();
 if (!PyArg_ParseTuple(args, "s:GdkColormap.alloc", color_name))
   return NULL;
 if (!gdk_color_parse(color_name, color)) {
   PyErr_SetString(PyExc_TypeError, "unable to parse color specification");
   return NULL;
 }
   }
   else
   {
 color.red = red;
 color.green = green;
 color.blue = blue;
   }
 
   if (!gdk_color_alloc(self-obj, color)) {
 PyErr_SetString(PyExc_RuntimeError, "couldn't allocate color");
 return NULL;
   }
   return PyGdkColor_New(color);
 }
 
 Finally, I really appreciate the excellent work you have done with pygtk.

Yes, that is a known problem and will be fixed in the next release.  You
can also fix the problem by changing the formatting characters from iii to
hhh.


 
 Best regards,

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] I want use po ?

2000-08-21 Thread James Henstridge

On Tue, 22 Aug 2000, Choi He Chul wrote:

 
 Hello.
 
 I want use po  ( gmo? )
 
 for i18n ...
 
 I can Use It?

There is a gettext module included in gnome-python which you can use to do
this.  There will be a version of this module included in python-2.0
(which is being discussed at the moment on python-dev), along with a
pyxgettext program that can be used to extract strings from python
programs.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Mozilla embedding widget questions

2000-08-20 Thread James Henstridge

On Sun, 20 Aug 2000, Jens P. Elsner wrote:

 Hi,
 
 I tried to write bindings for the mozilla embedding widget,
 but the problem is that I'm not good at C and I dont understand the
 reference counting concept. Can someone explain that in a few
 sentences please ?
 
 Other than that, the stuff I hacked together (probably full of non-sense, take
 a look at it) it included. All the functions work, execept for "render_data".
 That gives me a segfault - and I could not figure out why. 
 Perhaps the reference counting stuff?
 
 Anyway, the pymoz_demo.py program works here, with M17 and MOZILLA_FIVE_HOME
 set, but I have to comment out that "render_data" call.

Mark Crichton ([EMAIL PROTECTED]) has already written a set of gtkmozembed
bindings.  I can't remember the URL though.

 
 I'd appreciate comments and help!
 
 Thank you!
 
 Jens
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] pygtk status ?

2000-08-12 Thread James Henstridge

On Fri, 11 Aug 2000 [EMAIL PROTECTED] wrote:

 Hi all ! 
 
 I would like to know how is organized the development of pygtk bindings, and 
 what you are planning to do . I remenmber a thread about this in this mailing 
 list, but I don't know if it is still the case. So my questions are : 
 
 1/ Are you james the lone programmer of that bindings, with people submitting 
 patches, or is it a collective work for now ?
 are you planning to release 0.7.0 for GTK+ 2.0 or 1.2.8 - or 1.2.x ?

I do most of the work on pygtk, but others do submit bug fixes.  The work
on the gtk-1.2 based rewrite has been stopped.  Instead, I rolled most of
the changes from the rewrite to the gtk+-2.0 based pygtk (which has been
held up a bit lately, as I am waiting for Tim Janik to finish off the
GObject signals).

The reason for stopping work on the 1.2 based rewrite was that the rewrite
would break compatibility, and be followed by gtk+-2.0 shortly after that,
which would introduce its own compatibility problems.  By rolling the
rewrite into the gtk+-2.0 update, I only break compatibility once.

 
 2/ What do you think would be of help to make pygtk more accepted and generally 
 better ? In what domain could we (readers of this mailing list) help ?
 web site / doc / review / patches / ... 

Some of these things would be helpful.  

 
 3/ Do you plan to invest much time in pygtk  pygnome development or is it one 
 of you not-so-great priorities ? (not assuming you're doing really a great job 
 now !)

This year I have been fairly busy at university (it is my honours year),
which takes up some of my time, but I still work on pygtk.

 
 These questions have nothing to mean. I just wanted to know more about what 
 is going there and maybe to let you explain what you need in order for people 
 to help you further.
 
 Be sure that I personnaly find your work and the time you already spent on it 
 extremely valuable.
 
 cordially,
 
 xavier. (a non native english as you may have noticed)

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] fixed size font ?

2000-08-09 Thread James Henstridge

On Wed, 9 Aug 2000 [EMAIL PROTECTED] wrote:

 Greetings, 
 
 Can anybody suggest a fixed size font (the "syntax" seems to be awkward). 
 
 Why : 
 
 I have this text viewer in my app which is supposed 
 to be used to examine some generated ascii files (containing columns of
 numbers). 

Use a program like gfontsel of xfontsel to help select a font if you have
trouble with the XLFD format.  You can also look in the docs for X for
info on XLFDs.  Note that in gtk+-2.0, the font naming will change due to
the use of pango.  The newer naming is a lot simpler.

As for a nice fixed width font, either courier or lucida typewriter would
be good.  There are also a number of other terminal fonts what you may
prefer that don't fir the XLFD format.

 
 Thanks 
 
 _
   
   LaBoufarikoise

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] get_selection

2000-08-08 Thread James Henstridge

On Tue, 8 Aug 2000, Javi Roman wrote:

 Good, that seems that it works, but I talk about to a GtkList and not a
 GtkCList.

Note that in almost all cases it is better to use a CList than a
GtkList.  If you are going to have a substantial number of rows, then
CList will handle it a lot better (if the combined height of all the items
in a GtkList is  2^15, then GtkList will not work correctly).

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] problem with ong image

2000-08-08 Thread James Henstridge

On Tue, 8 Aug 2000, Torsten Landschoff wrote:

 On Wed, Aug 02, 2000 at 09:45:37AM +0800, James Henstridge wrote:
  
  This problem can be fixed by either modifying the python executable or the
  imlib build process.  You either need to modify imlib so that the image
  loading modules link against libgdk_imlib.so, or modify python so that it
  loads shared libraries with the RTLD_GLOBAL flag (Red Hat makes the second
  change).
 
 Ah, thanks. I did not dig deeper but according to your note this is the same 
 problem as with using GTK+ themes with python-gtk. The latter was fixed
 in the .debs but I am not sure why this problem reappears with the 
 image libraries.
 
 Greetings
 
 Torsten
 
 

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] problem with ong image

2000-08-08 Thread James Henstridge

On Tue, 8 Aug 2000, Torsten Landschoff wrote:

 On Wed, Aug 02, 2000 at 09:45:37AM +0800, James Henstridge wrote:
  
  This problem can be fixed by either modifying the python executable or the
  imlib build process.  You either need to modify imlib so that the image
  loading modules link against libgdk_imlib.so, or modify python so that it
  loads shared libraries with the RTLD_GLOBAL flag (Red Hat makes the second
  change).
 
 Ah, thanks. I did not dig deeper but according to your note this is the same 
 problem as with using GTK+ themes with python-gtk. The latter was fixed
 in the .debs but I am not sure why this problem reappears with the 
 image libraries.

Sorry about that.  Here is what I meant to type:

You should be able to fix the problem by using libtool-1.3b to compile
imlib, and modify its makefiles to link libgdk_imlib.la against the image
loading modules.  You need libtool-1.3b, as it allows linking one libtool
library against another.

 
 Greetings
 
 Torsten
 
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] How to draw images inside GnomeCanvas polygons?

2000-08-05 Thread James Henstridge

On Fri, 4 Aug 2000, Ben Escoto wrote:

 
  I would like to fill a GnomeCanvasItem on the GnomeCanvas with an
 xpm.  How is this done?  The Gnome User Interface API documentation
 says that, for instance, GnomeCanvasEllipse takes a GdkWindow object
 as the fill_stipple argument, and description.py in the pygtk
 distribution says that GdkWindow = GdkPixmap.  Does does that mean I
 can create a pixmap and pass it as fill_stipple=pixmap to
 GnomeCanvasEllipse?

A stipple is a bitmap, so unless the image is only two colours, I don't
think this would work.  I am not sure if there is a way to do what you
want with the standard canvas items.

 
  Here is a bit of code that doesn't work (no errors, just doesn't
 look like anything):
[snip]
 
 Why is pix a tuple?  If I say pix[0] instead of pix[1] I get an error

the function returns a pixmap and the mask.  The mask is used to draw
shaped pixmaps (the pixmap is only painted where the mask is set to 1).

 I don't understand:
 
 Gdk-ERROR **: BadMatch (invalid parameter attributes)
   serial 209 error_code 8 request_code 56 minor_code 0

The stipple can only be a bitmap.  The pixmap would have been created in
the default visual, which is probably not two colours.  The mask is a
bitmap however.

 
 If I substitute fill_color="black" in for fill_stipple I get the
 intended circle.
 
 I would appreciate anyone pointing me in the right direction.  It
 has taken me hours to figure out this much, and I don't know of any
 examples of what I am trying to do (at least none are included in the
 pygtk or pygnome distributions.
 
 
 --
 Ben Escoto

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] How to draw images inside GnomeCanvas polygons?

2000-08-05 Thread James Henstridge

On Sat, 5 Aug 2000, Ben Escoto wrote:

  "JH" == James Henstridge [EMAIL PROTECTED]
  wrote the following on Sat, 5 Aug 2000 17:04:23 +0800 (WST)
 
 I would like to fill a GnomeCanvasItem on the GnomeCanvas with
an xpm.  How is this done?
 
   JH A stipple is a bitmap, so unless the image is only two colours,
   JH I don't think this would work.  I am not sure if there is a way
   JH to do what you want with the standard canvas items.
 
  Thanks for your response, I appreciate it.  Then is the best way
 to do it to forget about the GnomeCanvas and just use gdk commands?
 For instance, could I make a bitmap of a polygon, and then use that to
 screen off an image, and the result would have the same effect as
 sticking a pixmap in a polygon?  I just don't want to waste time
 trying to do something in a way that can't be done or in an obviously
 stupid way.

That is basically correct.  You want to create a 1-bit depth pixmap
(bitmap) as a mask, and draw the polygon on that.  Then set it as a clip
mask for the GC and then draw the pixmap with it.  This will clip the
pixmap.

 
  For instance, I orginally wrote my program (a spherical pager,
 see http://www.stanford.edu/~bescoto/tmp/sphere-pager.jpg for current
 screenshot) using Tkinter, but then switched it to Gtk because I was
 under the impression that GnomeCanvas had (working) anti-aliased
 graphics and polygons I could stick pictures in...
 
 
 --
 Ben Escoto

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Window Stacking Problem

2000-08-01 Thread James Henstridge

On Tue, 1 Aug 2000, Mitch Chapman wrote:

 Well-put, but my customer wants mode*less* dialogs.
 They want to be able to continue working with the main
 application after the dialog appears.
 
 Imagine a window full of thumbnail vector images.  A single
 left-click on a thumbnail brings up a resizable window
 showing a larger view of the window.  The number of
 thumbnails, and consequently the number of enlarged views,
 can be quite large.  That's what the current specs call for.
 
 Here's the problem scenario:  The user has clicked on a
 thumbnail and gotten a larger view.  Now the user wants to
 go back to the main window and click on another thumbnail
 to get another larger image to compare to the first.  As soon
 as they click on the new thumbnail the main window comes
 forward, obscuring the original thumbnail.

Alright, tell them to turn on focus follows mouse (or sloppy
focus) without autoraising of windows.  That way they can click in the
other window without raising it.

Without some control over what window manager is used, you are going to
have trouble getting what you want.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] problem with ong image

2000-08-01 Thread James Henstridge

On Wed, 2 Aug 2000, Torsten Landschoff wrote:

 On Tue, Aug 01, 2000 at 10:47:35PM +0200, YuRiX wrote:
  hy guys, sorry for my english ... it's orrible  i know 
 
 No problem, but another thing bothers me: As you are using Debian you
 should report this bug to the Debian BTS using reportbug for example
 or by mail to [EMAIL PROTECTED] 
 
 There is no reason to bother the pygtk developers as long as you don't
 know if this problem is Debian specific. 
 
  ok here you are the problems : i can't load png images from my small 
  python program using gdk_imlib, and also the view.py example can't do
  that.
  
  what did i wrong ?
  i have installed  helix gnome on my sweet debian and i get this with 
  imlib-config
 
 Yep, I have the same problem with helix gnome packages as well. When I 
 have the standard gnome packages installed the example works...
 
 Seems like the person at helix code should work this out or we should
 merge helix and fix it in Debian...

This problem can be fixed by either modifying the python executable or the
imlib build process.  You either need to modify imlib so that the image
loading modules link against libgdk_imlib.so, or modify python so that it
loads shared libraries with the RTLD_GLOBAL flag (Red Hat makes the second
change).

Libtool-1.3b (the 1.4 beta) makes the first option quite easy, but doesn't
support all the platforms in the latest 1.3.x release.

 
 HTH
 
 Torsten (python-gdk-imlib maintainer)
 
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Window Stacking Problem

2000-07-26 Thread James Henstridge

On Wed, 26 Jul 2000, Mitch Chapman wrote:

 I'm not sure where to ask this, so will bug you all. :)
 
 I'm working on a pygtk application which has a main window and 
 several modeless dialogs.  The customer has requested that the
 modeless dialogs always stay in front of the main window, but that
 they be separately iconifiable.  (The dialogs just present zoomed
 depictions of the same basic type of data.)
 
 The first requirement is easy: just use set_transient_for().
 The second requirement is also easy:  just don't use 
 set_transient_for().  Does anybody have suggestions for 
 accomplishing both of these tasks at once?

Note that the set_transient_for() hint is a window manager hint, and is
not interpretted the same by all window managers (some even allow the user
to control how it is handled, some ignore it), so it may just be your
window manager that prevents the separate iconification.  Unless you can
control what window manager is in use, this requirement may be very
difficult to implement.

I am not sure what the best way to handle this is.

 --
 Mitch Chapman
 [EMAIL PROTECTED]

James.


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



Re: [pygtk] PyGTK and urllib

2000-07-18 Thread James Henstridge

On Tue, 18 Jul 2000, Martijn Faassen wrote:

 James Henstridge wrote:
  On Mon, 17 Jul 2000, Martijn Faassen wrote:
 [snip]
  Unless I am mistaken, urllib is a syncronous interface, so it will not
  return until it has completed the transfer.  This means your application
  will not process any events (mouse clicks, expose events, etc) until the
  transfer completes, which is what is causing your problems.
 
 It's not just my application, it's *X* that isn't responsive.
 Window manager, Gnome desktop, everything. That's symptom number 1.
 Symptom number 2 is that urlopen() takes a lot *longer* than when run
 outside the Gnome app. It would've made sense if my application wasn't
 responding; in fact that happens with the first call to urlopen() that
 I do. But the other call really blocks most of X.

What do you call urlopen in response to?  If you call it from a signal
handler when a pointer grab is in effect, that would prevent you sending
input to other windows.  I am not sure about the slowness issue though.

 
 Regards,
 
 Martijn
 

James

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] PyGTK and urllib

2000-07-17 Thread James Henstridge

On Mon, 17 Jul 2000, Martijn Faassen wrote:

 Hi there,
 
 I've run into an odd problem with urllib.urlopen() apparently taking a *lot*
 more time when used through PyGTK (using LibGlade and Gnome) than when
 I call the same routine through python only. In fact, if I call 
 urlopen() through the Gnome interface, *everything* in X seems to become
 unresponsive; the only thing I can move around is the mouse cursor, but
 since I can't click anything, it's not very useful.
 
 Oddly enough in the same app I call urlopen() somewhere else that doesn't
 cause this kind of blocking. But I did whittle down my code and it *does*
 seem to be urlopen() in the second case.
 
 Anyone have any suggestions?

Unless I am mistaken, urllib is a syncronous interface, so it will not
return until it has completed the transfer.  This means your application
will not process any events (mouse clicks, expose events, etc) until the
transfer completes, which is what is causing your problems.

You should either use an asyncronous transfer (using the
input_add() function to set up a handler for when information comes in on
the socket), or look at using threads.

 
 Regards,
 
 Martijn
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] New snapshot

2000-06-29 Thread James Henstridge

On Thu, 29 Jun 2000, Deirdre Saoirse wrote:

 On Tue, 20 Jun 2000, Aaron Optimizer Digulla wrote:
 
  I, for example, cannot use gnome but I use pygtk. Therefore,
  I depend on an independend pygtk package (a .tar.gz to be precise).
  The reason for this is: I'm developing in a tight/secure environment
  and I must restrict myself to the smallest set of tools possible.
 
 Many of us are not enamored with the way gnome has been headed, so I also
 prefer a gnome-less gtk option.
 

There will always be a gtk only pygtk.  What I was wondering about was
whether it would be a good idea to stop including pygtk inside
gnome-python as well.

James.


-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] pygtk won't install

2000-06-28 Thread James Henstridge

On Tue, 27 Jun 2000, Jon August wrote:

 
 I'm trying to install ECLiPt Roaster and one of the dependencies is pygtk
 - when I try to install it, I get this on the configure: 
 
  checking for headers required to compile python extensions... not found
  configure: error: could not find Python headers
 
 I get the same thing from doing the configure for gnome-python.
 
 I tried reinstalling python 1.52 from scratch and it didn't help.  I saw
 something about a python-dev package but I can't seem to find it.  What am
 I missing??

If you are using a Red Hat or Red Hat derived Linux distro, you should be
able to get things to build by installing the python-devel package.  There
may be a copy of pygtk included with the distro already.

 
   -Jon
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] gtk-1.3 bindings

2000-06-26 Thread James Henstridge

On Mon, 26 Jun 2000, Fred L. Drake, Jr. wrote:

   For quite a while, I have been passing function pointers around as
   CObjects in the modules (eg. gtk._gtk._PyGtk_API in the 0.7.0 release),
   which means that the different wrapper modules don't need to see each
   other's symbols.
 
   Excellent!  The example of using a CObject as an API container/
 accessor made this look very tedious for the implementor; what can I
 do to make this easier to use?

It is not that difficult.  I swiped the current setup from the numpy guys
:)

 
   As for symbols from libraries, I think from python 1.5.2, it doesn't use
   the RTLD_GLOBAL flag when loading extensions, so the extensions don't
   pollute the global symbol table.
 
   Yes, I understand why, I just recall having lots of problems with
 the Imlib stuff because of that.  That was a year ago, so has probably
 been fixed at this point, but I must admit that I've not built any of
 this stuff for a while now.

I heard from msw that Red Hat reverted that change in their packages.  The
problem with imlib (which also occurs in gdk-pixbuf) is that libtool-1.3.x
doesn't allow linking one libtool library as a dependency for
another.  The beta version, libtool-1.3b, allows this but doesn't support
as many platforms as 1.3.5.

 
   What would be nice would be if ExtensionClass integrated better with
   python (so that all the special cases for normal classes work for
   ExtensionClasses).
 
   I'd be very interested in your comments on what it would take to
 make things easier if something like ExtensionClass were available as
 part of the core, both from the requirements side and ease-of-use
 perspective.

ExtensionClass goes most of the way towards having an easy way to create
new class like types from C.  I had to patch is a bit to get making
subclasses in C, which made it good for most of the rewrite.

The real problems lie on the python side.  Things like isinstance and
issubclass don't work on ExtensionClasses.  There are similar problems in
other parts of the interpeter where there are special case handling with
PyInstance_Check (eg in PyObject_Compare).

For these ones, it would be nice if either ExtensionClass was integrated
and perform the same sort of special cases when
PyExtensionInstance_Check() is true as for normal instances, or if the
PyInstance_Check() calls were replaced with ones that would return true
for both normal instances and ExtensionClass instances (such as checking
for an __class__ attribute).

I don't know if you want to integrate ExtensionClass into the python core,
so maybe the second option would be better.

 
   -Fred
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



[pygtk] gtk-1.3 bindings

2000-06-25 Thread James Henstridge

I just got the HEAD branch of gtk+ compiled on my system, so was thinking
of starting off binding it.  One of the new features is the GObject
system, which is what the GtkObject stuff is based on in gtk+-1.3.

It provides a non GUI base for objects.  I have been wondering about
whether to put the base gobject support into a separate module or not, and
whether I should keep it separate from the gtk package (when you import
gtk, it initialises the GUI).  Does this sound like a good idea?

I don't know how many non gui libraries will be using gobject, and how
many of those will be useful to python programmers.  If we want to wrap
those libraries and not require gtk be loaded, it will have to be compiled
as a separate module.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] New snapshot

2000-06-24 Thread James Henstridge

On Fri, 23 Jun 2000, Hassan Aurag wrote:

 
  Ok even though I have those headers at the place it expects them, I get 
 this error when running configure.
 
   checking local Python configuration... looks good
   checking for headers required to compile python extensions... not found
   configure: error: could not find Python headers
 
  I think it has something to with the test run at line 1775 of configure 
 script. I do not understand all those ac_* stuff, so I am sorry I can't 
 just help.
 

Does the config.log file give any idea of what the problem may be?  You
may have to remove config.cache and rerun configure to get full log
messages.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



[pygtk] New snapshot

2000-06-23 Thread James Henstridge

I have put a new snapshot of pygtk available at:
  ftp://ftp.daa.com.au/pub/james/python/pygtk-0.7.0-unstable-dont-use.tar.gz

This version adds support for GtkGLArea and libglade.  These were pretty
easy add using the new code generator.  In future, it should be very easy
to add support for new libraries in pygtk and gnome-python.

I also changed things a little bit so arguments that are supposed to
accept only GtkObjects that are subclasses of a particular type accept
only python objects of that type.  This means that you can't add non
GtkWidgets to a container for instance.  This is important for when I
start doing gtk-1.4 support, as almost all types in gtk and gdk are
subclasses of GObject.

I am at a stage where the extension based pygtk can do most things the old
system could.  I haven't done any speed tests on it, but it doesn't seem
slower (it is probably a bit faster).  At this point, it is only worth
continuing the gtk-1.2 based work if we are going to release it.  The
problem with releasing this version is that it causes some breakage, and
when gtk-1.4 comes out there will be some more breakage.  It may be better
to have only one lot of breakage.

I am interested if this newest snapshot has any problems that cause
portability problems to windows (pygtk-0.6.x has some problems).  I think
I fixed them so that only makefiles need changing, but I may be wrong.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] pygtk 0.7.0 on AIX

2000-06-20 Thread James Henstridge

On Tue, 20 Jun 2000, Aaron Optimizer Digulla wrote:

 
 Ok, a bit late but nonetheless: pygtk 0.6.6 and 0.7.0 don't work on AIX
 anymore. There are several reasons for this:
 
 1. The names of the files are wrong. pygtk creates libmodule.so.0 which
 python cannot find. The name must either be module.so or modulemodule.so.
 
 2. AIX cannot link several shared libraries at the same time. Example:
 the glade and the gtk module use libgtk.so. On AIX, this means that
 *two independent* libgtk.so are loaded when a python script imports both
 modules - core dump. There are two solutions: Always link -static on AIX
 or make sure that only _gtkmodules.so is linked against libgtk.so.
 
 3. When I run PYTHONPATH=. python examples/ide/browser.py, then
 it core dumps in "import ExtensionClass". In the debugger xldb, I get
 "Unexpected error: getTextBlock failed (address 0x in pid ...).
 errno=5: There is an input or output"
 
 If anyone could help me to debug this, I could probably provide a patch.
 My setup: AIX 4.3.2, Compiler ibmcxx 3.6.4.0
 

With the newer releases, I have been using libtool to link the
extensions.  If it is behaving wrongly on AIX, it should be reported as a
libtool bug.  If you know about AIX dynamic linking (I don't), you may be
able to get them to fix the problem.  I think I am currently using the
latest libtool in my packages.

James.


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



Re: [pygtk] key_release trouble

2000-06-20 Thread James Henstridge

On Tue, 20 Jun 2000, Bellamy Bruno wrote:

 Hi there...
 
 I'm trying to catch the key_release event in a GtkText, so I had to
 use a mygtktext.add_events(GDK.KEY_RELEASE_MASK).
 But it seems to work only after I start by clicking in
 the GtkText with the mouse. Otherwise, no key_release event is detected.

The widget will only receive key press events if it has focus.  That could
be what the problem you are seeing.  Does the problem go away if you call
text_widget.grab_focus() ?

 
 --
 E-Mail: Bellamy Bruno [EMAIL PROTECTED]
 Web site: http://neverland.net/bellamy
 Date: 20-Jun-2000 Time: 11:37:26
 
 This message was sent by XFMail
 --
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Init trouble

2000-06-11 Thread James Henstridge

On Sun, 11 Jun 2000, Deirdre Saoirse wrote:

 On Mon, 12 Jun 2000, James Henstridge wrote:
 
  If you don't have esound installed on your system when compiling
  gnome, it won't use it.  If it was installed and you don't want gnome
  to use it, start the control center and go to the sound properties
  capplet and uncheck the "enable sound server startup" check box.  
  That should fix the problem.
 
 This presumes I'm using a gnome-based system, which I'm not. I've heard
 three people complaining that Glade can't open /dev/dsp. This is insane.

Well, it would be gnome that is using esound, so I thought that was a
fairly valid asumption.

 
 I don't care for that kind of bloat in my window manager or environment.

The control center is not that large.

 
 Heck, I can't even get the gnome-python stuff to run with instructions
 that worked fine for a year. Obviously, there's now even more
 dependencies than there used to be.
 

You can also make this change by hand by editing ~/.gnome/sound/system
(create it if it doesn't exist), and change the start_esd key to false in
the settings section.  So it might look something like:
  [settings]
  start_esd=false

Now none of the gnome apps should try to start esd.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



Re: [pygtk] Init trouble

2000-06-07 Thread James Henstridge

On Wed, 7 Jun 2000, Niklas Saers Mailinglistaccount wrote:

 Hi. When I do a 
 
 import gnome.ui
 
 (or applet or capplet) or even just 
 python /usr/local/lib/python1.5/site-packages/gnome/ui 
 then I get first Permission denied to /dev/dsp0 (which is ok since I don't
 have a soundcard which is supported on my FreeBSD 4.0 box) and then I get
 an 'Alarm clock' and it ends. The modules seem to end in the
 initialization of the python-files. Can anyone help me out on what this
 error is and how I can make it go away so that I can work with my glade
 projects? I'm using python 1.5 and python-glade 1.53

Well, the /dev/dsp message is due to the gnome-libs initialising esd.  I
don't know about the Alarm clock message.  Try passing the --disable-sound
argument to your program to disable esd usage and see if that makes a
difference.

 
 Sincerely yours
Niklas Saers
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



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



[pygtk] mailing list updates

2000-06-04 Thread James Henstridge

As you may have noticed, there was a bit of downtime this afternoon when I
was upgrading (both hardware and software -- it is not a Pentium 200 :)
the server this list runs on.  As part of the upgrade, I changed over to
mailman for management of the mailing list.

The list info page is available at:
  http://www.daa.com.au/mailman/listinfo/pygtk

I have opened the list to non member posting again to see if mailman's
antispam features can block some of the spam that gets sent to the list
(usually about half a dozen a week).  If it doesn't, I will switch back to
member posting again.  If this happens and you need to post from more than
one address, you should subscribe under the alternate address and turn off
delivery to the second address.

James.


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



Re: [pygtk] Ctree bug

2000-05-31 Thread James Henstridge

On Wed, 31 May 2000, Phillip Ezolt wrote:

 Hi all,
   When using Ctree  trying to read text from the 0th row, pygtk
 generates an execption.
 
   However, if I access row 1 and above things work fine. 
 
   I have data in row zero, so what's wrong? 
   
 Here's the stack trace.  I've included the test program. (select a row
 to see it crash.)
 
 [ezolt@pulitzer test]$ python hello.py 
 Traceback (innermost last):
   File "/usr/lib/python1.5/site-packages/gtk.py", line 125, in __call__
 ret = apply(self.func, a)
   File "hello.py", line 12, in on_epoch_tree_tree_select_row
 print tree.node_get_text(node, 0)
   File "/usr/lib/python1.5/site-packages/gtk.py", line 1412, in node_get_text
 return _gtk.gtk_ctree_node_get_text(self._o, node, col)
 ValueError: can't get text value

You shouldn't access the tree column of the CTree with gettext.  Instead,
use the get_node_info(node) method to get info about the tree column.

 
 Thanks much,
 --Phil
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Maximize a window and its children (after a resize)

2000-05-30 Thread James Henstridge

On Tue, 30 May 2000 [EMAIL PROTECTED] wrote:

 Greetings all, 
 
   I have a window W and a children C which after a
 C.set_transient_for(W0 stays always on top of the parent. The problem is
 when I minize the parent (W), both windows are minized (THIS IS VERY
 NICE).
 
 My problem is when I maximize the parent, the child is not autmatically
 maximized. The question is : Is there a flag or "something else" that
 would ensure this behavior.
 

The set_transient_for() method sets a flag that the window manager uses to
make the windows act like that (if the window manger ignores the transient
hint, then the behaviour you described won't occur).  You may be able to
configure your window manager this way though.

 
 Thanks
   
   LaBoufarikoise
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] How to stop mainloop from catching exceptions

2000-05-25 Thread James Henstridge

On Thu, 25 May 2000, Harry Henry Gebel wrote:

 How do I stop mainloop from catching exceptions?
 

Set the PYGTK_FATAL_EXCEPTIONS environment variable before running your
application.  This way, when an exception occurs, the main loop will be
exited (recursively if necessary).

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Word wrap in GtkText

2000-05-25 Thread James Henstridge

On Thu, 25 May 2000, Harry Henry Gebel wrote:

 How do I make a GtkText widget start a new line when the end of the current
 line is reached? I tried turning word wrap on, line wrap on, and word wrap
 and lone wrap both on, but all of these settings keep the text as one line;
 although some of them have the line drawn over two lines of the widget.
 
The current GtkText widget is not very flexible, as you have found.  Havoc
and Owen have been working on a new text widget for gtk+-1.4 (based on the
Tk text widget, but with pango support and multi view).  Of course, this
doesn't help too much right now.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] force window to resize to show all enclosed widgets?

2000-05-25 Thread James Henstridge

On Fri, 26 May 2000, Aaron Optimizer Digulla wrote:

 On Thu, May 25, 2000 at 09:59:47AM -0600, Joe Van Andel wrote:
 
  I tried window.queue_resize(), but it made no difference.  I also tried
  the following, where self.__table is packed inside self.__vbox, and it
  didn't help, either. 
 
 ?? That's very strange :-/ Are you sure the new added widgets are
 visible ? Try to reduce the code to the smallest possible demo
 (ie. a table with a button and that button adds a row to the table).
 Also, did you call table.resize() with the new number of rows and
 columns ?
 
In situations like this, I would also recommend trying another window
manager.  Sometimes buggy window managers can cause problems like this.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] simple color access

2000-05-19 Thread James Henstridge

On Fri, 19 May 2000 [EMAIL PROTECTED] wrote:

 [Python 1.6a2, pygtk-0.7.0, gtk+1.2.7, Suse Linux 6.1(2.2.11), pentium]
 
 How does one simply get a color object to set the background of a widget?
 I.e.:
 
   from _gtk import *
   from GTK import *

why are you importing these modules directly?  Just use "import gtk" or
"from gtk import *".

   w = GtkWindow(WINDOW_TOPLEVEL)
   clist = GtkCList(1, ('name'))
   clist.append(['George Young'])
   w.add(clist)
   w.showall()
   cm = w.get_colormap()
   blue_color = cm.alloc((10, 10, 200)) #segmentation fault

the extra brackets are incorrect here.

   blue_color = cm.alloc('blue') #segmentation fault

I find it hard to believe that this caused a seg fault.  Do you just mean
an exception?  I was getting an exception here because of a weird
interaction with ExtensionClass.  I have fixed it in CVS now.  The fix is
to edit gtk-types.c and insert the following line below the include
statements:

#undef Py_FindMethod

That should fix the problem (after recompiling).

 
 !! how do I get a GtkColor that is, e.g., 'blue'?  I would rather use names
 than rgb values, but anything would be helpful.

When passing a string argument, you can use any colour name in
/usr/lib/X11/rgb.txt, or hex forms like '#rrggbb' or 'rgb:rr/gg/bb'.

 
   clist.set_background(blue_color)
 
 
 Thanks,
   George
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] 0.7.0 NameError: gtk_init

2000-05-16 Thread James Henstridge

On Tue, 16 May 2000, George Young wrote:

 [Solaris 2.5.1, Python-1.6a2, pygtk-0.7.0]
 make and install seemed to go fine, but examples/simple/hello1.py says:
 
   Traceback (most recent call last):
 File "./hello1.py", line 17, in ?
   gtk_init()
   NameError: gtk_init

This example won't work with the pygtk-0.7.0, as the procedural interface
has been removed.

 
 and hello2.py says:
 
   Traceback (most recent call last):
 File "./simple2.py", line 6, in ?
   from gtk import *
   ImportError: No module named gtk
 
 I know this is alpha software, but there must be something stupid I'm doing...
 Any suggestions?
 
 
 Running with PYTHONVERBOSE to see what it's loading gets:

This is using the 0.6.x version of pygtk that seems to be
installed.  Either install the new pygtk, or set your PYTHONPATH so that
the not yet installed version is used.

You may also have to add the statement "import ltihooks" to the start of
the example so that python can find the actual locations of libraries from
the .la files.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Event handler

2000-05-15 Thread James Henstridge

On Mon, 15 May 2000, Luca Minuti wrote:

 I havn't found a "double click" signal to use with the connect method.
 If true, how can I handle a double click over an item of a GtkCList?
 
 I have another problem, I need a subclass of GtkCList that fire a
 custom signal under certain condition, but I don't know how to create
 new signal.

You want button_press_event, and check to see if the event's type is
GDK._2BUTTON_PRESS.  Here is the code:
  def button_press_handler(widget, event):
if event.type == GDK._2BUTTON_PRESS:
handle_double_click()
return TRUE

 
 Thanks,
   Luca.
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Which event correspond to window resize !?

2000-05-11 Thread James Henstridge

On Wed, 10 May 2000 [EMAIL PROTECTED] wrote:

 
 Hi,
 
   Can anybody tell me which event occurs when a window is being
 resized ? (I tried "rsize_event" but with no success")

Connect to the size_allocate signal on the window.  You may have to use
connect_after so that your handler is called after the GtkWindow has run
its resize handling code.

 
 
 Thnaks all
 
 _
   
   LaBoufarikoise

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Which event correspond to window resize !?

2000-05-11 Thread James Henstridge

On Thu, 11 May 2000, Fred L. Drake, Jr. wrote:

 
 James Henstridge writes:
   Connect to the size_allocate signal on the window.  You may have to use
   connect_after so that your handler is called after the GtkWindow has run
 
   Is this better than using the configure_event (that's what I used in
 piddleGTK)?

Depends.  You can connect to the size_allocate signal of any widget, even
those without their own window, so I guess it is more general.  I don't
know what times size_allocate is called when configure_event isn't or vice
versa.  Partly it is just personal style.

 
   -Fred
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new development snapshot

2000-05-09 Thread James Henstridge

On Tue, 9 May 2000, Tom Cato Amundsen wrote:

 In my eartraining program, I have the (bad?) habit of using multiple
 inheritance:
 
 class ChordBox(gkt.GtkHBox, DataStorage):
   def __init__(self, name):
   gtk.GtkHBox.__init__(self)
   DataStorage.__init__(self, name)
   ...
   ...
 
 With 0.7.0-unstable-dont-use, I get:
 
 DataStorage.__init__(self, name)
 TypeError: unbound method must be called with class instance 1st
 argument
 
 Should I convert to having a DataStorage variable in ChordBox, or will
 this
 be possible 0.7.0 is finished?

This is due to the use of ExtensionClass.  I am not sure how to fix this
properly.  This is mentioned in the ExtensionClass.stx file included in
the tarball.  You can get your code to work with:
DataStorage.__dict__['__init__'](self, name)

It doesn't look as pretty, but it does work.  The difference is that
DataStorage.__init__ is an unbound method that requires an Instance type
as its first argument (and in your case, self would be of type ChordBox),
while DataStorage.__dict__['__init__'] is just a plain function.

 
 Tom Cato
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new development snapshot

2000-05-09 Thread James Henstridge

On Tue, 9 May 2000, Tom Cato Amundsen wrote:

 James Henstridge wrote:
  This is due to the use of ExtensionClass.  I am not sure how to fix this
  properly.  This is mentioned in the ExtensionClass.stx file included in
  the tarball.  You can get your code to work with:
  DataStorage.__dict__['__init__'](self, name)
 Thanks, I can live with this. Anyway the code should have been fixed to
 not mix gui and data anyway.
 
 One last question about pre0.7.0, should we expect many
 incompatibilities.

There will be some.  I had to change some keyword arguments in some of the
examples because the argument names now match those found in the gtk+
header files.

 
 One thing, many constructors in gtk.py, like GtkAdjustment has default
 values,
 (at least now) 0.7.0 has not. This is just fine for me since it is
 closer to
 the C version.

Part of the reason why all functions had default values for the
constructors was to get the GtkWhatever(_obj=...) call to work with all
objects.  This isn't needed now, but having sensible defaults on some
objects would probably be a good idea.

 
 But will for example GtkCheckButton.active work in 0.7.0 final? Right
 now
 I need to use get_active() method. (Ok this is not close to C, but I
 like it...)

I guess that is a bug.  It can be fixed by editing gtk.defs and adding the
extra field to GtkToggleButton and recompiling.  I will add this.  There
are still a few bugs in the way you can access class attributes in the new
pygtk (eg. if a class defines new attributes, you can't get to any of the
attributes in a parent class).

 
 Tom Cato
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] add_entries in MenuFactory

2000-05-08 Thread James Henstridge

On Mon, 8 May 2000 [EMAIL PROTECTED] wrote:

 Greetings,
 
   Does anybody know how to put underscores under a selected letter
 of the items in a menu bar ? (You know the now traditional _File
 -underscore under F- means altF should pop-down the File menu...
 
 By the way I do not want to add an explicit accelerator which will yield
 to ALT+ Whaterver in the menu

Use the GtkItemFactory class.  It was the successor of the GtkMenuFactory
code (which the code in GtkExtra.py is based on).  It will handle the
underscores and setting up the correct accelerators.

 
 
 Thanks all 
 
 _
   
   LaBoufarikoise
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] new development snapshot

2000-05-08 Thread James Henstridge

I have put up another tarball of the new extension class based pygtk.  It
is available at:
  ftp://ftp.daa.com.au/pub/james/python/pygtk-0.7.0-unstable-dont-use.tar.gz

As before, it is not yet ready to replace the 0.6.x versions of pygtk, but
it is getting better.  You will probably find that a lot of your programs
just work (or almost work) with the new code.

If you want to run a program without installing the test release, remember
to import the ltihooks module before gtk (this makes sure it finds the
extensions correctly).

It is still not complete, but it is getting there.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new development snapshot

2000-05-08 Thread James Henstridge

On Mon, 8 May 2000, Tom Cato Amundsen wrote:

 James Henstridge wrote:
  
  I have put up another tarball of the new extension class based pygtk.  It
  is available at:
ftp://ftp.daa.com.au/pub/james/python/pygtk-0.7.0-unstable-dont-use.tar.gz
 It seems like you missed gtk/gdk.defs. Only gtk.defs and
 gtk-extrafuncs.defs is
 mentioned as EXTRA_DIST in gtk/Makefile.am.

My mistake.  I will put up a replacement snapshot soon.  Until then, you
can grab the files from CVS.

 
 Tom Cato

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] new development snapshot

2000-05-08 Thread James Henstridge

On Mon, 8 May 2000, Tom Cato Amundsen wrote:

 James Henstridge wrote:
  
  I have put up another tarball of the new extension class based pygtk.  It
  is available at:
ftp://ftp.daa.com.au/pub/james/python/pygtk-0.7.0-unstable-dont-use.tar.gz
 It seems like you missed gtk/gdk.defs. Only gtk.defs and
 gtk-extrafuncs.defs is
 mentioned as EXTRA_DIST in gtk/Makefile.am.

Alright.  The updated tarball is now on the ftp site.  I even ran make
distcheck on it, so it should build.  As I said in the first message, it
is still not finished, so don't be surprised if things don't quite work
right (I would like some feedback though).

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Popup windows.

2000-05-06 Thread James Henstridge

On Sat, 6 May 2000, George Farris wrote:

 I want to pop up a window, make sure it's shown fully on the screen 
 and then execute some other code. When that code is finished I will 
 destroy the pop up window.  I've tried the following:
 
 gm = GnomeMessageBox(message='Please wait')
 gm.show()

 while events_pending():
 mainiteration()
 
 other code
 
 gm.destroy()
 
 But it doesn't seem to show the contents of the window, ie the 
 'Please wait' until after "other code" is finished.
 
 Can someone tell me what I'm doing wrong.  I thought the 
 mainiteration would update all outstanding window events.
 

You could try the show_now() method.  It should handle making sure that
the window is shown correctly.

Note however, if the window gets covered and exposed again, it won't be
able to redraw itself, as the gtk event loop is not being run.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] gtk_menu_new() fail to be packed

2000-05-03 Thread James Henstridge

On Wed, 3 May 2000 [EMAIL PROTECTED] wrote:

 Greetings,
 
 
   Does anybody know why a menu bar fails to be packed into a box.
 
 I have successfully packed buttons into a box but a menubar created with 
 myMenuBar = gtk_menu_new() failed to be packed in tghe same box !!!???

A GtkMenu is a menu, not a menu bar.  You want the GtkMenuBar widget.  You
can add GtkMenuItems to the menu bar, then set some GtkMenu's as submenus
for the items.

Note that you shouldn't show the GtkMenu's, as they are not meant to be
visible at startup (only when the user clicks on the menu item).

 
 
 Any turn around ?
 
 _
   
   LaBoufarikoise
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Yet another stupid question

2000-05-03 Thread James Henstridge

On Thu, 4 May 2000, Hassan Aurag wrote:

  Hi,
 
  When you want to test whether /dev/dsp is properly configured you just 
 "cat somewave  /dev/dsp"
 
  Now what do I do if I want to test a /dev/ttyS(0-3). I tried to cat 
 AT and read if there is an OK answer, but it doesn't seem to work this 
 way.
 
  Even though this is not strictly gnome related, I am writing this for 
 gnome. And no wvdial won't do because it tries to configure everything 
 while all I need is to test the "comm port" for an OK.

Have you taken a look in the Serial-Programming howto?  You can probably
work out how to apply it to python using the python library docs (it looks
like you want to use the os, termios and TERMIOS modules).

 
  Thanks
  

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Making libglade.py work with gnome

2000-04-29 Thread James Henstridge

On Sun, 30 Apr 2000 [EMAIL PROTECTED] wrote:

 Hi
 
 I know that the question has already been asked but I definitively
 don't succeed in having libglade.py working properly on gnome 
 widgets.
 
 The libglade I have on my system is probably good as I am able to 
 make it work with gnome widget and C.  Using the same glade file 
 but with python the message I get is:
 
 ** WARNING **: unknown widget class 'GnomeApp'
 
 ** WARNING **: unknown widget class 'GnomeDialog'
 
 ** WARNING **: unknown widget class 'GnomeAbout'
 
 The modules I imported are:
 from gtk import * 
 from gnome.ui  import *
 from gnome.config import *
 import libglade
 
 I have a Mandrake 7.0 with:
 libglade-0.12-1mdk
 pygtk-libglade-0.6.6-1mdk
 libglade-devel-0.12-1mdk
 glade-0.5.7-2
 
 Can somebody give me a hint on this?

Does the following statement execute without exceptions on your system?
  import _gladegnome

It may be that this file was not included in any of the gnome-python
packages on your system (which is a bug in the packaging), in which case
you can't use gnome features with libglade in python.

 
 Thank you
 
 Frédéric
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] Re: Non-member submission from Joe Van Andel

2000-04-26 Thread James Henstridge

On Thu, 27 Apr 2000 [EMAIL PROTECTED] wrote:

 The 'configure' script needs updating:
 arrayobject.h now is included as
 
 #include Numeric/arrayobject.h

Well, the numeric python features for the extension class based pygtk are
not implemented yet, but I should fix this.

 
 Are you planning to proceed with this approach?  If I wanted to wrap
 gtk+extra-0.99.5, is using the Extension class approach a good idea?

Yes.  After figuring out some of the bugs, it looks like using
ExtensionClass is the way to go.  I am slowly converting over the rest of
pygtk/gnome-python (I have also been working on other projects, which is
why I haven't done too much recently).

I am still working out some of the bugs, so it is probably a good idea to
wait before converting over pygtk addons.

 
 Thanks much!
 

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Re: Non-member submission from Joe Van Andel

2000-04-26 Thread James Henstridge

On Wed, 26 Apr 2000, Joseph VanAndel wrote:

 So, if I need to wrap gtk+extra now, should I just use SWIG, but plan on
 using ExtensionClass later?

If all you want to do is use the GtkExtra widget library with python, go
to:
  http://home.pages.de/~voegele/gtkextra.html

(this link is in the links section on the GtkExtra web page).  I thought
you were talking about porting it to the unstable ExtensionClass branch of
pygtk (which as the name suggests could change, breaking your bindings).

 
 
 By the way on the subject line, what does 
 "Non-member submission from Joe Van Andel"
 mean?

The address you posted from was not on the mailing list, so it got bounced
to the mailing list maintainer (me).  I have added your address to the
post-only list, which is why your second message didn't bounce.

 
 Who is a "member"?

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkHTML 0.1 question, bug?!?!

2000-04-10 Thread James Henstridge

There is a function urllib.basejoin(base, url) that will convert a base
URL and a possibly relative url and give you an absolute one.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 10 Apr 2000, Hassan Aurag wrote:

 
  Hi,
 
  I am using gnome-python the latest. Gtkhmtl works fine until you load 
 urls.
 
  I am not sure how the python bindings use gtkhtml or python urllib 
 stuff, but all relative urls are scrapped somehow. Which means that it 
 will look for img src="gifs/whatever.png" locally instead of 
 relatively to the base url I gave it.
 
  I have used the gtkhtml_demo.py stuff as basic ingredient. For python 
 illiterates
 
  you usually use something like urllib.urlopen(url) which returns the 
 whole page as raw data that you then feed to gtkhtml using its write 
 method.
 
  And this where I don't know how things go, but relative urls don't 
 work, and believe me when I say all out there are usually relative 
 stuff.
 

 
 
 
 -
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] ExtensionClass based pygtk

2000-04-07 Thread James Henstridge

Thanks for this patch.  I have applied it and added support for keyword
arguments to a lot of the functions in the gtk.override file.  I was able
to run the examples/ide/browse.py example almost without modification
(just adding `import ltihooks' to the top, as I was running it from the
build directory, and changing the name of one variable), and it subclasses
GtkObjects and uses keyword arguments.

I think I have sorted out all the bugs related to the wrapper rescue code
in the destructor, but I am not that happy with the code (according to the
change log it is evil :).  It would be nice if python provided a more
general way of doing this sort of thing.

I will put out another snapshot tarball when I have a few more things
working.

BTW, I switched the stable version of pygtk and gnome-python over to using
the cvs automake, so now you can use an (almost) standard version of
automake to build gnome-python from cvs.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 31 Mar 2000, Toby D. Reeves wrote:

 James,
 
 The ExtensionClass based pygtk looks great so far.  I've been watching CVS
 as you built it up and have been waiting for you to announce that it is
 ready for folks to look at it.
 
 I've attached a CVS diff that make the generated code use
 PyArg_ParseTupleAndKeywords instead of PyArg_ParseTuple.  This allows
 keywords to be used  to override default arguments, like in the old pygtk.
 My implemention is kind-of brute force.  It could be changed to only use
 ParseTupleAndKeywords for functions and methods that have been assigned
 default argument values.
 
 The GtkItemFactory code in both the old and new pygtk has a refcount
 problem.  The attached python code demonstrates the bug.  I have looked at
 the gtk+ code and do not see a simple fix.   Maybe someone else will.
 Basically, gtk_item_factory_create_item()  does not allow a GtkDestroyNotify
 to be specified for the callback_data.
 
 I look forward to using the added capabilities of the new pygtk in a
 reorg/rewrite of our hyperspectral code.
 
 I'm glad that you agreed that using ExtensionClass was a good idea.
 
 Later,
 
 Toby
 

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] ANNOUNCE: pygtk-0.6.6 gnome-python-1.0.53

2000-04-07 Thread James Henstridge

I have just released pygtk-0.6.6 and gnome-python-1.0.53.  It is mainly
bug fixes.  The gtkhtml module should work correctly now (it uses
gnome-config to find the libraries to link with).  It also uses the CVS
version of automake (automake-1.4a) rather than my old automake patches,
and also uses libtool.

With this version, it is important that you pass the --prefix=/whatever
argument to configure.  Before it was ignored when installing the
packages, but now it isn't.  Either install under the same prefix as
python, add a .pth file to your python directory or set PYTHONPATH
correctly after installing.

If you have trouble building the shared libraries (eg. not getting the
correct extension, etc), it is probably a libtool defficiency, and should
be followed up with the libtool guys.  The tarballs include the latest
libtool version (1.3.4), so there shouldn't be too many problems.

The new packages are available from the usual locations:
  ftp://ftp.gnome.org/pub/GNOME/stable/sources/gnome-python/
  ftp://ftp.gtk.org/pub/gtk/python/   (soon)
  ftp://ftp.daa.com.au/pub/james/python/  (try to use one of the others)

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] CList get_row_data() question

2000-04-07 Thread James Henstridge

On Fri, 7 Apr 2000, lf11 wrote:

 James Henstridge wrote:
  
  clist.get_row_data(row) returns the data you set with
  clist.set_row_data(row, data).  If you want to get the text in a cell of
 
 I used clist.append(row, data).  clist.get_row_data(row) returns 'None',
 not the data in row.  Should I use clist.set_row_data(row, data)?

Those two functions are used for storing arbitrary data with a row in the
clist -- not for retrieving the cell values.

 
  the clist, use clist.get_text(row, col).
 
 I'd like to get the whole row, but I'll try that and see if it gets any
 text from the clist.

Then call clist.get_text for each column :)

 
 -lf

James.

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] bonobo

2000-04-07 Thread James Henstridge

not yet (I will probably add support when I get a bit further along with
the rewrite).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 7 Apr 2000, wrobell wrote:

 Any python module for gnome bonobo?
 
   wrobell [EMAIL PROTECTED]
 -
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] ExtensionClass based pygtk

2000-03-30 Thread James Henstridge

I have done a bit more work on ExtensionClass based pygtk, and have got to
a stage where others may want to try it out.  I put together a tarball for
people who don't have CVS access, or don't want to use it.  It is
available at:
  ftp://ftp.daa.com.au/pub/james/python/pygtk-0.7.0-unstable-dont-use.tar.gz

(the name is just so people don't complain too much when it breaks their
system if they try to install it).

To build it, do the following:
  ./configure --prefix=/usr # or whatever your python prefix is
  make

I don't recommend installing it, as it is not complete and will probably
not work on all setups.  You can test it out from the build directory
though.

Pygtk uses libtool now, so to use it without installing it, you will
either have to set up some symlinks for the shared libraries, or make your
program import ltihooks before importing gtk.  Ltihooks is a small set of
import hooks that treats .la files as extensions, and resolves the real
location of the shared library.

The single wrapper stuff is working correctly now, so that can be tested
out.

Post your comments about the code to the list.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] pygtk extensionclass work

2000-03-26 Thread James Henstridge

I just thought I would post a message saying that the extensionclass based
rewrite of pygtk is going pretty well.  In fact, you should even be able
to test it for very simple things.

If you want to do this, here are some instructions:

Checkout the extension-class branch of pygtk.  This can be done with the
following command:
  cvs -z3 get -f -r extensio-class -d pygtk-ec pygtk
(this will check out the extension-class branch of pygtk into the pygtk-ec
directory, and if any files don't have the extension-class tag, use HEAD).

You will still need my python patches for automake installed on your
system (I will switch it over to automake-1.4a soon).

Run the following:
  ./autogen.sh
  make

You can test out the new version from the build directory (I don't
recommend installing it at present).  As it uses libtool to build the
extensions, you will either have to create a few symlinks to get things
working, or use a set of import hooks that understand libtool libraries.
I have written some hooks like that, so that isn't a problem:
   import ltihooks
   ltihooks.install()
   import gtk

Not everything works (in fact there is a lot of unfinished stuff), but you
should be able to subclass the available widgets and the single wrapper
per GtkObject stuff is working.  Also, there is no fiddling round with _o
to worry about.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] pygtk extensionclass work

2000-03-26 Thread James Henstridge

Well, most of what is in gtk.py is being moved to a C extension module.
The types you create in an extension module are not class like, so you
can't subclass them for instance.  ExtensionClass is a bit of code that
allows you to create types that can be subclassed.

This way, I can autogenerate the C extension module, and keep the benefits
of having the python class wrappers (ie. you could subclass them and set
their attributes).  We also get all the benefits I mentioned in my
message.

There is documentation on ExtensionClass on Digital Creation's website
(www.digicool.com).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On 26 Mar 2000, Hrvoje Niksic wrote:

 This sounds yummy, even if my understanding of the specifics is vague.
 
 Could you please explain what "extensionclass" is, and how it will
 affect PyGtk?
 -
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] PyQt/PyKDE Bindings

2000-03-25 Thread James Henstridge

On Sat, 25 Mar 2000, Michael Lauer wrote:

  On Thu, 23 Mar 2000, Fred L. Drake, Jr. wrote:
  Well, I'm not sure how much breakage would be, but it's certainly not up
  to James alone: Gtk+ 1.4 is sure to break code anyway. As PyGTK is still
  young, I think there is still hope to fix those things...
 
 I can't find anything about future Gtk+ versions on www.gtk.org - where
 do you got these information from ?
 
Owen Taylor and Tim Janik gave a good talk about what will be in gtk+-1.4
(or 2.0, as it may be called when they release it) at GUADEC.  The slides
for their presentation are available at:
  http://people.redhat.com/otaylor/gtk/guadec/

You could also look at the gtk-devel-list archives, as the future of gtk
is often discussed there.

James.

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] PyQt/PyKDE Bindings

2000-03-23 Thread James Henstridge

On Thu, 23 Mar 2000, Moshe Zadka wrote:

 As long as you're breaking things anyway, let me suggest one change:
 have the "Gtk" prefix stripped from the classes' names (GtkText - Text,
 etc) and recommend that Gtk is imported via
 
 import Gtk
 
 And accesed via
 
 Gtk.Text()
 
 (Simillarily for Gnome/GnomeUI)
 
 It seems much more Pythonic then
 
 from gtk import *
 
 GtkText()
 

You can currently do:
  import gtk
  gtk.GtkText()

I am more in favour of keeping the Gtk prefix, as this seems to be common
in some of the other language bindings (even the java bindings kept the
Gtk prefix when the classes were in a gtk package).  Most of your
application is made up of manipulating widgets, rather than constructing
them, so the extra three characters is not that much of a problem.

 
 --
 Moshe Zadka [EMAIL PROTECTED]. 

James.

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] ANNOUNCE: pygtk-0.6.5 and gnome-python-1.0.52

2000-03-13 Thread James Henstridge

I have just put out pygtk-0.6.5 and gnome-python-1.0.52.  Here is a list
of some of the changes:

pygtk:
- more reference leaks fixed.
- crashes when changing window properties with 16 or 32 bit data
  formats fixed.
- some libglade wrapper fixes.
- various other fixes.
gnome-python:
- hopefully fixed the gettext.py module for big endian machines.
- fixed small GnomeMDIGenericChild wrapper problem (from Federic
  Gorby)
- small GnomeUIInfo handling bug fixed (again from Federic).

gnome-python is available from:
  ftp://ftp.gnome.org/pub/GNOME/stable/sources/gnome-python/
pygtk will soon be available from:
  ftp://ftp.gtk.org/pub/gtk/python/

I have also uploaded the new versions to ftp.python.org, and they are
available from my personal ftp site (please use a mirror though).

BTW, I will be at GUADEC (www.guadec.enst.fr) later on this week.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GnomeAbout, gnome.app_id and gnome.app_version

2000-03-13 Thread James Henstridge

That is the only way to explicitely set the program name and version.  In
a future version, it will probably require doing something like:
  import gnome.ui, gnome.whatever  # import all gnome components used ...
  gnome.init('program-name', 'version')

It is necessary to import gnome.ui before libglade if your interface uses
gnome widgets.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 13 Mar 2000, Mitch Chapman wrote:

 [Using gnome-python 1.0.52, libglade 0.12, and
 gnome-lib 1.0.14 -- admittedly old, but it came with Mandrake 6.1.]
 
 I'm trying to figure out how to get an application's name
 and version to show up in its About dialog.
 
 gnome/__init__.py handles the case where the application is
 run as a command whose name ends in .py[oc]? and appears to
 hardware the application version number to '0.0'.
 
 So far I can see only one way to override these settings:
 
 import gnome
 gnome.app_id = "SomeApp"
 gnome.app_version = "0.3 alpha"
 import gnome.ui
 
 Is there a better way?
 
 Along the same lines, I'm finding it necessary to import 
 gnome.ui before importing libglade.  Otherwise a segmentation
 fault occurs.  Paraphrasing (not in front of the development
 machine just now):
 
 GnomeUI-CRITICAL **: file gnome-app.c: line 206 (gnome_app_new):
 assertion 'appname != NULL' failed.
 
 Is it necessary to explicitly import gnome.ui before importing 
 libglade?
 
 --
 Mitch Chapman
 [EMAIL PROTECTED]
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] Re: BOUNCE pygtk@daa.com.au: Non-member submission from [Javi Roman javi@esware.com]

2000-03-07 Thread James Henstridge

The string for rc_parse_string() is the same format as the rc files.  It
basically allows you to embed an rc file in your application.  Here is an
example:

rcfile = """
style "default_style"
{
  bg[NORMAL] = { 0.5647, 0.6902, 0.6588 }
  bg[ACTIVE] = { 0.49, 0.60, 0.57 }
  bg[PRELIGHT] = { 0.67, 0.83, 0.79 }
  bg[INSENSITIVE] = { 0.5647, 0.6902, 0.6588 }
}
widget_class "*" style "default_style"
"""
rc_parse_string(rcfile)

The reason that the "style.bg_pixmap[...] = pixmap" causes a crash is a
bug and will be fixed in the next version.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Wed, 8 Mar 2000 [EMAIL PROTECTED] wrote:

 Please, i need a rc_parse_string(mystring) example. What's it "mystring"
 format?
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] PyGnomeHello and internationalization

2000-03-06 Thread James Henstridge

There is a gettext module included with gnome-python.  It is fairly
similar to the C API, but has some problems with big endian architectures
at the moment (this will be fixed).

You can use it like so:

  import gettext

  _ = gettext.gettext
  gettext.bindtextdomain("translation-domain", "/usr/share/locale")
  gettext.textdomain("translation-domain")

  print _("Hello world")

If you make the translated strings look like C strings (that is, use
double quotes and no triple quotes, etc), you should be able to use the
standard xgettext program to extract strings.

Alternatively, if you can get your program to translate every string
during its run (difficult if you are trying to translate error messages),
you can set the PY_XGETTEXT environment variable to a file name.  Then the
gettext module will work in reverse and output each translated string to
the file named in PY_XGETTEXT.  It outputs in standard PO file format,
complete with module name, function name and line number.

You can also use the gettext module for creating or editing message
catalogs:
  cat = gettext.Catalog('translation-domain')
  cat['Hello world'] = 'hello-world-in-some-other-language'
  cat.save('filename.mo')

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 5 Mar 2000, Daniel Kornhauser wrote:

 Hi pythoneers:
 
 I'm making a PyGnomeHello a shamessly python copy fo the GnomeHello of 
 the GGAD book.
 I think that the directory structure and  GNU instalation utilities could
 be usefull for proving order in the pygnome applications.
 
 I think that it would help avoiding the work of custom instalation
 utilites like the GMath_install.py. But perhaps the application's author
 would like more to do their own intalation srcipts.
 
 Anyway, my problem is to how make internationalization work in python. 
 I don't know if it would be prudent to use gettext on python programs
 and how to avoid python parsing errors with N_. It should be foolish to
 have to run a python program throught some kind of preprocesor in order to
 make it workable.
 
 So I'm hopping for replies encouraging my mediocrity saying  
 " skip the internationalazion and include the PyGnomeHello in the
 tutorial" or a viable solution using gettext or some other program for 
 internationalization.
 
 Thanks a lot
 
   Daniel Kornhauser
 
 
 
 
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Re: BOUNCE pygtk@daa.com.au: Non-member submission from [Hans Breuer hans@breuer.org]

2000-03-05 Thread James Henstridge

There isn't much to see at the moment.  I am testing out the modifications
on the extension-class-branch tag for the pygtk directory on CVS.  You can
view the stuff on this branch using bonsai:
  
http://cvs.gnome.org/bonsai/rview.cgi?rev=extension-class-branchdir=gnome-python/pygtkcvsroot=/cvs/gnome

Or grab a copy with:
  cvs -z3 get pygtk -r extension-class-branch

Currently, the interesting stuff is in the codegen directory.  There is a
working C header file parser (h2defs.py) that outputs .defs files using
Havoc's new defs file format.  There is also a defs file merger
(merge.py).  It takes a generated defs file, and an older version that
contains some hand modifications (ie. information that can't be deduced
from the headers, such as default values for arguments) and merges the
modifications into the new version.

I am about to start work on the code generator, which shouldn't be too
difficult -- it should be fairly similar to the old one.  When this is
finished, it will hopefully be possible to create new extensions from just
a defs file (mostly autogenerated) and maybe a few hand coded functions
where the code generator couldn't handle.

I think I have sorted out the single wrapper per GtkObject problem.  By
using ExtensionClass, I can do weird things like catching python object
destruction, which should help with this sort of thing.  This should allow
us to have the python wrapper holding a reference to the GtkObject, and if
the wrapper is destroyed before the GtkObject, we can `rescue' the wrapper
for use if the GtkObject comes back into use within python.

This should also allow things like:
  class MyButton(GtkButton):
# extra methods here ...
And have the exact same instance of MyButton passed to signal handlers,
even though there is no MyButton class in the gtk object system.

Hopefully this will reduce the number of quirks you have to know about
when programming with pygtk or gnome-python.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 5 Mar 2000, Hassan Aurag wrote:

 
 
  A while back, you talked about using something that autogenerates 
 python bindings. I think Havoc worked on it or something.
 
  Do you have more info on this. I'd love to tackle bindings for 
 bonobo!
 
 
  Original Message 
 
 On 3/4/00, 7:53:42 PM, James Henstridge [EMAIL PROTECTED] wrote 
 regarding [pygtk] Re: BOUNCE [EMAIL PROTECTED]: Non-member submission 
 from [Hans Breuer [EMAIL PROTECTED]] :
 
 
  I am sorry about not applying your patches before.  I have been doing 
 a
  bit of work to fix some of those problems though.
 
  I am currently working on changing pygtk over to use ExtensionClass to
  simplify things (no more self._o :), and I am moving over to a package
  structure at the same time, which should get rid of the case 
 insensitivity
  problems.
 
  I have started this work on the branch `extension-class-branch' of the
  pygtk directory (I haven't branched all of gnome-python because I am
  currently just trying to get things to work with pygtk at the moment).
  There isn't much to see now.  Just a script to try to convert C header
  files to the new .defs file format (based on the script sent to me by
  Toby Reeves), and a script to merge hand modifications from one .defs 
 file
  into a newer generated defs file.  There isn't any actual code to play
  around with yet though.  I will probably be porting the basics over to
  using ExtensionClass, then do the code generator.
 
  James.
 
  --
  Email: [EMAIL PROTECTED]
  WWW:   http://www.daa.com.au/~james/   http://www.daa.com.au/~james/
 
 
  On Sun, 5 Mar 2000 [EMAIL PROTECTED] wrote:
 
   At 11:51 03.03.00 +0200, Matti Picus wrote:
   I am very interested in getting python and the GIMP working on 
 Windows.
   What must be done to get python scripting up to the level of 
 script-fu? How
   difficult would it be to implement a python console that calls GIMP 
 over a
   socket? Over a pipe? Any ideas how to attack this? Are there enough
   question marks in this e-mail?
  
   Some time ago I've ported pygimp and pygtk. Take a look at:
  
   http://hans.breuer.org/ports
  
   It should work with the current Gimp version, if you follow the
   installation instructions included.
  
  
   Hi James,
   just in the fact, you have lost my mail from 10.11.99
  
   Here are some notes about the patch:
  
   - Win32 doesn't support filenames different in case only.
 So I've renamed GTK.py to GTK_const.py
   
   - Currently only _gtk is ported, because it's the only one real
 needed for Gimp plug-ins
   
   - There are little changes to the Gimp Win32, I'll discuss
 them with Tor Lillquist soon.
  
   Now they are integrated in The Gimp since a while ...
  
   - My first plug-in is basically running. It writes The Gimp
 documentation from PDB to nice formatted html files.
[...]
  
   See: http://hans.breuer.org/gimp/pdb/
  
   Regards,
   Hans
  
  
 
  To unsubscribe: echo "unsubs

[pygtk] Re: BOUNCE pygtk@daa.com.au: Non-member submission from [Hans Breuer hans@breuer.org]

2000-03-04 Thread James Henstridge

I am sorry about not applying your patches before.  I have been doing a
bit of work to fix some of those problems though.

I am currently working on changing pygtk over to use ExtensionClass to
simplify things (no more self._o :), and I am moving over to a package
structure at the same time, which should get rid of the case insensitivity
problems.

I have started this work on the branch `extension-class-branch' of the
pygtk directory (I haven't branched all of gnome-python because I am
currently just trying to get things to work with pygtk at the moment).
There isn't much to see now.  Just a script to try to convert C header
files to the new .defs file format (based on the script sent to me by
Toby Reeves), and a script to merge hand modifications from one .defs file
into a newer generated defs file.  There isn't any actual code to play
around with yet though.  I will probably be porting the basics over to
using ExtensionClass, then do the code generator.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 5 Mar 2000 [EMAIL PROTECTED] wrote:

 At 11:51 03.03.00 +0200, Matti Picus wrote:
 I am very interested in getting python and the GIMP working on Windows.
 What must be done to get python scripting up to the level of script-fu? How
 difficult would it be to implement a python console that calls GIMP over a
 socket? Over a pipe? Any ideas how to attack this? Are there enough
 question marks in this e-mail?
 
 Some time ago I've ported pygimp and pygtk. Take a look at:
 
 http://hans.breuer.org/ports
 
 It should work with the current Gimp version, if you follow the
 installation instructions included.
 
 
 Hi James,
 just in the fact, you have lost my mail from 10.11.99 
 
 Here are some notes about the patch:
 
 - Win32 doesn't support filenames different in case only.
   So I've renamed GTK.py to GTK_const.py
 
 - Currently only _gtk is ported, because it's the only one real
   needed for Gimp plug-ins
 
 - There are little changes to the Gimp Win32, I'll discuss
   them with Tor Lillquist soon.
 
 Now they are integrated in The Gimp since a while ...
 
 - My first plug-in is basically running. It writes The Gimp
   documentation from PDB to nice formatted html files. 
  [...]
 
 See: http://hans.breuer.org/gimp/pdb/
 
 Regards,
   Hans
 
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] style question again

2000-03-02 Thread James Henstridge

There isn't a style.red attribute.  To create the colour red in the
colormap used by the widget, use one of the following:
  red = widget.get_colormap().alloc('red')
  red = widget.get_colormap().alloc('#ff')
  red = widget.get_colormap().alloc(0x, 0, 0)

All these forms are equivalent (the last is a little bit faster, but the
first allows the system administrator to redefine red to something else in
/usr/lib/X11/rgb.txt :)

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Thu, 2 Mar 2000, Javi Roman wrote:

 I have:
 
   ...
   style = self.window.get_style ().copy ()
 style.bg[STATE_NORMAL] = style.black
 self.window.set_style (style)
 ...
 
 This works correctly, but i want a red background color, and i try:
 
   ...
   style.bg[STATE_NORMAL] = style.red
   ...
 
 This fail. I think that i don't understand very well. Can anybody help
 me?
 
 
 Regards.
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] how to adjust scrolledwindow pos

2000-03-01 Thread James Henstridge

The adjustment for the GtkText widget represents the position in the text.

You can set its value with the set_value() method.  Something like:
  adj = text.get_vadjustment()
  adj.set_value(adj.upper - adj.page_size)

This should adjust where the scrollbar thumb is positioned and the
position in the text.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Tue, 29 Feb 2000 [EMAIL PROTECTED] wrote:

 [ gtk+-1.2.6, pygtk-0.6.4, python-1.5.2 ]
 
 I create a text widget, and attach a vertical scrollbar.
 I insert a lot of text.  Now I want to programmaticaly position
 the scrollbar at the end, i.e. with the last line of text at the
 visible bottom of the window.  How is this done?
 
 vbox.pack_start(GtkLabel('Machine Log'), FALSE, FALSE)
 text = GtkText()
 text.set_editable(FALSE)
 text.set_word_wrap(TRUE)
 textbox=GtkHBox()
 textbox.pack_start(text, TRUE, TRUE, 0)
 textbox.pack_start(GtkVScrollbar(text.get_vadjustment()), FALSE, FALSE, 0)
 vbox.pack_start(textbox, TRUE, TRUE)
 
 text.delete_text(0, -1)
 text.freeze()
 for ldate,lstatus,lusr,lcomment in rslt:
 text.insert_defaults('Date: ' + ldate + '  User: ' + lusr + '  Status: ' + 
lstatus + '\n')
 text.insert_defaults(lcomment + '\n')
 text.insert_defaults('___\n')
 text.thaw()
 
 #Now 'text' is positioned at the top; how do I set it to the bottom.
 #I looked for something like set_scroll_pos(pos), but couldn't find such.
 
 Any other comments about good (or terrible) style, easier/better ways to 
 do things like this are welcome...
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] timeout causes lockup?

2000-02-27 Thread James Henstridge

There were some threading bugs in some early versions of gtk+
(specifically with events_pending() and mainiteration()). You should
really use gtk+ = 1.2.4.  I should have this check in the configure
script.

The other possible difference between the mandrake is if one was compiled
with threading and the other wasn't.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 27 Feb 2000, Scott Bender wrote:

 
 Yeah, this is a strange one. I have one linux box (Mandrake 7) which does not need 
the thread_enter/leave sutff,
 and another (RedHat 6.0) that does need it. They're both running the same pygtk 
(0.6.3), but different versions of
 gtk, the Madrake box has 1.2.6, the RedHat box has 1.2.1. I'm guessing that this is 
the reason.
 
 - Scott
 
 "Mitch Chapman" wrote:  
   
   Here's an excerpt from a module of miscellaneous pygtk functions.
   It shows three platform-dependent implementations of an update()
   function.  update() is used e.g. to update a progress bar
   in the middle of a time-consuming operation -- it's analogous to
   the Tkinter update() function.
   
   I haven't bothered looking at Gtk+ or pygtk sources in order to figure 
   out why you need threads_(enter|leave) on Solaris but not on Linux.
   If somebody could explain the difference I'd be grateful.
   
   One last note:  This code was tested w. pygtk 0.6.2, on all
   three platforms.
   
   --
   Mitch
   [EMAIL PROTECTED]
 
   
   Mitch Chapman wrote:

On Sat, 26 Feb 2000, Scott Bender wrote:
 Actually, the hang came after my timeout function completed. It was calling 
mainiteration(FALSE) to
 update a progress bar, which was causing the hang. Anyone know why?

 thanks,
 - Scott

I've seen this recently.  The behavior varies depending on what version
of Gtk+ you're running with, and on what operating system.

The basic problem is that, on some platforms, even w. Gtk+ 1.2.6,
you need to surround calls to gtk.events_pending() and
gtk.mainiteration() with calls to gtk.threads_leave() and
gtk.threads_enter(). On others (e.g. Solaris) you *shouldn't* do so.
   To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
   
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] CLI arguments

2000-02-27 Thread James Henstridge

It is the gnome code that is doing this.  I will be fixing this up when
moving to gnome-libs-2.

Currently the way to do this is to parse the arguments before importing
gnome.ui, and remove all but the gnome/gtk ones.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 28 Feb 2000, J.W. Bizzaro wrote:

 I'm trying to parse the command-line for arguments, but when the argument is a
 flag (starts with - or --), gtk catches it and (if it isn't a gtk flag) returns
 
 Error on option --bla: unknown option.
 
 How do I (1) turn off gtk's argument parsing or (2) make use of it in pygtk?
 
 Jeff
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Modal File Dialog

2000-02-25 Thread James Henstridge

You can use the set_modal method of any GtkWindow derived class:
  window.set_modal(TRUE)

When the dialog is shown, it will act as any other dialog, but no other
window can take input.  It will loose modality when it is hidden or
destroyed.

Unless you really have to it is probably better not to use a modal dialog,
as most users prefer non modal dialogs.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 25 Feb 2000, Moshe Zadka wrote:

 It's probably extremely easy, but I'm having problems figuring
 out how to display a file dialog so when it's active, the rest of
 the application doesn't respond.
 
 Do I need a seperate event loop, or something like that?
 
 Thanks in advance.
 
 --
 Moshe Zadka [EMAIL PROTECTED]. 
 INTERNET: Learn what you know.
 Share what you don't.
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Modal File Dialog

2000-02-25 Thread James Henstridge

If there is part of the GUI that the user shouldn't use while the dialog
is open, consider making it insensitive (with set_sensitive(FALSE)).  This
is sometimes nicer than making a window application modal.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 25 Feb 2000, Moshe Zadka wrote:

 On Fri, 25 Feb 2000, James Henstridge wrote:
 
  You can use the set_modal method of any GtkWindow derived class:
  window.set_modal(TRUE)
 
 Thanks.
 
  Unless you really have to it is probably better not to use a modal dialog,
  as most users prefer non modal dialogs.
 
 This maybe slightly off-topic, since it's more about UI design then about
 PyGTK specifically, but the alternative I'm considering is to make
 it into a dialog which replaces an entry field. Is that considered all 
 right? I'm squimish, because it might clobber someone's carefully crafted
 text, but I *have* to allow inputting both via the file dialog and the
 entry field.
 
 Thanks again!
 --
 Moshe Zadka [EMAIL PROTECTED]. 
 INTERNET: Learn what you know.
 Share what you don't.
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Inheriting From Widgets

2000-02-25 Thread James Henstridge

In more complex Tkinter projects, that rule does not seem to be followed.
Usually you may want to subclass an existing widget to get some special   
behaviour.  In both pygtk and Tkinter cases, subclassing a widget is the  
easiest way of achieving this.

I don't really have any specific recommendations to do with this.  The
main one is to not override any of the methods that are straight wrappers
for C functions.  If the equivalent C function is called on the object,
the method of your derived class will not be called, so you can't rely on
it.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 25 Feb 2000, Moshe Zadka wrote:

 My previous experience in Python GUI toolkits was with Tkinter. In
 Tkinter, the official advice was ``don't inherit from anything except
 Frame''. I wonder what the official advice about PyGTK is. 
 
 Is it considered politically correct to inherit from Gtk[VH]Box? 
 Are there any caveats?
 
 Thanks in advance.
 --
 Moshe Zadka [EMAIL PROTECTED]. 
 INTERNET: Learn what you know.
 Share what you don't.
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Bug in GtkRet_FromPyObject

2000-02-22 Thread James Henstridge

Yes that is a bug.  For simple bug fixes where the fix is obviously
correct, there shouldn't be a problem commiting the fixes directly to CVS.
You may as well commit the last few patches you posted to the list.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 21 Feb 2000, Frederic Gobry wrote:

 I'm continuing my investigations on MDI ;-)
 
 In gtkmodule.c, line 3041, isn't there a break missing ?
 
 Frédéric
 
 PS : I've write access to the Gnome CVS. Is it ok to fix these kind of bugs
 without warning ?
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Pygtk plans (was Re: [pygtk] Still an MDI bug in ...)

2000-02-22 Thread James Henstridge

I didn't notice that I hadn't CC'd this to the list.  It may be
interesting to others who have an opinion about how pygtk should handle
the PyObject - GtkObject relationship.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-- Forwarded message --
Date: Tue, 22 Feb 2000 21:55:53 +0800 (WST)
From: James Henstridge [EMAIL PROTECTED]
To: "Fred L. Drake, Jr." [EMAIL PROTECTED]
Subject: Pygtk plans (was Re: [pygtk] Still an MDI bug in ...)

It may be helpful.  Using the weak referenced GtkObjects we get to specify
a callback to be called on object finalisation.  This allows us to prevent
the reference loop by making the GtkObject own the python object.  The
idea is to use this feature to set the pointer to the GtkObject in the
python wrapper object to NULL on destruction of the GtkObject, and check
for this in methods.

This gives us a single wrapper object per GtkObject.  Unfortunately, it
breaks the following feature:
  container1.remove(widget)
  container2.add(widget)

Since the python wrapper would not be holding a reference to the GtkWidget
here, it would be destroyed between the two method calls.

Now if python had weak reference support, we could do this in the other
direction.  This would mean that the container add/remove example would
work, but if all references to the python wrapper disapeared, it would be
destroyed.  The next time the GtkObject was used from within python, a new
wrapper would be created.

This is similar to the multiple wrappers per GtkObject senario we have
now, where callbacks will usually be passed a different wrapper object
than in the function they were created.  On the other hand, at any one
time there will be at most one wrapper for each GtkObject (ie. wrapper1
and wrapper2 refer to the same object = id(wrapper1) == id(wrapper2)).

Would this be good enough for what most people want?  This would only be
possible if python had support for weak references with finalisation
notification like in gtk+.  The docs for the GTK weak reference stuff is
at:
  http://developer.gnome.org/doc/API/gtk/gtkobject.html#GTK-OBJECT-WEAKREF

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 21 Feb 2000, Fred L. Drake, Jr. wrote:

 James,
   Would this be easier if we had support for weak references in the
 stock interpreter?
 
 
   -Fred
 
 --
 Fred L. Drake, Jr.  fdrake at acm.org
 Corporation for National Research Initiatives
 


To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Bindings for GtkExtra

2000-02-22 Thread James Henstridge

I will probably do a reorg like this.  I am already making some changes to
pygtk that may not be fully compatible (these will probably be made as I
update to gtk-1.4/gnome-libs-2.0), so moving to a package layout like this
would probably be a good idea.  The current layout is quite similar to how
things were when I first started pygtk, using python-1.4 which didn't
support packages without ni.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Tue, 22 Feb 2000, Fred L. Drake, Jr. wrote:

   Does it make sense to turn all this into a Python package?  I don't
 know if there are enough components, but it would help keep the module 
 namespace clean.
   The structure could be:
 
   gtk/__init__.py # "from core import *" + docstring
 gtk/core.py # currently gtk.py
 gtk/extra.py
 gtk/_gtkmodule.so   # yes, this works in a package
 gtk/GDK.py
 gtk/GTK.py
 gtk/...
 
   This *shouldn't* affect code that doesn't use GtkExtra, and it
 sounds like that should change anyway.  My piddleGTK module will need
 to change since I use gdk-level functions, but that's not a big deal.
 
 
   -Fred
 
 --
 Fred L. Drake, Jr.  fdrake at acm.org
 Corporation for National Research Initiatives
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Still an MDI bug in gnome-python 1.0.51?

2000-02-20 Thread James Henstridge

I will make a new release soon (and I mean it :).  I will just see if I
have missed any other bugs that people sent in first.

At the moment I am investigating some ideas that will make pygtk easier to
maintain, smaller, easier to autogenerate the source of and a few other
things.  It should also allow having one PyObject - one GtkObject, which
people have been wanting for a long time, without circular reference
problems.

The changes will be using the ExtensionClass code which is currently
maintained with zope.  This code allows writing new types in C which can
be subclassed in python.  The idea is to move most of what is in gtk.py
into the C part of the package.

The code generation phase when building pygtk will probably be using
Havoc's new defs file format (which stores more information about how
functions relate to different objects, which is very helpful for an object
oriented wrapper like pygtk).  Havoc is also working on some code to
generate these new defs files from C headers, which will make adding
python support for other widget libraries trivial -- the steps may be as
simple as:
  1) generate defs file from C headers
  2) possibly make some modifications to generated defs file, or hand code
 functions that can't be autogenerated.
  3) generate source code for python wrapper.
  4) compile python wrapper
  5) install and use.

There are still a few questions I have about ExtensionClass, so I haven't
really started work on implementing this yet.

I will be making bug fix releases of pygtk/gnome-python when necessary in
the mean time.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 20 Feb 2000, Hassan Aurag wrote:

 
  No problem! It's just a small typo after all!
 
 
  But when will be next release. I will make my release of GmatH after 
 it so people could use the new MDI look of the thing I am doing!
 
  However if it's long, I could still tell them to replace aa by a and 
 all would be set!
 
 
  Original Message 
 
 On 2/19/00, 10:33:24 PM, James Henstridge [EMAIL PROTECTED] wrote 
 regarding Re: [pygtk] Still an MDI bug in gnome-python 1.0.51?:
 
 
  Sorry about not mentioning it, but I included this fix in my last 
 commit.
  It will be included in the next release.
 
  James.
 
  --
  Email: [EMAIL PROTECTED]
  WWW:   http://www.daa.com.au/~james/   http://www.daa.com.au/~james/
 
 
  On Sun, 20 Feb 2000, Hassan Aurag wrote:
 
 File
   "/var/tmp/gnome-python-root/usr/lib/python1.5/site-packages/gnome/ui.
   py", line 1163, in __call__
   aa[i] = _obj2inst(args[i])
   NameError: aa
  
   I think this is an error!
  
  
  
  
 
  To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 
 
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] 2 Typos in gtk.py

2000-02-19 Thread James Henstridge

I have applied the fix.  It will be included in the next release.  Thanks.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sat, 19 Feb 2000, Martin Preishuber wrote:

 Matt Wilson wrote:
 
  I don't see the problem in the latest release.  What are you looking
  at? 1.0.51?
  
  Matt
 
 hmmm line wrapping fault:
 
   def get_hadjustment(self):
   return GtkAdjusment(_obj=
 
  ^^ here's the t missing
 
   def get_vadjustment(self):
   return GtkAdjusment(_obj=
  
  ^ and here
 
 it's in 1.0.51 and in the cvs version
 
 Martin
 
 -- 
 Martin Preishuber - Student, ECLiPt Core Member, SysAdmin
 http://eclipt.uni-klu.ac.at,
 mailto:[EMAIL PROTECTED]
 
 ... I want to perform cranial activities with Tuesday Weld!!
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] X selection handling

2000-02-18 Thread James Henstridge

Selection handling is a complicated subject, which I don't know that much
about.  You probably should read some docs on X's handling of selections
before playing around with this (the O'Reilly books probably have
something about this).

If you only want to do text clipboard transfers, you could use the hack
the GnomeIconList widget uses -- create a toplevel GtkWindow (of type
popup, so the window manager ignores it) a long way off screen (eg at
2000,2000), and place a GtkEntry in it.  You can use the GtkEditable
clipboard functions on this widget.  You can connect to the GtkEntry's
selection_notify_event signal to be notified when a selection changes.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 18 Feb 2000, Rick Ree wrote:

 I know this has been asked before, but I haven't found an answer IIRC.
 Can/how do you get/set the X selection?  I tried experimenting with the
 GtkEntry class but ideally I want to manipulate the X selection without
 having to explicitly show an entry widget.
 
 Rick
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Text font

2000-02-17 Thread James Henstridge

The font attribute of the style should be a GdkFont -- not a string.  To
get the GdkFont for a particular logical font name, use the load_font
procedure.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Thu, 17 Feb 2000, Javi [iso-8859-1] Román wrote:

 Hi:
 
 I need change GtkFrame label font. I have this:
 
 marco = GtkFrame ("Warning")
 style = marco.get_style ().copy ()
 style.font =
 "-dec-terminal-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"
 marco.set_style (style)
 
 How can I do it correctly?
 
 
 Thanks.
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] ANNOUNCE: pygtk-0.6.4, gnome-python-1.0.51

2000-02-16 Thread James Henstridge

I have just released pygtk-0.6.4 and gnome-python-1.0.51.  Most of the
work for this release was done by Matt Wilson (thanks Matt :).

This release fixes a lot of reference leaks, so your programs may use less
memory.  One offshoot of this is that pygtk now uses some parts of the C
API that were only introduced in python-1.5.2.  If you have an earlier
version, you will need to upgrade.

There is a number of other bug fixes and improvements.  See the ChangeLogs
for details.

Pygtk-0.6.4 will be available shortly from:
  ftp://ftp.gtk.org/pub/gtk/python/
gnome-python-1.0.51 is available from:
  ftp://ftp.gnome.org/pub/GNOME/stable/sources/gnome-python/

Both are available from:
  ftp://ftp.daa.com.au/pub/james/pygtk/
(please use one of the other sites though).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] bounced message

2000-02-15 Thread James Henstridge

This message bounced as a non member submission.  If anyone has multiple
email addresses they like to post from, send a message to
[EMAIL PROTECTED] with "subscribe [EMAIL PROTECTED]" in the
body.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


-- Forwarded message --
Date: Wed, 16 Feb 2000 04:04:57 +0800 (WST)
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: BOUNCE [EMAIL PROTECTED]:Non-member submission from [Paul Clifford 
[EMAIL PROTECTED]]   

From [EMAIL PROTECTED]  Wed Feb 16 04:04:49 2000
Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net 
[194.217.242.89])
by quoll.daa.com.au (8.9.2/8.9.2) with ESMTP id EAA28490
for [EMAIL PROTECTED]; Wed, 16 Feb 2000 04:04:25 +0800 (WST)
Received: from plasma.demon.co.uk ([158.152.109.168])
by anchor-post-31.mail.demon.net with smtp (Exim 2.12 #1)
id 12Kntr-0007pO-0V
for [EMAIL PROTECTED]; Tue, 15 Feb 2000 19:44:44 +
Received: (qmail 27866 invoked from network); 15 Feb 2000 19:38:55 -
Received: from jenny.local (HELO plasma.demon.co.uk) ([EMAIL PROTECTED])
  by drusilla.local with SMTP; 15 Feb 2000 19:38:55 -
Sender: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Date: Tue, 15 Feb 2000 19:40:13 +
From: Paul Clifford [EMAIL PROTECTED]
X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.14 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: [EMAIL PROTECTED]
Subject: Re: [pygtk] GtkCList/CTree get_selection_info
References: [EMAIL PROTECTED] 
[EMAIL PROTECTED] [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Martin Preishuber wrote:

 I've made a simple example which shows the unwanted behaviour mentioned
 earlier ... could someone test it and post his/her results ? For me
 when dragging something to the list it returns (0,0) for the label,
 (1,0) for "First" and None for "Last"

The problem appears to be that get_selection_info expects coordinates
relative to the top left of the window holding the rows, while the
coordinates passed to your dragreceivelist method are relative to the
top left of the widget.  In your example this causes the row results to
be one greater than expected, and the last row to be ignored
completely.  (Actually, since the title is slightly taller than a normal
row you get different results depending on whether you end the drag at
the top or bottom of a row.)  If you put the GtkCList object inside a
scrolled window and add a large number of rows this mismatch is even
more pronounced - anything occupying the topmost (row height + cell
spacing) pixels will always be reported as row 0, regardless of how far
down you scroll.

The solution is either to translate the coordinates into the the
required format or to obtain the pointer position by some other suitable
method once dragreceivelist is called.  A brief look through the GTK
reference pages didn't yield any obvious clues as to how to do either,
so perhaps someone else can help here?

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCList/CTree get_selection_info

2000-02-14 Thread James Henstridge

The function should be returning None if you click outside of the cells,
or (row,col) if you click on a cell.  I don't know why it would be acting
differently on your system.

The code in pygtk reads like this:
  if (gtk_clist_get_selection_info(GTK_CLIST(PyGtk_Get(clist)), x, y,
   row, column))
return Py_BuildValue("(ii)", row, column);
  else {
Py_INCREF(Py_None);
return Py_None;
  }

This is a pretty close match to the documented behaviour of the function:
  http://developer.gnome.org/doc/API/gtk/gtkclist.html#GTK-CLIST-GET-SELECTION-INFO

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 14 Feb 2000, Martin Preishuber wrote:

 Hi,
 
 just playing with drag and drop to CLists and CTrees and there's some
 strange thing. I've done something like:
 
 list.connect("drag_data_received", DragReceiveList)
 
 def DragReceiveList(clist, context, x, y, data, info, time):
 selection = clist.get_selection_info(x, y)
 
 so this should return row,col of the current selection. The bad
 thing is, that it returns (0,x) for the title of the clist,
 (1,x) for the first element of the clist and None for the last
 element, which is wrong IMHO.
 
 any ideas ?
 
 Martin
 
 -- 
 Martin Preishuber - Student, ECLiPt Core Member, SysAdmin
 http://eclipt.uni-klu.ac.at,
 mailto:[EMAIL PROTECTED]
 
 The luck that is ordained for you will be coveted by others.
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Can somebody explain the libglade OO paradigm?

2000-02-11 Thread James Henstridge

What you want is a dictionary of the method objects.  The class dictionary
will not do (as that contains unbound methods, where the self parameter
must be explicitely passed.

The instance dictionary also will not do, as it does not contain the
methods either.  You would want to use some code something like:
  dict = {}
  for key in dir(self.__class__):
dict[key] = getattr(self, key)

This will give the bound methods that you can autoconnect with.

I know it is not perfect, but it should do what you want.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Thu, 10 Feb 2000, Daniel Kornhauser wrote:

 
 Hi I'm making a gnome-hello example for my pygtutorial 
 http://laguna.fmedic.unam.mx/~daniel/pygtutorial/
 and I'm stuck with the libglade example.
 I'm trying to do a gnome-hello like the one in my tutorial but with glade.
 
 My problem is the following:
 When I autoconect a handler, the handle is called ONLY with the callback
 argument and the instance reference isn't passed at all.
 
 PLEASE run the unfinished example I attached to see what I mean.
 Select the menu "help" and clik in "about".
 
 The example just instances a GnomeApp with a buton and menus.
 My problem comes when I want to show a GnomeAbout I made with glade.
 I try to do this selecting "about" in the "help" menu.
 Even if I am in the SAME class the "on_about_cb" method can't reference
 the  self.wtree which I need to show the GnomeAbout widget.
 This is because the "on_about_cb" method only recieves the
 argument callback but not the instance reference.
 --- partial code --
 class Application:
 def __init__(self):
   self.hello = Hello() 
 self.wtree = libglade.GladeXML('gnome-hello.glade')
 print "I instance self.wtree",self.wtree
 self.wtree.get_widget('app').connect("destroy", mainquit) 
 print "***Here is the dictionary ot the instance were I can see\
 self.wtree"
 print(self.__dict__)
 print "Here is the dictionary of the class were I can see\
 on_about_cb"
 print(Application.__dict__)
 self.wtree.signal_autoconnect(Application.__dict__)
 
 def on_about_cb(self,*args):
 print "This should contain the instance directory like in\
 ***",self
 print "This should contain the widget",args
 #self.wtree.get_widget('about_cb').show()
 --
 
 The following code prints when I activate the "about..." menu:
 
 --
 I instance self.wtree libglade.GladeXML instance at 81cfb40
 
 ***Here is the dictionary ot the instance were I can see self.wtree
 {'wtree': libglade.GladeXML instance at 81cfb40, 'hello':
 __main__.Hello instance at 8209a50}
 
 Here is the dictionary of the class were I can see on_about_cb
 {'__init__': function __init__ at 81f20e0, '__doc__': None,
 'on_about_cb': function on_about_cb at 8209a88, '__module__':
 '__main__'}
 
 This should contain the instance directory like in *** gtk.GtkBin
 instance at 8263f98
 
 This should contain the pixmap ()
 ---
 
 What I'm I doing wrong?
 
 Note:
 I'm not following the SkelImpl.py example because I don't understand his
 Object Oriented paradigm. Methods should be with the class they belong to,
 not all together in one "GladeHandlers" class.
 
 Thanks
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Width of a widget?

2000-02-11 Thread James Henstridge

What do you want?  The widget's prefered minimum size?  If so, use:
  width, height = widget.size_request()

To get the actual allocated size of the widget, use:
  x, y, width, height = widget.get_allocation()

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Fri, 11 Feb 2000, Stephan R.A. Deibel wrote:

 OK, this is pretty basic, but if I have an instance of gtk.GtkVBox I can't
 say x.width... it says Attribute Error.
 
 Shouldn't this be defined for all GtkWidgets?  Is there some other way to
 get at this info?
 
 Thanks,
 
 - Stephan
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] button and application

2000-02-10 Thread James Henstridge

How did you start the other application?  If you are using os.system()
then what you are seing is the correct behaviour -- the parent process
suspends until the child dies.  If you don't want this behaviour, you will
need to do the fork/exec yourself.

Something like this:
  pid = os.fork()
  if pid  0:
  print "Some error occured during the fork"
  sys.exit(1)
  else if pid == 0:
  # child
  os.exec(...) # whatever the arguments are supposed to be
  # anything after this point is only executed if os.exec fails
  os._exit(1)  # not sys.exit()
  # parent process continues execution here

You will also have to do something about reaping the child process when it
dies.  This is done by setting up a SIGCHLD handler (using the signal
module (which has nothing to do with GTK signal handling).  If you care
about the return value of the child process, the signal handler should be
a function that calls os.wait().  If you don't care about the return
value, use signal.SIG_IGN as the signal handler.

The reason for using os._exit() rather than sys.exit() in the child is
that after the fork, the parent and child are sharing file descriptors.
If the child exits, then it will tell the X server that it is finished
with its connection, breaking the connection for the parent as well.  This
is avoided by calling os._exit().

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Thu, 10 Feb 2000 [EMAIL PROTECTED] wrote:

 Hello,
 
   I would like to launch another application (named B) when I click on a
 button. I coded this, but since B is not closed, my python-gtk
 application is freezed. Did I missed something ?
 
 Thanks.
 -- 
 ..
 .^. | Didier Bretin, France | [EMAIL PROTECTED]|
 /V\ |---| www.informactis.com|
// \\|   `|
   /(   )\   | Visit: http://www.multimania.com/cieexcalibur/ |
^^-^^`'
 
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] pyglade/libglade ignores default-width/default-height ?

2000-01-31 Thread James Henstridge

I suppose I should put in a message stating that the pyglade module is
deprecated.  It is probably better to use the libglade module, which uses
libglade rather than being pure python.  It handles the default_width and
default_height attributes correctly.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Sun, 30 Jan 2000, Kelly Lynn Martin wrote:

 I've got a teeny .glade file (written as I try to figure out glade and
 company) that has distinctly different behaviour when I build it as a
 glade project vs. running it in libglade with glade.py frm the
 examples/ directory.  The pyglade version ignores the default window
 size specifications and doesn't connect some of my signals the way
 glade does.  Is this me using glade wrong, or is this a pyglade
 deficiency?
 
 The .glade file is appended.
 
 Kelly
 
 ?xml version="1.0"?
 GTK-Interface
 
 project
   nameGlade-hello/name
   program_nameglade-hello/program_name
   directory/directory
   source_directorysrc/source_directory
   pixmaps_directorypixmaps/pixmaps_directory
   languageC/language
   gnome_supportFalse/gnome_support
   gettext_supportTrue/gettext_support
   use_widget_namesFalse/use_widget_names
   output_main_fileTrue/output_main_file
   output_support_filesTrue/output_support_files
   output_build_filesTrue/output_build_files
   backup_source_filesTrue/backup_source_files
   main_source_fileinterface.c/main_source_file
   main_header_fileinterface.h/main_header_file
   handler_source_filecallbacks.c/handler_source_file
   handler_header_filecallbacks.h/handler_header_file
   support_source_filesupport.c/support_source_file
   support_header_filesupport.h/support_header_file
   translatable_strings_file/translatable_strings_file
 /project
 
 widget
   classGtkWindow/class
   namewindow1/name
   cxx_use_heapTrue/cxx_use_heap
   signal
 namedelete_event/name
 handlergtk_widget_destroy/handler
 last_modification_timeSat, 29 Jan 2000 04:23:33 GMT/last_modification_time
   /signal
   signal
 namedestroy/name
 handleron_window1_destroy/handler
 last_modification_timeSat, 29 Jan 2000 04:30:05 GMT/last_modification_time
   /signal
   titlewindow1/title
   typeGTK_WINDOW_TOPLEVEL/type
   positionGTK_WIN_POS_NONE/position
   modalFalse/modal
   default_width100/default_width
   default_height100/default_height
   allow_shrinkTrue/allow_shrink
   allow_growTrue/allow_grow
   auto_shrinkTrue/auto_shrink
 
   widget
 classGtkButton/class
 namebutton1/name
 cxx_use_heapTrue/cxx_use_heap
 can_focusTrue/can_focus
 signal
   nameclicked/name
   handlergtk_widget_destroy/handler
   objectwindow1/object
   last_modification_timeSat, 29 Jan 2000 04:24:01 GMT/last_modification_time
 /signal
 labelHello World/label
   /widget
 /widget
 
 /GTK-Interface
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] PyGTK development status

2000-01-22 Thread James Henstridge

On Sat, 22 Jan 2000, Gerald Gutierrez wrote:

 Hi all.
 
 The last release of pygtk was from a while ago. Previous to that the
 releases were fairly frequent. Is this because pygtk is fairly complete
 now and there isn't much more to do, or have things just slowed down
 around here lately?
 

We should be making another release of pygtk and gnome-python some time
soon.  I have been away on holiday for the last three weeks, and did not
have access to my mail or my work machine.  I have to go through some of
the patches I was sent, then it should be alright to make a new release.

James.

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] How do I get the row count from a CList/CTree?

1999-12-15 Thread James Henstridge

You would use the GtkCTree.node_moveto function.  You probably want
something like:
  ctree.node_moveto(node, 0, 0.5, 0.0)

The second argument is a column number, the third is the vertical row
alignment, and the last is the column alignment (I used 0.0 to put the 0th
column at the left of the display).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On 15 Dec 1999, Andreas Degert wrote:

 John Ehresman [EMAIL PROTECTED] writes:
 
 Another question about CLists: is there a good way to set the focus
 row to a given position, even on C level? The only way I have found is
 to emit a scroll_vertical signal with SCROLL_JUMP, which expects a
 relative value (0..1) for the postion; you need the number rows to
 calculate this value.
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] Pygtk: gtk_gl_area_swapbuffers/swap_buffers

1999-12-08 Thread James Henstridge

I wrote the gtkglarea wrapper based on what was in cvs back in july.  It
will compile against the version of gtkglarea in CVS, which has the
swapbuffers function marked as deprecated, so I used swap_buffers.  The
gtkglarea guy has not released a new version since then, which is why the
current python gtkglarea wrapper fails.

I think there is a snapshot of the newer gtkglarea available on the
author's web site which should work.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Wed, 8 Dec 1999, Scott James wrote:

 
 I'm trying to get some of the examples in the pygtk "gl" directory
 under version 0.6.3.
 
 I'm running on Solaris 2.6 with Mesa 3.0, using gtkglarea-1.2.1 and
 PyOpenGL-1.5.5.  
 
 My problem is that pygtk-0.6.3 seems to reference
 
gtk_gl_area_swap_buffers
 
 in gtkgl_impl.c
 
 whereas in gtkglarea-1.2.1, the actual function is named:
 
gtk_gl_area_swapbuffers
 
 resulting in
 
 james@flanders python dots.py
 Traceback (innermost last):
   File "dots.py", line 13, in ?
 import gtkgl
   File "/opt/gnu/lib/python1.5/site-packages/gtkgl.py", line 1, in ?
 import _gtkgl
 ImportError: ld.so.1: python: fatal: relocation error: file 
/opt/gnu/lib/python1.5/site-packages/_gtkglmodule.so: symbol 
gtk_gl_area_swap_buffers: referenced symbol not found
 
 Changing the pygtk code to reference "swapbuffers" gets a little further
 but results in:
 
 james@flanders python dots.py
 Use the mouse buttons to control some of the dots.
 Bus Error (core dumped)
 
and
 
 james@flanders python gears.py
 initfuncCalled = 0
 Traceback (innermost last):
   File "gears.py", line 182, in idle
 draw(glarea)
   File "gears.py", line 176, in draw
 glarea.swap_buffers()
   File "/opt/gnu/lib/python1.5/site-packages/gtkgl.py", line 43, in swap_buffers
 _gtkgl.gtk_gl_area_swap_buffers(self._o)
 AttributeError: gtk_gl_area_swap_buffers
 Traceback (innermost last):
   File "/opt/gnu/lib/python1.5/site-packages/gtk.py", line 120, in __call__
 ret = apply(self.func, a)
   File "gears.py", line 176, in draw
 glarea.swap_buffers()
   File "/opt/gnu/lib/python1.5/site-packages/gtkgl.py", line 43, in swap_buffers
 _gtkgl.gtk_gl_area_swap_buffers(self._o)
 AttributeError: gtk_gl_area_swap_buffers
 
 
 Ideas?
 To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



<    1   2   3   4   5   6   7   >