Giter Site home page Giter Site logo

shoes4's Introduction

Shoes 4 Linux Build StatusWindows Build statusCode ClimateTest Coverage

Shoes 4 : the next version of Shoes

About Shoes

Shoes is a little DSL for cross-platform (Mac, Windows, and Linux) GUI programming. It feels like real Ruby, rather than just another C++ library wrapper. For some samples, the manual, and a free book, check out the Shoes website.

Basic Usage

Want to see what Shoes looks like? Well, here you go! Given the script:

Shoes.app width: 300, height: 200 do
  background lime..blue

  stack do
    para "Welcome to the world of Shoes!"
    button "Click me" do alert "Nice click!" end
    image "http://shoesrb.com/img/shoes-icon.png",
          margin_top: 20, margin_left: 10
  end
end

This results in the following application:

shoes 4 screenshot Linux

The look and feel will differ for your operating system, as Shoes 4 uses native widgets.

Some history about Shoes

Way way back in the day, there was a guy named _why. He created a project known as Hackety Hack to teach programming to everyone. In order to reach all corners of the earth, _why decided to make Hackety Hack work on Windows, Mac OS X, and Linux. This was a lot of work, and so _why decided to share his toolkit with the world. Thus, Shoes was born.

Preview Version

Hi there, thanks for checking by! Shoes 4 is in the preview stage. It currently supports almost all of the shoes DSL, but there are still some unsupported spots and known issues. We are now regularly releasing updated preview versions to rubygems, for easy installation. If you're not too adventurous just yet you can still use the old shoes!

Installing Shoes 4

There are two ways to get your hands on Shoes 4 - the preview gem release and installing it straight from github. For both you need a current JRuby installation.

We recommend using JRuby 9.X+, with the majority of our testing currently against 9.1. JRuby 1.7.x may work, but has been untested since 4.0.0.pre6.

Get a JDK and JRuby

So your first step is to install a JDK (shoes also works with OpenJDK) and JRuby. Make sure to grab the appropriate JRuby version for your operating system. On Linux/Mac you can also use ruby installation tools to install JRuby. For instance rvm:

$ rvm install jruby

JDK version note: JRuby version 9 requires a JDK version of 7 or 8 - JDK 9 does not yet work with JRuby and therefore not with Shoes. Also within the JDK major version make sure to have the latest updates installed, we had cases where newer versions resolved bugs.

SWT requirement: Be aware that Shoes 4 builds on SWT for its default backend. That is usually no concern (other than the need for JRuby/JDK, described above) as you do not have to install SWT yourself. However, that means we have the same basic system requirements SWT does. For Linux that means you need GTK+ >= 2.10 or >= 3.0 if you like. Moreover, as of now there is no ARM support (as the Raspberry Pi would need).

Installing Shoes 4 as a gem

*nix (Mac OSX/Linux)

$ gem install shoes --pre

Windows

C:\tmp> jruby -S gem install shoes --pre

Installing Shoes 4 from github

If you want to be on the bleeding edge or want to contribute code you need to install it straight from the github repository.

*nix (Mac OSX/Linux)

  1. Fork the repository and clone your fork, or

     $ git clone git://github.com/shoes/shoes4.git
    
  2. Set up your local environment

     $ cd shoes4
     $ gem install bundler && bundle install
    

Note: If you got rvm, rbenv or something like that installed it might complain that you should use jruby version xx. That's because we keep our .ruby-version files up to date. You should be able to run it with a JRuby version >= 9.0.0.0 We recommend up to date versions though.

  1. You're ready to go!

Windows

  1. Fork the repository and clone your fork, or

     C:\tmp> git clone git://github.com/shoes/shoes4.git
    
  2. Set up your local environment

     C:\tmp>cd shoes4
     C:\tmp\shoes4>jruby -S gem install bundler
     C:\tmp\shoes4>jruby -S bundle install
    
  3. You're ready to go!

Running a Shoes App

Shoes 4 comes with a command-line app runner. Just pass it the filename of your Shoes app.

$ bin/shoes samples/simple_sound.rb

Note: For Windows, C:\tmp\shoes4>bin\shoes samples\simple_sound.rb If you installed Shoes 4 as a gem, just do C:\tmp> shoes path\to\file.rb

There is also a simple ruby starter script when using the SWT backend which you may use as follows:

$ bin/shoes-swt samples/simple_sound.rb

This does not work yet on Mac as JRuby (the JVM) needs some additional parameters. Here you can just do the following (which basically is what bin/shoes does):

$ jruby -J-XstartOnFirstThread bin/shoes-swt samples/simple_sound.rb

Another alternative yet is to put require 'shoes' at the top of your applications, then you can simply do

$ jruby path/to/file.rb

On OS X you still need to supply the additional parameters to JRuby

$ jruby -J-XstartOnFirstThread path/to/file.rb

Want to see what shoes can do?

You can run rake samples and random samples we believe are working will be run until you quit with Ctr + C. Some of them are really simple, while others are more complex or even games! If you notice any issue with those samples please let us know!

By setting the SHOES_USE_INSTALLED environment variable to true, you can also use your installed version of shoes (shoes command) to run the samples instead of the local bin/shoes.

Packaging a Shoes App

Packaging is just a baby, so be gentle.

In order to package an app, you need to have the Shoes gem installed in your environment. If you didn't do the gem installation you can always generate a gem and install it from the current source:

$ rake install:all

Now, you can package an app. But first, look here:

  • The packager will include everything in the directory of your shoes script and below, unless you tell it not to.
  • The packager will probably not work properly if it detects a .gemspec or a Gemfile. It uses Warbler, which always looks for those files. If you run the specs, you may notice some warnings like this:

warning: Bundler `path' components are not currently supported. The `shoes-4.0.0.pre1' component was not bundled. Your application may fail to boot!

That's Warbler talking. Actually, we sneak the Shoes gem in anyway, but don't tell.

Okay, now for real. The simplest thing is to put your script in a directory by itself and then:

$ bin/shoes package --mac path/to/directory-of/your-shoes-app.rb

This will produce a Mac app, which you can then find at path/to/directory-of/pkg/your-shoes-app.app.

You can also package a shoes app up as a jar through:

$ bin/shoes package --jar path/to/directory-of/your-shoes-app.rb

You can find the jar in the same directory as above, i.e. path/to/directory-of/pkg/your-shoes-app.jar

If you want more control (like you want to name your app something besides "Shoes App", or you don't want to include all of those files we talked about before), make an app.yaml file. See the example for more details.

Note: If you use an app.yaml, you will have to customize or comment out each option. The example is just an example ;)

When you have an app.yaml file right next to your script, you have three options:

$ bin/shoes package --mac path/to/directory-of/your-shoes-app.rb
$ bin/shoes package --mac path/to/directory-of/app.yaml
$ bin/shoes package --mac path/to/directory-of

The packager will find your instructions using any of those commands. Again, you'll find your app in the pkg directory inside your project's directory. Find out more at bin/shoes --help.

Oh, and you can also just run your Shoes apps with bin/shoes.

Want to contribute?

That's awesome, thank you!

You can go ahead an try to fix one of our issues. We have introduced a new tag 'Newcomer Friendly' for issues we believe are suitable to get started with shoes contributing. These issues either are relatively easy to accomplish or don't depend on a lot of other shoes code (e.g. completely new features) so that it's easier to get started. Please feel free to tackle any issue - we will help you if needed. The tag is just a suggestion! =)

Also there is a list of samples that already work at samples/README, along with all the other samples. You can try to get a new sample to run. In order to do so you can run rake non_samples to run a random sample we think does not work. If you just want to list the non working samples you can also run rake list_non_samples.

With all you do, please make sure to write specs as Shoes 4 is developed TDD-style (see the Running Specs section below). So make sure that you don't break any tests :-)

If you feel unsure about testing or your implementation just open an issue or a pull request. Pull requests don't need to be done - they are great discussion starters! We're happy to help you get your contribution ready to be merged in order to help build Shoes 4!

In fact we greatly appreciate early pull requests to review code and help you find your way around Shoes 4! =)

If you have questions, also feel free to drop by on the #shoes channel on FreeNode irc. People might not respond instantly, but after some time someone will respond :-)

It sometimes is also a good way to refactor some code or write some specs in order to get familiar with a project. If you want to try this approach you can have a look at our Code Climate to find candidates for refactoring or after running the specs locally take a peak into the coverage directory and open index.html - it shows you our current coverage data. See something that isn't covered and maybe you can write a spec for it?

Refer to the following section for information on how to run the specs, that were mentioned before :-)

Running Specs

Shoes 4 is developed in a TDD style using RSpec. You should be writing and running the specs :)

The simplest way to do this is with rake tasks.

$ bundle exec rake

(Try rake --tasks for a full list)

If you want more details on other modes to run specs in, philosophy on how and what to tests, check out the Testing Shoes entry in the wiki.

Code of Conduct

Way way back in the day, there was a guy named _why. He created a project known as Hackety Hack to teach programming to everyone. In order to reach all corners of the earth, _why decided to make Hackety Hack work on Windows, Mac OS X, and Linux. This was a lot of work, and so _why decided to share his toolkit with the world. Thus, Shoes was born.

Shoes was born to teach programming to everyone, in all corners of the earth. It's not cool to make new programmers or programmers with bad English feel bad because they don't write Ruby / English very well. And clearly any other anti-social comments directed at someone's religion, ethnicity, race, gender identity, or any of that personal stuff won't be tolerated here in the land of chunky-bacon! If community members feel like your comments are out of line in any project space (code, issues, chat rooms, mailing lists), they'll kindly let you know how to improve per our code of conduct.

The bottom-line is: Have Fun with Shoes!

Shoes Around the Web

If you want to keep up to date with what's going on with Shoes, you can find us in various places:

Contact

Want to get in touch with the shoes community? That's great! You can get in touch here:

However we try to keep most discussions about the development in this repository/its issues so everyone can see them and look them up.

shoes4's People

Contributors

alindeman avatar ashbb avatar charlesetc avatar chuckremes avatar davidbegin avatar davorb avatar ericboehs avatar estensland avatar fism88 avatar gazcmarsh avatar glenn-murray-bse avatar heartpunk avatar hkal avatar jaredmoody avatar jasonrclark avatar kcerb avatar kerrizor avatar lumeet avatar mpapis avatar nashby avatar nicholalexander avatar orthodex avatar phansch avatar pjfitzgibbons avatar plexus avatar pragtob avatar rubycoder avatar steveklabnik avatar tapickell avatar wasnotrice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shoes4's Issues

How to get started?

Hi everyone,

I think the start for people rather new to the shoes4 project should be easier. Here is a list (of the top off my head) of things that might help:

  • a description of the directory structure (personally I think I get most of it but I don't know what testing is there for and why we have static and images)
  • an easy tag for issues, or starter job or whatever you want to call it (was suggested by Eric in another issue, just wanted to bring it up)
  • how do I know what still needs to be done implementation wise? The issues don't seem to cover it all. So do I try to run samples until I find one that isn't working and try to fix that one? Would be nice to have a list of working samples - is probably hard to update though.

That's all I can think of for now :-)

Review the feature of Links

After looking around shoes4/features directory, I think we need to review the feature of Links.
Try out the following two snippets with your Shoes 3.

Shoes.app{link 'hello'}
Shoes.app{para link 'hello'}

It needs using TextBlock method (i.e. para) to show the link 'hello'.
I think that it's better to keep this spec in Shoes 4.

Overlap elements

This is continued from issue #40, but another big problem. So, I open this new thread.

At #40 discussion, we've reached the following conclusion:

  • implement Shoes::Flow with SWT::StyledText
  • implement Shoes::Stack with SWT::Composit

But I noticed that the following two snippets would get the same screenshot. :(

Shoes.app do
  rect 0, 0, 100, 100
  title 'hello', stroke: white
end
Shoes.app do
  title 'hello', stroke: white
  rect 0, 0, 100, 100
end

Umm,... we might go back to the start...
We can't use SWT::StyledText for Shoes::Flow? Need to make our original layouter?

Cleanup file system

In particular, it would be nice to refactor the code we have (as heavily as necessary) rather than writing it all again from scratch.

Keep:

  • bin/*
  • features/*
  • fonts/*
  • lib/shoes/*
  • spec/shoes/*
  • static/*
  • Guardfile

Delete:

  • archive/*
  • lib/shoes-archive/*
  • lib/shoes-archive.rb
  • lib/swing_shoes/*
  • lib/swing_shoes.rb
  • lib/white_shoes/*
  • lib/white_shoes.rb
  • spec/swing_shoes/*
  • spec/white_shoes/*
  • spec/todo
  • LEARNING_PJF
  • README.rdoc
  • rspec.readme
  • swing-shoooes*

Move:

  • images/ -> samples/images/
  • sounds/ -> samples/sounds/
  • lib/shoes/swt_shoes -> lib/shoes/swt
  • lib/*.jar, lib/log4j/ -> [some place for java libs (lib/support/?)]
  • testing/* -> samples/
  • swt-shoooes* -> bin/

Note : Guardfile should be kept.

For Java methods, should we use camelCase or snake_case?

JRuby allows us to use Java camelCase method names or Ruby snake_case ones. Also Java getValue and setValue or Ruby value and value=. Also Java isDisposed or Ruby disposed?.

At the moment, we have both usages in the codebase. I think it makes sense to decide on one notation, because when you are reading code, it can be easy to forget that setLayout and set_layout are the same method. Also, RSpec treats them as different expectations on mock objects.

The advantage to using Java notation is that you don't have to translate from the Swt docs. The advantage to using Ruby is that it looks like the rest of the code.

I prefer Ruby notation, but I don't care that much. Thoughts?

[To be recorded in the Wiki upon consensus]

TDD-style developing

I read the latest README. It says:

With all you do, please make sure to write specs as shoes4 is developped TDD-style (see the Running Specs section above). So make sure that you don't break any tests :-)

This statement is absolutely true. But for now, is it really economic?

The for now means that we have to revise/convert/reconsider basic design, e.g. transition from modules to classes, window size, etc.

Try out this local commit. The bin/swt-shoooes samples/simple-oval.rb woks fine. So, this commit seems to be reasonable to convert App from module to class. But, in order to pass all tests we already have, I have to update many other files.

This is because the tests are dependent on basic design.

So, what shall we do now?

  • Do merge the commit if it breaks some tests.
  • Temporarily, delete all codes and specs. Then add some codes and specs finished to revise.
  • At first, revise all specs along with our new basic design.

Fix mixin/inheritance chain

I had to code lots of classes before I ran into a problem with this structure, so I think it was a completely reasonable idea. We adapt.

2 Answers:

A: Yes, currently, SwtShoes::Button is a mixin to Shoes::Button, and likewise for other Shoes classes and SwtShoes modules. In the SwtShoes::Button file, there is a reopening of Shoes::Button to mixin the SwtShoes module. It is expected in the sense that everything is currently coded that way.

A: Hmmm. I think we could go either way on this. Shoes::Button::Swt makes sense because the framework buttons kind of belong to the Shoes class. But when I visualize it:

Shoes                   Shoes
 Animation               Animation
 Button                    Swt
 Flow                      Swing
 ...                        ...
 Swt                     Button
   Animation               Swt
   Button                  Swing
   Flow                    ...
   ...                   Flow
 Swing                     Swt
   Animation               Swing
   Button                  ...
   Flow                  ...
   ...
 ...

I think it makes more sense to namespace like Shoes::Swt::Button. Since the gui framework classes are going to be bundled together, it makes sense that they are namespaced together. Compare:

Shoes                   Shoes
 Swt                     Animation
   Animation               Swt
   Button                Button
   Flow                    Swt
   ...                   Flow
                           Swt
                           ...

Build fails on Travis, but not locally

There are 24 failures, all with the same error. Here's an example:

Failures:

1) SwtShoes::App Shoes::App shell receives open
Failure/Error: subject { Shoes::App.new }
NativeException:
  org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
# org.eclipse.swt.SWT:-1:in `error'
# org.eclipse.swt.widgets.Display:-1:in `createDisplay'
# org.eclipse.swt.widgets.Display:-1:in `create'
# org.eclipse.swt.graphics.Device:-1:in `<init>'
# org.eclipse.swt.widgets.Display:-1:in `<init>'
# org.eclipse.swt.widgets.Display:-1:in `<init>'
# sun/reflect/NativeConstructorAccessorImpl.java:-2:in `newInstance0'
# sun/reflect/NativeConstructorAccessorImpl.java:57:in `newInstance'
# sun/reflect/DelegatingConstructorAccessorImpl.java:45:in `newInstance'
# java/lang/reflect/Constructor.java:532:in `newInstance'
# org/jruby/javasupport/JavaConstructor.java:259:in `newInstanceDirect'
# ./lib/swt_shoes/app.rb:13:in `gui_init'
# ./lib/shoes/app.rb:39:in `initialize'
# ./spec/swt_shoes/app_spec.rb:15:in `(root)'
# org/jruby/RubyBasicObject.java:1730:in `instance_eval'
# ./spec/swt_shoes/app_spec.rb:20:in `(root)'
# org/jruby/RubyBasicObject.java:1730:in `instance_eval'
# org/jruby/RubyArray.java:2331:in `collect'
# org/jruby/RubyArray.java:2339:in `collect'
# org/jruby/RubyArray.java:2331:in `collect'
# org/jruby/RubyArray.java:2339:in `collect'
# org/jruby/RubyArray.java:2331:in `collect'
# org/jruby/RubyArray.java:2339:in `collect'
# org/jruby/RubyArray.java:2331:in `collect'
# org/jruby/RubyArray.java:2339:in `collect'

I think this might have to do with the TravisCI build VM not having DISPLAY. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=119156#c1

No such file or directory on Ubuntu 12.04

I'm on Ubuntu 12.04 32 bit, using RVM and jruby 1.6.7.2.

./bin/swt-shoooes samples/simple-sound.rb
/usr/bin/env: jruby --1.9 -J-XstartOnFirstThread: No such file or directory

jruby -v
jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (OpenJDK Server VM 1.6.0_24) [linux-i386-java]

Thoughts? The specs run fine when I run rake, but the bin/swt-shoooes file just doesn't seem to work.

with the patch in #32:

./bin/swt-shoooes
Unrecognized option: -XstartOnFirstThread
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

When that part is removed, I get this:

./bin/swt-shoooes ./samples/simple-animate.rb
DEBUG sun.reflect.NativeMethodAccessorImpl (invoke0) - Shoooes!
ArgumentError: wrong number of arguments (0 for 1)
(root) at -e:1

Keeping the open commit policy

Hey everyone-

I just added @alindeman on @jrgifford's request. Welcome Andy!

I'd like to keep the same open commit policy that I put in place for Red Shoes. Get one commit, you're on the team. I got a lot of good vibes and feedback from this for people, but since you're all also doing a lot of work on this, I wanted to make sure that's cool with everyone before I kept it up.

Separate specs/suites for unit/integration specs

As mentioned by @alindeman in #37 (this comment), we ought to be intentional about testing units vs testing the system. Let's discuss that here.

To consider:

  • how do we separate unit vs integration tests?
  • how do we separate tests that require creating windows, or are otherwise slow?
  • how do we create a ShoesSpec that can run against all of the following
    1. lib/shoes code
    2. lib/shoes/swt code
    3. any other backend that comes along, that will probably be packaged in a separate gem

Hook up to travisci

I don't know how we want to do this, but we should get this set up with travisci sooner, rather than later.

simple-move.rb isn't working correctly (at least on Linux)

Hi everyone,

when looking through the code I just noticed that the simple-move.rb, which is marked as working, seems to be broken - at least on my machine. Broken in the sense that id doesn't do what I expect it to do, see the screenshot:

Simple Move Broken

I'm running Linux Mint Debian Edition, jruby 1.6.7 and swt gem version 0.13

Cheers to everyone,
Tobi

Let's require symbol keys in hashes

Currently, we have some places where we use the facets method stringify_keys! (e.g. Shoes::App). I would prefer to see us use only symbol keys in hashes, like current versions of Shoes. Less overhead, easier to reason about, than permitting both strings and symbols.

See shoes/brown_shoes#5

Backwards compatibility

Just so we're all on the same page here, I want to discuss how much we're trying to make Shoes backwards compatible with Shoes 3.

As far as I can tell, Hackety is the only really major app that relies on Shoes 3. And frankly, it needs a lot of work anyway, a near-re-write if not an entire one.

So how much do we care?

I personally vote for not worrying too much about being compatible at an API level. We shouldn't deviate for the sake of it, but this is Shoes 4 and not 3.3 for a reason.

Thoughts?

Shoes window itself is a flow

This is a basic spec written in Shoes manual: Slots

So, we should do the following:

  • create a top slot (a Shoes::Flow object) and add it to the Shoes::App object
  • put all elemets and slots on the top slot

For now, the background is put on the app itself (i.e. Swt::Shell). But it should be put on the top slot.

Specs for Shoes::App and Shoes.app

After gaining consensus on code structure, I'd like to start discussion about spec.

There are already many _spec.rb files. But I couldn't find describe Shoes.app.

IMHO, the specs for Shoes::App and Shoes.app are most important. So, let's start off from them.

I'll make a list of something we should consider.

Undefined local variable or method 'java' for Shoes::Sound:Class

I've tested in Ubuntu 12.04 32 and 64 bit, as well as Fedora 17 32.

When I run any of the examples, I get the following error:

NameError: undefined local variable or method `java' for Shoes::Sound:Class
Sound at /home/jrg/code/shoes4/lib/shoes/sound.rb:19
Shoes at /home/jrg/code/shoes4/lib/shoes/sound.rb:16
(root) at /home/jrg/code/shoes4/lib/shoes/sound.rb:15
require at org/jruby/RubyKernel.java:1042
require at /home/jrg/.rvm/rubies/jruby-1.6.7.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
(root) at /home/jrg/code/shoes4/lib/shoes/sound.rb:28

it appears that this was introduced in dcec852.

I haven't had a chance to test on Windows yet. Thoughts on what might be causing this?

Update README

I'll try to run my stuff (a game) with brown shoes and see what is missing right now. Which points to the need for a how-to section in the README.

Definitely we need a how-to section in the README. You can totally give your game a try, but it is unlikely that it will work yet. We have only basic implementations of buttons, colors, flows, sounds, stroke, fill, and shapes so far. It is not nearly to the level of functionality that Purple Shoes has (yet!).

But we have also written specifications for all of the behavior we have implemented. And discovered lots of Shoes quirks along the way. Part of the goal is to uncover hidden behaviors and make sure they are sane.

What are `bin/*`?

These are questions for learning.

  • What are bin/*?
  • Were almost all files (i.e. autospec, cdiff, etc.) generated by Bundler?
  • When and how to use them?

Redcarpet won't build under jruby

Hey all,
First, congratulation for the outstanding work. I love Shoes and the way this project is going.

I just started cloning the project and had some problem when bundle installing.

Redcarpet wouldn't build. It seems like it won't run under jruby. Am I missing something?

Otherwise, it might be worthy to use a markdown parser that runs out of the box in jruby.

What do you guys think?

Cheers!

spec/shoes/learn_app_spec.rb

This is my first rspec for learning. :)

Clone my new sandbox branch and run the following.

C:\tmp>git clone git://github.com/ashbb/shoes4.git

C:\tmp>cd shoes4

C:\tmp\shoes4>jruby --1.9 -S rspec spec\shoes\learn_app_spec.rb

Shoes::App
  initialize
    should set accessor :width
    should set default value - window's width is 600

Finished in 0.078 seconds
2 examples, 0 failures

Randomized with seed 63180

It works anyway. But I have two questions. Look at the code: spec/shoes/learn_app_spec.rb

  • Is line 6 Shoes::App.any_instance.stub(:gui_open) reasonable? Using :gui_open instead of :flow
  • Is line 7 @app = Shoes.app{} reasonable? Using instace variable @app instead of local variable app. Using Shoes.app instead of Shoes::App.new.

Thought?

Is Shoes a class or a module?

In Shoes 3, Shoes is a class, not a module for users.
To be honest, I don't know pros and cons. But for that reason, implemented in Shoes 3 like this:

Types = module Shoes; self end

module Shoes
 # define constants, e.g. DIR, COLORS, etc.
end

class Object
  remove_const :Shoes
end

In Shoes 4, is Shoes a class or a module?

What's our documentation format?

Now's the time to commit to having well documented code, even though this is Shoes :) I don't really care that we have a super-specified "style" for documentation, but it sure is nice to have a tool generate nice docs for you. From that standpoint, it's good to all be on the same page.

Does anyone have a strong feeling about what tools to use?

TextBlock

I've started working on implementing TextBlock. This includes:

  • banner
  • title
  • subtitle
  • tagline
  • caption
  • para
  • inscription

Running a Shoes App

$ bin/swt-shoooes samples/working/simple-sound.rb written in README doesn't work at least on Windows.

$ bin/swt-shoooes samples/simple-sound.rb is okay. But is it better to edit the code of samples/working-swt/simple-sound.rb? The following is okay.

require "samples/simple-sound"

Shoes shouldn't require 'java'

We need to carefully isolate the 'java' bits to the Swt module. Right now, lib/shoes.rb requires 'java' and log4j. These (and perhaps others) need to be moved into the backend.

App.width, App.height and their meaning

Right now, and in the old Shoes when you specify the following

Shoes.app :width => 200, :height => 200 do
  button "hello, world!"
end

A window will be created where the total size of the window, including the controls and the window bar on the top, is 200x200 pixels.

an example

Basically right now, we're specifying (x,y_1). From a user's perspective, it would make more sense if what we specified was (x,y_2) -- the size of the "canvas" that the user actually gets to use. Especially since everything the user actually places on the canvas is specified in pixels.

Specs fail with commit ffa0b33f84

After updating rspec gem from 2.6.4 to 2.10.0, I tried to run rake spec on my Window 7 with the latest code (commit ffa0b33) and got the following.

C:\tmp\shoes4>jruby --1.9 -S rake spec
jruby --debug --1.9 -Ispec  -S ./bin/rspec --tty   spec/shoes/app_spec.rb spec/s
hoes/button_spec.rb spec/shoes/color_spec.rb spec/shoes/element_methods_spec.rb
spec/shoes/flow_spec.rb spec/shoes/framework_learning_spec.rb spec/shoes/line_sp
ec.rb spec/shoes/oval_spec.rb spec/shoes/shape_spec.rb
DEBUG sun.reflect.NativeMethodAccessorImpl (invoke0) - Shoooes!

Shoes::Flow
  initialize
�[32m    should set accessors�[0m

Shoes::Button
  behaves like movable object
�[32m    moves�[0m
  initialize
�[32m    should set accessors�[0m

Basic Element Methods
  oval
�[32m    produces a Shoes::Oval�[0m
  animate
    defaults
      behaves like basic
�[32m        should be an instance of Shoes::Animation�[0m
      framerate
�[32m        should eq 24�[0m
    with numeric argument
      behaves like basic
�[32m        should be an instance of Shoes::Animation�[0m
      behaves like 10fps
        framerate
�[32m          should eq 10�[0m
  line
�[32m    makes a Shoes::Line�[0m
  flow
�[32m    should use self, gui_container, opts, blk�[0m
  fill
�[32m    returns a color�[0m
�[32m    applies to subsequently created objects�[0m
�[32m    sets on receiver�[0m
  stroke
�[32m    returns a color�[0m
�[32m    applies to subsequently created objects�[0m
�[32m    sets on receiver�[0m
  strokewidth
�[32m    returns a number�[0m
�[32m    applies to subsequently created objects�[0m
�[32m    sets on receiver�[0m
  shape
�[32m    should be an instance of Shoes::Shape�[0m
�[32m    receives style from app�[0m
  rgb
�[32m    sends args to Shoes::Color�[0m
�[32m    defaults to opaque�[0m

Shoes::Shape
  behaves like object with style
�[32m    merges new styles�[0m
  behaves like movable object
�[32m    moves�[0m
  behaves like object with stroke
�[32m    returns a color�[0m
�[32m    defaults to black�[0m
�[32m    sets on receiver�[0m
  octagon
    right
�[32m      should eq 370�[0m
    left
�[32m      should eq 130�[0m
    behaves like movable object
�[32m      moves�[0m
    top
�[32m      should eq 100�[0m
    height
�[32m      should eq 240�[0m
    width
�[32m      should eq 240�[0m
    bottom
�[32m      should eq 340�[0m

Shoes::Color
  peru
    with optional alpha
      behaves like peru
�[32m        should not be black�[0m
�[32m        should not be white�[0m
        red
�[32m          should eq 205�[0m
        green
�[32m          should eq 133�[0m
        class
�[32m          should eq Shoes::Color�[0m
        blue
�[32m          should eq 63�[0m
      alpha
�[32m        should eq 100�[0m
    using floats
      with optional alpha
        behaves like peru
�[32m          should not be black�[0m
�[32m          should not be white�[0m
          red
�[32m            should eq 205�[0m
          green
�[32m            should eq 133�[0m
          class
�[32m            should eq Shoes::Color�[0m
          blue
�[32m            should eq 63�[0m
        alpha
�[32m          should eq 100�[0m
      without optional alpha
        behaves like peru
�[32m          should not be black�[0m
�[32m          should not be white�[0m
          red
�[32m            should eq 205�[0m
          green
�[32m            should eq 133�[0m
          class
�[32m            should eq Shoes::Color�[0m
          blue
�[32m            should eq 63�[0m
        alpha
�[32m          should eq 255�[0m
    without optional alpha
      behaves like peru
�[32m        should not be black�[0m
�[32m        should not be white�[0m
        red
�[32m          should eq 205�[0m
        green
�[32m          should eq 133�[0m
        class
�[32m          should eq Shoes::Color�[0m
        blue
�[32m          should eq 63�[0m
      alpha
�[32m        should eq 255�[0m
  black
    with optional alpha
      behaves like black
�[32m        should be black�[0m
�[32m        should not be white�[0m
        red
�[32m          should eq 0�[0m
        green
�[32m          should eq 0�[0m
        class
�[32m          should eq Shoes::Color�[0m
        blue
�[32m          should eq 0�[0m
      alpha
�[32m        should eq 0�[0m
    using floats
      with optional alpha
        behaves like black
�[32m          should be black�[0m
�[32m          should not be white�[0m
          red
�[32m            should eq 0�[0m
          green
�[32m            should eq 0�[0m
          class
�[32m            should eq Shoes::Color�[0m
          blue
�[32m            should eq 0�[0m
        alpha
�[32m          should eq 0�[0m
      without optional alpha
        behaves like black
�[32m          should be black�[0m
�[32m          should not be white�[0m
          red
�[32m            should eq 0�[0m
          green
�[32m            should eq 0�[0m
          class
�[32m            should eq Shoes::Color�[0m
          blue
�[32m            should eq 0�[0m
        alpha
�[32m          should eq 255�[0m
    without optional alpha
      behaves like black
�[32m        should be black�[0m
�[32m        should not be white�[0m
        red
�[32m          should eq 0�[0m
        green
�[32m          should eq 0�[0m
        class
�[32m          should eq Shoes::Color�[0m
        blue
�[32m          should eq 0�[0m
      alpha
�[32m        should eq 255�[0m
  rgb
�[32m    returns a new Shoes::Color object�[0m
�[32m    allows alpha to be omitted�[0m
�[32m    accepts alpha�[0m
  white
�[32m    should be white�[0m
�[32m    should not be black�[0m
  comparable
�[32m    is equal when values are equal�[0m
�[32m    is greater than when lighter�[0m
�[32m    is less than when darker�[0m
    same rgb values
�[32m      is less than when less opaque�[0m
�[32m      is greater than when more opaque�[0m
  transparency
�[32m    only transparent colors are transparent�[0m
�[32m    only opaque colors should be opaque�[0m
  light and dark
�[32m    light color is light�[0m
�[32m    dark color is dark�[0m

Shoes::Oval
  (eccentric)
�[32m    should be an instance of Shoes::Oval�[0m
    left
�[32m      should eq 20�[0m
    width
�[32m      should eq 100�[0m
    top
�[32m      should eq 30�[0m
    height
�[32m      should eq 200�[0m
  (circle) created with explicit arguments:
    width and height
      behaves like circle
�[32m        should be an instance of Shoes::Oval�[0m
        left
�[32m          should eq 20�[0m
        width
�[32m          should eq 100�[0m
        top
�[32m          should eq 30�[0m
        height
�[32m          should eq 100�[0m
    radius
      behaves like circle
�[32m        should be an instance of Shoes::Oval�[0m
        left
�[32m          should eq 20�[0m
        width
�[32m          should eq 100�[0m
        top
�[32m          should eq 30�[0m
        height
�[32m          should eq 100�[0m
  basic
    behaves like object with stroke
�[32m      returns a color�[0m
�[32m      defaults to black�[0m
�[32m      sets on receiver�[0m
    behaves like movable object
�[32m      moves�[0m
    behaves like object with fill
�[32m      returns a color�[0m
�[32m      defaults to black�[0m
�[32m      sets on receiver�[0m
  (circle) created with style hash:
    left, top, height, width, center: false
      behaves like circle
�[32m        should be an instance of Shoes::Oval�[0m
        left
�[32m          should eq 20�[0m
        width
�[32m          should eq 100�[0m
        top
�[32m          should eq 30�[0m
        height
�[32m          should eq 100�[0m
    left, top, radius
      behaves like circle
�[32m        should be an instance of Shoes::Oval�[0m
        left
�[32m          should eq 20�[0m
        width
�[32m          should eq 100�[0m
        top
�[32m          should eq 30�[0m
        height
�[32m          should eq 100�[0m
    left, top, height, width
      behaves like circle
�[32m        should be an instance of Shoes::Oval�[0m
        left
�[32m          should eq 20�[0m
        width
�[32m          should eq 100�[0m
        top
�[32m          should eq 30�[0m
        height
�[32m          should eq 100�[0m
    left, top, width, height, center: true
      behaves like circle
�[32m        should be an instance of Shoes::Oval�[0m
        left
�[32m          should eq 20�[0m
        width
�[32m          should eq 100�[0m
        top
�[32m          should eq 30�[0m
        height
�[32m          should eq 100�[0m

Shoes::App
  style
    behaves like object with style
�[32m      merges new styles�[0m
  strokewidth
�[32m    defaults to 1�[0m
�[32m    passes new values to objects�[0m
�[31m    passes default to objects (FAILED - 1)�[0m
  initialize
�[32m    should set default accessor values�[0m
�[32m    should set accessors from opts�[0m
�[32m    should set accessors from constructor args�[0m
�[32m    initializes style hash�[0m
  stroke
�[32m    defaults to black�[0m
�[32m    passes new value to objects�[0m
�[31m    passes default to objects (FAILED - 2)�[0m

A Shoes Framework
�[32m  should include Framework Plugins�[0m

Shoes::Line
  created left-to-right, top-to-bottom
    behaves like basic line
�[32m      should be a kind of Shoes::Line�[0m
      left
�[32m        should eq 10�[0m
      width
�[32m        should eq 90�[0m
      top
�[32m        should eq 15�[0m
      height
�[32m        should eq 45�[0m
  specified right-to-left, top-to-bottom
    behaves like basic line
�[32m      should be a kind of Shoes::Line�[0m
      left
�[32m        should eq 10�[0m
      width
�[32m        should eq 90�[0m
      top
�[32m        should eq 15�[0m
      height
�[32m        should eq 45�[0m
  basic
    behaves like object with stroke
�[32m      returns a color�[0m
�[32m      defaults to black�[0m
�[32m      sets on receiver�[0m
    behaves like movable object
�[32m      moves�[0m
  specified right-to-left, bottom-to-top
    behaves like basic line
�[32m      should be a kind of Shoes::Line�[0m
      left
�[32m        should eq 10�[0m
      width
�[32m        should eq 90�[0m
      top
�[32m        should eq 15�[0m
      height
�[32m        should eq 45�[0m
  specified left-to-right, bottom-to-top
    behaves like basic line
�[32m      should be a kind of Shoes::Line�[0m
      left
�[32m        should eq 10�[0m
      width
�[32m        should eq 90�[0m
      top
�[32m        should eq 15�[0m
      height
�[32m        should eq 45�[0m

Shoes built-in colors
�[32m  there are 140�[0m
  papayawhip
�[32m    should eq #<Shoes::Color:0x1f035ce @blue=213, @green=239, @red=255, @al
pha=255>�[0m
  tomato
�[32m    should eq #<Shoes::Color:0x1c10dd7 @blue=71, @green=99, @red=255, @alph
a=255>�[0m
  aquamarine
�[32m    should eq #<Shoes::Color:0xaac2cc @blue=212, @green=255, @red=127, @alp
ha=255>�[0m

differences from Red Shoes
  integers
�[32m    too-large values become 255�[0m
�[32m    too-small values become 0�[0m
  unusual input
    too-large values
�[32m      red does not get modulo-256'd into bounds�[0m
�[32m      blue does not get modulo-256'd into bounds�[0m
�[32m      green does not get modulo-256'd into bounds�[0m
    edge cases
�[32m      0.0 does not become 1�[0m
�[32m      1.0 does not become 0�[0m
    negative values
�[32m      -1 does not become 255�[0m
�[32m      float behaviour�[0m
�[32m      256 and neighbors�[0m
  floats
�[32m    too-large values become 255�[0m
�[32m    too-small values become 0�[0m

Failures:

  1) Shoes::App strokewidth passes default to objects
     �[31mFailure/Error:�[0m �[31msubject.line(0, 100, 100, 0).style[:strokewidt
h].should eq(1)�[0m
       �[31m�[0m
       �[31mexpected: 1�[0m
       �[31m     got: 10�[0m
       �[31m�[0m
       �[31m(compared using ==)�[0m
�[36m     # ./spec/shoes/app_spec.rb:57:in `(root)'�[0m

  2) Shoes::App stroke passes default to objects
     �[31mFailure/Error:�[0m �[31msubject.oval(100, 100, 100).style[:stroke].sho
uld eq(black)�[0m
       �[31m�[0m
       �[31mexpected: #<Shoes::Color:0x2d1ead @blue=0, @green=0, @red=0, @alpha=
255>�[0m
       �[31m     got: #<Shoes::Color:0xa5bc1e @blue=32, @green=165, @red=218, @a
lpha=255>�[0m
       �[31m�[0m
       �[31m(compared using ==)�[0m
       �[31m�[0m
       �[31mDiff:�[0m
       �[31m@@ -1,2 +1,2 @@�[0m
       �[31m-#<Shoes::Color:0x000000 @alpha=255, @blue=0, @green=0, @red=0>�[0m
       �[31m+#<Shoes::Color:0x000000 @alpha=255, @blue=32, @green=165, @red=218>
�[0m
�[36m     # ./spec/shoes/app_spec.rb:74:in `(root)'�[0m

Finished in 0.905 seconds
�[31m199 examples, 2 failures�[0m

Failed examples:

�[31mrspec ./spec/shoes/app_spec.rb:56�[0m �[36m# Shoes::App strokewidth passes
default to objects�[0m
�[31mrspec ./spec/shoes/app_spec.rb:73�[0m �[36m# Shoes::App stroke passes defau
lt to objects�[0m

Randomized with seed 39162

rake aborted!
Command failed with status (1): [jruby --debug --1.9 -Ispec  -S ./bin/rspec...]

Tasks: TOP => spec:shoes
(See full trace by running task with --trace)

Build is now failing

I don't know if it's because of afafe89. I didnt' have the opportunity to run the specs, since I haven't been able to run them since last Thursday (they're all broken om my machine).

Could someone investigate this?

Samples works but not completely

The following four samples works on my Windows 7 with the latest commit ffa0b33.

simple-animate.rb
simple-move.rb
simple-sound.rb
simple-stripes.rb

But looks like not completely for now. ;-)

  • the window is not resizable
  • the window's background color is not white
  • the window's size is not correct (default should be 600 x 500)
  • no icon on the window (Note: Windows only)

Stacks and Flows

Stacks and Flows are boxes used to lay out Elements.

Slots:

  • Stack, Flow

Elements:

  • Button, EditLine, EditBox, ListBox, Progress, Check, Radio
  • Background, Border, Image, Shapes, TextBlocks, Animate, Video

Shapes:

  • Oval, Rect, Line, Shape, Star, Arrow

TextBlocks

  • Banner, Title, Subtitle, Tagline, Caption, Para, Inscription

Well, in this thread, let's talk about

  • lay out Elements in a Slot
  • a Slot contains other Slots
  • lay out all automatically when a window is resized
  • move Slots
  • scroll up/down in a Slot

At first, we have to consider about

  • how to implement each Element with any SWT class
  • how to lay out Elements with any SWT layout class

If we will not find useful SWT classes, we have to write our layouter by ourselves as same as Red, Green and Purple. It's not so easy in practice...

Okay now, I have a first question:

  • Can we use SWT Composit with RowLayout as Shoes Slot?

If yes, that's fantastic!

Advanced Layouts

This is another feature creep that some folks want from Shoes. Treeview and tableview layouts. I have no idea how that could be done in a Shoes Friendly DSL. I'm just bookmarking the issue.

App.width and height don't change after resizing the window

If you resize the window, App.width and App.height will still report the old values you used when you created the window.

You can reproduce this bug by running the following code, clicking on the button, resizing the window and then clicking the button again.

Shoes.app :width => 200, :height => 200 do
  button "Print the values" do
    puts "(width,height) : (#{width},#{height})"
  end
end

Media Widgets

I'm just logging this feature request so it doesn't get left out of Shoes4 design (also its a wicked problem wave away waiting for some future miracle to occur)

We should have GUI visual widgets for audio and video players like we sort of, almost did in Raisins.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.