scarpe 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -1
  3. data/CHANGELOG.md +36 -4
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +13 -3
  6. data/LICENSE.txt +7 -1
  7. data/README.md +77 -14
  8. data/Rakefile +67 -0
  9. data/examples/Edit_box_Styles.rb +8 -0
  10. data/examples/Kerning.rb +7 -0
  11. data/examples/border.rb +11 -0
  12. data/examples/check.rb +2 -0
  13. data/examples/download_and_show_image.rb +3 -0
  14. data/examples/flags/finland.rb +15 -0
  15. data/examples/flags/italy.rb +11 -0
  16. data/examples/flags/mauritius.rb +14 -0
  17. data/examples/font_family.rb +17 -0
  18. data/examples/font_shorthand.rb +9 -0
  19. data/examples/gen.rb +4 -0
  20. data/examples/legacy/not_checked/shoes-manual/append.rb +10 -0
  21. data/examples/legacy/not_checked/shoes-manual/background_change.rb +12 -0
  22. data/examples/legacy/not_checked/shoes-manual/background_pattern.rb +5 -0
  23. data/examples/legacy/not_checked/shoes-manual/basic_app.rb +8 -0
  24. data/examples/legacy/not_checked/shoes-manual/border.rb +9 -0
  25. data/examples/legacy/not_checked/shoes-manual/builtins/FONTS.rb +5 -0
  26. data/examples/legacy/not_checked/shoes-manual/builtins/ask.rb +2 -0
  27. data/examples/legacy/not_checked/shoes-manual/builtins/ask_color.rb +5 -0
  28. data/examples/legacy/not_checked/shoes-manual/builtins/ask_open_file.rb +5 -0
  29. data/examples/legacy/not_checked/shoes-manual/builtins/ask_save_folder.rb +2 -0
  30. data/examples/legacy/not_checked/shoes-manual/builtins/confirm.rb +4 -0
  31. data/examples/legacy/not_checked/shoes-manual/builtins/debug.rb +2 -0
  32. data/examples/legacy/not_checked/shoes-manual/builtins/info.rb +3 -0
  33. data/examples/legacy/not_checked/shoes-manual/button.rb +9 -0
  34. data/examples/legacy/not_checked/shoes-manual/clear.rb +7 -0
  35. data/examples/legacy/not_checked/shoes-manual/custom_header.rb +13 -0
  36. data/examples/legacy/not_checked/shoes-manual/displace.rb +14 -0
  37. data/examples/legacy/not_checked/shoes-manual/edit_box.rb +8 -0
  38. data/examples/legacy/not_checked/shoes-manual/fill_pattern.rb +5 -0
  39. data/examples/legacy/not_checked/shoes-manual/fonts.rb +7 -0
  40. data/examples/legacy/not_checked/shoes-manual/gutter.rb +6 -0
  41. data/examples/legacy/not_checked/shoes-manual/image_web.rb +4 -0
  42. data/examples/legacy/not_checked/shoes-manual/keypress.rb +7 -0
  43. data/examples/legacy/not_checked/shoes-manual/list_box.rb +10 -0
  44. data/examples/legacy/not_checked/shoes-manual/motion.rb +10 -0
  45. data/examples/legacy/not_checked/shoes-manual/mouse.rb +8 -0
  46. data/examples/legacy/not_checked/shoes-manual/move.rb +14 -0
  47. data/examples/legacy/not_checked/shoes-manual/nested_ovals.rb +8 -0
  48. data/examples/legacy/not_checked/shoes-manual/oval.rb +7 -0
  49. data/examples/legacy/not_checked/shoes-manual/ovals.rb +6 -0
  50. data/examples/legacy/not_checked/shoes-manual/ovals_image.rb +8 -0
  51. data/examples/legacy/not_checked/shoes-manual/prepend.rb +7 -0
  52. data/examples/legacy/not_checked/shoes-manual/progress_bar.rb +10 -0
  53. data/examples/legacy/not_checked/shoes-manual/radio.rb +18 -0
  54. data/examples/legacy/not_checked/shoes-manual/radio_alternative_1.rb +7 -0
  55. data/examples/legacy/not_checked/shoes-manual/radio_alternative_2.rb +9 -0
  56. data/examples/legacy/not_checked/shoes-manual/rotate_rectangle.rb +6 -0
  57. data/examples/legacy/not_checked/shoes-manual/shape.rb +11 -0
  58. data/examples/legacy/not_checked/shoes-manual/static/avatar.png +0 -0
  59. data/examples/legacy/not_checked/shoes-manual/stroke.rb +5 -0
  60. data/examples/legacy/not_checked/shoes-manual/style.rb +3 -0
  61. data/examples/legacy/not_checked/shoes-manual/style_alternative_1.rb +4 -0
  62. data/examples/legacy/not_checked/shoes-manual/style_alternative_2.rb +5 -0
  63. data/examples/legacy/not_checked/shoes-manual/style_length.rb +5 -0
  64. data/examples/legacy/not_checked/shoes-manual/timer.rb +6 -0
  65. data/examples/legacy/not_checked/shoes-manual/trigger_window.rb +8 -0
  66. data/examples/legacy/not_checked/shoes-manual/window_owner.rb +8 -0
  67. data/examples/legacy/working/shoes_manual/alert_button.rb +2 -0
  68. data/examples/legacy/working/shoes_manual/animate.rb +7 -0
  69. data/examples/legacy/working/shoes_manual/background_para.rb +4 -0
  70. data/examples/legacy/working/shoes_manual/button_alternative.rb +7 -0
  71. data/examples/legacy/working/shoes_manual/checkbox.rb +17 -0
  72. data/examples/legacy/working/shoes_manual/download.rb +12 -0
  73. data/examples/legacy/working/shoes_manual/edit_box.rb +6 -0
  74. data/examples/legacy/working/shoes_manual/editline.rb +7 -0
  75. data/examples/legacy/working/shoes_manual/fixed_height.rb +8 -0
  76. data/examples/legacy/working/shoes_manual/fixed_width.rb +12 -0
  77. data/examples/legacy/working/shoes_manual/image.rb +5 -0
  78. data/examples/legacy/working/shoes_manual/instance_variable_check.rb +10 -0
  79. data/examples/legacy/working/shoes_manual/message.rb +18 -0
  80. data/examples/legacy/working/shoes_manual/rectangle.rb +6 -0
  81. data/examples/legacy/working/shoes_manual/save_download.rb +12 -0
  82. data/examples/legacy/working/shoes_manual/self_check.rb +10 -0
  83. data/examples/legacy/working/shoes_manual/stack.rb +7 -0
  84. data/examples/legacy/working/shoes_manual/style_info.rb +8 -0
  85. data/examples/legacy/working/shoes_manual/utf8_support.rb +8 -0
  86. data/examples/legacy/working/shoes_manual/width.rb +4 -0
  87. data/examples/local_assets/multi_image.rb +5 -0
  88. data/examples/local_assets/small.png +0 -0
  89. data/examples/local_fonts.rb +3 -0
  90. data/examples/margin.rb +13 -0
  91. data/examples/margin_check.rb +27 -0
  92. data/examples/oval-with-kwargs.rb +3 -0
  93. data/examples/oval.rb +26 -0
  94. data/examples/para_font_styles.rb +17 -0
  95. data/examples/para_font_variant.rb +6 -0
  96. data/examples/para_fontweight.rb +13 -0
  97. data/examples/parse_xl_funnies.rb +3 -0
  98. data/examples/rect.rb +1 -1
  99. data/examples/scarpe_ext.rb +3 -0
  100. data/examples/shapes/star.rb +1 -3
  101. data/examples/spacing.rb +1 -1
  102. data/examples/span.rb +4 -2
  103. data/lacci/lacci.gemspec +2 -2
  104. data/lacci/lib/lacci/scarpe_cli.rb +0 -1
  105. data/lacci/lib/lacci/version.rb +1 -1
  106. data/lacci/lib/scarpe/niente/display_service.rb +5 -1
  107. data/lacci/lib/scarpe/niente/drawable.rb +2 -0
  108. data/lacci/lib/scarpe/niente/shoes_spec.rb +7 -1
  109. data/lacci/lib/scarpe/niente.rb +14 -2
  110. data/lacci/lib/shoes/app.rb +44 -50
  111. data/lacci/lib/shoes/constants.rb +23 -2
  112. data/lacci/lib/shoes/display_service.rb +43 -4
  113. data/lacci/lib/shoes/drawable.rb +309 -35
  114. data/lacci/lib/shoes/drawables/arc.rb +2 -24
  115. data/lacci/lib/shoes/drawables/arrow.rb +2 -22
  116. data/lacci/lib/shoes/drawables/border.rb +28 -0
  117. data/lacci/lib/shoes/drawables/button.rb +4 -20
  118. data/lacci/lib/shoes/drawables/check.rb +7 -3
  119. data/lacci/lib/shoes/drawables/document_root.rb +4 -4
  120. data/lacci/lib/shoes/drawables/edit_box.rb +6 -5
  121. data/lacci/lib/shoes/drawables/edit_line.rb +5 -4
  122. data/lacci/lib/shoes/drawables/flow.rb +3 -5
  123. data/lacci/lib/shoes/drawables/font_helper.rb +62 -0
  124. data/lacci/lib/shoes/drawables/image.rb +2 -2
  125. data/lacci/lib/shoes/drawables/line.rb +4 -7
  126. data/lacci/lib/shoes/drawables/link.rb +5 -8
  127. data/lacci/lib/shoes/drawables/list_box.rb +8 -5
  128. data/lacci/lib/shoes/drawables/oval.rb +48 -0
  129. data/lacci/lib/shoes/drawables/para.rb +106 -18
  130. data/lacci/lib/shoes/drawables/progress.rb +2 -1
  131. data/lacci/lib/shoes/drawables/radio.rb +5 -3
  132. data/lacci/lib/shoes/drawables/rect.rb +5 -4
  133. data/lacci/lib/shoes/drawables/shape.rb +2 -1
  134. data/lacci/lib/shoes/drawables/slot.rb +99 -8
  135. data/lacci/lib/shoes/drawables/stack.rb +6 -11
  136. data/lacci/lib/shoes/drawables/star.rb +8 -30
  137. data/lacci/lib/shoes/drawables/text_drawable.rb +93 -34
  138. data/lacci/lib/shoes/drawables/video.rb +3 -2
  139. data/lacci/lib/shoes/drawables/widget.rb +8 -3
  140. data/lacci/lib/shoes/drawables.rb +2 -1
  141. data/lacci/lib/shoes/errors.rb +13 -3
  142. data/lacci/lib/shoes/margin_helper.rb +79 -0
  143. data/lacci/lib/shoes.rb +4 -3
  144. data/lacci/test/.gitignore +1 -0
  145. data/lacci/test/test_draw_context.rb +167 -0
  146. data/lacci/test/test_font_helper.rb +57 -0
  147. data/lacci/test/test_helper.rb +31 -4
  148. data/lacci/test/test_lacci.rb +93 -6
  149. data/lacci/test/test_margin_helper.rb +82 -0
  150. data/lacci/test/test_niente_test_infra.rb +26 -0
  151. data/lacci/test/test_oval.rb +82 -0
  152. data/lacci/test/test_parenting.rb +140 -0
  153. data/lacci/test/test_text_drawables.rb +23 -0
  154. data/lib/scarpe/assets.rb +18 -0
  155. data/lib/scarpe/cats_cradle.rb +57 -98
  156. data/lib/scarpe/shoes_spec.rb +22 -43
  157. data/lib/scarpe/version.rb +1 -1
  158. data/lib/scarpe/wv/app.rb +1 -0
  159. data/lib/scarpe/wv/arc.rb +0 -4
  160. data/lib/scarpe/wv/border.rb +15 -0
  161. data/lib/scarpe/wv/control_interface.rb +2 -10
  162. data/lib/scarpe/wv/document_root.rb +2 -2
  163. data/lib/scarpe/wv/drawable.rb +6 -40
  164. data/lib/scarpe/wv/edit_box.rb +4 -1
  165. data/lib/scarpe/wv/edit_line.rb +5 -2
  166. data/lib/scarpe/wv/image.rb +2 -5
  167. data/lib/scarpe/wv/link.rb +4 -2
  168. data/lib/scarpe/wv/oval.rb +13 -0
  169. data/lib/scarpe/wv/para.rb +1 -0
  170. data/lib/scarpe/wv/scarpe_extensions.rb +8 -0
  171. data/lib/scarpe/wv/shape.rb +10 -5
  172. data/lib/scarpe/wv/text_drawable.rb +72 -14
  173. data/lib/scarpe/wv/web_wrangler.rb +33 -11
  174. data/lib/scarpe/wv/webview_local_display.rb +6 -2
  175. data/lib/scarpe/wv.rb +8 -1
  176. data/scarpe-components/Gemfile +4 -1
  177. data/scarpe-components/Gemfile.lock +2 -3
  178. data/scarpe-components/README.md +2 -2
  179. data/scarpe-components/assets/bootstrap-themes/bootstrap-cerulean.css +12229 -0
  180. data/scarpe-components/assets/bootstrap-themes/bootstrap-cosmo.css +11810 -0
  181. data/scarpe-components/assets/bootstrap-themes/bootstrap-cyborg.css +12210 -0
  182. data/scarpe-components/assets/bootstrap-themes/bootstrap-darkly.css +12153 -0
  183. data/scarpe-components/assets/bootstrap-themes/bootstrap-flatly.css +12126 -0
  184. data/scarpe-components/assets/bootstrap-themes/bootstrap-icons.min.css +5 -0
  185. data/scarpe-components/assets/bootstrap-themes/bootstrap-journal.css +12099 -0
  186. data/scarpe-components/assets/bootstrap-themes/bootstrap-litera.css +12211 -0
  187. data/scarpe-components/assets/bootstrap-themes/bootstrap-lumen.css +12369 -0
  188. data/scarpe-components/assets/bootstrap-themes/bootstrap-lux.css +11928 -0
  189. data/scarpe-components/assets/bootstrap-themes/bootstrap-materia.css +13184 -0
  190. data/scarpe-components/assets/bootstrap-themes/bootstrap-minty.css +12177 -0
  191. data/scarpe-components/assets/bootstrap-themes/bootstrap-morph.css +12750 -0
  192. data/scarpe-components/assets/bootstrap-themes/bootstrap-pulse.css +11890 -0
  193. data/scarpe-components/assets/bootstrap-themes/bootstrap-quartz.css +12622 -0
  194. data/scarpe-components/assets/bootstrap-themes/bootstrap-sandstone.css +12201 -0
  195. data/scarpe-components/assets/bootstrap-themes/bootstrap-simplex.css +12186 -0
  196. data/scarpe-components/assets/bootstrap-themes/bootstrap-sketchy.css +12451 -0
  197. data/scarpe-components/assets/bootstrap-themes/bootstrap-slate.css +12492 -0
  198. data/scarpe-components/assets/bootstrap-themes/bootstrap-solar.css +12149 -0
  199. data/scarpe-components/assets/bootstrap-themes/bootstrap-spacelab.css +12266 -0
  200. data/scarpe-components/assets/bootstrap-themes/bootstrap-superhero.css +12216 -0
  201. data/scarpe-components/assets/bootstrap-themes/bootstrap-united.css +12077 -0
  202. data/scarpe-components/assets/bootstrap-themes/bootstrap-vapor.css +12549 -0
  203. data/scarpe-components/assets/bootstrap-themes/bootstrap-yeti.css +12325 -0
  204. data/scarpe-components/assets/bootstrap-themes/bootstrap-zephyr.css +12283 -0
  205. data/scarpe-components/assets/bootstrap-themes/bootstrap.bundle.min.js +7 -0
  206. data/scarpe-components/lib/scarpe/components/asset_server.rb +219 -0
  207. data/scarpe-components/lib/scarpe/components/base64.rb +22 -0
  208. data/scarpe-components/lib/scarpe/components/calzini/{art_widgets.rb → art_drawables.rb} +42 -18
  209. data/scarpe-components/lib/scarpe/components/calzini/border.rb +38 -0
  210. data/scarpe-components/lib/scarpe/components/calzini/button.rb +6 -8
  211. data/scarpe-components/lib/scarpe/components/calzini/misc.rb +7 -17
  212. data/scarpe-components/lib/scarpe/components/calzini/para.rb +213 -11
  213. data/scarpe-components/lib/scarpe/components/calzini/slots.rb +14 -60
  214. data/scarpe-components/lib/scarpe/components/calzini.rb +88 -1
  215. data/scarpe-components/lib/scarpe/components/errors.rb +4 -0
  216. data/scarpe-components/lib/scarpe/components/html.rb +4 -1
  217. data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +11 -3
  218. data/scarpe-components/lib/scarpe/components/minitest_result.rb +41 -0
  219. data/scarpe-components/lib/scarpe/components/print_logger.rb +17 -2
  220. data/scarpe-components/lib/scarpe/components/process_helpers.rb +37 -0
  221. data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +1 -1
  222. data/scarpe-components/lib/scarpe/components/tiranti.rb +42 -100
  223. data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +3 -1
  224. data/scarpe-components/lib/scarpe/components/version.rb +1 -1
  225. data/scarpe-components/test/assets/big-image.png +0 -0
  226. data/scarpe-components/test/assets/big-stylesheet.css +497 -0
  227. data/scarpe-components/test/assets/little-image.png +0 -0
  228. data/scarpe-components/test/assets/little-stylesheet.css +1 -0
  229. data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +7 -7
  230. data/scarpe-components/test/calzini/test_calzini_button.rb +7 -5
  231. data/scarpe-components/test/calzini/test_calzini_misc.rb +9 -9
  232. data/scarpe-components/test/calzini/test_calzini_para.rb +6 -9
  233. data/scarpe-components/test/calzini/test_calzini_slots.rb +12 -57
  234. data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +83 -18
  235. data/scarpe-components/test/calzini/test_various.rb +133 -0
  236. data/scarpe-components/test/test_asset_server.rb +72 -0
  237. data/scarpe-components/test/test_components.rb +31 -2
  238. data/scarpe-components/test/test_helper.rb +0 -1
  239. data/scarpe-components/test/test_minitest_result.rb +7 -0
  240. data/scarpe-components/test/test_segmented_app_files.rb +2 -0
  241. data/tasks/check_html_fixtures.rb +140 -0
  242. data/tasks/regenerate_html_fixtures.rb +104 -0
  243. data/templates/class_template_with_shapes.erb +0 -11
  244. metadata +180 -32
  245. data/lacci/lib/scarpe/niente/logger.rb +0 -29
  246. data/lacci/lib/shoes/drawables/span.rb +0 -27
  247. data/lacci/lib/shoes/spacing.rb +0 -9
  248. data/lib/scarpe/evented_assertions.rb +0 -121
  249. data/lib/scarpe/wv/span.rb +0 -44
  250. data/scarpe-components/lib/scarpe/components/calzini/text_widgets.rb +0 -65
  251. /data/examples/legacy/{not_checked → working}/shoes3-tests/editline/editline.rb +0 -0
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @slot = stack { para "Old text" }
4
+ timer 3 do
5
+ @slot.clear { para "Brand new text" }
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack do
4
+ title "GET Google", size: 16
5
+ @status = para "One moment..."
6
+
7
+ download "http://www.google.com/search?q=shoes",
8
+ method: "GET" do |dump|
9
+ @status.text = dump.response.body
10
+ end
11
+ para 'Hii'
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ flow margin: 12 do
4
+ # Set up three buttons
5
+ button "One"
6
+ @two = button "Two"
7
+ button "Three"
8
+
9
+ # Bounce the second button
10
+ animate do |i|
11
+ @two.displace(0, (Math.sin(i) * 6).to_i)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ edit_box do |e|
4
+ @counter.text = e.text.size
5
+ end
6
+ @counter = strong("0")
7
+ para @counter, " characters"
8
+ end
@@ -0,0 +1,5 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ fill "static/avatar.png"
4
+ star 200, 200, 5
5
+ end
@@ -0,0 +1,7 @@
1
+ Shoes.app do
2
+ para "てすと (te-su-to)", font: case RUBY_PLATFORM
3
+ when /mingw/; "MS UI Gothic"
4
+ when /darwin/; "AppleGothic, Arial"
5
+ else "Arial"
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack margin_right: 20 + gutter do
4
+ para "Insert fat and ratified declaration of independence here..."
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ image "https://en.wikipedia.org/wiki/Hackety_Hack#/media/File:Hackety-Star-Title.png"
4
+ end
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @info = para "NO KEY is PRESSED."
4
+ keypress do |k|
5
+ @info.replace "#{k.inspect} was PRESSED."
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ para "Choose a fruit:"
4
+ list_box items: ["Grapes", "Pears", "Apricots"],
5
+ width: 120, choose: "Apricots" do |list|
6
+ @fruit.text = list.text
7
+ end
8
+
9
+ @fruit = para "No fruit selected"
10
+ end
@@ -0,0 +1,10 @@
1
+ #!ruby
2
+ Shoes.app width: 200, height: 200 do
3
+ background black
4
+ fill white
5
+ @circ = oval 0, 0, 100, 100
6
+
7
+ motion do |top, left|
8
+ @circ.move top - 50, left - 50
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @p = para
4
+ animate do
5
+ button, left, top = self.mouse
6
+ @p.replace "mouse: #{button}, #{left}, #{top}"
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ flow margin: 12 do
4
+ # Set up three buttons
5
+ button "One"
6
+ @two = button "Two"
7
+ button "Three"
8
+
9
+ # Bounce the second button
10
+ animate do |i|
11
+ @two.move(40, 40 + (Math.sin(i) * 6).to_i)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ Shoes.app do
2
+ fill black(0.1)
3
+ shape do
4
+ 100.times do |i|
5
+ oval i, i, i * 2
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stroke blue
4
+ strokewidth 4
5
+ fill black
6
+ oval 10, 10, 50
7
+ end
@@ -0,0 +1,6 @@
1
+ Shoes.app do
2
+ fill black(0.1)
3
+ 100.times do |i|
4
+ oval i, i, i * 2
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ Shoes.app do
2
+ fill black(0.1)
3
+ image 300, 300 do
4
+ 100.times do |i|
5
+ oval i, i, i * 2
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @slot = stack { para 'Good Morning' }
4
+ timer 3 do
5
+ @slot.prepend { para "Your car is ready." }
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ Shoes.app do
2
+ stack margin: 0.1 do
3
+ title "Progress example"
4
+ @p = progress width: 1.0
5
+
6
+ animate do |i|
7
+ @p.fraction = (i % 100) / 100.0
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack do
4
+ para "Among these films, which do you prefer?"
5
+ flow do
6
+ radio :films
7
+ para "The Taste of Tea by Katsuhito Ishii"
8
+ end
9
+ flow do
10
+ radio :films
11
+ para "Kin-Dza-Dza by Georgi Danelia"
12
+ end
13
+ flow do
14
+ radio :films
15
+ para "Children of Heaven by Majid Majidi"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ para "Among these films, which do you prefer?\n"
4
+ radio; para strong("The Taste of Tea"), " by Katsuhito Ishii\n"
5
+ radio; para strong("Kin-Dza-Dza"), " by Georgi Danelia\n"
6
+ radio; para strong("Children of Heaven"), " by Majid Majidi\n"
7
+ end
@@ -0,0 +1,9 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack do
4
+ para "Among these films, which do you prefer?"
5
+ flow { radio; para "The Taste of Tea by Katsuhito Ishii" }
6
+ flow { radio; para "Kin-Dza-Dza by Georgi Danelia" }
7
+ flow { radio; para "Children of Heaven by Majid Majidi" }
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ fill "#333"
4
+ rotate 45
5
+ rect 30, 30, 40, 40
6
+ end
@@ -0,0 +1,11 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ fill red(0.2)
4
+ shape do
5
+ move_to(90, 55)
6
+ arc_to(50, 55, 50, 50, 0, PI/2)
7
+ arc_to(50, 55, 60, 60, PI/2, PI)
8
+ arc_to(50, 55, 70, 70, PI, TWO_PI-PI/2)
9
+ arc_to(50, 55, 80, 80, TWO_PI-PI/2, TWO_PI)
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stroke red
4
+ arrow 0, 100, 10
5
+ end
@@ -0,0 +1,3 @@
1
+ Shoes.app title: "A Styling Sample" do
2
+ para "Red with an underline", stroke: red, underline: "single"
3
+ end
@@ -0,0 +1,4 @@
1
+ Shoes.app title: "A Styling Sample" do
2
+ @text = para "Red with an underline"
3
+ @text.style(stroke: red, underline: "single")
4
+ end
@@ -0,0 +1,5 @@
1
+ Shoes.app title: "A Styling Sample" do
2
+ @text = para "Red with an underline"
3
+ @text.stroke = red
4
+ @text.underline = "single"
5
+ end
@@ -0,0 +1,5 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @s = stack width: "100%"
4
+ para @s.style[:width]
5
+ end
@@ -0,0 +1,6 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ timer(5) do
4
+ alert("Your five seconds are up.")
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ Shoes.app title: "MAIN" do
2
+ para self
3
+ button "Spawn" do
4
+ window title: "CHILD" do
5
+ para self
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ #!ruby
2
+ Shoes.app title: "The Owner" do
3
+ button "Pop up?" do
4
+ window do
5
+ para "Okay, popped up from #{owner}"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,2 @@
1
+ #!ruby
2
+ Shoes.app { button("Click me!") { alert("Good job.") } }
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @counter = para "STARTING"
4
+ animate(24) do |frame|
5
+ @counter.replace "FRAME #{frame}"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ Shoes.app do
2
+ background "#DFA"
3
+ para "Welcome to Shoes"
4
+ end
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @b1 = button "OK!"
4
+ @b1.click { para "Well okay then." }
5
+ @b2 = button "Are you sure?"
6
+ @b2.click { para "Your confidence is inspiring." }
7
+ end
@@ -0,0 +1,17 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ @list = ['Frances Johnson', 'Ignatius J. Reilly',
4
+ 'Winston Niles Rumfoord']
5
+
6
+ stack do
7
+ @list.map! do |name|
8
+ flow { @c = check; para name }
9
+ [@c, name]
10
+ end
11
+
12
+ button "What's been checked?" do
13
+ selected = @list.map { |c, name| name if c.checked? }.compact
14
+ alert("You selected: " + selected.join(', '))
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack do
4
+ title "Searching Google", size: 16
5
+ @status = para "One moment..."
6
+
7
+ # Search Google for 'shoes' and print the HTTP headers
8
+ download "http://www.google.com/search?q=shoes" do |goog|
9
+ @status.text = "Headers: " + goog.response.headers.inspect
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ edit_box
4
+ edit_box "HORRAY EDIT ME"
5
+ edit_box "small one", width: 100, height: 160
6
+ end
@@ -0,0 +1,7 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack do
4
+ edit_line
5
+ edit_line width: 400
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ Shoes.app do
2
+ stack width: 200, height: 200, scroll: true do
3
+ background "#DFA"
4
+ 100.times do |i|
5
+ para "Paragraph No. #{i}"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ Shoes.app do
2
+ flow do
3
+ stack width: 200 do
4
+ caption "Column one"
5
+ para "is 200 pixels wide"
6
+ end
7
+ stack width: -200 do
8
+ caption "Column two"
9
+ para "is 100% minus 200 pixels wide"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ para "Nice, nice, very nice. Busy, busy, busy."
4
+ image "#{DIR}/docs/static/avatar.png"
5
+ end
@@ -0,0 +1,10 @@
1
+ # instance variables allowed as the code block is essentially running
2
+ # inside Shoes class due to the use of instance_eval
3
+
4
+ Shoes.app do
5
+ @s = stack do
6
+ @p1 = para "First"
7
+ @p2 = para "Second"
8
+ @p3 = para "Third"
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ class Messenger
2
+ def initialize(stack)
3
+ @stack = stack
4
+ end
5
+ def add(msg)
6
+ @stack.app do
7
+ @stack.append do
8
+ para msg
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ Shoes.app do
15
+ @stack = stack do
16
+ end
17
+ Messenger.new(@stack).add('Hii')
18
+ end
@@ -0,0 +1,6 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stroke rgb(0.5, 0.5, 0.7)
4
+ fill rgb(1.0, 1.0, 0.9)
5
+ rect 10, 10, self.width - 20, self.height - 20
6
+ end
@@ -0,0 +1,12 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack do
4
+ title "Downloading Google image", size: 16
5
+ @status = para "One moment..."
6
+
7
+ download "http://www.google.com/logos/nasa50th.gif",
8
+ save: "nasa50th.gif" do
9
+ @status.text = "Okay, is downloaded."
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ # self is same throughout due to the use of instance_eval. Caller
2
+ # is Shoes instance.
3
+
4
+ Shoes.app do
5
+ self.stack do
6
+ self.para "First"
7
+ self.para "Second"
8
+ self.para "Third"
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ Shoes.app do
2
+ stack do
3
+ para "First"
4
+ para "Second"
5
+ para "Third"
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ # A button which take up the whole page
4
+ @b = button "All of it", width: 1.0, height: 1.0
5
+
6
+ # When clicked, show the styles
7
+ @b.click { alert(@b.style.inspect) }
8
+ end
@@ -0,0 +1,8 @@
1
+ Shoes.app do
2
+ stack margin: 10 do
3
+ @edit = edit_box width: 1.0 do
4
+ @para.text = @edit.text
5
+ end
6
+ @para = para ""
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ #!ruby
2
+ Shoes.app do
3
+ stack(width: 150) { para "Now that's precision." }
4
+ end
@@ -0,0 +1,5 @@
1
+ Shoes.app do
2
+ image "http://shoesrb.com/manual/static/shoes-icon.png"
3
+ image "sample.gif", width: 120, height: 64 # an image big enough to be served with the asset server
4
+ image "small.png" # an image small enough to be served with a data URL
5
+ end
Binary file
@@ -1,3 +1,6 @@
1
+ # html_ci: false
2
+ # Note: fonts render differently in CI
3
+
1
4
  Shoes.app do
2
5
  font "#{DIR}/fonts/Pacifico.ttf"
3
6
  para "Hello yayyy", font: "Pacifico"
@@ -0,0 +1,13 @@
1
+ Shoes.app do
2
+
3
+ para "All margins with array input", margin:[60,30,80,40]
4
+
5
+ para "All margins with string input", margin: "30 20 10 20"
6
+
7
+ para "One Number to set all margins", margin:20
8
+
9
+ para "Specific property can overwrite shorthand" , margin:[20,10,20,30], margin_top:100
10
+
11
+ para "margins using a hash input" , margin:{left:20,top:100,bottom:10,right:20}
12
+
13
+ end
@@ -0,0 +1,27 @@
1
+ Shoes.app do
2
+ background blue
3
+
4
+ @stack1 = stack(width: 100, height: 100) do
5
+ background red
6
+ b = button("Push me", margin: [10, 25, 5, 10]) do
7
+ alert "Aha! Click!"
8
+ end
9
+ end
10
+
11
+ @stack1 = stack do
12
+ background aquamarine
13
+ b = button("Hash margin", margin: { left: 10, right: 5, top: 25, bottom: 10 }) do
14
+ alert "Aha! Click!"
15
+ end
16
+ end
17
+
18
+ stack(width: 100, height: 100) do
19
+ background yellow
20
+ button "Middle Button", margin: 5, margin_top: 30
21
+ end
22
+
23
+ @stack2 = stack(width: 100, height: 100) do
24
+ background green
25
+ button "OK 2"
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ Shoes.app do
2
+ oval top: 20, left: 20, radius: 160, center: true, fill: fuchsia
3
+ end
data/examples/oval.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ #TODO: Support color methods as argument
4
+ #TODO: Allow strokewidth to go wider than container?
5
+ #TODO: Support strokewidth draw context
6
+
7
+ Shoes.app(
8
+ title: "Schwad's unbelievable desktop application that renders an oval",
9
+ height: 700,
10
+ ) do
11
+ flow(height: 200) do
12
+ para "Positional arguments:"
13
+ oval 30, 30, 80, 200, center: true
14
+ end
15
+ flow(height: 200) do
16
+ para "As a circle"
17
+ stroke "blue"
18
+ fill "pink"
19
+ oval 30, 30, 80, center: true
20
+ end
21
+ flow(height: 200) do
22
+ para "Keyword arguments:"
23
+ fill "green"
24
+ oval top: 20, left: 20, height: 160, width: 90, center: true, stroke: "red", strokewidth: 4
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ Shoes.app do
2
+
3
+ para "this text is in normal styl" , emphasis:"italic"
4
+
5
+ para "this text is in italic style" , font: "italic normal bold 16px 'Times New Roman', serif;"
6
+
7
+
8
+ para "this text is in oblique style " , family: "'Pacifico', cursive;"
9
+
10
+ para "Text in Helvetica", font: "Helvetica;"
11
+
12
+ para "And in Lucida", font: "'Pacifico', cursive;"
13
+
14
+ para "From an example", font: "Trebuchet bold"
15
+
16
+ end
17
+
@@ -0,0 +1,6 @@
1
+ Shoes.app do
2
+ para "This is Normal Variant" ,font_variant: "normal"
3
+
4
+ para "This is Small Caps Variant " ,font_variant: "small-caps"
5
+
6
+ end