[pygtk] Re: Small bug in GnomeIconSelection

2000-02-21 Thread Juergen Ehrensberger

Hi,

after adding the missing return statement in GnomeIconSelection.get_icon (line
1045 in ui.py) the method works correctly if an icon has been selected.
However, if nothing is selected it gives a segmentation fault.

Cheers
Juergen



from gtk import *
from gnome.ui import *

def get_icon(button, iconSel):
print iconSel.get_icon()

win = GtkWindow()
win.connect("destroy", mainquit)
vbox = GtkVBox()

iconSel = GnomeIconSelection()
iconSel.add_directory('/usr/share/pixmaps')
iconSel.show_icons()
vbox.pack_start(iconSel, expand=TRUE)

button = GtkButton("OK")
button.connect("clicked", get_icon, iconSel)
vbox.pack_start(button)

win.add(vbox)
win.show_all()
mainloop()

-- 
_

 /  __  /  /  / Jürgen Ehrensberger
/  /   /  /  /  Laboratoire de Télécommunications
   /  /  /  /   Ecole Polytechnique Fédérale de Lausanne
  /  /  /  /1015 Lausanne, Switzerland
_/ _/ _/ _/ Tel:  +41 21 693 46 94, Fax: +41 21 693 26 83
Mail: [EMAIL PROTECTED]
_
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] How to use UIINFO_TOGGLEITEM

2000-02-21 Thread Juergen Ehrensberger

Hi all,

in a GnomeApp I created menus including a UIINFO_TOGGLEITEM. However, the
connected callback cannot determine the value of the toggle item, since it
receives a GtkObject of type GtkCheckMenuItem instead of the GtkCheckMenuItem
itself. Therefore the method call __getattr__("active") does not work. Is it
possible to access the GtkCheckMenuItem inside the GtkObject ? For GtkMenus
everything works just fine.

Cheers
Juergen


from gtk import *
from gnome.ui import *

def toggled(checkMenuItem):
print checkMenuItem
print checkMenuItem.__getattr__("active")

win = GnomeApp()
win.connect("destroy", mainquit)

# Gnome Menu
toggle_menu = [UIINFO_TOGGLEITEM("Toggle", cb=toggled)]
main_menu = [UIINFO_SUBTREE('GnomeMenu', toggle_menu)]
win.create_menus(main_menu)

# GtkMenu
vbox = GtkVBox()
gtkMenuBar = GtkMenuBar()
gtkMenuItem = GtkMenuItem("GtkMenu")
gtkSubMenu = GtkMenu()
gtkCheck = GtkCheckMenuItem("Toggle")
gtkCheck.connect("toggled", toggled)
gtkSubMenu.append(gtkCheck)
gtkMenuItem.set_submenu(gtkSubMenu)
gtkMenuBar.append(gtkMenuItem)
vbox.pack_start(gtkMenuBar, expand=TRUE)

win.set_contents(vbox)
win.set_usize(100,100)
win.show_all()
mainloop()

-- 
_

 /  __  /  /  / Jürgen Ehrensberger
/  /   /  /  /  Laboratoire de Télécommunications
   /  /  /  /   Ecole Polytechnique Fédérale de Lausanne
  /  /  /  /1015 Lausanne, Switzerland
_/ _/ _/ _/ Tel:  +41 21 693 46 94, Fax: +41 21 693 26 83
Mail: [EMAIL PROTECTED]
_
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] Small bug in GnomeIconSelection

2000-02-16 Thread Juergen Ehrensberger

Hi,

when trying the class GnomeIconSelection we realized that the method get_icon
does not return the filename of the selected icon since the return statement is
missing.

Cheers,
Juergen

-- 
_

 /  __  /  /  / Jürgen Ehrensberger
/  /   /  /  /  Laboratoire de Télécommunications
   /  /  /  /   Ecole Polytechnique Fédérale de Lausanne
  /  /  /  /1015 Lausanne, Switzerland
_/ _/ _/ _/ Tel:  +41 21 693 46 94, Fax: +41 21 693 26 83
Mail: [EMAIL PROTECTED]
_
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]