scarpe 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/CHANGELOG.md +16 -2
- data/Gemfile.lock +7 -3
- data/README.md +24 -8
- data/Rakefile +1 -1
- data/examples/animate.rb +20 -0
- data/examples/arrow.rb +10 -0
- data/examples/btn_tooltip.rb +7 -0
- data/examples/button_style_changed.rb +7 -0
- data/examples/button_styles_default.rb +6 -0
- data/examples/gen.rb +8 -8
- data/examples/highlander.rb +3 -3
- data/examples/legacy/README.md +6 -0
- data/examples/legacy/not_checked/shoes-contrib/basic/shoes-notes.rb +1 -1
- data/examples/legacy/not_checked/simple/anim-shapes.rb +1 -1
- data/examples/legacy/not_checked/speedometer_app.rb +55 -0
- data/examples/legacy/working/simple/image-icon.rb +3 -0
- data/examples/legacy/{not_checked → working}/simple/image.rb +1 -1
- data/examples/list_box_choose.rb +17 -0
- data/examples/local_assets/local_file_server.rb +82 -0
- data/examples/local_assets/sample.gif +0 -0
- data/examples/local_assets/sample.mp4 +0 -0
- data/examples/local_fonts.rb +2 -2
- data/examples/local_images.rb +2 -3
- data/examples/para/para_text.rb +14 -0
- data/examples/progress.rb +31 -0
- data/examples/radio/radio_groups.rb +2 -2
- data/examples/rect.rb +4 -0
- data/examples/rotate_shapes.rb +17 -0
- data/examples/simpler-menu.rb +21 -0
- data/exe/scarpe +2 -1
- data/lacci/Gemfile +2 -0
- data/lacci/Gemfile.lock +8 -1
- data/lacci/lacci.gemspec +1 -1
- data/lacci/lib/lacci/scarpe_cli.rb +2 -1
- data/lacci/lib/lacci/scarpe_core.rb +2 -1
- data/lacci/lib/lacci/version.rb +1 -1
- data/lacci/lib/scarpe/niente/app.rb +23 -0
- data/lacci/lib/scarpe/niente/display_service.rb +62 -0
- data/lacci/lib/scarpe/niente/drawable.rb +57 -0
- data/lacci/lib/scarpe/niente/logger.rb +29 -0
- data/lacci/lib/scarpe/niente/shoes_spec.rb +87 -0
- data/lacci/lib/scarpe/niente.rb +20 -0
- data/lacci/lib/shoes/app.rb +88 -43
- data/lacci/lib/shoes/background.rb +2 -2
- data/lacci/lib/shoes/border.rb +2 -2
- data/lacci/lib/shoes/builtins.rb +63 -0
- data/lacci/lib/shoes/changelog.rb +52 -0
- data/lacci/lib/shoes/colors.rb +3 -1
- data/lacci/lib/shoes/constants.rb +19 -1
- data/lacci/lib/shoes/display_service.rb +39 -16
- data/lacci/lib/shoes/download.rb +2 -2
- data/lacci/lib/shoes/drawable.rb +380 -0
- data/lacci/lib/shoes/drawables/arc.rb +49 -0
- data/lacci/lib/shoes/drawables/arrow.rb +41 -0
- data/lacci/lib/shoes/drawables/button.rb +73 -0
- data/lacci/lib/shoes/{widgets → drawables}/check.rb +5 -4
- data/lacci/lib/shoes/{widgets → drawables}/document_root.rb +3 -3
- data/lacci/lib/shoes/{widgets → drawables}/edit_box.rb +6 -6
- data/lacci/lib/shoes/{widgets → drawables}/edit_line.rb +6 -6
- data/lacci/lib/shoes/{widgets → drawables}/flow.rb +6 -6
- data/lacci/lib/shoes/{widgets → drawables}/image.rb +6 -6
- data/lacci/lib/shoes/{widgets → drawables}/line.rb +7 -5
- data/lacci/lib/shoes/drawables/link.rb +34 -0
- data/lacci/lib/shoes/drawables/list_box.rb +56 -0
- data/lacci/lib/shoes/drawables/para.rb +118 -0
- data/lacci/lib/shoes/drawables/progress.rb +14 -0
- data/lacci/lib/shoes/drawables/radio.rb +33 -0
- data/lacci/lib/shoes/drawables/rect.rb +17 -0
- data/lacci/lib/shoes/{widgets → drawables}/shape.rb +6 -7
- data/lacci/lib/shoes/{widgets → drawables}/slot.rb +32 -20
- data/lacci/lib/shoes/{widgets → drawables}/span.rb +8 -7
- data/lacci/lib/shoes/{widgets → drawables}/stack.rb +6 -4
- data/lacci/lib/shoes/drawables/star.rb +50 -0
- data/lacci/lib/shoes/drawables/subscription_item.rb +93 -0
- data/lacci/lib/shoes/drawables/text_drawable.rb +63 -0
- data/lacci/lib/shoes/drawables/video.rb +16 -0
- data/lacci/lib/shoes/drawables/widget.rb +69 -0
- data/lacci/lib/shoes/drawables.rb +31 -0
- data/lacci/lib/shoes/errors.rb +28 -0
- data/lacci/lib/shoes/log.rb +2 -2
- data/lacci/lib/shoes/ruby_extensions.rb +15 -0
- data/lacci/lib/shoes/spacing.rb +2 -2
- data/lacci/lib/shoes-spec.rb +93 -0
- data/lacci/lib/shoes.rb +27 -7
- data/lacci/test/test_helper.rb +54 -0
- data/lacci/test/test_lacci.rb +12 -3
- data/lacci/test/test_shoes_errors.rb +49 -0
- data/lib/scarpe/cats_cradle.rb +81 -59
- data/lib/scarpe/errors.rb +77 -0
- data/lib/scarpe/evented_assertions.rb +50 -17
- data/lib/scarpe/shoes_spec.rb +181 -0
- data/lib/scarpe/version.rb +2 -2
- data/lib/scarpe/wv/app.rb +20 -20
- data/lib/scarpe/wv/arc.rb +4 -47
- data/lib/scarpe/wv/arrow.rb +9 -0
- data/lib/scarpe/wv/button.rb +7 -35
- data/lib/scarpe/wv/check.rb +3 -5
- data/lib/scarpe/wv/control_interface.rb +18 -20
- data/lib/scarpe/wv/document_root.rb +81 -4
- data/lib/scarpe/wv/{widget.rb → drawable.rb} +66 -43
- data/lib/scarpe/wv/edit_box.rb +4 -17
- data/lib/scarpe/wv/edit_line.rb +4 -18
- data/lib/scarpe/wv/flow.rb +2 -18
- data/lib/scarpe/wv/image.rb +8 -28
- data/lib/scarpe/wv/line.rb +3 -25
- data/lib/scarpe/wv/link.rb +3 -16
- data/lib/scarpe/wv/list_box.rb +6 -29
- data/lib/scarpe/wv/para.rb +11 -30
- data/lib/scarpe/wv/progress.rb +19 -0
- data/lib/scarpe/wv/radio.rb +9 -10
- data/lib/scarpe/wv/rect.rb +13 -0
- data/lib/scarpe/wv/shape.rb +3 -8
- data/lib/scarpe/wv/slot.rb +8 -25
- data/lib/scarpe/wv/span.rb +3 -27
- data/lib/scarpe/wv/stack.rb +2 -18
- data/lib/scarpe/wv/star.rb +3 -53
- data/lib/scarpe/wv/subscription_item.rb +38 -4
- data/lib/scarpe/wv/text_drawable.rb +32 -0
- data/lib/scarpe/wv/video.rb +15 -15
- data/lib/scarpe/wv/web_wrangler.rb +299 -329
- data/lib/scarpe/wv/webview_local_display.rb +48 -33
- data/lib/scarpe/wv/webview_relay_display.rb +12 -12
- data/lib/scarpe/wv/webview_relay_util.rb +7 -10
- data/lib/scarpe/wv/wv_display_worker.rb +2 -2
- data/lib/scarpe/wv.rb +45 -12
- data/lib/scarpe/wv_local.rb +1 -1
- data/lib/scarpe/wv_relay.rb +1 -1
- data/lib/scarpe.rb +1 -0
- data/logger/debug_web_wrangler.json +1 -1
- data/logger/scarpe_wv_test.json +1 -1
- data/scarpe-components/Gemfile.lock +86 -0
- data/scarpe-components/lib/scarpe/components/base64.rb +3 -7
- data/scarpe-components/lib/scarpe/components/calzini/alert.rb +49 -0
- data/scarpe-components/lib/scarpe/components/calzini/art_widgets.rb +203 -0
- data/scarpe-components/lib/scarpe/components/calzini/button.rb +39 -0
- data/scarpe-components/lib/scarpe/components/calzini/misc.rb +146 -0
- data/scarpe-components/lib/scarpe/components/calzini/para.rb +35 -0
- data/scarpe-components/lib/scarpe/components/calzini/slots.rb +155 -0
- data/scarpe-components/lib/scarpe/components/calzini/text_widgets.rb +65 -0
- data/scarpe-components/lib/scarpe/components/calzini.rb +149 -0
- data/scarpe-components/lib/scarpe/components/errors.rb +20 -0
- data/scarpe-components/lib/scarpe/components/file_helpers.rb +1 -0
- data/scarpe-components/lib/scarpe/components/html.rb +131 -0
- data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +75 -0
- data/scarpe-components/lib/scarpe/components/minitest_import_runnable.rb +98 -0
- data/scarpe-components/lib/scarpe/components/minitest_result.rb +86 -0
- data/scarpe-components/lib/scarpe/components/modular_logger.rb +5 -5
- data/scarpe-components/lib/scarpe/components/print_logger.rb +9 -5
- data/scarpe-components/lib/scarpe/components/promises.rb +14 -14
- data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +36 -17
- data/scarpe-components/lib/scarpe/components/string_helpers.rb +10 -0
- data/scarpe-components/lib/scarpe/components/tiranti.rb +225 -0
- data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +45 -5
- data/scarpe-components/lib/scarpe/components/version.rb +2 -2
- data/scarpe-components/test/calzini/test_calzini_alert.rb +30 -0
- data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +105 -0
- data/scarpe-components/test/calzini/test_calzini_button.rb +52 -0
- data/scarpe-components/test/calzini/test_calzini_misc.rb +115 -0
- data/scarpe-components/test/calzini/test_calzini_para.rb +37 -0
- data/scarpe-components/test/calzini/test_calzini_slots.rb +130 -0
- data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +41 -0
- data/scarpe-components/test/mtr_data/exception.json +1 -0
- data/scarpe-components/test/mtr_data/fail_with_message.json +1 -0
- data/scarpe-components/test/mtr_data/skipped_no_message.json +1 -0
- data/scarpe-components/test/mtr_data/skipped_w_msg.json +1 -0
- data/scarpe-components/test/mtr_data/succeed_2_asserts.json +1 -0
- data/scarpe-components/test/test_dimensions.rb +26 -0
- data/scarpe-components/test/test_helper.rb +20 -0
- data/scarpe-components/test/test_html.rb +65 -0
- data/scarpe-components/test/test_minitest_result.rb +61 -0
- data/scarpe-components/test/test_promises.rb +5 -4
- data/scarpe-components/test/test_segmented_app_files.rb +8 -6
- data/scarpegen.rb +14 -14
- data/sig/scarpe.rbs +1 -1
- data/templates/basic_class_template.erb +13 -14
- data/templates/class_template_with_event_bind.erb +4 -4
- data/templates/class_template_with_shapes.erb +8 -17
- data/templates/example_template.erb +1 -1
- data/templates/module_template.erb +4 -4
- data/templates/webview_template.erb +3 -2
- metadata +113 -55
- data/examples/legacy/not_checked/shoes-contrib/elements/image-icon.rb +0 -3
- data/lacci/lib/shoes/widget.rb +0 -218
- data/lacci/lib/shoes/widgets/alert.rb +0 -19
- data/lacci/lib/shoes/widgets/arc.rb +0 -51
- data/lacci/lib/shoes/widgets/button.rb +0 -35
- data/lacci/lib/shoes/widgets/font.rb +0 -14
- data/lacci/lib/shoes/widgets/link.rb +0 -25
- data/lacci/lib/shoes/widgets/list_box.rb +0 -25
- data/lacci/lib/shoes/widgets/para.rb +0 -68
- data/lacci/lib/shoes/widgets/radio.rb +0 -35
- data/lacci/lib/shoes/widgets/star.rb +0 -44
- data/lacci/lib/shoes/widgets/subscription_item.rb +0 -60
- data/lacci/lib/shoes/widgets/text_widget.rb +0 -51
- data/lacci/lib/shoes/widgets/video.rb +0 -15
- data/lacci/lib/shoes/widgets.rb +0 -29
- data/lib/scarpe/wv/alert.rb +0 -66
- data/lib/scarpe/wv/background.rb +0 -27
- data/lib/scarpe/wv/border.rb +0 -24
- data/lib/scarpe/wv/control_interface_test.rb +0 -238
- data/lib/scarpe/wv/dimensions.rb +0 -22
- data/lib/scarpe/wv/font.rb +0 -36
- data/lib/scarpe/wv/html.rb +0 -108
- data/lib/scarpe/wv/spacing.rb +0 -41
- data/lib/scarpe/wv/text_widget.rb +0 -30
- /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/definr.rb +0 -0
- /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/funnies.rb +0 -0
- /data/examples/legacy/not_checked/shoes-contrib/{elements → basic}/list_box-select-class.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/basic-edit-box.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/basic-fps.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/border-cat.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/check-mate.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/clock.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/gradient-shoes.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/list_box.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/phat-button.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib → working}/simple/simple-calc.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/position → working/simple}/stack-width.rb +0 -0
- /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c83fb76fc149cffa58c679978dc3647689acb5b418d7e65a931bddfb1687b250
|
|
4
|
+
data.tar.gz: 2b73dae2f9f5be78d6b5637d605b089c3031b14aff91acc1eced51f021283f5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6da8066857ec4241252fcca4bbe01a60c369260b618a65f44384666a4ed67311ee3bd065ab68bed79f7084e3f8c5ba7c8db3244c3cbcf9e166d1ad5130ccb43d
|
|
7
|
+
data.tar.gz: b8ba6762940cc53078e1461024f26b762acd302a99cb6fccd965b4c4018ac1452ad85821c78c8ab59b28db572ac899781d1e84bacd77bce602a9edeb0fe84a85
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -10,10 +10,24 @@ straightforward as possible.
|
|
|
10
10
|
|
|
11
11
|
### Fixed
|
|
12
12
|
|
|
13
|
-
## [0.
|
|
13
|
+
## [0.3.0] - 2023-11-24 - You
|
|
14
|
+
|
|
15
|
+
- Progress bars
|
|
16
|
+
- Various new APIs and many bug fixes
|
|
17
|
+
- Added Tiranti, a Bootstrap-based Calzini HTML renderer replacement
|
|
18
|
+
- Added Calzini, a Drawable-to-HTML renderer
|
|
19
|
+
- Rename of Widget to Drawable
|
|
20
|
+
- Extremely early Shoes-Spec testing support
|
|
21
|
+
- Niente, a "no-op" testing display service
|
|
22
|
+
|
|
23
|
+
## [0.2.1] - 2023-07-02 - Give
|
|
24
|
+
|
|
25
|
+
- Bugfix release
|
|
26
|
+
|
|
27
|
+
## [0.2.0] - 2023-07-02 - Gonna
|
|
14
28
|
|
|
15
29
|
- First batch of functionality. Will aggressively track to changelog from here on out.
|
|
16
30
|
|
|
17
|
-
## [0.1.0] -
|
|
31
|
+
## [0.1.0] - 2023-02-09 - Never
|
|
18
32
|
|
|
19
33
|
- Initial release
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
scarpe (0.
|
|
4
|
+
scarpe (0.3.0)
|
|
5
5
|
bloops (~> 0.5)
|
|
6
6
|
fastimage
|
|
7
7
|
lacci
|
|
@@ -14,12 +14,13 @@ PATH
|
|
|
14
14
|
PATH
|
|
15
15
|
remote: lacci
|
|
16
16
|
specs:
|
|
17
|
-
lacci (0.
|
|
17
|
+
lacci (0.3.0)
|
|
18
|
+
scarpe-components
|
|
18
19
|
|
|
19
20
|
PATH
|
|
20
21
|
remote: scarpe-components
|
|
21
22
|
specs:
|
|
22
|
-
scarpe-components (0.
|
|
23
|
+
scarpe-components (0.3.0)
|
|
23
24
|
|
|
24
25
|
GEM
|
|
25
26
|
remote: https://rubygems.org/
|
|
@@ -53,6 +54,8 @@ GEM
|
|
|
53
54
|
multi_json (1.15.0)
|
|
54
55
|
nokogiri (1.15.2-x86_64-darwin)
|
|
55
56
|
racc (~> 1.4)
|
|
57
|
+
nokogiri (1.15.2-x86_64-linux)
|
|
58
|
+
racc (~> 1.4)
|
|
56
59
|
parallel (1.22.1)
|
|
57
60
|
parser (3.2.1.0)
|
|
58
61
|
ast (~> 2.4.1)
|
|
@@ -80,6 +83,7 @@ GEM
|
|
|
80
83
|
rubocop (~> 1.44)
|
|
81
84
|
ruby-progressbar (1.11.0)
|
|
82
85
|
sqlite3 (1.6.3-x86_64-darwin)
|
|
86
|
+
sqlite3 (1.6.3-x86_64-linux)
|
|
83
87
|
unicode-display_width (2.4.2)
|
|
84
88
|
webrick (1.7.0)
|
|
85
89
|
webview_ruby (0.1.2)
|
data/README.md
CHANGED
|
@@ -29,17 +29,31 @@ Shoes.app do
|
|
|
29
29
|
end
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
<img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158565981-57240f72-fbaf-4b72-b66e-8c0d517a90d7.png">
|
|
33
|
+
|
|
34
|
+
A bit more...
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
Shoes.app do
|
|
38
|
+
@push = button "Push me"
|
|
39
|
+
@note = para "Nothing pushed so far"
|
|
40
|
+
@push.click {
|
|
41
|
+
@note.replace(
|
|
42
|
+
"Aha! Click! ",
|
|
43
|
+
link("Go back") { @note.replace "Nothing pushed so far" }
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
```
|
|
33
48
|
|
|
34
|
-
|
|
49
|
+
<img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158566011-0372d0c7-fbeb-4ed6-a082-73908f04a0b6.gif">
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
More examples can be found in the [`examples` folder](https://github.com/scarpe-team/scarpe/tree/main/examples)!
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
## Wiki
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
Explore more in the [Scarpe Wiki](https://github.com/scarpe-team/scarpe/wiki) for in-depth documentation, tutorials, and additional resources. Whether you're a new contributor or an experienced user, the Wiki provides valuable information to enhance your Scarpe experience.
|
|
41
56
|
|
|
42
|
-
<img width="480" alt="hello_world" src="https://user-images.githubusercontent.com/9624267/158566011-0372d0c7-fbeb-4ed6-a082-73908f04a0b6.gif">
|
|
43
57
|
|
|
44
58
|
## Scarpe in Development
|
|
45
59
|
|
|
@@ -52,8 +66,10 @@ This repo is where most of the action is happening right now, and to have the fu
|
|
|
52
66
|
```
|
|
53
67
|
# dependencies - Mac version
|
|
54
68
|
brew install portaudio pkg-config # for sound!
|
|
69
|
+
# dependencies - Mac M1 version
|
|
70
|
+
brew install portaudio && bundle config build.bloops --with-portaudio-dir=$(brew --prefix portaudio)
|
|
55
71
|
# dependencies - Ubuntu Linux version
|
|
56
|
-
sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev
|
|
72
|
+
sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev portaudio19-dev
|
|
57
73
|
|
|
58
74
|
for any other linux or windows. please see the webview docs for your [platform](https://github.com/webview/webview#prerequisites)
|
|
59
75
|
|
|
@@ -147,7 +163,7 @@ You can set SCARPE_LOG_CONFIG to an appropriate YAML file to set log levels per-
|
|
|
147
163
|
```
|
|
148
164
|
{
|
|
149
165
|
"default": "warn",
|
|
150
|
-
"
|
|
166
|
+
"Webview::WebWrangler": ["logger/web_wrangler.log", "debug"]
|
|
151
167
|
}
|
|
152
168
|
```
|
|
153
169
|
|
data/Rakefile
CHANGED
data/examples/animate.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Shoes.app do
|
|
2
|
+
stack do
|
|
3
|
+
para "10 fps"
|
|
4
|
+
p = para "-"
|
|
5
|
+
animate do |frame|
|
|
6
|
+
p.replace(frame.to_s)
|
|
7
|
+
end
|
|
8
|
+
para "20 fps"
|
|
9
|
+
p2 = para "-"
|
|
10
|
+
animate(20) do |frame|
|
|
11
|
+
p2.replace(frame.to_s)
|
|
12
|
+
end
|
|
13
|
+
para "3spf"
|
|
14
|
+
p3 = para "-"
|
|
15
|
+
every(3) do |count|
|
|
16
|
+
p3.replace(count.to_s)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
data/examples/arrow.rb
ADDED
data/examples/gen.rb
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
require 'erb'
|
|
3
3
|
|
|
4
4
|
class ScarpeGenerator
|
|
5
|
-
def initialize(filename,
|
|
5
|
+
def initialize(filename, shoes_styles)
|
|
6
6
|
@filename = filename
|
|
7
|
-
@
|
|
7
|
+
@shoes_styles = shoes_styles
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def generate_files(choice, class_template_choice)
|
|
@@ -96,7 +96,7 @@ class ScarpeGenerator
|
|
|
96
96
|
capitalized_argument = @filename.capitalize
|
|
97
97
|
binding.dup.tap do |b|
|
|
98
98
|
b.local_variable_set(:argument, capitalized_argument)
|
|
99
|
-
b.local_variable_set(:
|
|
99
|
+
b.local_variable_set(:shoes_styles, @shoes_styles)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
end
|
|
@@ -109,7 +109,7 @@ Shoes.app(title: 'Templates') do
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
stack width: 400 do
|
|
112
|
-
para 'Enter
|
|
112
|
+
para 'Enter Shoes styles (like :height,:text) '
|
|
113
113
|
$properties_input = edit_line
|
|
114
114
|
end
|
|
115
115
|
|
|
@@ -125,13 +125,13 @@ Shoes.app(title: 'Templates') do
|
|
|
125
125
|
|
|
126
126
|
button 'Generate Files!',color:"#FF7116",padding_bottom:"8",padding_top:"8",text_color:"white",font_size:"16" do
|
|
127
127
|
filename = $filename_input.text
|
|
128
|
-
|
|
129
|
-
choice = $choice_input.
|
|
128
|
+
shoes_styles = $properties_input.text
|
|
129
|
+
choice = $choice_input.text
|
|
130
130
|
|
|
131
|
-
generator = ScarpeGenerator.new(filename,
|
|
131
|
+
generator = ScarpeGenerator.new(filename, shoes_styles)
|
|
132
132
|
|
|
133
133
|
if choice == 'Class'
|
|
134
|
-
generator.generate_files(choice, $class_template_choice_input.
|
|
134
|
+
generator.generate_files(choice, $class_template_choice_input.text)
|
|
135
135
|
else
|
|
136
136
|
generator.generate_files(choice, nil)
|
|
137
137
|
end
|
data/examples/highlander.rb
CHANGED
|
@@ -35,7 +35,7 @@ def update_dup_list
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def highlander_the_selected_item
|
|
38
|
-
selected = $dup_list.
|
|
38
|
+
selected = $dup_list.text
|
|
39
39
|
if !selected || selected == "" || !selected.include?(DIVIDER)
|
|
40
40
|
$bottom_display.replace("Select an item first!")
|
|
41
41
|
return
|
|
@@ -58,7 +58,7 @@ def highlander_the_selected_item
|
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
$dup_list.
|
|
61
|
+
$dup_list.choose nil
|
|
62
62
|
$bottom_display.replace BOTTOM_DISPLAY_INSTRUCTIONS
|
|
63
63
|
update_dup_list
|
|
64
64
|
end
|
|
@@ -67,7 +67,7 @@ Shoes.app(title: "Highlander") do
|
|
|
67
67
|
stack :margin => 40 do
|
|
68
68
|
$top_text = para "Loading..."
|
|
69
69
|
$dup_list = list_box(:items => []).change do
|
|
70
|
-
$bottom_display.replace "Selected duplicates: #{$dup_list.
|
|
70
|
+
$bottom_display.replace "Selected duplicates: #{$dup_list.text.inspect}"
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
update_dup_list
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Legacy Projects
|
|
2
|
+
|
|
3
|
+
These are Shoes examples, taken from a wide variety of sources. In general, we try not to modify them.
|
|
4
|
+
|
|
5
|
+
It's possible that some of them run but we haven't realised it yet, which is why the "not_checked" directory is nameed that, rather than something like "won't work". Also, they aren't checked by CI, while the ones marked working have to at least boot up.
|
|
6
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Source: https://www.hanselman.com/blog/the-weekly-source-code-29-ruby-and-shoes-and-the-first-ruby-virus
|
|
2
|
+
|
|
3
|
+
class Speedometer < Shoes::Widget
|
|
4
|
+
attr_accessor :range, :tick, :position
|
|
5
|
+
def initialize opts = {}
|
|
6
|
+
@range = opts[:range] || 200
|
|
7
|
+
@tick = opts[:tick] || 10
|
|
8
|
+
@position = opts[:position] || 0
|
|
9
|
+
@cx, @cy = self.left + 110, self.top + 100
|
|
10
|
+
|
|
11
|
+
nostroke
|
|
12
|
+
rect :top => self.top, :left => self.left,
|
|
13
|
+
:width => 220, :height => 200
|
|
14
|
+
nofill
|
|
15
|
+
stroke white
|
|
16
|
+
oval :left => @cx - 50, :top => @cy - 50, :radius => 100
|
|
17
|
+
(ticks + 1).times do |i|
|
|
18
|
+
radial_line 225 + ((270.0 / ticks) * i), 70..80
|
|
19
|
+
radial_line 225 + ((270.0 / ticks) * i), 45..49
|
|
20
|
+
end
|
|
21
|
+
strokewidth 2
|
|
22
|
+
oval :left => @cx - 70, :top => @cy - 70, :radius => 140
|
|
23
|
+
stroke lightgreen
|
|
24
|
+
oval :left => @cx - 5, :top => @cy - 5, :radius => 10
|
|
25
|
+
@needle = radial_line 225 + ((270.0 / @range) * @position), 0..90
|
|
26
|
+
end
|
|
27
|
+
def ticks; @range / @tick end
|
|
28
|
+
def radial_line deg, r
|
|
29
|
+
pos = ((deg / 360.0) * (2.0 * Math::PI)) - (Math::PI / 2.0)
|
|
30
|
+
line (Math.cos(pos) * r.begin) + @cx, (Math.sin(pos) * r.begin) + @cy,
|
|
31
|
+
(Math.cos(pos) * r.end) + @cx, (Math.sin(pos) * r.end) + @cy
|
|
32
|
+
end
|
|
33
|
+
def position= pos
|
|
34
|
+
@position = pos
|
|
35
|
+
@needle.remove
|
|
36
|
+
append do
|
|
37
|
+
@needle = radial_line 225 + ((270.0 / @range) * @position), 0..90
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Shoes.app do
|
|
43
|
+
stack do
|
|
44
|
+
para "Enter a number between 0 and 100"
|
|
45
|
+
flow do
|
|
46
|
+
@p = edit_line
|
|
47
|
+
button "OK" do
|
|
48
|
+
@s.position = @p.text.to_i
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
@s = speedometer :range => 100, :ticks => 10
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Shoes.app do
|
|
2
2
|
background "#eee"
|
|
3
3
|
@list = stack do
|
|
4
|
-
@img = image
|
|
4
|
+
@img = image "#{DIR}/docs/static/man-builds.png"
|
|
5
5
|
para "Enter a image URL to download:", :margin => [10, 8, 10, 0]
|
|
6
6
|
flow :margin => 10 do
|
|
7
7
|
@url = edit_line :width => -120
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Shoes.app(title: "Guessing secret word", width: 500, height: 450) do
|
|
2
|
+
secret_word = "apple"
|
|
3
|
+
guess_label = para "Guess the secret word:"
|
|
4
|
+
guess_input = list_box items: ["apple", "banana", "orange"], choose: "orange"
|
|
5
|
+
|
|
6
|
+
button "Guess" do
|
|
7
|
+
guess = guess_input.text
|
|
8
|
+
|
|
9
|
+
if guess == secret_word
|
|
10
|
+
alert("Yayyy! that's right.")
|
|
11
|
+
else
|
|
12
|
+
alert("No, better luck next time😕")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
guess_input.choose "orange"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Require the WEBrick library
|
|
2
|
+
require 'webrick'
|
|
3
|
+
|
|
4
|
+
# Configuration for the server
|
|
5
|
+
configuration = {
|
|
6
|
+
Port: 4567,
|
|
7
|
+
DocumentRoot: File.join(File.dirname(__FILE__), '..', '..', 'examples', 'local_assets')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
# Create a new instance of WEBrick::HTTPServer with the configuration
|
|
11
|
+
server = WEBrick::HTTPServer.new(configuration)
|
|
12
|
+
|
|
13
|
+
# Define a custom servlet to handle file requests
|
|
14
|
+
class FileServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
15
|
+
def do_GET(request, response)
|
|
16
|
+
relative_path = request.path
|
|
17
|
+
path = File.join(@config[:DocumentRoot], relative_path)
|
|
18
|
+
|
|
19
|
+
if File.exist?(path) && !File.directory?(path)
|
|
20
|
+
begin
|
|
21
|
+
file_content = File.read(path)
|
|
22
|
+
|
|
23
|
+
response.status = 200
|
|
24
|
+
response['Content-Type'] = WEBrick::HTTPUtils.mime_type(path, WEBrick::HTTPUtils::DefaultMimeTypes)
|
|
25
|
+
response['Content-Disposition'] = "inline; filename=#{File.basename(path)}"
|
|
26
|
+
response.body = file_content
|
|
27
|
+
rescue StandardError => e
|
|
28
|
+
response.status = 500
|
|
29
|
+
response.body = 'Internal Server Error'
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
response.status = 404
|
|
33
|
+
response.body = 'File not found'
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Mount the custom servlet at the root URL
|
|
39
|
+
server.mount('/', FileServlet)
|
|
40
|
+
|
|
41
|
+
# Set up a signal trap to gracefully shut down the server on interrupt (e.g., Ctrl+C)
|
|
42
|
+
trap('INT') do
|
|
43
|
+
server.shutdown
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Start the server in a separate thread
|
|
47
|
+
server_thread = Thread.new { server.start }
|
|
48
|
+
|
|
49
|
+
# Shoes application to display the file from the local server
|
|
50
|
+
Shoes.app do
|
|
51
|
+
stack do
|
|
52
|
+
flow do
|
|
53
|
+
para "Enter the file path: (e.g., sample.gif, sample.mp4)"
|
|
54
|
+
@file_path = edit_line
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
button "Display File" do
|
|
58
|
+
file_path = @file_path.text
|
|
59
|
+
|
|
60
|
+
begin
|
|
61
|
+
file_extension = File.extname(file_path).downcase
|
|
62
|
+
|
|
63
|
+
case file_extension
|
|
64
|
+
when '.png', '.jpg', '.jpeg', '.gif'
|
|
65
|
+
image "http://localhost:4567/#{file_path}"
|
|
66
|
+
when '.mp4', '.mov'
|
|
67
|
+
video "http://localhost:4567/#{file_path}"
|
|
68
|
+
else
|
|
69
|
+
para "Unsupported file type"
|
|
70
|
+
end
|
|
71
|
+
rescue StandardError => e
|
|
72
|
+
para "Error: #{e.message}"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Ensure the Shoes application is closed before stopping the server
|
|
78
|
+
at_exit do
|
|
79
|
+
server_thread.join if server_thread.alive?
|
|
80
|
+
server.shutdown
|
|
81
|
+
end
|
|
82
|
+
end
|
|
Binary file
|
|
Binary file
|
data/examples/local_fonts.rb
CHANGED
data/examples/local_images.rb
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Shoes.app do
|
|
2
|
+
stack do
|
|
3
|
+
@note = para " your note will appear here"
|
|
4
|
+
|
|
5
|
+
@edit_box = edit_box ""
|
|
6
|
+
@save_button = button "Save"
|
|
7
|
+
|
|
8
|
+
@save_button.click do
|
|
9
|
+
new_text = @edit_box.text
|
|
10
|
+
@note.text = new_text
|
|
11
|
+
alert("Note saved successfully!")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Shoes.app(width: 400, height: 300) do
|
|
2
|
+
flow do
|
|
3
|
+
stack(width: 0.5) do
|
|
4
|
+
para "this is initally at 30%"
|
|
5
|
+
@progress1 = progress fraction: 0.3
|
|
6
|
+
|
|
7
|
+
para "this is initally at 60%"
|
|
8
|
+
@progress2 = progress fraction: 0.6
|
|
9
|
+
|
|
10
|
+
para "this is initally at 80%"
|
|
11
|
+
@progress3 = progress fraction: 0.8
|
|
12
|
+
|
|
13
|
+
para "this is a normal progress bar with no initial value"
|
|
14
|
+
@progress4 = progress
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
stack(width: 0.5) do
|
|
18
|
+
@start = button "Start"
|
|
19
|
+
@start.click { start_progress }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def start_progress
|
|
24
|
+
animate do
|
|
25
|
+
@progress1.fraction += 0.01
|
|
26
|
+
@progress2.fraction += 0.015
|
|
27
|
+
@progress3.fraction += 0.02
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Shoes.app do
|
|
2
2
|
stack do
|
|
3
3
|
para "Among these films, which do you prefer?"
|
|
4
4
|
flow do
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
radio :films
|
|
14
14
|
para "Children of Heaven by Majid Majidi"
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
para "Is radio button checked? #{radio(:films).checked?}"
|
|
17
17
|
end
|
|
18
18
|
end
|
data/examples/rect.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Shoes.app(height:600) do
|
|
2
|
+
rotate 90
|
|
3
|
+
rect 10, 10, 75, 50, 5
|
|
4
|
+
rotate 180
|
|
5
|
+
arrow 100, 100, 30
|
|
6
|
+
rotate 60
|
|
7
|
+
arrow 150, 120,40
|
|
8
|
+
rotate 120
|
|
9
|
+
arrow 30 ,60 ,40
|
|
10
|
+
rotate 75
|
|
11
|
+
arc 50, 50, 120, 100, 60, 225
|
|
12
|
+
rotate 45
|
|
13
|
+
arrow :left => 50, :top => 80,
|
|
14
|
+
:width => 40
|
|
15
|
+
rotate 180
|
|
16
|
+
line 100, 100, 200, 200
|
|
17
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Cut down from a more complicated example widget
|
|
2
|
+
|
|
3
|
+
class MenuPanel < Shoes::Widget
|
|
4
|
+
@@boxes = []
|
|
5
|
+
def initialize(color, args)
|
|
6
|
+
@@boxes << self
|
|
7
|
+
background color
|
|
8
|
+
para "Box #{@@boxes.length}",
|
|
9
|
+
:margin => 18, :align => "center", :size => 20
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Shoes.app :width => 400, :height => 130 do
|
|
14
|
+
#style(Link, :underline => nil)
|
|
15
|
+
#style(LinkHover, :fill => nil, :underline => nil)
|
|
16
|
+
menu_panel green, :width => 175, :height => 120, :margin => 4
|
|
17
|
+
menu_panel blue, :width => 140, :height => 120, :margin => 4
|
|
18
|
+
menu_panel red, :width => 135, :height => 120, :margin => 4
|
|
19
|
+
menu_panel purple, :width => 125, :height => 120, :margin => 4
|
|
20
|
+
end
|
|
21
|
+
|
data/exe/scarpe
CHANGED
|
@@ -38,6 +38,7 @@ add_env_categories("Scarpe::WV" => [
|
|
|
38
38
|
env_or_default("SCARPE_TEST_CONTROL", "(none)"),
|
|
39
39
|
env_or_default("SCARPE_TEST_RESULTS", "(none)"),
|
|
40
40
|
env_or_default("SCARPE_TEST_DEBUG", "(none)"),
|
|
41
|
+
env_or_default("SCARPE_HTML_RENDERER", "calzini"),
|
|
41
42
|
])
|
|
42
43
|
|
|
43
44
|
verb = "run"
|
|
@@ -76,7 +77,7 @@ when "-v"
|
|
|
76
77
|
puts "Lacci #{Lacci::VERSION}"
|
|
77
78
|
when "run"
|
|
78
79
|
# Run the Scarpe app file
|
|
79
|
-
Shoes.run_app
|
|
80
|
+
Shoes.run_app verb_target
|
|
80
81
|
when "env"
|
|
81
82
|
print_env
|
|
82
83
|
else
|
data/lacci/Gemfile
CHANGED
data/lacci/Gemfile.lock
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../scarpe-components
|
|
3
|
+
specs:
|
|
4
|
+
scarpe-components (0.3.0)
|
|
5
|
+
|
|
1
6
|
PATH
|
|
2
7
|
remote: .
|
|
3
8
|
specs:
|
|
4
|
-
lacci (0.
|
|
9
|
+
lacci (0.3.0)
|
|
10
|
+
scarpe-components
|
|
5
11
|
|
|
6
12
|
GEM
|
|
7
13
|
remote: https://rubygems.org/
|
|
@@ -66,6 +72,7 @@ DEPENDENCIES
|
|
|
66
72
|
redcarpet
|
|
67
73
|
rubocop (~> 1.21)
|
|
68
74
|
rubocop-shopify
|
|
75
|
+
scarpe-components!
|
|
69
76
|
yard
|
|
70
77
|
|
|
71
78
|
BUNDLED WITH
|