shoes 4.0.0.pre11 → 4.0.0.pre12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/bin/shoes-stub +8 -0
  3. data/lib/shoes/samples.rb +8 -0
  4. data/samples/README +122 -0
  5. data/samples/avatar.png +0 -0
  6. data/samples/blue-box.png +0 -0
  7. data/samples/class-book.yaml +387 -0
  8. data/samples/class_book.rb +46 -0
  9. data/samples/cy.png +0 -0
  10. data/samples/expert_definr.rb +24 -0
  11. data/samples/expert_funnies.rb +60 -0
  12. data/samples/expert_game_of_life.rb +224 -0
  13. data/samples/expert_irb.rb +109 -0
  14. data/samples/expert_minesweeper.rb +272 -0
  15. data/samples/expert_othello.rb +323 -0
  16. data/samples/expert_pong.rb +69 -0
  17. data/samples/expert_snake.rb +88 -0
  18. data/samples/expert_tankspank.rb +425 -0
  19. data/samples/expert_tetris.rb +322 -0
  20. data/samples/good_arc.rb +51 -0
  21. data/samples/good_bounce.rb +34 -0
  22. data/samples/good_clock.rb +55 -0
  23. data/samples/good_displace.rb +99 -0
  24. data/samples/good_follow.rb +27 -0
  25. data/samples/good_image_dl.rb +13 -0
  26. data/samples/good_potato_chopping.rb +23 -0
  27. data/samples/good_psychidelic_circles.rb +73 -0
  28. data/samples/good_reminder.rb +163 -0
  29. data/samples/good_vjot.rb +65 -0
  30. data/samples/lib/require_me.rb +6 -0
  31. data/samples/loogink.png +0 -0
  32. data/samples/menu-corner1.png +0 -0
  33. data/samples/menu-corner2.png +0 -0
  34. data/samples/menu-gray.png +0 -0
  35. data/samples/menu-left.png +0 -0
  36. data/samples/menu-right.png +0 -0
  37. data/samples/menu-top.png +0 -0
  38. data/samples/nks_booklist.rb +25 -0
  39. data/samples/nks_breadsticks.rb +8 -0
  40. data/samples/nks_dancing_circle.rb +14 -0
  41. data/samples/nks_dictionary.rb +24 -0
  42. data/samples/nks_edit_box.rb +5 -0
  43. data/samples/nks_edit_line.rb +7 -0
  44. data/samples/nks_notes.rb +16 -0
  45. data/samples/nks_poem.rb +23 -0
  46. data/samples/nks_self.rb +7 -0
  47. data/samples/nks_text_sizes.rb +11 -0
  48. data/samples/nks_trurl.rb +6 -0
  49. data/samples/potato_chopping/1258_s001.gif +0 -0
  50. data/samples/potato_chopping/1258_s002.gif +0 -0
  51. data/samples/potato_chopping/1258_s003.gif +0 -0
  52. data/samples/potato_chopping/1258_s004.gif +0 -0
  53. data/samples/potato_chopping/1258_s005.gif +0 -0
  54. data/samples/potato_chopping/1258_s006.gif +0 -0
  55. data/samples/potato_chopping/1258_s007.gif +0 -0
  56. data/samples/potato_chopping/1258_s008.gif +0 -0
  57. data/samples/potato_chopping/1258_s009.gif +0 -0
  58. data/samples/potato_chopping/1258_s010.gif +0 -0
  59. data/samples/potato_chopping/1258_s011.gif +0 -0
  60. data/samples/potato_chopping/1258_s012.gif +0 -0
  61. data/samples/potato_chopping/1258_s013.gif +0 -0
  62. data/samples/potato_chopping/1258_s014.gif +0 -0
  63. data/samples/potato_chopping/1258_s015.gif +0 -0
  64. data/samples/potato_chopping/1258_s016.gif +0 -0
  65. data/samples/potato_chopping/1258_s017.gif +0 -0
  66. data/samples/potato_chopping/1258_s018.gif +0 -0
  67. data/samples/potato_chopping/1258_s019.gif +0 -0
  68. data/samples/potato_chopping/1258_s020.gif +0 -0
  69. data/samples/potato_chopping/1258_s021.gif +0 -0
  70. data/samples/potato_chopping/1258_s022.gif +0 -0
  71. data/samples/potato_chopping/1258_s023.gif +0 -0
  72. data/samples/potato_chopping/1258_s024.gif +0 -0
  73. data/samples/potato_chopping/1258_s025.gif +0 -0
  74. data/samples/potato_chopping/1258_s026.gif +0 -0
  75. data/samples/potato_chopping/1258_s027.gif +0 -0
  76. data/samples/potato_chopping/1258_s028.gif +0 -0
  77. data/samples/potato_chopping/1258_s029.gif +0 -0
  78. data/samples/potato_chopping/1258_s030.gif +0 -0
  79. data/samples/potato_chopping/1258_s031.gif +0 -0
  80. data/samples/potato_chopping/1258_s032.gif +0 -0
  81. data/samples/potato_chopping/1258_s033.gif +0 -0
  82. data/samples/potato_chopping/1258_s034.gif +0 -0
  83. data/samples/potato_chopping/1258_s035.gif +0 -0
  84. data/samples/potato_chopping/1258_s036.gif +0 -0
  85. data/samples/potato_chopping/1258_s037.gif +0 -0
  86. data/samples/potato_chopping/1258_s038.gif +0 -0
  87. data/samples/potato_chopping/1258_s039.gif +0 -0
  88. data/samples/potato_chopping/1258_s040.gif +0 -0
  89. data/samples/potato_chopping/1258_s041.gif +0 -0
  90. data/samples/potato_chopping/1258_s042.gif +0 -0
  91. data/samples/potato_chopping/1258_s043.gif +0 -0
  92. data/samples/potato_chopping/1258_s044.gif +0 -0
  93. data/samples/potato_chopping/1258_s045.gif +0 -0
  94. data/samples/potato_chopping/1258_s046.gif +0 -0
  95. data/samples/potato_chopping/1258_s047.gif +0 -0
  96. data/samples/potato_chopping/1258_s048.gif +0 -0
  97. data/samples/potato_chopping/1258_s049.gif +0 -0
  98. data/samples/potato_chopping/1258_s050.gif +0 -0
  99. data/samples/potato_chopping/1258_s051.gif +0 -0
  100. data/samples/potato_chopping/1258_s052.gif +0 -0
  101. data/samples/potato_chopping/1258_s053.gif +0 -0
  102. data/samples/potato_chopping/1258_s054.gif +0 -0
  103. data/samples/potato_chopping/1258_s055.gif +0 -0
  104. data/samples/potato_chopping/1258_s056.gif +0 -0
  105. data/samples/potato_chopping/1258_s057.gif +0 -0
  106. data/samples/potato_chopping/1258_s058.gif +0 -0
  107. data/samples/potato_chopping/1258_s059.gif +0 -0
  108. data/samples/red-box.png +0 -0
  109. data/samples/shape_arc_to.rb +10 -0
  110. data/samples/simple-form.shy +0 -0
  111. data/samples/simple_accordion.rb +98 -0
  112. data/samples/simple_alert.rb +10 -0
  113. data/samples/simple_altered_para.rb +11 -0
  114. data/samples/simple_anim_shapes.rb +18 -0
  115. data/samples/simple_anim_text.rb +14 -0
  116. data/samples/simple_animate.rb +12 -0
  117. data/samples/simple_arc.rb +25 -0
  118. data/samples/simple_attach.rb +26 -0
  119. data/samples/simple_border_image.rb +9 -0
  120. data/samples/simple_borderless.rb +4 -0
  121. data/samples/simple_bounce.rb +27 -0
  122. data/samples/simple_breadsticks.rb +11 -0
  123. data/samples/simple_breadsticks2.rb +11 -0
  124. data/samples/simple_brightness_transitions.rb +16 -0
  125. data/samples/simple_button_animate.rb +17 -0
  126. data/samples/simple_buttons.rb +4 -0
  127. data/samples/simple_calc.rb +67 -0
  128. data/samples/simple_calc_2.rb +49 -0
  129. data/samples/simple_clipboard.rb +17 -0
  130. data/samples/simple_color_selector.rb +11 -0
  131. data/samples/simple_color_transitions.rb +12 -0
  132. data/samples/simple_concentric_circles.rb +9 -0
  133. data/samples/simple_console.rb +12 -0
  134. data/samples/simple_control_sizes.rb +25 -0
  135. data/samples/simple_count_and_draw.rb +19 -0
  136. data/samples/simple_curve.rb +34 -0
  137. data/samples/simple_dialogs.rb +33 -0
  138. data/samples/simple_dialogs_outside.rb +17 -0
  139. data/samples/simple_displace.rb +16 -0
  140. data/samples/simple_downloader.rb +29 -0
  141. data/samples/simple_draw.rb +16 -0
  142. data/samples/simple_editor.rb +30 -0
  143. data/samples/simple_face.rb +15 -0
  144. data/samples/simple_flashing.rb +22 -0
  145. data/samples/simple_flow_wrap.rb +12 -0
  146. data/samples/simple_font.rb +18 -0
  147. data/samples/simple_form.rb +30 -0
  148. data/samples/simple_fullscreen.rb +5 -0
  149. data/samples/simple_gradient_shapes.rb +23 -0
  150. data/samples/simple_guess_game.rb +30 -0
  151. data/samples/simple_image_as_stroke.rb +22 -0
  152. data/samples/simple_image_fill.rb +13 -0
  153. data/samples/simple_image_stroke.rb +13 -0
  154. data/samples/simple_info.rb +10 -0
  155. data/samples/simple_iterated_content.rb +8 -0
  156. data/samples/simple_keypress.rb +15 -0
  157. data/samples/simple_logo_display.rb +15 -0
  158. data/samples/simple_loogink_cy.rb +33 -0
  159. data/samples/simple_lorem_ipsum.rb +19 -0
  160. data/samples/simple_manual.rb +5 -0
  161. data/samples/simple_menu.rb +42 -0
  162. data/samples/simple_mouse_follow.rb +9 -0
  163. data/samples/simple_oval.rb +6 -0
  164. data/samples/simple_polygon_line.rb +19 -0
  165. data/samples/simple_position_as_we_go.rb +10 -0
  166. data/samples/simple_progress_bar.rb +15 -0
  167. data/samples/simple_random_bubbles.rb +15 -0
  168. data/samples/simple_require.rb +9 -0
  169. data/samples/simple_sample_executor.rb +7 -0
  170. data/samples/simple_sample_executor_all.rb +14 -0
  171. data/samples/simple_sesame_street_shoes.rb +6 -0
  172. data/samples/simple_shoes_intro.rb +22 -0
  173. data/samples/simple_slide.rb +57 -0
  174. data/samples/simple_stack_flow_buttons.rb +16 -0
  175. data/samples/simple_stripes.rb +9 -0
  176. data/samples/simple_system_background.rb +5 -0
  177. data/samples/simple_text_movement.rb +8 -0
  178. data/samples/simple_tictactoe.rb +224 -0
  179. data/samples/simple_timer.rb +16 -0
  180. data/samples/simple_translate.rb +10 -0
  181. data/samples/simple_visibility.rb +20 -0
  182. metadata +186 -7
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ class RequireMe
3
+ def self.message
4
+ "This came from another file we required"
5
+ end
6
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ class BookList < Shoes
3
+ url '/', :index
4
+ url '/twain', :twain
5
+ url '/kv', :vonnegut
6
+
7
+ def index
8
+ para "Books I've read: ",
9
+ link("by Mark Twain", click: "/twain"),
10
+ link("by Kurt Vonnegut", click: "/kv")
11
+ end
12
+
13
+ def twain
14
+ para "Just Huck Finn.\n",
15
+ link("Go back.", click: "/")
16
+ end
17
+
18
+ def vonnegut
19
+ para "Cat's Cradle. Sirens of Titan. ",
20
+ "Breakfast of Champions.\n",
21
+ link("Go back.", click: "/")
22
+ end
23
+ end
24
+
25
+ Shoes.app width: 400, height: 500
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app width: 200, height: 80 do
3
+ para "Testing test test. ",
4
+ strong("Breadsticks. "),
5
+ em("Breadsticks. "),
6
+ code("Breadsticks. "),
7
+ strong(ins("Very good."))
8
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ @o = oval top: 0, left: 0,
4
+ radius: 40
5
+
6
+ stack margin: 40 do
7
+ title "Dancing With a Circle"
8
+ subtitle "How graceful and round."
9
+ end
10
+
11
+ motion do |x, y|
12
+ @o.move width - x, height - y
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ class Dictionary < Shoes
3
+ url '/', :index
4
+ url '/(\w+)', :word
5
+
6
+ def index
7
+ stack do
8
+ title "Enter a Word"
9
+ @word = edit_line
10
+ button "OK" do
11
+ visit "/#{@word.text}"
12
+ end
13
+ end
14
+ end
15
+
16
+ def word(string)
17
+ stack do
18
+ para "No definition found for #{string}. ",
19
+ "Sorry this doesn't actually work."
20
+ end
21
+ end
22
+ end
23
+
24
+ Shoes.app
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ @e = edit_box "Would that I...",
4
+ width: 400, height: 240
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ @e = edit_line width: 400
4
+ button "O.K." do
5
+ alert @e.text
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ stack margin: 20, width: 250 do
4
+ subtitle "Shoes Notebook"
5
+ para "Add a note."
6
+ @add = edit_line
7
+
8
+ button "Save" do
9
+ @notes.append do
10
+ para @add.text, " ", link("delete") { |x| x.parent.remove }
11
+ end
12
+ @add.text = ""
13
+ end
14
+ end
15
+ @notes = stack margin: 20, width: -250
16
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app width: 280, height: 350 do
3
+ flow width: 280, margin: 10 do
4
+ stack width: "100%" do
5
+ banner "A POEM"
6
+ end
7
+ stack width: "80px" do
8
+ para "Goes like:"
9
+ end
10
+ stack width: "-90px" do
11
+ para "the sun.\n",
12
+ "a lemon.\n",
13
+ "the goalie.\n",
14
+ "a fireplace.\n",
15
+ "i want to write\n",
16
+ "a poem for the\n",
17
+ "kids who haven't\n",
18
+ "even heard one yet.\n\n",
19
+ "and the goalie guards\n",
20
+ "the fireplace"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ stack do
4
+ edit_line "Sample sample."
5
+ button "Breadsticks."
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app width: 150, height: 200 do
3
+ stack do
4
+ title "Title"
5
+ subtitle "Subtitle"
6
+ tagline "Tagline"
7
+ caption "Caption"
8
+ para "Para"
9
+ inscription "Inscription"
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ button("Trurl?") do
4
+ alert("Klapaucius!")
5
+ end
6
+ end
Binary file
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ shape do
4
+ move_to(90, 55)
5
+ arc_to(50, 55, 50, 20, 0, Shoes::PI / 2)
6
+ arc_to(50, 55, 60, 60, Shoes::PI / 2, Shoes::PI)
7
+ arc_to(50, 55, 70, 70, Shoes::PI, Shoes::TWO_PI - Shoes::PI / 2)
8
+ arc_to(50, 55, 80, 80, Shoes::TWO_PI - Shoes::PI / 2, Shoes::TWO_PI)
9
+ end
10
+ end
Binary file
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+ module Accordion
3
+ OPEN_HEIGHT = 240
4
+
5
+ def open_page(stack)
6
+ if stack.height >= OPEN_HEIGHT
7
+ zero_other_pages(stack)
8
+ return
9
+ end
10
+
11
+ a = animate 60 do
12
+ stack.height += 20
13
+ decrement_other_pages(stack)
14
+ a.stop if stack.height >= OPEN_HEIGHT
15
+ end
16
+ end
17
+
18
+ def other_pages(stack)
19
+ @pages.reject { |page| page == stack }
20
+ .reject { |page| page.height <= 0 }
21
+ end
22
+
23
+ def zero_other_pages(stack)
24
+ other_pages(stack).each do |page|
25
+ page.height = 0
26
+ end
27
+ end
28
+
29
+ def decrement_other_pages(stack)
30
+ other_pages(stack).each do |page|
31
+ page.height -= [page.height, 20].min
32
+ end
33
+ end
34
+
35
+ def page(title, active, text)
36
+ @pages ||= []
37
+ stack do
38
+ page_text = nil
39
+ header = stack width: "100%" do
40
+ background "#fff".."#eed"
41
+ hi = background "#ddd".."#ba9", hidden: true
42
+ para link(title) {}, size: 26
43
+ hover { hi.show }
44
+ leave { hi.hide }
45
+ end
46
+
47
+ height = active ? OPEN_HEIGHT : 0
48
+ page_text = stack width: "100%", height: height do
49
+ para text
50
+ end
51
+ @pages << page_text
52
+
53
+ header.click do
54
+ open_page(page_text)
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ Shoes.app do
61
+ extend Accordion
62
+ style(Shoes::Link, stroke: black, underline: nil, weight: "strong")
63
+ style(Shoes::LinkHover, stroke: black, fill: nil, underline: nil)
64
+
65
+ page "0.0", true, <<-'END'
66
+ There is a thought
67
+ I have just had
68
+ Which I don’t care to pass to
69
+ Anyone at all at this time.
70
+
71
+ I have even forgotten it now,
72
+ But kept only the pleasures
73
+ Of my property
74
+ And of my controlled mental slippage.
75
+ END
76
+ page "0.1", false, <<-'END'
77
+ My eyes have blinked again
78
+ And I have just realized
79
+ This upright world
80
+ I have been in.
81
+
82
+ My eyelids wipe
83
+ My eyes hundreds of times
84
+ Reseting and renovating
85
+ The scenery.
86
+ END
87
+ page "0.2", false, <<-'END'
88
+ Sister, without you,
89
+ The universe would
90
+ Have such a hole through it,
91
+ Where infinity has been shot.
92
+
93
+ This cannot be, though.
94
+ There will always be room
95
+ For you—all of us are
96
+ Holding the way open.
97
+ END
98
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ Shoes.app do
3
+ para "Click somewhere"
4
+ click do
5
+ # Earlier versions had trouble because para would get drawn while the
6
+ # alert was up, but before it got positioned. Make sure we don't regress.
7
+ para 'hahahahaha destroy everything'
8
+ alert 'muhhh'
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ # sample56.rb
3
+ Para = Shoes::Para
4
+ Shoes.app width: 200, height: 160 do
5
+ style Para, align: 'center', stroke: pink, size: 30
6
+ stack do
7
+ para "hello"
8
+ para "hello", size: 10, stroke: red
9
+ para "hello"
10
+ end
11
+ end