[#43299] Ruby implementation Q's — justinj@... (Justin Johnson)

Apologies in advance for this meaty posting:

30 messages 2002/07/01

[#43358] (0..3) == (0...4) returning false? — Massimiliano Mirra <list@...>

Is there a reason for two ranges holding the same extension but

41 messages 2002/07/02

[#43416] Segmentation Fault - Ruby Garbage Collection — James Eric Birmingham <avenger@...>

During load testing of our Ruby program, we have been getting

22 messages 2002/07/02

[#43570] self_parent — Tom Sawyer <transami@...>

i was wondering what others thought of the idea of having a built in

47 messages 2002/07/04
[#43571] Re: self_parent — David Alan Black <dblack@...> 2002/07/04

Hello --

[#43584] Re: self_parent — Tom Sawyer <transami@...> 2002/07/04

all my real examples are pretty large, mostly to do with using the REXML

[#43628] Re: self_parent — Massimiliano Mirra <list@...> 2002/07/05

On Fri, Jul 05, 2002 at 07:49:09AM +0900, Tom Sawyer wrote:

[#43662] Re: self_parent — Tom Sawyer <transami@...> 2002/07/05

On Fri, 2002-07-05 at 05:31, Massimiliano Mirra wrote:

[#43705] Re: self_parent — Austin Ziegler <austin@...> 2002/07/05

On Sat, 6 Jul 2002 03:32:11 +0900, Tom Sawyer wrote:

[#43713] Re: self_parent — Michael Campbell <michael_s_campbell@...> 2002/07/05

> In ten years of professional software development, a good chunk of

[#43602] is there a better string.each? — Tyler Spivey <tspivey8@...>

well, i have a bit of a problem:

98 messages 2002/07/05
[#43606] Re: is there a better string.each? — Tom Sawyer <transami@...> 2002/07/05

a = "canada"

[#43644] Re: is there a better string.each? — Sean Russell <ser@...> 2002/07/05

Tom Sawyer wrote:

[#43645] Re: is there a better string.each? — Michael Campbell <michael_s_campbell@...> 2002/07/05

> > thought it was strange myself. personally i'd like it if String

[#43707] Re: is there a better string.each? — Sean Russell <ser@...> 2002/07/05

Hal E. Fulton wrote:

[#43714] Re: is there a better string.each? — Michael Campbell <michael_s_campbell@...> 2002/07/05

[#43774] Re: is there a better string.each? — Sean Russell <ser@...> 2002/07/06

Michael Campbell wrote:

[#43805] Re: is there a better string.each? — Michael Campbell <michael_s_campbell@...> 2002/07/07

[#43848] Re: is there a better string.each? — "Hal E. Fulton" <hal9000@...> 2002/07/07

----- Original Message -----

[#43611] Powered by Ruby (logo) — Davey <davey@...>

Hey,

23 messages 2002/07/05

[#43780] passing to objects at the bottom — Tom Sawyer <transami@...>

i have a chain of objects such that one object contains another which

17 messages 2002/07/06

[#43795] Pre-RCR... nil.empty? — Dave Thomas <Dave@...>

34 messages 2002/07/07
[#43799] Re: Pre-RCR... nil.empty? — David Alan Black <dblack@...> 2002/07/07

Hi --

[#43807] unshifting a directory onto ENV['PATH'] — Bil Kleb <W.L.Kleb@...>

Is there a more elegant (compact?) method than

16 messages 2002/07/07

[#43916] How to determine EOF with sysread? — Jim Freeze <jim@...>

Hi:

13 messages 2002/07/08

[#43943] SV: SV: [ANN] Archive 0.2 — Thomas Søndergaard <tsondergaard@...>

DQo+IFRoYW5rcy4gOi0pIEknbSBub3QgdGVycmlibHkgaW4gaHVycnkgdG8gYWRkIFppcCBzdXBw

13 messages 2002/07/08

[#43944] Re: is there a better string.each? — George Ogata <g_ogata@...>

Hi,

45 messages 2002/07/08
[#43959] Re: is there a better string.each? — Austin Ziegler <austin@...> 2002/07/08

On Mon, 8 Jul 2002 20:43:57 +0900, George Ogata wrote:

[#43949] for ... else ... end — "Kontra, Gergely" <kgergely@...>

Hi!

45 messages 2002/07/08
[#44103] Re: for ... else ... end — Sean Russell <ser@...> 2002/07/09

Yukihiro Matsumoto wrote:

[#44107] Re: for ... else ... end — "Kontra, Gergely" <kgergely@...> 2002/07/09

For the keyword war: (silly, dummy example)

[#43957] Redirecting standard error — Gilles Filippini <gilles.filippini@...>

Hi,

13 messages 2002/07/08

[#44019] String#split converts string args to regexes -- ? — David Alan Black <dblack@...>

Hello --

41 messages 2002/07/08
[#44104] Re: String#split converts string args to regexes -- ? — kasal@... (Stepan Kasal) 2002/07/09

Hallo,

[#44137] Re: String#split converts string args to regexes -- ? — matz@... (Yukihiro Matsumoto) 2002/07/09

Hi,

[#44209] Re: String#split converts string args to regexes -- ? — kasal@... (Stepan Kasal) 2002/07/10

Hallo,

[#44212] Re: String#split converts string args to regexes -- ? — David Alan Black <dblack@...> 2002/07/10

Hi --

[#44265] spliter of for...each: looping — Tom Sawyer <transami@...>

when looping, using each, i find i am often wonton of a few nice

24 messages 2002/07/10
[#44266] Re: spliter of for...each: looping — David Alan Black <dblack@...> 2002/07/10

Hello --

[#44268] Re: spliter of for...each: looping — Tom Sawyer <transami@...> 2002/07/10

hmmm...

[#44270] Re: spliter of for...each: looping — David Alan Black <dblack@...> 2002/07/10

Hi --

[#44272] Re: spliter of for...each: looping — Tom Sawyer <transami@...> 2002/07/10

david,

[#44275] Re: spliter of for...each: looping — David Alan Black <dblack@...> 2002/07/10

Hi --

[#44282] Re: spliter of for...each: looping — Tom Sawyer <transami@...> 2002/07/11

each_with_nindex, rocking! i'll throw that in my library, for sure.

[#44289] Re: spliter of for...each: looping — David Alan Black <dblack@...> 2002/07/11

Hi --

[#44296] RE: Commercial Support for Ruby — "Berger, Daniel" <djberge@...>

> Hi Everyone,

18 messages 2002/07/11

[#44312] opengl — Tom Sawyer <transami@...>

can any one give me some help installing the opengl interface library? i

22 messages 2002/07/11
[#44316] Re: opengl — Dossy <dossy@...> 2002/07/11

On 2002.07.12, Tom Sawyer <transami@transami.net> wrote:

[#44320] Re: opengl — Tom Sawyer <transami@...> 2002/07/11

just did apt-get mesag-dev. still the same thing:

[#44387] Dynamic Methods — "John" <nojgoalbyspam@...>

Hi all,

29 messages 2002/07/12
[#44402] Re: Dynamic Methods — "John" <nojgoalbyspam@...> 2002/07/12

Wow! Thanks Dave!

[#44408] Re: Dynamic Methods — Michael Campbell <michael_s_campbell@...> 2002/07/12

[#44415] Re: Dynamic Methods — "John" <nojgoalbyspam@...> 2002/07/13

> (What do you propose if more than one possibility matches, by the

[#44425] hey! where's #count? — Tom Sawyer <transami@...>

i went to count the number of equal objects in an array and discoverd

24 messages 2002/07/13
[#44515] Re: hey! where's #count? — "Christoph" <chr_news@...> 2002/07/14

"Tom Sawyer" wrote

[#44516] Re: hey! where's #count? — Philipp Meier <meier@...> 2002/07/14

On Sun, Jul 14, 2002 at 11:41:55PM +0900, Christoph wrote:

[#44517] RE: hey! where's #count? — "Christoph" <crippel@...> 2002/07/14

[#44482] instance_eval — "John" <nojgoalbyspam@...>

Hi all,

14 messages 2002/07/13

[#44618] RE: TkText no -textvariable workaround? — "J.Hawkesworth" <J.Hawkesworth@...>

I think what Tom is after is a neat way to have the widget's display

41 messages 2002/07/16
[#44621] RE: TkText no -textvariable workaround? — Tom Sawyer <transami@...> 2002/07/16

On Tue, 2002-07-16 at 09:08, J.Hawkesworth wrote:

[#44622] Re: TkText no -textvariable workaround? — Dossy <dossy@...> 2002/07/16

On 2002.07.17, Tom Sawyer <transami@transami.net> wrote:

[#44626] Re: TkText no -textvariable workaround? — Tom Sawyer <transami@...> 2002/07/16

actually, Dossy, your post was a bit helpful. what i'm after also sort

[#44628] Re: TkText no -textvariable workaround? — Dossy <dossy@...> 2002/07/16

On 2002.07.17, Tom Sawyer <transami@transami.net> wrote:

[#44734] Syntax "surprise" — "David Douthitt" <DDouthitt@...>

I don't know if this qualifies as a real "surprise", but it was to me. I h=

39 messages 2002/07/17

[#44788] Selling ruby to my boss — Francis Hwang <sera@...>

So I've just started working as the sole programmer at a non-profit

22 messages 2002/07/18

[#44829] Q: "print usage_msg, exit 1 if error_flag" does not work — kwatch@... (kwatch)

Hi,

15 messages 2002/07/18
[#44831] Re: Q: "print usage_msg, exit 1 if error_flag" does not work — ts <decoux@...> 2002/07/18

>>>>> "k" == kwatch <kwatch@lycos.jp> writes:

[#44832] Re: Q: "print usage_msg, exit 1 if error_flag" does not work — Hugh Sasse Staff Elec Eng <hgs@...> 2002/07/18

On Thu, 18 Jul 2002, ts wrote:

[#44833] Re: Q: "print usage_msg, exit 1 if error_flag" does not work — ts <decoux@...> 2002/07/18

>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:

[#44855] Ruby in MacOSX 10.2 (Jaguar) — Luc Heinrich <lucsky@...>

It now seems to be "official" that Ruby will come by default with the next iteration of MacOSX.

12 messages 2002/07/18

[#44893] amrita 0.8.1 — Taku Nakajima <tnakajima@...>

Amrita is a a html/xhtml template library for Ruby.

22 messages 2002/07/19

[#44920] Objective C backend for Ruby? — "James F.Hranicky" <jfh@...>

While people are kicking around ideas for new backends for Ruby,

24 messages 2002/07/19

[#44985] GUI's and the Rouge, Part II — Tom Sawyer <transami@...>

in part one of this message i mention the problem of non-POLS and

72 messages 2002/07/20
[#45161] Re: GUI's and the Rouge, Part II — patrick-may@... (Patrick May) 2002/07/23

Ned Konz <ned@bike-nomad.com> wrote in message news:<200207201125.13528@ned.bike-nomad.com>...

[#45241] Re: GUI's and the Rouge, Part III (yes, finally) 1/2 — Tom Sawyer <transami@...> 2002/07/23

a bit of an intro: my original thought on the matter of making a

[#45246] Re: GUI's and the Rouge, Part III (yes, finally) 1/2 — Albert Wagner <alwagner@...> 2002/07/24

Still looks like plain old Model-View-Controller to me. You've split the

[#45282] RE: GUI's and the Rouge, Part III (yes, finally) 1/2 — "Curt Hibbs" <curt@...> 2002/07/24

Tom Sawyer wrote:

[#45287] RE: GUI's and the Rouge, Part III (yes, finally) 1/2 — Steve Tuckner <STUCKNER@...> 2002/07/24

What about WX-Windows. There is no ruby bindings for it, but would that fit

[#45300] RE: GUI's and the Rouge, Part III (yes, finally) 1/2 — Tom Sawyer <transami@...> 2002/07/24

On Wed, 2002-07-24 at 08:39, Steve Tuckner wrote:

[#45314] Re: GUI's and the Rouge, Part III (yes, finally) 1/2 — Wayne Vucenic <wvucenic@...> 2002/07/24

Hi Tom,

[#45364] RE: GUI's and the Rouge, Part III (yes, finally) 1/2 — "Curt Hibbs" <curt@...> 2002/07/25

Wayne Vucenic wrote:

[#45416] wxWindows for ruby — "repeater" <repeater@...> 2002/07/25

> Wayne Vucenic wrote:

[#44994] Learning Japanese — "John" <nojgoalbyspam@...>

Inspired to learn to read Japanese due to a lot of information on Ruby being

12 messages 2002/07/20

[#45044] Install troubles — Jim Freeze <jfreeze@...>

Hi:

13 messages 2002/07/21
[#45051] Re: Install troubles — Chris Gehlker <gehlker@...> 2002/07/21

On 7/21/02 12:13 PM, "Jim Freeze" <jfreeze@freebsdportal.com> wrote:

[#45085] ruby-dev summary 17696-17713 — Minero Aoki <aamine@...>

Hi all,

28 messages 2002/07/22
[#45090] rdtool and rdoc — Dave Thomas <Dave@...> 2002/07/22

Minero Aoki <aamine@mx.edit.ne.jp> writes:

[#45118] Re: rdtool and rdoc — "David Douthitt" <DDouthitt@...>

I took a look at your comparison page. I've not used either, but some thin=

16 messages 2002/07/22

[#45136] Strings and member-operators — the Bare <grrr@...>

Hi:

22 messages 2002/07/22
[#45140] Re: Strings and member-operators — Dossy <dossy@...> 2002/07/23

On 2002.07.23, the Bare <grrr@wild.net> wrote:

[#45148] Re: Strings and member-operators — David Alan Black <dblack@...> 2002/07/23

Hi --

[#45173] Re: Strings and member-operators — Dossy <dossy@...> 2002/07/23

On 2002.07.23, David Alan Black <dblack@candle.superlink.net> wrote:

[#45175] Re: Strings and member-operators — David Alan Black <dblack@...> 2002/07/23

Hi --

[#45198] Re: Strings and member-operators — George Ogata <g_ogata@...> 2002/07/23

Hello,

[#45201] Re: Strings and member-operators — David Alan Black <dblack@...> 2002/07/23

Hi --

[#45206] Re: Strings and member-operators — Tom Sawyer <transami@...> 2002/07/23

let me get this straight? is the original question how to strip a string

[#45257] Re: GUI's and the Rouge, Part III (yes, finally) 1/2 — Benjamin Peterson <bjsp123@...>

>you have this super application you wrote --the

11 messages 2002/07/24

[#45269] Can I get data back from a fork? — Jim Freeze <jfreeze@...>

Hi:

15 messages 2002/07/24

[#45286] Re: GUI's and the Rouge, Part III (yes, finally) 1/2 — Benjamin Peterson <bjsp123@...>

>its really just SOC on aanother level.

10 messages 2002/07/24

[#45368] Re: [OT] Re: GUI's and the Rouge, Part III (yes, finally) 1/2 — Benjamin Peterson <bjsp123@...>

>The functionality of a spreadsheet had been around

39 messages 2002/07/25
[#45476] Re: curses dev kit, was Re: [OT] Re: GUI's and the Rouge — Thomas Dickey <dickey@...> 2002/07/26

clemens fischer <ino-waiting@gmx.net> wrote:

[#45480] Re: curses dev kit, was Re: [OT] Re: GUI's and the Rouge — Massimiliano Mirra <list@...> 2002/07/26

On Fri, Jul 26, 2002 at 07:51:25PM +0900, Thomas Dickey wrote:

[#45422] Singleton Classes & thread safety — David King Landrith <dave@...>

I'm a bit new to Ruby, so please excuse me if this is a simplistic=20

24 messages 2002/07/25
[#45425] Re: Singleton Classes & thread safety — Ned Konz <ned@...> 2002/07/25

On Thursday 25 July 2002 02:06 pm, David King Landrith wrote:

[#45427] Re: Singleton Classes & thread safety — David King Landrith <dave@...> 2002/07/25

On Thursday, July 25, 2002, at 05:26 PM, Ned Konz wrote:

[#45430] Re: Singleton Classes & thread safety — Ned Konz <ned@...> 2002/07/25

On Thursday 25 July 2002 02:44 pm, David King Landrith wrote:

[#45431] How do you think of... — Michael Campbell <michael_s_campbell@...> 2002/07/25

This is going to sound like an odd question, and there's no "right"

[#45429] Opinion on Ruby maturity, the missing things — "Paul E.C. Melis" <paul@...>

Hello all,

18 messages 2002/07/25
[#45440] Re: Opinion on Ruby maturity, the missing things — John Carter <john.carter@...> 2002/07/25

On Fri, 26 Jul 2002, Paul E.C. Melis wrote:

[#45465] Ruby-Talk Index — Tom Sawyer <transami@...>

here's a one nighter coding challange for some one feeling the need to

17 messages 2002/07/26
[#45466] Re: Ruby-Talk Index — matz@... (Yukihiro Matsumoto) 2002/07/26

Hi,

[#45467] Re: Ruby-Talk Index — Tom Sawyer <transami@...> 2002/07/26

On Thu, 2002-07-25 at 23:50, Yukihiro Matsumoto wrote:

[#45621] Seattle.rb meeting tomorrow (7/30) — Pat Eyler <pate@...>

Just a quick reminder that we'll be meeting tomorrow night at 7:00 PM at

11 messages 2002/07/29

[#45644] FormatR 1.06 — Paul Rubel <rubel@...>

A new release of FormatR is out, 1.06. FormatR provides perl-like

37 messages 2002/07/30

[#45688] Ruby Language Q's — "Justin Johnson" <justinj@...>

76 messages 2002/07/30
[#45689] Re: Ruby Language Q's — Dave Thomas <Dave@...> 2002/07/30

"Justin Johnson" <justinj@mobiusent.com> writes:

[#45690] Re: Ruby Language Q's — ts <decoux@...> 2002/07/30

>>>>> "D" == Dave Thomas <Dave@PragmaticProgrammer.com> writes:

[#45723] Syntax proposal — Massimiliano Mirra <list@...>

I often write things like this:

12 messages 2002/07/30

[#45737] ActiveRubyScript and RubyAEOSA — Chris Gehlker <gehlker@...>

I just discovered ActiveRubyScript (sometimes written as two words) by

14 messages 2002/07/30
[#45742] Re: ActiveRubyScript and RubyAEOSA — "Hal E. Fulton" <hal9000@...> 2002/07/30

----- Original Message -----

[#45768] RE: A very basic tail -f implementation — "Berger, Daniel" <djberge@...>

> From: Paul Brannan [mailto:pbrannan@atdesk.com]

12 messages 2002/07/30

[#45799] Question about GetoptLong — Patrick Bennett <patrick.bennett@...>

I'm trying to recreate a Perl script in Ruby and have run into a problem.

22 messages 2002/07/31

[#45829] Unicode in Ruby now? — Tobias Peters <tpeters@...>

I've read the thread "Unicode in Ruby's Future?" [ruby-talk: 40016]. It

52 messages 2002/07/31
[#45840] Re: Unicode in Ruby now? — matz@... (Yukihiro Matsumoto) 2002/07/31

Hi,

[#45954] Re: Unicode in Ruby now? — Tobias Peters <tpeters@...> 2002/08/01

On Wed, 31 Jul 2002, Yukihiro Matsumoto wrote:

[#45960] Re: Unicode in Ruby now? — Curt Sampson <cjs@...> 2002/08/01

On Thu, 1 Aug 2002, Tobias Peters wrote:

[#45969] Re: Unicode in Ruby now? — Alexander Bokovoy <a.bokovoy@...> 2002/08/01

On Thu, Aug 01, 2002 at 07:53:07PM +0900, Curt Sampson wrote:

[#45973] Re: Unicode in Ruby now? — Curt Sampson <cjs@...> 2002/08/01

On Thu, 1 Aug 2002, Alexander Bokovoy wrote:

[#45979] Re: Unicode in Ruby now? — Alexander Bokovoy <a.bokovoy@...> 2002/08/01

On Thu, Aug 01, 2002 at 09:55:48PM +0900, Curt Sampson wrote:

[#45982] Re: Unicode in Ruby now? — Curt Sampson <cjs@...> 2002/08/01

On Thu, 1 Aug 2002, Alexander Bokovoy wrote:

[#45993] Re: Unicode in Ruby now? — Alexander Bokovoy <a.bokovoy@...> 2002/08/01

On Thu, Aug 01, 2002 at 11:23:38PM +0900, Curt Sampson wrote:

[#46042] Re: Unicode in Ruby now? — Curt Sampson <cjs@...> 2002/08/02

On Fri, 2 Aug 2002, Alexander Bokovoy wrote:

[#46260] Re: Unicode in Ruby now? — Clifford Heath <cjh_nospam@...> 2002/08/04

Curt Sampson wrote:

[#46266] Re: Unicode in Ruby now? — Curt Sampson <cjs@...> 2002/08/05

On Mon, 5 Aug 2002, Clifford Heath wrote:

[#46281] Re: Unicode in Ruby now? — Clifford Heath <cjh_nospam@...> 2002/08/05

Curt Sampson wrote:

[#45922] Re: Unicode in Ruby now? — Clifford Heath <cjh_nospam@...> 2002/08/01

Matz,

[#45931] Re: Unicode in Ruby now? — Curt Sampson <cjs@...> 2002/08/01

On Thu, 1 Aug 2002, Clifford Heath wrote:

[#45859] matrix challange — Daniel Bretoi <lists@...>

15 messages 2002/07/31

[#45876] Emacs is dead, long live whatever comes after that as long as it is made with Ruby — Jani Alanko <jani.alanko@...>

Subject is not exactly right but I was too lazy to invent something that

13 messages 2002/07/31

Re: GUI's and the Rouge, Part III (grand finally) 2/2

From: Tom Sawyer <transami@...>
Date: 2002-07-25 01:37:18 UTC
List: ruby-talk #45334
has anyone gotten a chance to take a look at the GUtopIa code yet?

there's something very strange about it. something i can't figure out. i
mean i wrote it and all, but i never explictly told it how to update the
widget when the object changes. yet it does! how? i keep coming back to
this and looking for some place in the code that does it, but i can't
find it. very spooky.

~transami


On Tue, 2002-07-23 at 18:31, Tom Sawyer wrote:
> well, i just read over my last post. sorry about all the typos. i needed
> a break and didn't bother to proofread. but i'm sure you can make out
> what i was trying to say where i blurbed. okay, now to the good stuff! 
> 
> i spent the last few days hacking out the first steps in the creation of
> a super-duper ruby gui api, which i have dubbed GUtopIa (thanks rich).
> just to kick things off here's a small clip of one of my examples (note
> MyModels is drawn from an unshown require):
> 
>   INTERFACE = 'PDA'
>   fruitapp = FruitApp.new
>   mygui = GUtopIa::GUI.new('Fruity Fun Time')
>   names = {
>     'awindow' => fruitapp.appname,
>     'aradio'  => fruitapp.fruitbasket.name
>   }
>   bindings = {
>     fruitapp.fruitbasket.name => { 
>       :value        => Proc.new { fruitapp.fruit.isa },
>       :value=       => Proc.new { |x| fruitapp.fruit.isa = x },
>       :items        => Proc.new { fruitapp.fruitbasket.contains },
>       :event_change => Proc.new { fruitapp.pickafruit }
>     }
>   }
>   model = MyModels.pick_model(mygui, INTERFACE)
>   mygui.transaction(bindings, names, &model)
>   mygui.build
> 
> the idea is that you take an instance of your application (FruitApp in
> this case), completely untouched --you don't have to add or change a
> single line of code (unless you want too ;-) you then create a model. a
> model (not shown in example) is an executable description of the fixed
> aspects of your gui. it has no references to any part of your app
> (although you can do so if you don't care about SOC) it is a completely
> independent entity and as such can be reused in other fitting contexts.
> you can also draw on multiple sub-models. then you create a binding (as
> seen above). this describes how an instance of your application
> "interfaces" with your model. and then presto out comes you gui-ized
> app.
> 
> also note that GUtopIa uses a transaction mechinism. this effectivly
> bundles an executable model into a single execution. not only does this
> increase speed, but also offers a means to rollback the effects of a
> transaction should there be an error, adding much greater stability to
> your gui-ized application.
> 
> some other things to note: bindings are actually integrated directly
> into the class models of the widgets. when a widget is created it is
> subclassed into a specialized class of that widget which includes
> methods to react to the bindings described.
> 
> i've attached my work thus far so you can checkout all of this in
> detail. be sure to run example.rb (the snipet above) and check out
> orig-example.rb, which is a non-SOC version of the original Rouge/Utopia
> example. then check out gutopia.rb which is the heart of the matter.
> 
> so that's the the word on implementation. i've taken the advice of
> others and i have worked out what i think is shaping up to be the best
> gui api design in existence. Curt Hibbs has offered me a wiki for this
> project. (thanks curt) i will take him up on it. now i hope i can get
> YOU enthused enough to help. there's real potential here, to not only
> create an awsome gui api for ruby that is unique and powerful, but also
> create a full-fledge game sdk! this thing looks to be awesome indeed.
> 
> i need people to take on a few tasks. a ruby wrapper needs to be created
> for ClanLib and we need to build a Themes and Behaviors manager. someone
> needs to hack out the communications layer (i've tried it with DRb and
> ROMP but they bomb). and i could use some help finishing off the main
> api. if we can pull together on this, ruby, our favorite little
> scripting language, will have its very own GUI to rival all others!
> 
> as you might be able to tell, i'm very excited! i hope you are too!
> 
> thanks for your time and hope to hear from you,
> 
> ~transami :-)
> 
> 
> ----
> 

> # GUtopIa Example - Application Layer
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> class FruitApp
>   attr_accessor :appname
>   attr_reader :fruitbasket, :fruit, :basketname
>   def initialize
>     @appname = 'Fruity Fun'
>     @fruitbasket = FruitBasket.new
>     @fruit = Fruit.new
>   end
>   def pickafruit
>     puts "You got a #{@fruit.isa}!"
>   end
> end
> 
> class FruitBasket
>   attr_accessor :name, :contains
>   def initialize
>     @name = 'Fruit Basket'
>     @contains = ["None", "Apple", "Orange", "Banana"]
>   end
> end
> 
> class Fruit
>   attr_accessor :isa
>   def initialize
>     @isa = "None"
>   end
> end
> ----
> 

> # GUtopIa Daemon Example - Client
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'drb'
> require 'example-app'
> require 'example-pre'
> 
> 
> # Configure interface
> 
> INTERFACE = 'PDA'
> puts "\nINTERFACE: #{INTERFACE}\n"
> 
> 
> # Make GUI App
> 
> fruitapp = FruitApp.new
> 
> DRb.start_service()
> mygui = DRbObject.new(nil, 'druby://localhost:8080')
> 
> names = {
>   'awindow' => fruitapp.appname,
>   'aradio'  => fruitapp.fruitbasket.name
> }
> 
> bindings = {
>   fruitapp.fruitbasket.name => { 
>     :value        => Proc.new { fruitapp.fruit.isa },
>     :value=       => Proc.new { |x| fruitapp.fruit.isa = x },
>     :items        => Proc.new { fruitapp.fruitbasket.contains },
>     :event_change => Proc.new { fruitapp.pickafruit }
>   }
> }
> 
> model = MyModels.pick_model(mygui, INTERFACE)
> 
> mygui.transaction(bindings, names, &model)
> 
> mygui.build
> 
> 
> # Run some tests
> 
> puts
> puts "MYGUI "
> p mygui
> 
> puts
> puts "MYGUI WIDGETS"
> mygui.widgets.each_key do |k|
>   puts k
> end
> 
> puts
> puts "THE WINDOW"
> p mygui.widgets[fruitapp.appname].class.superclass
> puts "name: #{fruitapp.appname}"
> puts "width: #{mygui.widgets[fruitapp.appname].width}"
> puts "height: #{mygui.widgets[fruitapp.appname].height}"
> 
> puts
> puts "THE RADIO"
> p mygui.widgets[fruitapp.fruitbasket.name].class.superclass
> puts "name: #{fruitapp.fruitbasket.name}"
> puts "items: #{mygui.widgets[fruitapp.fruitbasket.name].items.join(', ')}"
> puts "value: #{mygui.widgets[fruitapp.fruitbasket.name].value}"
> 
> puts
> puts
> puts "TRY OUT!"
> puts
> puts "Current state of fruit and its widget:"
> puts "fruit=#{fruitapp.fruit.isa}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Changing widget to: #{mygui.widgets[fruitapp.fruitbasket.name].value = 'Banana'}"
> puts "fruit=#{fruitapp.fruit.isa}"
> puts
> puts "Changing fruit to: #{fruitapp.fruit.isa = 'Orange'}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Trigger event_change event:"
> mygui.widgets[fruitapp.fruitbasket.name].event_change
> puts
> puts "Changing fruit to: #{fruitapp.fruit.isa = 'Apple'}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Changing widget to: #{mygui.widgets[fruitapp.fruitbasket.name].value = 'Banana'}"
> puts "fruit=#{fruitapp.fruit.isa}"
> 
> puts
> ----
> 

> # GUtopIa Example - Models
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'gutopia'
> 
> module MyModels
> 
>   def MyModels.pick_model(gui, which)
>     case which
>     when 'PC'
>       return MyModels.pc_model(gui)
>     when 'PDA'
>       return MyModels.pda_model(gui)
>     end
>   end
> 
>   private
> 
>   # PC model using serial notatation (slower)
>   def MyModels.pc_model(gui)
> 
>     Proc.new {
>   
>       # RadioBox
>       r = gui.widgetFactory(:RadioBox, 'aradio')
> 
>       # Window
>       w = gui.widgetFactory(:Window, 'awindow')
>       w.width = 640
>       w.height = 400
>       w.grid = [ [ r ] ]
>     
>     }
> 
>   end
> 
>   # PDA model using parallel notation (faster)
>   def MyModels.pda_model(gui)
> 
>     Proc.new {
>   
>       # RadioBox
>       r = gui.widgetFactory(:RadioBox, 'aradio')
> 
>       # Window
>       w = gui.widgetFactory(:Window, 'awindow',
>         :width  => 320,
>         :height => 240,
>         :grid => [ [ r ] ]
>       )
>       
>     }
>     
>   end
> 
> end  # MyModels
> ----
> 

> # GUtopIa Daemon Example - Client
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'romp/romp'
> require 'example-app'
> require 'example-pre'
> 
> 
> # Configure interface
> 
> INTERFACE = 'PDA'
> puts "\nINTERFACE: #{INTERFACE}\n"
> 
> 
> # Make GUI App
> 
> fruitapp = FruitApp.new
> 
> client = ROMP::Client.new('tcpromp://localhost:8080')
> mygui = client.resolve('gutopia-romp')
> 
> names = {
>   'awindow' => fruitapp.appname,
>   'aradio'  => fruitapp.fruitbasket.name
> }
> 
> bindings = {
>   fruitapp.fruitbasket.name => { 
>     :value        => Proc.new { fruitapp.fruit.isa },
>     :value=       => Proc.new { |x| fruitapp.fruit.isa = x },
>     :items        => Proc.new { fruitapp.fruitbasket.contains },
>     :event_change => Proc.new { fruitapp.pickafruit }
>   }
> }
> 
> model = MyModels.pick_model(mygui, INTERFACE)
> 
> mygui.transaction(bindings, names, &model)
> 
> mygui.build
> 
> 
> # Run some tests
> 
> puts
> puts "MYGUI "
> p mygui
> 
> puts
> puts "MYGUI WIDGETS"
> mygui.widgets.each_key do |k|
>   puts k
> end
> 
> puts
> puts "THE WINDOW"
> p mygui.widgets[fruitapp.appname].class.superclass
> puts "name: #{fruitapp.appname}"
> puts "width: #{mygui.widgets[fruitapp.appname].width}"
> puts "height: #{mygui.widgets[fruitapp.appname].height}"
> 
> puts
> puts "THE RADIO"
> p mygui.widgets[fruitapp.fruitbasket.name].class.superclass
> puts "name: #{fruitapp.fruitbasket.name}"
> puts "items: #{mygui.widgets[fruitapp.fruitbasket.name].items.join(', ')}"
> puts "value: #{mygui.widgets[fruitapp.fruitbasket.name].value}"
> 
> puts
> puts
> puts "TRY OUT!"
> puts
> puts "Current state of fruit and its widget:"
> puts "fruit=#{fruitapp.fruit.isa}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Changing widget to: #{mygui.widgets[fruitapp.fruitbasket.name].value = 'Banana'}"
> puts "fruit=#{fruitapp.fruit.isa}"
> puts
> puts "Changing fruit to: #{fruitapp.fruit.isa = 'Orange'}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Trigger event_change event:"
> mygui.widgets[fruitapp.fruitbasket.name].event_change
> puts
> puts "Changing fruit to: #{fruitapp.fruit.isa = 'Apple'}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Changing widget to: #{mygui.widgets[fruitapp.fruitbasket.name].value = 'Banana'}"
> puts "fruit=#{fruitapp.fruit.isa}"
> 
> puts
> ----
> 

> # GUtopIa Example - Presentation
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'gutopia'
> require 'example-app'
> require 'example-pre'
> 
> 
> # Configure interface
> 
> INTERFACE = 'PDA'
> puts "\nINTERFACE: #{INTERFACE}\n"
> 
> 
> # Make GUI App
> 
> fruitapp = FruitApp.new
> 
> mygui = GUtopIa::GUI.new('Fruity Fun Time')
> 
> names = {
>   'awindow' => fruitapp.appname,
>   'aradio'  => fruitapp.fruitbasket.name
> }
> 
> bindings = {
>   fruitapp.fruitbasket.name => { 
>     :value        => Proc.new { fruitapp.fruit.isa },
>     :value=       => Proc.new { |x| fruitapp.fruit.isa = x },
>     :items        => Proc.new { fruitapp.fruitbasket.contains },
>     :event_change => Proc.new { fruitapp.pickafruit }
>   }
> }
> 
> model = MyModels.pick_model(mygui, INTERFACE)
> 
> mygui.transaction(bindings, names, &model)
> 
> mygui.build
> 
> 
> # Run some tests
> 
> puts
> puts "MYGUI "
> p mygui
> 
> puts
> puts "MYGUI WIDGETS"
> mygui.widgets.each_key do |k|
>   puts k
> end
> 
> puts
> puts "THE WINDOW"
> p mygui.widgets[fruitapp.appname].class.superclass
> puts "name: #{fruitapp.appname}"
> puts "width: #{mygui.widgets[fruitapp.appname].width}"
> puts "height: #{mygui.widgets[fruitapp.appname].height}"
> 
> puts
> puts "THE RADIO"
> p mygui.widgets[fruitapp.fruitbasket.name].class.superclass
> puts "name: #{fruitapp.fruitbasket.name}"
> puts "items: #{mygui.widgets[fruitapp.fruitbasket.name].items.join(', ')}"
> puts "value: #{mygui.widgets[fruitapp.fruitbasket.name].value}"
> 
> puts
> puts
> puts "TRY OUT!"
> puts
> puts "Current state of fruit and its widget:"
> puts "fruit=#{fruitapp.fruit.isa}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Changing widget to: #{mygui.widgets[fruitapp.fruitbasket.name].value = 'Banana'}"
> puts "fruit=#{fruitapp.fruit.isa}"
> puts
> puts "Changing fruit to: #{fruitapp.fruit.isa = 'Orange'}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Trigger event_change event:"
> mygui.widgets[fruitapp.fruitbasket.name].event_change
> puts
> puts "Changing fruit to: #{fruitapp.fruit.isa = 'Apple'}"
> puts "widget=#{mygui.widgets[fruitapp.fruitbasket.name].value}"
> puts
> puts "Changing widget to: #{mygui.widgets[fruitapp.fruitbasket.name].value = 'Banana'}"
> puts "fruit=#{fruitapp.fruit.isa}"
> 
> puts
> ----
> 

> # GUtopIa - ROMP Daemon
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'drb'
> require 'gutopia'
> 
> gutopia_drb = GUtopIa::GUI.new('DRb')
> 
> DRb.start_service('druby://localhost:8080', gutopia_drb)
> DRb.thread.join
> ----
> 

> # GUtopIa - ROMP Daemon
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'romp/romp'
> require 'gutopia'
> 
> gutopiad = GUtopIa::GUI.new('Romp')
> 
> server = ROMP::Server.new('tcpromp://localhost:8080', nil, true)
> server.bind(gutopiad, 'gutopia-romp')
> server.thread.join
> ----
> 

> # GUtopIa API
> # Copyright (c)2002 Thomas Sawyer, Ruby License
> 
> module GUtopIa
> 
>   # Returns a GUIFactory object
>   class GUI
> 
>     attr_reader :name, :widgets
> 
>     def initialize(name)
>       @name = name
>       #
>       @widgets = {}
>       @names = {}
>       @bindings = {}
>       @transactions = []
>     end
> 
>     # Method used to prefab GUI
>     def transaction(bindings={}, names={}, &model)
>       @names = names
>       @bindings = bindings
>       @transactions << Proc.new {
>         #commit
>         #begin
>           model.call #(self)
>           #commit
>         #rescue ScriptError
>           #rollback
>         #rescue StandardError
>           #rollback
>         #end
>       }
>     end
>     
>     # Method used to build GUI
>     #   This runs the all pending transactions
>     def build
>       @transactions.each do |transaction|
>         transaction.call(@bindings)
>       end
>       @transactions.clear  # all done with those
>     end
>   
>     # Widget Factory
>     #   Returns a new widget object of specialized widget class
>     def widgetFactory(widget, name, attributes={})
>       
>       # a widget string name will work too
>       widget = widget.intern if widget.is_a?(String)
>        
>       # makes an anoynomous class as subclass of desired widget
>       widgetClass = Class.new(GUtopIa.const_get(widget))
>     
>       # specialize class via bindings
>       if @bindings[@names[name] || name]
>         @bindings[@names[name] || name].each do |k, v|
>           widgetClass.class_eval {
>             define_method(k, v)
>           }
>         end
>       end
>         
>       w = widgetClass.new(attributes)
>       w.name = @names[name] || name
>       @widgets[w.name] = w
>       
>       return w
>       
>     end
> 
>     #
>     def alert(msg)
>       puts msg
>     end
> 
>     #
>     def stop
>       puts "stopping...#{@name}"
>       exit
>     end
> 
>     # Useful Class Methods?
>     
>     def GUI.screen_realestate
>       # { :height => , :width => , :depth => }
>     end
>     
>   end  # GUI
>   
>   
>   # Widgets
>   
>   # ToDo: add a whole bunch more super widgets :-)
>   #       attributes require validation
>   
>   class Widget
>     attr_accessor :name
>   end
>   
>   
>   class Window < Widget
>   
>     attr_accessor :height, :width, :colordepth, :flags
>     attr_accessor :caption, :icon, :background, :grid
>     
>     def initialize(attributes={})
>       @height = attributes[:height] ? attributes[:height] : 200
>       @width = attributes[:width] ? attributes[:width] : 200
>       @colordepth = attributes[:colordepth] ? attributes[:colordepth] : 16
>       @flags = attributes[:flags] ? attributes[:flags] : 0
>       @caption = attributes[:caption] ? attributes[:caption] : nil
>       @icon = attributes[:icon] ? attributes[:icon] : nil
>       @background = attributes[:background] ? attributes[:background] : nil
>       @grid = attributes[:grid] ? attributes[:grid] : []
>       #
>       super()
>     end
>   
>     def show
>       puts "showing window....#{@caption}"
>     end
>   
>     def hide
>       puts "hiding window...#{@caption}"
>     end
>     
>   end  # Window
> 
> 
>   class Panel < Widget
>   
>     attr_accessor :height, :width
>     attr_accessor :background, :grid
>     
>     def initialize(attributes={})
>       @height = attributes[:height] ? attributes[:height] : 200
>       @width = attributes[:width] ? attributes[:width] : 200
>       @background = attributes[:background] ? attributes[:background] : nil
>       @grid = attributes[:grid] ? attributes[:grid] : []
>       #
>       super()
>     end
>   
>   end  # Panel
> 
> 
>   class Label < Widget
>   
>     attr_accessor :text
>   
>     def initialize(attributes={})
>       @text = attributes[:text] ? attributes[:text] : nil
>       #
>       super()
>     end
>   
>   end  # Label
>   
> 
>   class TextField < Widget
>   
>     attr_accessor :text, :value
>   
>     def initialize(attributes={})
>       @text = attributes[:text] ? attributes[:text] : nil
>       @value = attributes[:value] ? attributes[:value] : nil
>       #
>       super()
>     end
>   
>   end  # TextField
> 
> 
>   class TextArea < Widget
>   
>     attr_accessor :text, :value, :cols, :lines
>   
>     def initialize(attributes={})
>       @text = attributes[:text] ? attributes[:text] : nil
>       @value = attributes[:value] ? attributes[:value] : nil
>       @cols = attributes[:cols] ? attributes[:cols] : nil
>       @lines = attributes[:lines] ? attributes[:lines] : nil
>       #
>       super()
>     end
>   
>   end  # TextArea
> 
> 
>   class Button < Widget
>   
>     attr_accessor :text
>     attr_accessor :event_pressed
>   
>     def initialize(attributes={})
>       @text = attributes[:text] ? attributes[:text] : nil
>       # events
>       @event_pressed = attributes[:event_pressed] ? attributes[:event_pressed] : nil
>       #
>       super()
>     end
>   
>   end  # Button
> 
> 
>   class RadioBox < Widget
>   
>     attr_accessor :value, :items
>     attr_accessor :event_change
>   
>     def initialize(attributes={})
>       @value = attributes[:value] ? attributes[:value] : nil
>       @items = attributes[:content] ? attributes[:content] : nil
>       # events
>       @event_change = attributes[:event_change] ? attributes[:event_change] : nil
>       #
>       super()
>     end
>   
>   end  # RadioBox
> 
>   
>   class MenuBar < Widget
>   
>     attr_accessor :items
>     
>     def initialize(attributes={})
>       @items = attributes[:items] ? attributes[:items] : nil
>       #
>       super()
>     end
>   
>   end  # MenuBar
>   
>   
>   class Menu < Widget
>   
>     attr_accessor :text, :items
>     
>     def initialize(attributes={})
>       @text = attributes[:text] ? attributes[:text] : nil
>       @items = attributes[:items] ? attributes[:items] : nil
>       #
>       super()
>     end
>   
>   end  # Menu
> 
> 
>   class MenuItem < Widget
>   
>     attr_accessor :text
>     attr_accessor :event_selected
>   
>     def initialize(attributes={})
>       @text = attributes[:text] ? attributes[:text] : nil
>       # events
>       @event_selected = attributes[:event_selected] ? attributes[:event_selected] : nil
>       #
>       super()
>     end
>   
>   end  # MenuItem
> 
> end  # GUtopIa
> ----
> 

> # GUtopIa Example - Presentation
> # Copyright (c) 2002 Thomas Sawyer, Ruby License
> 
> require 'gutopia'
> 
> app = GUtopIa::GUI.new('My Application')
> 
> # here you must refer to widgets with app.widgets['widget's name']
> bindings = {
>   'quit' => {
>     :event_selected => Proc.new {
>       app.stop
>     }
>   },
>   'about' => {
>     :event_selected => Proc.new { 
>       app.widgets['aboutWindow'].show
>     }
>   },
>   'submit' => { 
>     :event_pressed => Proc.new { 
>       app.alert("And the fruit is...#{app.widgets['favoriteFruit'].text}")
>       app.widgets['mainWindow'].hide
>       app.stop
>     }
>   },
>   'clear' => { 
>     :event_pressed => Proc.new {
>       app.widgets['favoriteFruit'].text = nil
>     }
>   },
>   'close' => {
>     :event_pressed => Proc.new {
>       app.widgets['aboutWindow'].hide
>     }
>   }
> }
> 
> # here you can refer to widgets with local name
> #   or the app.widgets['widget's name']
> app.transaction(bindings) {
>     
>   quit = app.widgetFactory(:MenuItem, 'quit',
>     :text => 'Quit'
>   )
>   about = app.widgetFactory(:MenuItem, 'about',
>     :text => 'About'
>   )
>   file = app.widgetFactory(:Menu, 'file',
>     :text => 'File',
>     :items => [ app.widgets['quit'] ]
>   )
>   help = app.widgetFactory(:Menu, 'help',
>     :text => 'Help',
>     :items => [ about ]
>   )
>   menu = app.widgetFactory(:MenuBar, 'menu',
>     :items => [ file, help ]
>   )
>   firstName = app.widgetFactory(:TextField, 'firstName',
>     :label => 'First Name',
>     :label_position => :left
>   )
>   lastName = app.widgetFactory(:TextField, 'lastName',
>     :label => 'Last Name',
>     :label_position => :left
>   )
>   favoriteFruit = app.widgetFactory(:TextArea, 'favoriteFruit',
>     :text => 'Banana',
>     :cols => 5,
>     :lines => 4,
>     :readonly => false,
>     :label => 'Favorite Fruit',
>     :label_position => :top
>   )
>   submit = app.widgetFactory(:Button, 'submit',
>     :text => 'Update',
>     :image => 'check.png'
>   )
>   clear = app.widgetFactory(:Button, 'clear',
>     :text => 'Clear'
>   )
>   fruit_panel = app.widgetFactory(:Panel, 'fruit_panel',
>     :grid => [ [ firstName     ],
>                [ lastName      ],
>                [ favoriteFruit ],
>                [ submit        ],
>                [ clear         ] ]
>   )
>   mainWindow = app.widgetFactory(:Window, 'mainWindow',
>     :caption => 'My Cool Window',
>     :icon => 'myIcon.ico',
>     :grid => [ [ menu        ],
>                [ fruit_panel ] ]
>   )
>   aboutLbl = app.widgetFactory(:Label, 'aboutLbl', 
>     :text => <<-DATA
>     This is a very cool application
>     that I created using the GUtopIa
>     GUI API.
>     DATA
>   )
>   close = app.widgetFactory(:Button, 'close',
>     :text => 'Close'
>   )
>   aboutWindow = app.widgetFactory(:Window, 'aboutWindow',
>     :caption => 'About My Cool App',
>     :grid => [ [ aboutLbl ],
>                [ close    ] ]
>   )
>   
> }
>     
> app.build
> 
> puts
> puts "select about from menu"
> app.widgets['about'].event_selected
> puts "click on close"
> app.widgets['close'].event_pressed
> puts "click on submit"
> app.widgets['submit'].event_pressed
> puts
-- 
~transami

In This Thread