Creating a full application with Ruby

F

Fily Salas

Hi,

I have a desk-top application that I created using Actionscript 3.0 and
AIR, nothing fancy it just basically calculates the quantity of
rectangular parts that can fit in a bigger rectangular part based on the
user=E2=80=99s input, the thing is that it ALSO dynamically creates the =
actual
rectangles and show them on the screen based on the same factors and I
was wondering if this is something I can create with Ruby and may be
FXRuby, I do understand that Ruby is not meant for big application but
for something like this I think it would be nice to give it try since I
want to start working more with Ruby and this would be the perfect time
since I need to update the application.

I guess my question is what do I need to create full applications
because I have no doubt that it can be done with Ruby I just need to
know what tools do I need to create it?

What GUI can dynamically create objects?

I currently have FXRuby installed in my machine and I also bought the
book but when I go to their website it looks outdated and I=E2=80=99m won=
dering
if it would be worth it to learn it or is it even the right tool to
create the application I=E2=80=99m describing (see screen-shot).

Just to give you an idea in the attached screen shot I=E2=80=99m calculat=
ing how
many times I can fit a 15=E2=80=9Dx2=E2=80=9D part into a 60=E2=80=9Dx120=
=E2=80=9D

Thanks

Attachments:
http://www.ruby-forum.com/attachment/6115/calculator.JPG
http://www.ruby-forum.com/attachment/6116/calculator.JPG


-- =

Posted via http://www.ruby-forum.com/.=
 
7

7stud --

Fily Salas wrote in post #992154:
Hi,

I have a desk-top application that I created using Actionscript 3.0 and=
AIR, nothing fancy it just basically calculates the quantity of
rectangular parts that can fit in a bigger rectangular part based on th= e
user=E2=80=99s input, the thing is that it ALSO dynamically creates th= e actual
rectangles and show them on the screen based on the same factors and I
was wondering if this is something I can create with Ruby and may be
FXRuby, I do understand that Ruby is not meant for big application

The creators of the application Ruby on Rails would disagree with you.
but
for something like this I think it would be nice to give it try since I=
want to start working more with Ruby and this would be the perfect time=
since I need to update the application.

Then go for it.
I guess my question is what do I need to create full applications
because I have no doubt that it can be done with Ruby I just need to
know what tools do I need to create it?

What GUI can dynamically create objects?

All of them. You might want to check out Shoes, which is a simplistic =

gui toolkit that is easy to learn. See here:

http://shoesrb.com/manual/Art.html

I currently have FXRuby installed in my machine and I also bought the
book but when I go to their website it looks outdated and I=E2=80=99m w= ondering
if it would be worth it to learn it or is it even the right tool to
create the application I=E2=80=99m describing (see screen-shot).

Just to give you an idea in the attached screen shot I=E2=80=99m calcul= ating how
many times I can fit a 15=E2=80=9Dx2=E2=80=9D part into a 60=E2=80=9Dx1= 20=E2=80=9D

Thanks

I prefer wxRuby for gui applications, although drawing shapes is a =

little more involved than with Shoes.

-- =

Posted via http://www.ruby-forum.com/.=
 
J

jake kaiden

Fily Salas wrote in post #992154:
...was wondering if this is something I can create with Ruby and may be
FXRuby,
...What GUI can dynamically create objects?
...Just to give you an idea in the attached screen shot...

hi fily -

this looks like something you could do relatively easily with ruby -
give it a shot!
i agree that shoes is probably the easiest, though i really haven't
used it at all. i use gtk2 for gui's, and you can redraw shapes
relatively easily...

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Ruby/GTK
http://zetcode.com/tutorials/rubygtktutorial/cairo/#shapes

-j
 
F

Fily Salas

Thank you all for your reply.

It looks like Shoes is the easiest GUI but I'm a little afraid when I
dont have a book or something to learn from thats why I went with FXRuby
because it has a book, but since it looks like learning a GUI is like
learning a new language I want to make the right decision and stick with
one for a while.

I will give Shoes a try.

Excuse my ignorance but is it possible to make small animations with
Ruby? If yes, is this what the GUI is for?

When I say small animation I'm talking about mouse over transitions and
all the simple stuff NOT animations for banners or anything like that.

Do I need a separate program to package the application?

I usually get exited about being able to create an application using a
language like ruby, thats why I want to give it a try.


Thanks a lot
 
J

jake kaiden

Fily Salas wrote in post #992195:
is it possible to make small animations with
Ruby? If yes, is this what the GUI is for?

hi fily -

simple animations are easy with gtk2...
http://ruby-gnome2.sourceforge.jp/ja/hiki.cgi?Gdk::PixbufAnimation

for example:

require 'gtk2'

win = Gtk::Window.new()

anim = Gdk::pixbufAnimation.new("TradyBlix.gif")
image = Gtk::Image.new(anim)

win.add(image)
win.show_all

win.signal_connect("destroy"){Gtk.main_quit}

Gtk.main

"TradyBlix.gif" is a simple animation i made in gimp.

i don't know about animations with wxRuby, as i don't use it, but it's
probably also possible.

Do I need a separate program to package the application?

ruby apps can be made executable (so you don't have to type "ruby"
before the app name to run it... how you do that depends on your
system, and the target system - there's plenty of info with a google
search.

have fun...

-j
 
A

ashbb

[Note: parts of this message were removed to make it a legal post.]

Hi Fily,
I'm a little afraid when I dont have a book
How about the Shoes manual?

http://shoes.heroku.com/manual/Hello.html

or `Nobody Knows Shoes` (a big pdf file)

http://cloud.github.com/downloads/shoes/shoes/nks.pdf
I will give Shoes a try.
Cool!
If you have any questions, feel free to ask in Shoes ML.

http://shoes.heroku.com/current-progress
When I say small animation I'm talking about mouse over transitions
Umm,...

Try out the following snippet with your Shoes.
When the mouse enters the black oval, it'll change the color to red.

Shoes.app do
o = oval 100, 100, 100
o.hover{o.style fill: red}
end

Cheers,
ashbb
 
A

ashbb

[Note: parts of this message were removed to make it a legal post.]

Hi jake,

If you like both gtk2 and Shoes, how about Green Shoes? ;-)

http://rubygems.org/gems/green_shoes

Green Shoes is one of the colorful Shoes.
It is written in pure ruby with gtk2.

Cheers,
ashbb
 
F

Fily Salas

I was reading the documentation from the Shoes' website and it looks
simple but I was surprised because apparently you don't have to have
Ruby installed so I started wondering how is your code going to work
without Ruby?

Is Ruby embedded in Shoes?

Can you write your own code or you are limited to the the pre-built
functions from Shoes?

Thanks a lot for your help!
 
7

7stud --

Fily Salas wrote in post #992314:
I was reading the documentation from the Shoes' website and it looks
simple but I was surprised because apparently you don't have to have
Ruby installed so I started wondering how is your code going to work
without Ruby?

Please point us to what you are referring to.
 
F

Fily Salas

Please point us to what you are referring to.
Here.
http://shoes.heroku.com/manual/Installing.html

I have been reading the book "No Body Knows Shoes" and it seems to be
pretty simple and makes me wonder if shoes is really a complete GUI
program, or is simply for very simple stuff.

What are the limitation of using Shoes? I like it and even if there are
some limitations I will definitely give it a try.

Thanks a lot
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

Hey there! Maintainer of Shoes here!

You don't need to install Ruby because Shoes is like its own Ruby
distribution. It comes with a Ruby 1.9.1 built inside of it.
What are the limitation of using Shoes? I like it and even if there are
some limitations I will definitely give it a try.

The main limitation is that you can't use gems with C extensions. We've
included a few with Shoes: bloopsaphone, chipmunk, ftsearch, hpricot, json,
and squite3, but that's all you're going to get.

The second limitation is that Shoes can still be a bit strange in places.
I'm currently undergoing an effort to increase documentation and add tests,
but you can run into strange corners sometimes.

The last big limitation is that some larger Shoes programs can be a bit
unstable on Windows sometimes. I can't reproduce this myself, but Hackety
Hack (the largest Shoes program I know of) will just die on certain systems
after about 15 minutes of running. It has something to do with Ruby 1.9.1
and threads, and I'm working on it, but be aware of that. Smaller programs
seem to have no issues, and it's not on every system, just some.

With that said, Shoes is a lot of fun to code with, and you get all three
platforms for free, so... yeah!

Any other questions about Shoes, I'll be happy to answer them.
 
F

Fily Salas

Thank you for your reply!

I'm currently trying it and as I said its way too easy, I like it.

What would you considere a small-big program?

I also heard that with shoes you can not create menus, like File, Save
as, Version etc. is this true?


Thanks a lot!
 
A

ashbb

[Note: parts of this message were removed to make it a legal post.]

Hi Fily,
I also heard that with shoes you can not create menus,
like File, Save as, Version etc. is this true?
Umm,... No.
You can use list_box like this:

Shoes.app do
list_box items: %w[File Save Version]
end

Or, you can write your original menu method with image or shape
elements of Shoes. ;-)

You can find lots of way in the ShoeBox: http://the-shoebox.org/

Cheers,
ashbb
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]
I'm currently trying it and as I said its way too easy, I like it.

Glad to hear it. :)

What would you considere a small-big program?

I dunno, a couple of hundred lines? Check out Hackety Hack, for example:
https://github.com/hacketyhack/hacketyhack

I also heard that with shoes you can not create menus, like File, Save
as, Version etc. is this true?

Yes, we don't have a good solution for this yet. Basically, cross-platform
menus are hard to do right, since they end up looking different on every
platform... ashbb's suggestion is how most Shoes apps handle such things.
 
F

Fily Salas

Thank you all for your help!
You can find lots of way in the ShoeBox: http://the-shoebox.org/
Thank you for the link.
What would you considere a small-big program?
I dunno, a couple of hundred lines? Check out Hackety Hack, for example:
https://github.com/hacketyhack/hacketyhack



Are you saying that Hackety Hack is a perfect example of a program that
may unexpectedly quit after 15 minutes using it? Now, this is a Windows
problem only right?

Thanks
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]
Are you saying that Hackety Hack is a perfect example of a program that
may unexpectedly quit after 15 minutes using it?


heheh, yes, that may be what I'm referring to. :/ Working on it!

Now, this is a Windows
problem only right?

Yep. Flawless on my Mac and Linux. In fact, mostly flawless on my Windows,
too: it's only some configurations.
 
F

Fily Salas

Thank you for your help!

There are currently 19 users using the application I described im my
original post and a little worried about stability since they are all
Windows users, I know its a small application but it can create up to
50,000 rectangle shapes.

Could this be a problem if I create it using Shoes?

Now, is it even possible to pack and distribute an application created
in Shoes?

Thanks a lot!
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]
Could this be a problem if I create it using Shoes?

Only way to know for sure is to try. ;)

Now, is it even possible to pack and distribute an application created
in Shoes?

Absolutely! There should be a 'package an app' screen on the main shoes
screen. It'll give you a .exe of your app.
 
F

Fily Salas

Thanks a lot for your help!

I will try to create the app and see how it goes. Where can I ask future
questions about Shoes? I'm sure I will have some...

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top