[#2617] irb for 1.5.x — Andrew Hunt <Andy@...>
5 messages
2000/05/03
[#2639] OT: Japanese names — Dave Thomas <Dave@...>
4 messages
2000/05/09
[#2643] Ruby Toplevel — Dave Thomas <Dave@...>
7 messages
2000/05/09
[#2656] Re: Append alias for Array.append? — Aleksi Niemel<aleksi.niemela@...>
Hideto ISHIBASHI:
5 messages
2000/05/09
[#2660] win OLE / eRuby — Andrew Hunt <Andy@...>
8 messages
2000/05/09
[#2663] Re: win OLE / eRuby — Aleksi Niemel<aleksi.niemela@...>
>At Tue, 9 May 2000 09:14:51 -0400,
4 messages
2000/05/09
[#2667] The reference manual is now online — Dave Thomas <Dave@...>
6 messages
2000/05/09
[#2668] Re: The reference manual is now online — schneik@...
4 messages
2000/05/09
[#2702] Re: Append alias for Array.append? — Andrew Hunt <andy@...>
>From: Aleksi Niemel<aleksi.niemela@cinnober.com>
7 messages
2000/05/10
[#2752] RE: Array.pop and documentation [was: Append al ias for Array.append?] — Aleksi Niemel<aleksi.niemela@...>
6 messages
2000/05/11
[#2758] Re: irb install — Andrew Hunt <andy@...>
>|Excellent! Will you consider adding mod_ruby to install_app as
7 messages
2000/05/11
[#2777] Re: irb install
— "NAKAMURA, Hiroshi" <nakahiro@...>
2000/05/12
Hi,
[#2764] More code browsing questions — Albert Wagner <alwagner@...>
I see some class definitions contain "include" and "extend" statements.
6 messages
2000/05/12
[#2843] Re: editors for ruby — "Conrad Schneiker" <schneiker@...>
(Posted on comp.lang.ruby and ruby-talk ML.)
6 messages
2000/05/17
[#2874] RE: simple httpd for local use — Aleksi Niemel<aleksi.niemela@...>
> I personally use it for access to full-text indexed linux
6 messages
2000/05/18
[#2875] Re: simple httpd for local use
— hipster <hipster@...4all.nl>
2000/05/18
On Thu, 18 May 2000 09:10:28 +0200, Aleksi Niemelwrote:
[#2920] SWIG: virtual variable? — Yasushi Shoji <yashi@...>
hello,
4 messages
2000/05/22
[#2928] FYI: What our Python friends are up to. — "Conrad Schneiker" <schneiker@...>
Hi,
8 messages
2000/05/22
[#2964] Thank you — h.fulton@...
Thanks, Matz (and others) for your replies to
4 messages
2000/05/24
[#2973] Re: Socket.getnameinfo — ts <decoux@...>
>>>>> "D" == Dave Thomas <Dave@thomases.com> writes:
10 messages
2000/05/25
[#3016] rbconfig.rb — Dave Thomas <Dave@...>
5 messages
2000/05/28
[#3039] Re: Final for World Series: Python vs Ruby — "Dat Nguyen" <thucdat@...>
1 message
2000/05/30
[#3058] FailureClass? — Aleksi Niemel<aleksi.niemela@...>
Question arising from the FAQ:
7 messages
2000/05/31
[ruby-talk:03001] FYI: Re: Python, Glade, & GTK
From:
Conrad Schneiker <schneik@...>
Date:
2000-05-27 01:12:08 UTC
List:
ruby-talk #3001
This comp.lang.python post might be of some interest to those working on
or with Ruby/GTK. (Original had HTML; trying to send text only.)
Mitch Chapman wrote:
> Mafee wrote:
> > Can anyone give me some clues of linking python code to a GUI interface
> > generate by Glade or GTK or whatever please?
>
> Here's an example. Two files are attached.
>
> GladeBase.py provides two base classes. Class UI creates a widget
> hierarchy from a Glade file. Class Controller provides an
> MVC-style controller for the UI. The main() function of the module
> shows how to use these base classes to build and control a GUI.
>
> ui.glade is a simple user interface created using Glade. If you
> plop it into the same directory with GladeBase.py and then run
> GladeBase.py, you should get an application window on your display.
>
> The cool part about James Henstridge's libglade, on which this example
> is based, is the way it wires up callback routines. You pass it
> a dictionary of callable objects, keyed by name. It roots
> through the Glade-based user interface hierarchy, and for every
> connected signal declared in the interface, it looks for a callable
> of the same name in the callback dictionary. If it finds one,
> it plugs it in. It's cheap and easy.
>
> In the example, Controller._connectToUI() assumes that you will
> derive from class Controller and define all of the callback methods
> in the derived class.
>
> Hoping this helps...
>
> --
> Mitch Chapman
> chapman@bioreason.com
>
> ----------------------------------------------------------------
> #!/usr/bin/env python
> """This is an example of accessing Glade-built UIs from Python."""
> import gnome.ui, gtk, libglade
>
> class UI(libglade.GladeXML):
> """Base class for all UIs loaded from glade."""
> def __init__(self, filename, rootname):
> """Initialize a new instance."""
> libglade.GladeXML.__init__(self, filename=filename, root=rootname)
> self.root = self.get_widget(rootname)
>
> def show(self):
> """Make the UI visible."""
> self.root.show()
>
> class Controller:
> """Base class for all controllers of glade-derived UIs."""
> def __init__(self, ui):
> """Initialize a new instance. `ui' is the GladeXML UI to control."""
> self.ui = ui
> self._connectToUI()
>
> def _connectToUI(self):
> """Wire up self to its UI.
>
> This method assumes that any method defined by self's class
> could be a Gtk+ callback. It wires up any methods referenced by
> self's ui."""
> names = dir(self.__class__)
> d = {}
> for name in names:
> d[name] = getattr(self, name)
>
> self.ui.signal_autoconnect(d)
>
> def show(self):
> """Show the user interface."""
> self.ui.show()
>
> def main():
> """Module mainline (for standalone execution)"""
> class SampleController(Controller):
> def on_pushBtn_clicked(self, *args):
> """Called when the 'push me' button is clicked."""
> print "Thanks for pushing me."
> gtk.mainquit()
>
> def on_win_delete_event(self, *args):
> """Called when the window is deleted."""
> gtk.mainquit()
>
> theUI = UI("ui.glade", "win")
> theController = SampleController(theUI)
> theController.show()
> gtk.mainloop()
>
> if __name__ == "__main__":
> main()
>
> ----------------------------------------------------------------
> CreateWorkspacecreate_workspacesrcpixmapsCTrueTrueGtkWindowwindelete_eventon_win_delete_eventWed,
> 03 May 2000 00:16:13
> GMTGTK_WINDOW_TOPLEVELGTK_WIN_POS_NONEFalseFalseTrueFalseGtkVBoxvbox1False0GtkLabellabel1Go
> on, push the
> button.GTK_JUSTIFY_CENTERFalse0.50.5000FalseFalseGtkButtonpushBtnTrueclickedon_pushBtn_clickedMon,
> 22 May 2000 15:28:00 GMTPush Me0FalseFalse
--
Conrad Schneiker
(This note is unofficial and subject to improvement without notice.)