Re: [pygtk] what documentation?

2004-05-17 Thread Igor Stroh
gabor wrote:
...
i know about the gtk (the C versio) documentation..
is there a reference like documentation specially for pygtk?
Yes, I usually use this one:
http://www.moeraki.com/pygtkreference/pygtk2reference/
HTH,
Igor
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Problem with TreeView.scroll_to_cell()

2004-05-10 Thread Igor Stroh
David M. Cook wrote:
On Fri, May 07, 2004 at 03:27:33PM +0200, Igor Stroh wrote:


treeview.scroll_to_cell(path, col, gtk.TRUE, 0.5, 0)


Try putting the scroll_to_cell in a idle_add call:

gtk.idle_add(treeview.scroll_to_cell, path, col, gtk.TRUE, 0.5, 0)
Thanks for your replies guys, the problem was my own code: I accidently
doubled all entries of the appropriate TreeStore before calling 
scroll_to_cell()...

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


[pygtk] TreeModelFilter.set_visible_func()

2004-05-10 Thread Igor Stroh
Hi there,

it seems that the above method is not wrapped in 2.3.91, though it shows
up in gtk/gtk.defs. Does anyone know how to patch the pygtk source
to make it available?
Greetings,
Igor
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Problem with TreeView.scroll_to_cell()

2004-05-07 Thread Igor Stroh
Hi there,

I can't force a TreeView entry to be scrolled into view, that's how I do it:

selected = 
selection = treeview.get_selection()
selection.select_iter(selected)
path = tree.get_path(selected)
col = treeview.get_column(1)
treeview.scroll_to_cell(path, col, gtk.TRUE, 0.5, 0)
the TreeView seems to be scrolled, but not "far enough", i.e. I don't 
see the
selected entry in the middle of the TreeView (encapsulated in a 
ScrolledWindow).
What's the problem here, any hints?

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


[pygtk] weird TreeView problem (not covered by FAQ)

2004-05-04 Thread Igor Stroh
Hi there,

I've encountered a weird behaviour with ListStore + TreeView. The 
situation is
as followed (simplified a bit):
Two buttons, A and B trigger the display of two different lists in a 
TreeView (ListStore
model). Button A should display a rather big list (say 200 items), 
button B - a short
one (10 items). The ListStore is clear()'ed before the list items are 
appended to the
model. Now comes the funny part: if I click on A and right after that 
(before all items
from A are "loaded" into the TreeView) on B, I see a TreeView with two 
mixed lists.
Items from A on top followed by items from B. Is there any way to "lock" 
the TreeView
somehow, so it doesn't work like described above?
Here's the code snippet that's responsible for displaying list items:

def showHosts(self, iterator, data, hide_unused=gtk.FALSE):
g = self.__gui
d = self.__db
treeview = g.get('hosts_treeview')
# disconnect the model from treeview to ensure consistent display
treeview.set_model(None)
g.HostsList.clear()
if hide_unused:
method = d.getUsedHosts
msg = 'Getting used hosts...'
else:
method = d.getAllHosts
msg = 'Getting all hosts...'
total = int(data.address.len())
g.pstart()
g.pfirst(0, msg, total)
for host in method(data):
backgr, foregr = self.__getStatusColors(host)
row = (host,
   host.address,
   host.comment,
   host.status[0],
   host.revlookup,
   host.timestamp,
   backgr,
   foregr)
g.pstep()
g.HostsList.append(row)
g.pstop()
# reconnect model again
treeview.set_model(g.HostsList)
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] pygtk2 and Tkinter

2003-11-17 Thread Igor Stroh
On Mo, 2003-11-17 at 14:34, Christian Robottom Reis wrote:
> On Mon, Nov 17, 2003 at 09:30:44AM +0100, Igor Stroh wrote:
> > 
> > top = gtk.Window()
> > while gtk.events_pending():
> >   gtk.main_iteration(block=gtk.FALSE)
> > do_something()
> > top.show_all()
> > top.mainloop()
> > 
> 
> Look into the gtk.timeout_add() function, it does exactly what you want.
> There's a FAQ entry on it.

Great! Works like a charm :)

Muchos gracias,
Igor
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] pygtk2 and Tkinter

2003-11-17 Thread Igor Stroh
Hi there,

trying to port a Tkinter program[0] to pygtk2 I ran into a problem:
I replaced this Tkinter code:


top = Tk()
top.title(title)
top.after_idle(do_something) # see [1] for details
top.mainloop()


with following pygtk2 code


top = gtk.Window()
while gtk.events_pending():
  gtk.main_iteration(block=gtk.FALSE)
do_something()
top.show_all()
top.mainloop()



Can anyone prove it to be identical to Tkinter stuff?

[0]: Tk.VerboseUI for offlineimap
[1]: from
http://twisted.sourceforge.net/TwistedDocs-1.0.4alpha1/api/private/Tkinter.Misc.html#after_idle

after_idle(self, func, *args) 
Call FUNC once if the Tcl main loop has no event to process.

Return an identifier to cancel the scheduling with after_cancel.

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


Re: [pygtk] Using an image as "background"

2003-11-13 Thread Igor Stroh
Hi,

On Mi, 2003-11-12 at 22:21, Morten Heiberg wrote:

[setting background pixmaps]

I'm not sure if I understood your problem correctly, but maybe this will
help (replace gtk.Window with appropriate Widget class):

iconsdir = './icons'
imagename = 'image.png'

win = gtk.Window()
path = os.path.join(iconsdir, imagename)
pixbuf = gtk.gdk.pixbuf_new_from_file(path)
pixmap, mask = pixbuf.render_pixmap_and_mask()
width, height = pixmap.get_size()
del pixbuf
win.set_app_paintable(gtk.TRUE)
win.resize(width, height)
win.realize()
win.window.set_back_pixmap(pixmap, gtk.FALSE)
del pixmap

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


Re: [pygtk] TreeView accessing every row of my custom TreeModel?

2003-11-06 Thread Igor Stroh
Hi,

On Mi, 2003-11-05 at 22:51, Jeffrey C. Ollie wrote:

> I'm implementing a custom TreeModel to display the contents of a large
> debug file.  Things are working very well, except that when the model is
> first assigned to the view, the view walks through every row in the
> model before displaying!  This makes the initial display very slow! 
> Once the initial display is completed scolling around in the view is
> very fast.  I wrote the custom TreeModel to avoid reading & parsing
> every line in the file until the line actually needed displaying.  Is
> this the normal behavior of a TreeView or is there a bug somewhere?

I don't think so. I have an app where I display data from an LDAP tree
using the vanilla TreeStore & TreeView. The scrolling is pretty fast,
although I have more then 500 in average. Maybe it's because I assign
the data for the child nodes (if any) on the fly, i.e. when a parent
node is beeng expanded...

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


Re: [pygtk] PyGTK is just great.

2003-10-22 Thread Igor Stroh
On Fri, 2003-09-26 at 20:03, Michal Pasternak wrote:

> I am using PyGTK 2 on NetBSD and Win32 and I must say, that it is just
> great. Everything works fine, using glade I can develop GUI very fast,
> TreeViews are the best thing I have ever seen in a GUI library and the API
> makes a lot more sense, than wxWindows (I have used wx before). 

Full ACK.

I started developing with pygtk2 'cos I had to port a pygtk1.2 tool for
my company. The whole thing turned into a complete rewrite (because of
heavy use of TreeViews), and I finished much more earlier then I thought
I would :) Even better, as I saw how easy it is to develop stuff with
glade and pygtk2, I started to write an LDAP-Browser/-Editor[0] which is
almost done by now (I spent only one week implementing the basic
features).

Great work guys, keep it up!

[0]: it should replace GQ, which imho, is pretty ugly :)

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


Re: [pygtk] libglade.XML.signal_autoconnect() problems

2003-10-22 Thread Igor Stroh
On Fri, 2003-09-26 at 15:32, Christian Reis wrote:
> On Mon, Sep 15, 2003 at 01:19:21PM +0200, Igor Stroh wrote:
> > is there any way to find out the signal handler ids for sig.handlers
> > that were connected to widgets using signal_autoconnect() from
> > libglade.XML?
> 
> http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.008.htp

That's a new entry, it wasn't there at the time I asked :)
However, I already do it this way (like described in FAQ), I just wanted
to know if there's a more "elegant" method...

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


[pygtk] Problems adding submenu

2003-10-08 Thread Igor Stroh
Hi there,

here's the problem: I have an app with a menubar and a popup-menu.
Certain submenus of the popup-menu and the menu-bar are similar, so I
decided to build this submenu only once using ItemFactory and attach it
to the appropriate MenuItems upon startup, but it doesn't work. Here's a
code sample:

def __setupMenus(self):
menu = self.get_widget('edit_menu') # gtk.MenuItem
factory = self.__makeEditSubmenu()  # gtk.ItemFacory
submenu = factory.get_widget('') # gtk.Menu
submenu.show_all()
menu.set_submenu(submenu)

I get no warnings or errors when I run this piece of code, but I don't
see any submenu entries if I activate the edit MenuItem. If I create the
submenu the "hard" way, everything works just fine:

def __setupMenus(self):
menu = self.get_widget('edit_menu')
submenu = gtk.Menu()
item = gtk.MenuItem('foo')
submenu.add(item)
submenu.show_all()
menu.set_submenu(submenu)

If I `print submenu` at the bottom of the method, I get the same
__repr__ for both, the gtk.Menu and the one generated by ItemFactory.
I also tried to submenu.reparent(menu), but that gave me a bunch of
assertion errors, so I guess it's not the right way either...

What's wrong here?

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


[pygtk] GnomeEntry and events

2003-09-30 Thread Igor Stroh
Hi all,

I'm looking for an event that's fired by a GnomeEntry widget when an
entry is selected from the history list. Something like
'selection_changed' from GtkCombo->GtkList. I mean I could connect the
'changed' signal to the widget, but then it would be fired each time the
user types something into the Entry...
I searched for this topic on the net, and the only hit was an archived
posting from this list dated to April(?) 2001 with no reply.

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


Re: [pygtk] check button callbacks

2003-09-29 Thread Igor Stroh
On Mon, 2003-09-29 at 14:51, liquid wrote:
...
> def callback(self, widget, data=None):
>a = "%s" % ((3, 4)[widget.get_active()])
>

add 'global a' to callback():
def callback(self, widget, data=None):
global a
a = "%s" % ((3, 4)[widget.get_active()]

However, using global variables is bad style, why don't you make 'a' a
class variable?

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


[pygtk] libglade.XML.signal_autoconnect() problems

2003-09-24 Thread Igor Stroh
Hi there,

is there any way to find out the signal handler ids for sig.handlers
that were connected to widgets using signal_autoconnect() from
libglade.XML?
The problem is, I have an application with several dialogs that contain
gtk.Entry widgets, all those widgets are connect()'ed to the same signal
handler. Now I'd like to widget.handler_block() the 'changed' signal at
some time, but this method requires a signal handler id as parameter. So
the question is, does libglade (or gtk itself) offer some way to
retrieve the signal ids from widgets the're connected to?

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


[pygtk] libglade.XML.signal_autoconnect() problems

2003-09-15 Thread Igor Stroh
Hi there,

is there any way to find out the signal handler ids for sig.handlers
that were connected to widgets using signal_autoconnect() from
libglade.XML?
The problem is, I have an application with several dialogs that contain
gtk.Entry widgets, all those widgets are connect()'ed to the same signal
handler. Now I'd like to widget.handler_block() the 'changed' signal at
some time, but this method requires a signal handler id as parameter. So
the question is, does libglade (or gtk itself) offer some way to
retrieve the signal ids from widgets the're connected to?

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