shoes-swt 4.0.0.pre2 → 4.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -200
- data/Rakefile +1 -0
- data/bin/shoes-swt +11 -0
- data/lib/shoes/swt.rb +5 -2
- data/lib/shoes/swt/animation.rb +2 -2
- data/lib/shoes/swt/app.rb +45 -50
- data/lib/shoes/swt/arc.rb +7 -7
- data/lib/shoes/swt/background.rb +1 -1
- data/lib/shoes/swt/border.rb +1 -2
- data/lib/shoes/swt/click_listener.rb +70 -0
- data/lib/shoes/swt/color.rb +5 -5
- data/lib/shoes/swt/common/clickable.rb +2 -53
- data/lib/shoes/swt/common/fill.rb +1 -1
- data/lib/shoes/swt/common/painter.rb +7 -7
- data/lib/shoes/swt/common/painter_updates_position.rb +2 -2
- data/lib/shoes/swt/common/remove.rb +2 -3
- data/lib/shoes/swt/common/resource.rb +1 -1
- data/lib/shoes/swt/common/selection_listener.rb +14 -14
- data/lib/shoes/swt/common/stroke.rb +1 -2
- data/lib/shoes/swt/common/update_position.rb +1 -1
- data/lib/shoes/swt/dialog.rb +3 -45
- data/lib/shoes/swt/disposed_protection.rb +1 -1
- data/lib/shoes/swt/download.rb +0 -1
- data/lib/shoes/swt/font.rb +4 -4
- data/lib/shoes/swt/generate-backend.rb +9 -0
- data/lib/shoes/swt/gradient.rb +17 -16
- data/lib/shoes/swt/image.rb +3 -5
- data/lib/shoes/swt/image_pattern.rb +2 -2
- data/lib/shoes/swt/input_box.rb +3 -3
- data/lib/shoes/swt/key_listener.rb +6 -6
- data/lib/shoes/swt/line.rb +4 -24
- data/lib/shoes/swt/link.rb +2 -2
- data/lib/shoes/swt/link_segment.rb +3 -3
- data/lib/shoes/swt/list_box.rb +4 -4
- data/lib/shoes/swt/mouse_move_listener.rb +6 -5
- data/lib/shoes/swt/oval.rb +2 -3
- data/lib/shoes/swt/packager.rb +82 -0
- data/lib/shoes/swt/progress.rb +2 -2
- data/lib/shoes/swt/radio.rb +0 -2
- data/lib/shoes/swt/radio_group.rb +54 -54
- data/lib/shoes/swt/rect_painter.rb +7 -7
- data/lib/shoes/swt/redrawing_aspect.rb +32 -34
- data/lib/shoes/swt/shape.rb +1 -1
- data/lib/shoes/swt/shoes_layout.rb +5 -2
- data/lib/shoes/swt/slot.rb +2 -3
- data/lib/shoes/swt/sound.rb +17 -22
- data/lib/shoes/swt/star.rb +30 -8
- data/lib/shoes/swt/swt_button.rb +3 -2
- data/lib/shoes/swt/text_block.rb +3 -3
- data/lib/shoes/swt/text_block/cursor_painter.rb +2 -2
- data/lib/shoes/swt/text_block/fitter.rb +5 -3
- data/lib/shoes/swt/text_block/painter.rb +9 -9
- data/lib/shoes/swt/text_block/text_font_factory.rb +3 -3
- data/lib/shoes/swt/text_block/text_segment.rb +9 -9
- data/lib/shoes/swt/text_block/text_segment_collection.rb +2 -0
- data/lib/shoes/swt/text_block/text_style_factory.rb +9 -3
- data/lib/shoes/swt/timer.rb +1 -1
- data/lib/shoes/swt/version.rb +1 -1
- data/shoes-swt.gemspec +7 -6
- data/spec/shoes/cli_spec.rb +2 -2
- data/spec/{swt_shoes → shoes/swt}/animation_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/app_spec.rb +36 -3
- data/spec/{swt_shoes → shoes/swt}/arc_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/background_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/border_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/button_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/check_spec.rb +1 -1
- data/spec/shoes/swt/click_listener_spec.rb +162 -0
- data/spec/{swt_shoes → shoes/swt}/color_factory_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/color_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/common/painter_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/common/remove_spec.rb +4 -11
- data/spec/{swt_shoes → shoes/swt}/configuration_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/dialog_spec.rb +1 -7
- data/spec/{swt_shoes → shoes/swt}/disposed_protection_spec.rb +0 -0
- data/spec/{swt_shoes → shoes/swt}/flow_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/font_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/gradient_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/image_pattern_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/image_spec.rb +4 -3
- data/spec/{swt_shoes → shoes/swt}/input_box_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/integration_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/key_listener_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/line_spec.rb +4 -8
- data/spec/{swt_shoes → shoes/swt}/link_segment_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/link_spec.rb +3 -10
- data/spec/{swt_shoes → shoes/swt}/list_box_spec.rb +5 -3
- data/spec/{swt_shoes → shoes/swt}/minimal.png +0 -0
- data/spec/{swt_shoes → shoes/swt}/mouse_move_listener_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/oval_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/progress_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/radio_group_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/radio_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/rect_painter_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/rect_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/shape_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/shared_examples/button.rb +0 -0
- data/spec/shoes/swt/shared_examples/clickable.rb +13 -0
- data/spec/{swt_shoes → shoes/swt}/shared_examples/movable.rb +0 -0
- data/spec/{swt_shoes → shoes/swt}/shared_examples/paintable.rb +0 -0
- data/spec/{swt_shoes → shoes/swt}/shared_examples/painter.rb +0 -0
- data/spec/{swt_shoes → shoes/swt}/shared_examples/pattern.rb +0 -0
- data/spec/{swt_shoes → shoes/swt}/shared_examples/removable.rb +1 -3
- data/spec/{swt_shoes → shoes/swt}/shared_examples/swt_app_context.rb +11 -3
- data/spec/{swt_shoes → shoes/swt}/shared_examples/visibility.rb +0 -0
- data/spec/{swt_shoes → shoes/swt}/shell_control_listener_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/slot_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/spec_helper.rb +0 -1
- data/spec/{swt_shoes → shoes/swt}/star_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/text_block/centered_text_segment_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/text_block/cursor_painter_spec.rb +8 -4
- data/spec/{swt_shoes → shoes/swt}/text_block/fitter_spec.rb +5 -5
- data/spec/{swt_shoes → shoes/swt}/text_block/painter_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/text_block/text_font_factory_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/text_block/text_segment_collection_spec.rb +7 -2
- data/spec/{swt_shoes → shoes/swt}/text_block/text_segment_spec.rb +1 -1
- data/spec/{swt_shoes → shoes/swt}/text_block_spec.rb +2 -5
- data/spec/spec_helper.rb +7 -3
- metadata +132 -331
- data/CHANGELOG +0 -84
- data/Gemfile +0 -24
- data/Guardfile +0 -11
- data/manifests/common.rb +0 -34
- data/manifests/shoes-swt.rb +0 -29
- data/spec/code_coverage.rb +0 -14
- data/spec/shoes/animation_spec.rb +0 -65
- data/spec/shoes/app_spec.rb +0 -484
- data/spec/shoes/arc_spec.rb +0 -51
- data/spec/shoes/background_spec.rb +0 -53
- data/spec/shoes/border_spec.rb +0 -47
- data/spec/shoes/builtin_methods_spec.rb +0 -110
- data/spec/shoes/button_spec.rb +0 -44
- data/spec/shoes/check_spec.rb +0 -35
- data/spec/shoes/color_spec.rb +0 -408
- data/spec/shoes/common/inspect_spec.rb +0 -26
- data/spec/shoes/common/remove_spec.rb +0 -38
- data/spec/shoes/common/style_normalizer_spec.rb +0 -28
- data/spec/shoes/common/style_spec.rb +0 -147
- data/spec/shoes/configuration_spec.rb +0 -36
- data/spec/shoes/constants_spec.rb +0 -38
- data/spec/shoes/dialog_spec.rb +0 -163
- data/spec/shoes/dimension_spec.rb +0 -407
- data/spec/shoes/dimensions_spec.rb +0 -837
- data/spec/shoes/download_spec.rb +0 -142
- data/spec/shoes/flow_spec.rb +0 -133
- data/spec/shoes/font_spec.rb +0 -37
- data/spec/shoes/framework_learning_spec.rb +0 -30
- data/spec/shoes/gradient_spec.rb +0 -32
- data/spec/shoes/helpers/fake_element.rb +0 -17
- data/spec/shoes/helpers/inspect_helpers.rb +0 -5
- data/spec/shoes/helpers/sample17_helper.rb +0 -66
- data/spec/shoes/image_spec.rb +0 -49
- data/spec/shoes/images/shoe.jpg +0 -0
- data/spec/shoes/input_box_spec.rb +0 -80
- data/spec/shoes/integration_spec.rb +0 -20
- data/spec/shoes/internal_app_spec.rb +0 -141
- data/spec/shoes/keypress_spec.rb +0 -11
- data/spec/shoes/keyrelease_spec.rb +0 -12
- data/spec/shoes/line_spec.rb +0 -49
- data/spec/shoes/link_spec.rb +0 -105
- data/spec/shoes/list_box_spec.rb +0 -74
- data/spec/shoes/logger/ruby_spec.rb +0 -8
- data/spec/shoes/logger_spec.rb +0 -45
- data/spec/shoes/oval_spec.rb +0 -24
- data/spec/shoes/point_spec.rb +0 -71
- data/spec/shoes/progress_spec.rb +0 -54
- data/spec/shoes/radio_spec.rb +0 -32
- data/spec/shoes/rect_spec.rb +0 -39
- data/spec/shoes/renamed_delegate_spec.rb +0 -70
- data/spec/shoes/shape_spec.rb +0 -95
- data/spec/shoes/shared_examples/button.rb +0 -6
- data/spec/shoes/shared_examples/changeable.rb +0 -26
- data/spec/shoes/shared_examples/clickable.rb +0 -5
- data/spec/shoes/shared_examples/common_methods.rb +0 -35
- data/spec/shoes/shared_examples/dimensions.rb +0 -32
- data/spec/shoes/shared_examples/dsl.rb +0 -44
- data/spec/shoes/shared_examples/dsl/animate.rb +0 -29
- data/spec/shoes/shared_examples/dsl/arc.rb +0 -45
- data/spec/shoes/shared_examples/dsl/background.rb +0 -26
- data/spec/shoes/shared_examples/dsl/border.rb +0 -10
- data/spec/shoes/shared_examples/dsl/button.rb +0 -5
- data/spec/shoes/shared_examples/dsl/cap.rb +0 -6
- data/spec/shoes/shared_examples/dsl/check.rb +0 -11
- data/spec/shoes/shared_examples/dsl/edit_box.rb +0 -8
- data/spec/shoes/shared_examples/dsl/edit_line.rb +0 -8
- data/spec/shoes/shared_examples/dsl/editable_element.rb +0 -29
- data/spec/shoes/shared_examples/dsl/fill.rb +0 -27
- data/spec/shoes/shared_examples/dsl/flow.rb +0 -15
- data/spec/shoes/shared_examples/dsl/gradient.rb +0 -62
- data/spec/shoes/shared_examples/dsl/image.rb +0 -21
- data/spec/shoes/shared_examples/dsl/line.rb +0 -9
- data/spec/shoes/shared_examples/dsl/nofill.rb +0 -6
- data/spec/shoes/shared_examples/dsl/nostroke.rb +0 -6
- data/spec/shoes/shared_examples/dsl/oval.rb +0 -88
- data/spec/shoes/shared_examples/dsl/pattern.rb +0 -34
- data/spec/shoes/shared_examples/dsl/progress.rb +0 -7
- data/spec/shoes/shared_examples/dsl/rect.rb +0 -92
- data/spec/shoes/shared_examples/dsl/rgb.rb +0 -26
- data/spec/shoes/shared_examples/dsl/shape.rb +0 -21
- data/spec/shoes/shared_examples/dsl/star.rb +0 -48
- data/spec/shoes/shared_examples/dsl/stroke.rb +0 -30
- data/spec/shoes/shared_examples/dsl/strokewidth.rb +0 -19
- data/spec/shoes/shared_examples/dsl/style.rb +0 -32
- data/spec/shoes/shared_examples/dsl/text_elements.rb +0 -81
- data/spec/shoes/shared_examples/dsl/video.rb +0 -5
- data/spec/shoes/shared_examples/dsl_app_context.rb +0 -8
- data/spec/shoes/shared_examples/hover_leave.rb +0 -11
- data/spec/shoes/shared_examples/parent.rb +0 -6
- data/spec/shoes/shared_examples/scroll.rb +0 -41
- data/spec/shoes/shared_examples/shared_element_method.rb +0 -60
- data/spec/shoes/shared_examples/slot.rb +0 -331
- data/spec/shoes/shared_examples/state.rb +0 -19
- data/spec/shoes/shared_examples/style.rb +0 -82
- data/spec/shoes/slot_spec.rb +0 -130
- data/spec/shoes/sound_spec.rb +0 -15
- data/spec/shoes/span_spec.rb +0 -112
- data/spec/shoes/spec_helper.rb +0 -24
- data/spec/shoes/stack_spec.rb +0 -79
- data/spec/shoes/star_spec.rb +0 -31
- data/spec/shoes/text_block_dimensions_spec.rb +0 -75
- data/spec/shoes/text_block_spec.rb +0 -270
- data/spec/shoes/url_spec.rb +0 -68
- data/spec/shoes/widget_spec.rb +0 -70
- data/spec/shoes_spec.rb +0 -44
- data/spec/swt_shoes/shared_examples/clickable.rb +0 -85
- data/spec/swt_shoes/sound.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6157cdc9610526ffb063c6c08ee1a78d77d26e86
|
4
|
+
data.tar.gz: 29e9d0f9376d61eabcdafe9429e9c914bcd3aa99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d357ec7854ea59d2746ad44a482e13be4d3f4f0a06bfb7fbf01e3d31da2046c3df97babfad75d4faa4bf0925dcf6716420c3c8d5c5e7bb7ecdce1d036fac278d
|
7
|
+
data.tar.gz: 517a9db8cd6880ffeeea32425604800879c1a9c02670e0d11e0a762643e193b49edd0f5542edcad802dd8e40c199aa562c4dcc952f4058067e2f71bc8a7289b9
|
data/README.md
CHANGED
@@ -1,201 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# shoes-swt
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Hi there, thanks for checking by! Shoes 4 is still pre-alpha software. It currently supports almost all of the shoes DSL, but there are still some spots where you might get surprising results. If you're not too adventurous just yet you can still use the [old shoes](https://github.com/shoes/shoes)!
|
8
|
-
|
9
|
-
There is a first [preview release](https://rubygems.org/gems/shoes/versions/4.0.0.pre1) now :)
|
10
|
-
|
11
|
-
## Installing Shoes4
|
12
|
-
|
13
|
-
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](http://www.jruby.org/) installation.
|
14
|
-
|
15
|
-
|
16
|
-
### Get a JDK and JRuby
|
17
|
-
|
18
|
-
So your first step is to install a [JDK](http://www.oracle.com/technetwork/java/javase/downloads/) (shoes also works with [OpenJDK](http://openjdk.java.net/)) and [JRuby](http://jruby.org). 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](http://rvm.io/):
|
19
|
-
|
20
|
-
$ rvm install jruby
|
21
|
-
|
22
|
-
**Important JRuby version note:** JRuby 1.7.14 and 1.7.15 have a bug where `bundle install` won't work with shoes4. Make sure to use JRuby 1.7.16 or JRuby-1.7.13 with shoes4.
|
23
|
-
|
24
|
-
**JDK version note:** While shoes4 should generally work with JDK version 6 and up we recommend to use newer version. Also within the JDK major version make sure to have the latest updates installed, we had cases where newer versions resolved bugs.
|
25
|
-
|
26
|
-
### Installing Shoes4 as a gem
|
27
|
-
|
28
|
-
#### *nix (Mac OSX/Linux)
|
29
|
-
|
30
|
-
$ gem install shoes --pre
|
31
|
-
|
32
|
-
#### Windows
|
33
|
-
|
34
|
-
C:\tmp> jruby -S gem install shoes --pre
|
35
|
-
|
36
|
-
### Installing Shoes4 from github
|
37
|
-
|
38
|
-
If you want to be on the bleeding edge or want to contribute code you need to install it straight from the github repository.
|
39
|
-
|
40
|
-
#### *nix (Mac OSX/Linux)
|
41
|
-
|
42
|
-
1. Fork the repository and clone your fork, or
|
43
|
-
|
44
|
-
$ git clone git://github.com/shoes/shoes4.git
|
45
|
-
|
46
|
-
2. Set up your local environment
|
47
|
-
|
48
|
-
$ cd shoes4
|
49
|
-
$ gem install bundler && bundle install
|
50
|
-
|
51
|
-
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 >= 1.7.0. We recommend up to date versions though.
|
52
|
-
|
53
|
-
3. You're ready to go!
|
54
|
-
|
55
|
-
#### Windows
|
56
|
-
|
57
|
-
1. Fork the repository and clone your fork, or
|
58
|
-
|
59
|
-
C:\tmp> git clone git://github.com/shoes/shoes4.git
|
60
|
-
|
61
|
-
2. Set up your local environment
|
62
|
-
|
63
|
-
C:\tmp>cd shoes4
|
64
|
-
C:\tmp\shoes4>jruby -S gem install bundler
|
65
|
-
C:\tmp\shoes4>jruby -S bundle install
|
66
|
-
|
67
|
-
3. You're ready to go!
|
68
|
-
|
69
|
-
## Running a Shoes App
|
70
|
-
|
71
|
-
Shoes 4 comes with a command-line app runner. Just pass it the filename of your Shoes app.
|
72
|
-
|
73
|
-
$ bin/shoes samples/simple-sound.rb
|
74
|
-
|
75
|
-
**Note:** For Windows, `C:\tmp\shoes4>bin\shoes samples\simple-sound.rb` If you installed Shoes4 as a gem, just do `C:\tmp> shoes path\to\file.rb`
|
76
|
-
|
77
|
-
There is also a simple ruby starter script which you may use as follows:
|
78
|
-
|
79
|
-
$ bin/ruby-shoes samples/simple-sound.rb
|
80
|
-
|
81
|
-
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):
|
82
|
-
|
83
|
-
$ jruby -J-XstartOnFirstThread bin/ruby-shoes samples/simple-sound.rb
|
84
|
-
|
85
|
-
Another alternative yet is to put `require 'shoes'` at the top of your applications, then you can simply do
|
86
|
-
|
87
|
-
$ jruby path/to/file.rb
|
88
|
-
|
89
|
-
On OS X you still need to supply the additional parameters to JRuby
|
90
|
-
|
91
|
-
$ jruby -J-XstartOnFirstThread path/to/file.rb
|
92
|
-
|
93
|
-
## Want to see what shoes can do?
|
94
|
-
|
95
|
-
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!
|
96
|
-
If you notice any issue with those samples please [let us know](https://github.com/shoes/shoes4/issues/new)!
|
97
|
-
|
98
|
-
## Packaging a Shoes App
|
99
|
-
|
100
|
-
Packaging is just a baby, so be gentle.
|
101
|
-
|
102
|
-
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:
|
103
|
-
|
104
|
-
$ rake install:all
|
105
|
-
|
106
|
-
Now, you can package an app. But first, look here:
|
107
|
-
|
108
|
-
- The packager will include ***everything*** in the directory of your shoes script and below, unless you tell it not to.
|
109
|
-
- 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:
|
110
|
-
|
111
|
-
> warning: Bundler \`path' components are not currently supported.
|
112
|
-
> The \`shoes-4.0.0.pre1' component was not bundled.
|
113
|
-
> Your application may fail to boot!
|
114
|
-
|
115
|
-
That's Warbler talking. Actually, we sneak the Shoes gem in anyway, but don't tell.
|
116
|
-
|
117
|
-
Okay, now for real. The simplest thing is to put your script in a directory by itself and then:
|
118
|
-
|
119
|
-
$ bin/shoes -p swt:app path/to/directory-of/your-shoes-app.rb
|
120
|
-
|
121
|
-
This will produce a Mac app, which you can then find at `path/to/directory-of/pkg/Shoes App.app`.
|
122
|
-
|
123
|
-
You can also package a shoes app up as a jar through:
|
124
|
-
|
125
|
-
$ bin/shoes -p swt:jar path/to/directory-of/your-shoes-app.rb
|
126
|
-
|
127
|
-
You can find the jar in the same directory as above, i.e. path/to/directory-of/pkg/your-shoes-app.jar
|
128
|
-
|
129
|
-
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](https://github.com/shoes/shoes4/blob/master/app.yaml) for more details.
|
130
|
-
|
131
|
-
***Note:*** *If you use an `app.yaml`, you will have to customize or comment out each option. The example is just an example ;)*
|
132
|
-
|
133
|
-
When you have an `app.yaml` file right next to your script, you have three options:
|
134
|
-
|
135
|
-
$ bin/shoes -p swt:app path/to/directory-of/your-shoes-app.rb
|
136
|
-
$ bin/shoes -p swt:app path/to/directory-of/app.yaml
|
137
|
-
$ bin/shoes -p swt:app path/to/directory-of
|
138
|
-
|
139
|
-
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`.
|
140
|
-
|
141
|
-
Oh, and you can also just run your Shoes apps with `bin/shoes`.
|
142
|
-
|
143
|
-
## Want to contribute?
|
144
|
-
|
145
|
-
That's awesome, thank you!
|
146
|
-
|
147
|
-
You can go ahead an try to fix one of our [issues](https://github.com/shoes/shoes4/issues).
|
148
|
-
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.
|
149
|
-
Please feel free to tackle any issue - we will help you if needed. The tag is just a suggestion! =)
|
150
|
-
|
151
|
-
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`.
|
152
|
-
|
153
|
-
With all you do, please make sure to write specs as Shoes 4 is developed TDD-style (see the [Running Specs](https://github.com/shoes/shoes4#running-specs) section below). So make sure that you don't break any tests :-)
|
154
|
-
|
155
|
-
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!
|
156
|
-
|
157
|
-
In fact we greatly appreciate early pull requests to review code and help you find your way around Shoes4! =)
|
158
|
-
|
159
|
-
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 :-)
|
160
|
-
|
161
|
-
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](https://codeclimate.com/github/shoes/shoes4) 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?
|
162
|
-
|
163
|
-
Refer to the following section for information on how to run the specs, that were mentioned before :-)
|
164
|
-
|
165
|
-
## Running Specs
|
166
|
-
|
167
|
-
Shoes 4 is developed in a TDD style. You should be writing and running the specs :)
|
168
|
-
|
169
|
-
There are two kinds of Shoes 4 specs:
|
170
|
-
|
171
|
-
1. **Integration specs:** These specify the functionality of the Shoes
|
172
|
-
DSL. They can be run with any compatible Shoes backend. Shoes 4 comes
|
173
|
-
with a mock backend and an Swt backend that can run the integration
|
174
|
-
specs.
|
175
|
-
|
176
|
-
2. **Isolation specs:** These specify the internal behavior of a Shoes
|
177
|
-
backend, in isolation from the DSL. Shoes 4 comes with an isolation spec
|
178
|
-
suite for the Swt backend.
|
179
|
-
|
180
|
-
There are rake tasks for running specs. Some examples:
|
181
|
-
|
182
|
-
$ rake spec # Run the whole spec suite
|
183
|
-
$ rake spec:shoes # Run integration specs using the mock backend
|
184
|
-
$ rake spec:swt # Run integration specs using the Swt backend, plus isolation specs for the Swt backend
|
185
|
-
$ rake spec:swt:isolation # Run isolation specs for the Swt backend
|
186
|
-
$ rake spec:swt:integration # Run integration specs using the Swt backend
|
187
|
-
$ rake spec[Shape] # Run the whole spec suite, but only for Shape
|
188
|
-
$ rake spec:shoes[Shape] # Run integration specs for Shape using the mock backend
|
189
|
-
$ rake spec:swt[Shape] # Run integration and isolation specs for Shape, using the Swt backend
|
190
|
-
$ rake spec:swt:isolation[Shape] # Run isolation specs for Shape using the Swt backend
|
191
|
-
|
192
|
-
**Note:** For Windows, `C:\tmp\shoes4>jruby -S rake spec`
|
193
|
-
|
194
|
-
## Contact
|
195
|
-
|
196
|
-
Want to get in touch with the shoes community? That's great! You can get in touch here:
|
197
|
-
|
198
|
-
* You can join the mailing list, simply send an email to shoes@librelist.com - you can also check out [the archives](http://librelist.com/browser/shoes/)
|
199
|
-
* We also have an irc channel #shoes on freenode - a lot of people are idling there so it might take some time to react
|
200
|
-
|
201
|
-
However we try to keep most discussions about the development in this repository/its issues so everyone can see them and look them up.
|
3
|
+
This is the default shoes backend, implemented for JRuby using the SWT library.
|
4
|
+
In addition to implementing the full backend interface it also installs the
|
5
|
+
`shoes-swt` executable which can be targeted by the main `shoes-picker`
|
6
|
+
executable.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/shoes-swt
ADDED
data/lib/shoes/swt.rb
CHANGED
@@ -29,7 +29,7 @@ class Shoes
|
|
29
29
|
extend ::Shoes::Common::Registration
|
30
30
|
|
31
31
|
module Shoes
|
32
|
-
def self.app(opts={}, &blk)
|
32
|
+
def self.app(opts = {}, &blk)
|
33
33
|
Shoes::App.new(opts, &blk)
|
34
34
|
Shoes.logger.debug "Exiting Shoes.app"
|
35
35
|
end
|
@@ -42,7 +42,7 @@ class Shoes
|
|
42
42
|
::Swt::Widgets::Display.getCurrent
|
43
43
|
end
|
44
44
|
|
45
|
-
::Swt::Widgets::Display.new.getFontList(nil, true).each{|f| ::Shoes::FONTS << f.getName}
|
45
|
+
::Swt::Widgets::Display.new.getFontList(nil, true).each { |f| ::Shoes::FONTS << f.getName }
|
46
46
|
::Shoes::FONTS.uniq!
|
47
47
|
end
|
48
48
|
end
|
@@ -51,6 +51,7 @@ end
|
|
51
51
|
Shoes.configuration.backend = :swt
|
52
52
|
|
53
53
|
require 'shoes/swt/disposed_protection'
|
54
|
+
require 'shoes/swt/click_listener'
|
54
55
|
require 'shoes/swt/color'
|
55
56
|
require 'shoes/swt/color_factory'
|
56
57
|
require 'shoes/swt/common/child'
|
@@ -112,6 +113,8 @@ require 'shoes/swt/text_block/fitter'
|
|
112
113
|
require 'shoes/swt/text_block/text_font_factory'
|
113
114
|
require 'shoes/swt/text_block/text_style_factory'
|
114
115
|
|
116
|
+
require 'shoes/swt/packager'
|
117
|
+
|
115
118
|
require 'shoes/swt/tooling/leak_hunter' if ENV["LEAK_HUNTER"]
|
116
119
|
|
117
120
|
# redrawing aspect needs to know all the classes
|
data/lib/shoes/swt/animation.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
class Shoes
|
2
2
|
module Swt
|
3
3
|
class Animation
|
4
|
-
|
5
4
|
attr_reader :task
|
6
5
|
|
7
6
|
# An Swt animation implementation
|
@@ -15,7 +14,7 @@ class Shoes
|
|
15
14
|
|
16
15
|
# Wrap the animation block so we can count frames.
|
17
16
|
# Note that the task re-calls itself on each run.
|
18
|
-
@task =
|
17
|
+
@task = proc do
|
19
18
|
unless animation_removed?
|
20
19
|
run_animation unless @dsl.stopped?
|
21
20
|
schedule_next_animation
|
@@ -29,6 +28,7 @@ class Shoes
|
|
29
28
|
end
|
30
29
|
|
31
30
|
private
|
31
|
+
|
32
32
|
def animation_removed?
|
33
33
|
@app.real.disposed? || @dsl.removed?
|
34
34
|
end
|
data/lib/shoes/swt/app.rb
CHANGED
@@ -19,10 +19,9 @@ class Shoes
|
|
19
19
|
include Common::Container
|
20
20
|
include Common::Clickable
|
21
21
|
|
22
|
-
attr_reader :dsl, :real, :shell, :
|
22
|
+
attr_reader :dsl, :real, :shell, :click_listener
|
23
23
|
|
24
|
-
def initialize
|
25
|
-
@clickable_elements = []
|
24
|
+
def initialize(dsl)
|
26
25
|
@dsl = dsl
|
27
26
|
::Swt::Widgets::Display.app_name = @dsl.app_title
|
28
27
|
@background = Color.new(@dsl.opts[:background])
|
@@ -58,24 +57,20 @@ class Shoes
|
|
58
57
|
end
|
59
58
|
|
60
59
|
def width
|
61
|
-
|
62
|
-
@shell.client_area.width
|
63
|
-
else
|
64
|
-
width_adjusted_for_scrollbars
|
65
|
-
end
|
60
|
+
shell.client_area.width
|
66
61
|
end
|
67
62
|
|
68
63
|
def height
|
69
|
-
|
64
|
+
shell.client_area.height
|
70
65
|
end
|
71
66
|
|
72
67
|
def disposed?
|
73
68
|
@shell.disposed? || @real.disposed?
|
74
69
|
end
|
75
70
|
|
76
|
-
def redraw(left=nil, top=nil, width=nil, height=nil, all=true)
|
71
|
+
def redraw(left = nil, top = nil, width = nil, height = nil, all = true)
|
77
72
|
unless @real.disposed?
|
78
|
-
if
|
73
|
+
if left.nil? || top.nil? || width.nil? || height.nil?
|
79
74
|
@real.redraw
|
80
75
|
else
|
81
76
|
@real.redraw(left, top, width, height, all)
|
@@ -94,14 +89,15 @@ class Shoes
|
|
94
89
|
end
|
95
90
|
|
96
91
|
def scroll_top
|
97
|
-
@real.
|
92
|
+
@real.location.y
|
98
93
|
end
|
99
94
|
|
100
95
|
def scroll_top=(n)
|
101
96
|
@real.setLocation 0, -n
|
102
|
-
@shell.
|
97
|
+
@shell.vertical_bar.selection = n
|
103
98
|
end
|
104
99
|
|
100
|
+
# Java doesn't like ruby-style accessors here for some reason
|
105
101
|
def clipboard
|
106
102
|
::Swt::Clipboard.new(Shoes.display).getContents ::Swt::TextTransfer.getInstance
|
107
103
|
end
|
@@ -121,8 +117,8 @@ class Shoes
|
|
121
117
|
@shell.full_screen
|
122
118
|
end
|
123
119
|
|
124
|
-
def
|
125
|
-
@clickable_elements
|
120
|
+
def clickable_elements
|
121
|
+
@click_listener.clickable_elements
|
126
122
|
end
|
127
123
|
|
128
124
|
def started?
|
@@ -134,7 +130,7 @@ class Shoes
|
|
134
130
|
# method is called, we don't rely on its reported value.
|
135
131
|
def gutter
|
136
132
|
# 16
|
137
|
-
@shell.
|
133
|
+
@shell.vertical_bar.size.x
|
138
134
|
end
|
139
135
|
|
140
136
|
def add_key_listener(listener)
|
@@ -145,12 +141,21 @@ class Shoes
|
|
145
141
|
@key_listeners[listener.class].delete(listener)
|
146
142
|
end
|
147
143
|
|
144
|
+
# For use from modal Shoes windows, keeps pumping UI messages but hangs
|
145
|
+
# on from executing other Shoes code until we're done.
|
146
|
+
def wait_until_closed
|
147
|
+
until @shell.isDisposed
|
148
|
+
::Swt.display.sleep unless ::Swt.display.readAndDispatch
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
148
152
|
private
|
153
|
+
|
149
154
|
def initialize_scroll_bar
|
150
|
-
scroll_bar = @shell.
|
151
|
-
scroll_bar.
|
155
|
+
scroll_bar = @shell.vertical_bar
|
156
|
+
scroll_bar.increment = 10
|
152
157
|
selection_listener = SelectionListener.new(scroll_bar) do |vertical_bar, event|
|
153
|
-
if
|
158
|
+
if shell.vertical_bar.visible && event.detail != ::Swt::SWT::DRAG
|
154
159
|
vertically_scroll_window(vertical_bar)
|
155
160
|
end
|
156
161
|
end
|
@@ -158,9 +163,9 @@ class Shoes
|
|
158
163
|
end
|
159
164
|
|
160
165
|
def vertically_scroll_window(vertical_bar)
|
161
|
-
location =
|
162
|
-
location.y = -vertical_bar.
|
163
|
-
|
166
|
+
location = real.location
|
167
|
+
location.y = -vertical_bar.selection
|
168
|
+
real.location = location
|
164
169
|
end
|
165
170
|
|
166
171
|
def force_shell_size
|
@@ -172,15 +177,16 @@ class Shoes
|
|
172
177
|
end
|
173
178
|
|
174
179
|
def main_window_on_close
|
175
|
-
lambda
|
180
|
+
lambda do |_event|
|
176
181
|
::Swt.display.dispose
|
177
|
-
Dir[File.join(Dir.tmpdir, "__shoes4_*.png")].each{|f| File.delete f}
|
178
|
-
|
182
|
+
Dir[File.join(Dir.tmpdir, "__shoes4_*.png")].each { |f| File.delete f }
|
183
|
+
end
|
179
184
|
end
|
180
185
|
|
181
186
|
def main_window_style
|
182
187
|
style = ::Swt::SWT::CLOSE | ::Swt::SWT::MIN | ::Swt::SWT::V_SCROLL
|
183
188
|
style |= ::Swt::SWT::RESIZE | ::Swt::SWT::MAX if @dsl.opts[:resizable]
|
189
|
+
style |= ::Swt::SWT::APPLICATION_MODAL if @dsl.opts[:modal]
|
184
190
|
style
|
185
191
|
end
|
186
192
|
|
@@ -196,9 +202,9 @@ class Shoes
|
|
196
202
|
|
197
203
|
def initialize_real
|
198
204
|
@real = ::Swt::Widgets::Composite.new(@shell,
|
199
|
-
|
200
|
-
@real.setSize(@dsl.width - @shell.
|
201
|
-
@real.
|
205
|
+
::Swt::SWT::TRANSPARENT | ::Swt::SWT::NO_RADIO_GROUP)
|
206
|
+
@real.setSize(@dsl.width - @shell.vertical_bar.size.x, @dsl.height)
|
207
|
+
@real.layout = init_shoes_layout
|
202
208
|
end
|
203
209
|
|
204
210
|
# it seems like the class can not not have a constructor with an argument
|
@@ -213,6 +219,7 @@ class Shoes
|
|
213
219
|
attach_shell_event_listeners
|
214
220
|
attach_real_event_listeners
|
215
221
|
attach_key_event_listeners
|
222
|
+
attach_click_listener
|
216
223
|
end
|
217
224
|
|
218
225
|
def attach_shell_event_listeners
|
@@ -222,7 +229,7 @@ class Shoes
|
|
222
229
|
end
|
223
230
|
|
224
231
|
def unregister_app
|
225
|
-
proc do |
|
232
|
+
proc do |_event|
|
226
233
|
::Shoes::Swt.unregister(self)
|
227
234
|
end
|
228
235
|
end
|
@@ -252,22 +259,13 @@ class Shoes
|
|
252
259
|
end
|
253
260
|
end
|
254
261
|
|
255
|
-
def
|
256
|
-
|
262
|
+
def attach_click_listener
|
263
|
+
@click_listener = ClickListener.new(self)
|
257
264
|
end
|
258
265
|
|
259
|
-
def
|
260
|
-
|
261
|
-
end
|
262
|
-
|
263
|
-
def width_adjusted_for_scrollbars
|
264
|
-
if @shell.getVerticalBar.getVisible
|
265
|
-
@shell.client_area.width + @shell.getVerticalBar.getSize.x
|
266
|
-
else
|
267
|
-
@shell.client_area.width
|
268
|
-
end
|
266
|
+
def for_this_shell?(evt)
|
267
|
+
evt.widget.shell == @shell unless evt.widget.disposed?
|
269
268
|
end
|
270
|
-
|
271
269
|
end
|
272
270
|
|
273
271
|
class ShellControlListener
|
@@ -277,21 +275,19 @@ class Shoes
|
|
277
275
|
|
278
276
|
def controlResized(event)
|
279
277
|
shell = event.widget
|
280
|
-
width
|
278
|
+
width = shell.client_area.width
|
281
279
|
height = shell.client_area.height
|
282
|
-
@app.dsl.top_slot.width = width
|
283
|
-
@app.dsl.top_slot.height = height
|
284
280
|
@app.real.setSize width, height
|
285
281
|
@app.real.layout
|
286
|
-
@app.dsl.resize_callbacks.each
|
282
|
+
@app.dsl.resize_callbacks.each(&:call)
|
287
283
|
end
|
288
284
|
|
289
|
-
def controlMoved(
|
285
|
+
def controlMoved(_e)
|
290
286
|
end
|
291
287
|
end
|
292
288
|
|
293
289
|
class MouseListener
|
294
|
-
def initialize
|
290
|
+
def initialize(app)
|
295
291
|
@app = app
|
296
292
|
end
|
297
293
|
|
@@ -305,10 +301,9 @@ class Shoes
|
|
305
301
|
@app.dsl.mouse_pos = [e.x, e.y]
|
306
302
|
end
|
307
303
|
|
308
|
-
def mouseDoubleClick(
|
304
|
+
def mouseDoubleClick(_e)
|
309
305
|
# do nothing
|
310
306
|
end
|
311
307
|
end
|
312
|
-
|
313
308
|
end
|
314
309
|
end
|