On Wed, 05 Dec 2001 13:15:12 -0500
"Steve McClure" <[EMAIL PROTECTED]> wrote:

> realize is called when the dialog is first created.
> map is called each time show() is called.
> I believe the widget.show() method generates a map-event which 
> generates a map signal.  You can see that if you connect both 'map' and 
> 'map-event' to the dialog.
> 
> I use the map signal, not map-event, for dialogs to populate
> themselves then use this function instead of widget.show():
> 
>       def showDialog(self, dialogName, title = None):
>               d = self.wtree.get_widget(dialogName)
>               if title:
>                       d.set_title(title)
>               if d.flags(gtk.MAPPED) == 0:
>                       d.show()
>               else:
>                       d.get_window()._raise()
>                       # call map again so dialogs will refresh their contents
>                       return d.emit('map', d)

Cool!  Could you post to the list enough code that could be
run "out of the box" that demonstrates that?  I don't use
Classes at all (but have often thought about it) and am simply
unsure about how to best go about it.  In fact, let me make
that a more general question (for a more general audience):
could some of you explain how *you* use glade and/or gtk?
Do you use classes? Do you do things programmatically? Personally,
I use a wrapper that does (essentially) this:

import foo_handlers
wtree = libglade.GladeXML(filename)
try:
  foo_handlers.wtree = wtree
  foo_handlers.setup() # handles things like commandline, preps variables
  foo_handlers.wtree.signal_autoconnect(foo_handlers.__dict__)
  f = os.path.expanduser("~/.gtkrc-foo")
  if os.path.exists(f):
    gtk.rc_parse(f)
  foo_handlers.go() # eventually calls gtk.mainloop()
except:
  foo_handlers.on_exit() # eventually calls gtk.mainquit()
  raise
  sys.exit(1)

and foo_handlers is little more than support functions and

def on_button_foo_clicked(widget):
  blah blah blah

style.  No classes, etc...


-- 
Jon Nelson                \|/ ____ \|/   Gort,
[EMAIL PROTECTED]    "@'/ ,. \`@"   Klaatu
C and Python Programmer   /_| \__/ |_\   barada
Motorcycle Enthusiast        \__U_/      nikto.
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to