[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]



[pygtk] PyGnorba?

2000-02-15 Thread Randolph Fritz

Sigh...folks, I want to find out if the panel is running, so my
program can decide whether or not to be a Gnome applet.  Problem is,
this needs Gnorba, which doesn't seem to be included in gnome-python
release (1.50) that I have.  Am I looking in the wrong place?  Or
should I start writing a test module? :)

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



Re: [pygtk] Destroy event?

2000-02-15 Thread Randolph Fritz

On Mon, Feb 14, 2000 at 06:35:48AM -0700, Mitch Chapman wrote:
> You'll probably find that connecting to "delete_event" has the
> desired result.  I don't know why "destroy_event" doesn't work.
> 
> BTW if you do decide to connect to "delete_event" you'll need an extra
> argument:
> 
> def _kill(window, event, obj):
> print "Aaagh!"
> gtk.mainquit()
> 

That was exactly right.  Thank you.

> Also BTW thanks for showing how to use pdb.set_trace().  I don't
> use pdb much, and have been looking for a function which does what
> set_trace() seems to do.
> 

You're very welcome!  I sure hope the gud integration gets here soon.

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



Re: [pygtk] Hello, and `pygtk' reminder

2000-02-15 Thread Hrvoje Niksic

François Pinard <[EMAIL PROTECTED]> writes:

>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.
> 
> However, I do not run Gnome, and would prefer to not ought to change
> window managers as well.  A new language and a new design spirit is
> a lot already for the poor little me, I do not feel like embracing a
> new religion as well!  I tried both KDE and Gnome for a while, and
> returned to my previous habits, probably because I merely failed to
> quickly see the promised wonders. :-)
> 
> However, I repeatedly read on the `pygtk' mailing list archives that
> PyGnome (whatever it is :-) is the way to go, yet the same lists
> report a lot of build and unstability problems (but maybe I
> misinterpreted them?).

François, please note that pygtk does not require PyGnome to be used.
PyGnome is merely a superset of pygtk, providing wrappers for
Gnome-specific stuff, such as communication with panel, and the
additional Gtk widgets provided by Gnome.  (Also note that you needn't
switch window managers to run Gnome, but that's a different issue.)

I believe the glade bindings can be useful.  Gtk programming is
basically fun -- you explain to the engine the layout you want your
widgets to have, you connect their actions to callbacks, and watch
things happen.  With Python's lexical-scoping-like bound methods, it's
really not hard to get reasonable results.

The most tedious part of it all is configuring actual widget packing.
Take, for instance, a simple class that tries to configure a text
entry field along with "OK" and "Cancel".  It's totally trivial, and
should look like this:

class OpenDialog(gtk.GtkWindow):
def __init__(self, dispatchfun):
gtk.GtkWindow.__init__(self)
# ... setup the widgets ...

gtk_entry.connect("activate", self.open, entry, dispatchfun)
gtk_entry.connect("changed", self.change_hook)
button1.connect("clicked", self.open, dispatchfun)
button2.connect("clicked", self.destroy)

self.show_all()

def change_hook(self, widget):
if widget.get_text() == '':
self.ok_button.set_sensitive(gtk.FALSE)
else:
self.ok_button.set_sensitive(gtk.TRUE)

def open(self, widget, entry, dispatchfun):
text = entry.gtk_entry().get_text()
if text != '':
dispatchfun(text)
self.destroy()

Nice and simple, isn't it?  In reality, because I didn't bother to
learn to use libglade properly, it looks as below, a spaghetti of
getting the Gtk widgets to look nice.  *All* the additional code could
have been done within libglade, based on an XML file that the users
can edit.  My code would simply get the objects and work on them.  The
real code follows:

class OpenDialog(gtk.GtkWindow):
def __init__(self, dispatchfun):
gtk.GtkWindow.__init__(self)
self.set_border_width(5)
self.set_policy(gtk.TRUE, gtk.TRUE, gtk.FALSE)
gtk.quit_add_destroy(1, self)

vbox = gtk.GtkVBox()
self.add(vbox)

label = gtk.GtkLabel("Enter a URL to download it with Wget.")
label.set_alignment(0, 0.5) # No centering
label.set_padding(0, 5)
vbox.pack_start(label, expand = gtk.FALSE, fill = gtk.FALSE)

hbox = gtk.GtkHBox(spacing = 10)
vbox.pack_start(hbox, expand = gtk.FALSE, padding = 3)

hbox.pack_start(gtk.GtkLabel("Open:"), expand = gtk.FALSE, fill = gtk.FALSE)

entry = gnome.ui.GnomeEntry("OpenDialog")
gtk_entry = entry.gtk_entry()
gtk_entry.connect("activate", self.open, entry, dispatchfun)
gtk_entry.connect("changed", self.change_hook)
#gtk_entry.set_flags(gtk.HAS_DEFAULT | gtk.CAN_DEFAULT)
#gtk_entry.grab_default()
hbox.pack_start(entry)

vbox.pack_start(gtk.GtkHSeparator(), expand = gtk.FALSE, padding = 10)

alignment = gtk.GtkAlignment(0.5, 0.5, 1, 1)
vbox.pack_start(alignment, expand = gtk.FALSE)

bbox = gtk.GtkHButtonBox()
bbox.set_layout(gtk.BUTTONBOX_SPREAD)
alignment.add(bbox)

button = gnome.ui.GnomeStockButton(gnome.ui.STOCK_BUTTON_OK)
button.connect("clicked", self.open, dispatchfun)
button.set_flags(gtk.HAS_DEFAULT | gtk.CAN_DEFAULT)
#button.grab_default()
button.set_sensitive(gtk.FALSE)
bbox.pack_start(button)
self.ok_button = button

button = gnome.ui.GnomeStockButton(gnome.ui.STOCK_BUTTON_CANCEL)
button.connect("clicked", self.destroy)
bbox.pack_start(button)

def change_hook(self, widget):
if widget.get_text() == '':
self.ok_button.set_sensitive(gtk.FALSE)
else:
self.ok_button.set_sensitive(gtk.TRUE)

def open(self, widget, entr