green_shoes 0.138.0 → 0.139.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/shoes/help.rb +9 -1
  2. data/static/manual-en.txt +89 -43
  3. metadata +3 -3
data/lib/shoes/help.rb CHANGED
@@ -76,7 +76,7 @@ class Manual < Shoes
76
76
  code = lines[n...-1].join(NL+' ')
77
77
  flow do
78
78
  background lightsteelblue, curve: 5
79
- inscription link(fg('Run this', green)){instance_eval code}, margin_left: 480
79
+ inscription link(fg('Run this', green)){eval mk_executable(code), TOPLEVEL_BINDING}, margin_left: 480
80
80
  para ' ', fg(code, maroon), NL
81
81
  end
82
82
  para
@@ -120,6 +120,14 @@ class Manual < Shoes
120
120
  str.split("\n\n") - ['']
121
121
  end
122
122
 
123
+ def mk_executable code
124
+ if code =~ /\# Not yet available/
125
+ "Shoes.app{para 'Sorry, not yet available...'}"
126
+ else
127
+ code
128
+ end
129
+ end
130
+
123
131
  def color_page
124
132
  Shoes::App::COLORS.each do |color, v|
125
133
  r, g, b = v
data/static/manual-en.txt CHANGED
@@ -263,6 +263,7 @@ Like let's say you pass around a stack object. And you have a class that edits
263
263
  that object.
264
264
 
265
265
  {{{
266
+ # Not yet available
266
267
  class Messenger
267
268
  def initialize(stack)
268
269
  @stack = stack
@@ -286,6 +287,7 @@ Fortunately, each Shoes object has an `app` method that will let you reopen the
286
287
  App object so you can do somefurther editing.
287
288
 
288
289
  {{{
290
+ # Not yet available
289
291
  class Messenger
290
292
  def initialize(stack)
291
293
  @stack = stack
@@ -316,6 +318,7 @@ stack.'''
316
318
  Fixed widths on slots are great so you can split the window into columns.
317
319
 
318
320
  {{{
321
+ # Not yet available
319
322
  Shoes.app do
320
323
  flow do
321
324
  stack :width => 200 do
@@ -343,6 +346,7 @@ On difference between normal slots and nested window slots is that the latter
343
346
  can have scrollbars.
344
347
 
345
348
  {{{
349
+ # Not yet available
346
350
  Shoes.app do
347
351
  stack :width => 200, :height => 200, :scroll => true do
348
352
  background "#DFA"
@@ -367,9 +371,9 @@ shapes!'''
367
371
 
368
372
  {{{
369
373
  Shoes.app do
370
- fill black(0.1)
374
+ fill black.push(0.1)
371
375
  100.times do |i|
372
- oval i, i, i * 2
376
+ oval i, i, i * 2 if i > 0
373
377
  end
374
378
  end
375
379
  }}}
@@ -378,11 +382,12 @@ In this example, one-hundred Oval objects are created. This isn't too bad.
378
382
  But things would be slimmer if we made these into a single shape.
379
383
 
380
384
  {{{
385
+ # Not yet available
381
386
  Shoes.app do
382
387
  fill black(0.1)
383
388
  shape do
384
389
  100.times do |i|
385
- oval i, i, i * 2
390
+ oval i, i, i * 2 if i > 0
386
391
  end
387
392
  end
388
393
  end
@@ -398,6 +403,7 @@ strictly with outlines.
398
403
  Another option is to combine all those ovals into a single image.
399
404
 
400
405
  {{{
406
+ # Not yet available
401
407
  Shoes.app do
402
408
  fill black(0.1)
403
409
  image 300, 300 do
@@ -436,7 +442,7 @@ To illustrate:
436
442
  {{{
437
443
  Shoes.app do
438
444
  stack :margin => 10 do
439
- @edit = edit_box :width => 1.0 do
445
+ @edit = edit_box do
440
446
  @para.text = @edit.text
441
447
  end
442
448
  @para = para ""
@@ -569,7 +575,9 @@ A common one is `alert`:
569
575
 
570
576
  {{{
571
577
  #!ruby
572
- alert "No dots in sight"
578
+ Shoes.app do
579
+ alert "No dots in sight"
580
+ end
573
581
  }}}
574
582
 
575
583
  Compare that to the method `reverse`, which isn't a Kernel method and is only
@@ -577,10 +585,12 @@ available for Arrays and Strings:
577
585
 
578
586
  {{{
579
587
  #!ruby
580
- "Plaster of Paris".reverse
581
- #=> "siraP fo retsalP"
582
- [:dogs, :cows, :snakes].reverse
583
- #=> [:snakes, :cows, :dogs]
588
+ Shoes.app do
589
+ para "Plaster of Paris".reverse
590
+ #=> "siraP fo retsalP"
591
+ para [:dogs, :cows, :snakes].reverse
592
+ #=> [:snakes, :cows, :dogs]
593
+ end
584
594
  }}}
585
595
 
586
596
  Most Shoes methods for drawing and making buttons and so on are attached to
@@ -608,7 +618,7 @@ Pops up a window containing a short message.
608
618
 
609
619
  {{{
610
620
  #!ruby
611
- alert("I'm afraid I must interject!")
621
+ Shoes.app{ alert("I'm afraid I must interject!") }
612
622
  }}}
613
623
 
614
624
  Please use alerts sparingly, as they are incredibly annoying! If you are using
@@ -622,6 +632,7 @@ their name.
622
632
 
623
633
  {{{
624
634
  #!ruby
635
+ # Not yet available
625
636
  name = ask("Please, enter your name:")
626
637
  }}}
627
638
 
@@ -637,6 +648,7 @@ use this color.
637
648
 
638
649
  {{{
639
650
  #!ruby
651
+ # Not yet available
640
652
  backcolor = ask_color("Pick a background")
641
653
  Shoes.app do
642
654
  background backcolor
@@ -651,8 +663,8 @@ file.
651
663
 
652
664
  {{{
653
665
  #!ruby
654
- filename = ask_open_file
655
666
  Shoes.app do
667
+ filename = ask_open_file
656
668
  para File.read(filename)
657
669
  end
658
670
  }}}
@@ -664,6 +676,7 @@ previously.
664
676
 
665
677
  {{{
666
678
  #!ruby
679
+ # Not yet available
667
680
  save_as = ask_save_file
668
681
  }}}
669
682
 
@@ -675,6 +688,7 @@ the folder.
675
688
 
676
689
  {{{
677
690
  #!ruby
691
+ # Not yet available
678
692
  folder = ask_open_folder
679
693
  Shoes.app do
680
694
  para Dir.entries(folder)
@@ -689,6 +703,7 @@ previously. On OS X, this method currently behaves like an alias of
689
703
 
690
704
  {{{
691
705
  #!ruby
706
+ # Not yet available
692
707
  save_to = ask_save_folder
693
708
  }}}
694
709
 
@@ -700,6 +715,7 @@ you'll get back a `true`. If not, you'll get back `false`.
700
715
 
701
716
  {{{
702
717
  #!ruby
718
+ # Not yet available
703
719
  if confirm("Draw a circle?")
704
720
  Shoes.app{ oval :top => 0, :left => 0, :radius => 50 }
705
721
  end
@@ -712,6 +728,7 @@ by pressing `Alt-/` on any Shoes window (or `⌘-/` on OS X.)
712
728
 
713
729
  {{{
714
730
  #!ruby
731
+ # Not yet available
715
732
  debug("Running Shoes on " + RUBY_PLATFORM)
716
733
  }}}
717
734
 
@@ -760,6 +777,7 @@ available to you on this platform. You can check for a certain font by using
760
777
  `include?`.
761
778
 
762
779
  {{{
780
+ # Not yet available
763
781
  if Shoes::FONTS.include? "Helvetica"
764
782
  alert "Helvetica is available on this system."
765
783
  else
@@ -782,6 +800,7 @@ Create a grayscale color from a level of darkness and, optionally, an alpha
782
800
  level.
783
801
 
784
802
  {{{
803
+ # Not yet available
785
804
  black = gray(0.0)
786
805
  white = gray(1.0)
787
806
  }}}
@@ -794,7 +813,7 @@ debug messages are designed to help the program figure out what's happening,
794
813
 
795
814
  {{{
796
815
  #!ruby
797
-
816
+ # Not yet available
798
817
  info("You just ran the info example on Shoes #{Shoes::RELEASE_NAME}.")
799
818
  }}}
800
819
 
@@ -809,15 +828,21 @@ transparency) can also be added, optionally.
809
828
  When passing in a whole number, use values from 0 to 255.
810
829
 
811
830
  {{{
812
- blueviolet = rgb(138, 43, 226)
813
- darkgreen = rgb(0, 100, 0)
831
+ Shoes.app do
832
+ blueviolet = rgb(138, 43, 226)
833
+ darkgreen = rgb(0, 100, 0)
834
+ oval 100, 100, 100, fill: [blueviolet, darkgreen].sample(1)
835
+ end
814
836
  }}}
815
837
 
816
838
  Or, use a decimal number from 0.0 to 1.0.
817
839
 
818
840
  {{{
819
- blueviolet = rgb(0.54, 0.17, 0.89)
820
- darkgreen = rgb(0, 0.4, 0)
841
+ Shoes.app do
842
+ blueviolet = rgb(0.54, 0.17, 0.89)
843
+ darkgreen = rgb(0, 0.4, 0)
844
+ oval 100, 100, 100, fill: [blueviolet, darkgreen].sample(1)
845
+ end
821
846
  }}}
822
847
 
823
848
  This method may also be called as `Shoes.rgb`.
@@ -904,11 +929,12 @@ If you attach a block to a download, it'll get called as the `finish` event.
904
929
 
905
930
  {{{
906
931
  #!ruby
932
+ # Not yet available
907
933
  Shoes.app do
908
934
  stack do
909
935
  title "Searching Google", :size => 16
910
936
  @status = para "One moment..."
911
-
937
+
912
938
  # Search Google for 'shoes' and print the HTTP headers
913
939
  download "http://www.google.com/search?q=shoes" do |goog|
914
940
  @status.text = "Headers: " + goog.response.headers.inspect
@@ -926,11 +952,12 @@ Another simple use of `download` is to save some web data to a file, using the
926
952
 
927
953
  {{{
928
954
  #!ruby
955
+ # Not yet available
929
956
  Shoes.app do
930
957
  stack do
931
958
  title "Downloading Google image", :size => 16
932
959
  @status = para "One moment..."
933
-
960
+
934
961
  download "http://www.google.com/logos/nasa50th.gif",
935
962
  :save => "nasa50th.gif" do
936
963
  @status.text = "Okay, is downloaded."
@@ -950,11 +977,12 @@ class.)
950
977
 
951
978
  {{{
952
979
  #!ruby
980
+ # Not yet available
953
981
  Shoes.app do
954
982
  stack do
955
983
  title "GET Google", :size => 16
956
984
  @status = para "One moment..."
957
-
985
+
958
986
  download "http://www.google.com/search?q=shoes",
959
987
  :method => "GET" do |dump|
960
988
  @status.text = dump.response.body
@@ -1027,6 +1055,7 @@ The style hash can also be changed by using the [[Common.style]] method,
1027
1055
  available on every element and slot.
1028
1056
 
1029
1057
  {{{
1058
+ # Not yet available
1030
1059
  Shoes.app :title => "A Styling Sample" do
1031
1060
  @text = para "Red with an underline"
1032
1061
  @text.style(:stroke => red, :underline => "single")
@@ -1037,6 +1066,7 @@ Most styles can also be set by calling them as methods. (I'd use the manual
1037
1066
  search to find the method.)
1038
1067
 
1039
1068
  {{{
1069
+ # Not yet available
1040
1070
  Shoes.app :title => "A Styling Sample" do
1041
1071
  @text = para "Red with an underline"
1042
1072
  @text.stroke = red
@@ -1677,8 +1707,8 @@ To draw a star with an image pattern:
1677
1707
  {{{
1678
1708
  #!ruby
1679
1709
  Shoes.app do
1680
- fill "static/avatar.png"
1681
- star 200, 200, 5
1710
+ fill "../static/gshoes-icon.png"
1711
+ star 200, 200, 5, 100, 50
1682
1712
  end
1683
1713
  }}}
1684
1714
 
@@ -1792,6 +1822,7 @@ and arcs and bends.
1792
1822
 
1793
1823
  {{{
1794
1824
  #!ruby
1825
+ # Not yet available
1795
1826
  Shoes.app do
1796
1827
  fill red(0.2)
1797
1828
  shape do
@@ -1827,6 +1858,7 @@ So, to draw an arrow with a red line around it:
1827
1858
 
1828
1859
  {{{
1829
1860
  #!ruby
1861
+ # Not yet available
1830
1862
  Shoes.app do
1831
1863
  stroke red
1832
1864
  arrow 0, 100, 10
@@ -1957,8 +1989,8 @@ attached here which is called any type the user changes the text in the box.
1957
1989
  #!ruby
1958
1990
  Shoes.app do
1959
1991
  edit_box
1960
- edit_box "HORRAY EDIT ME"
1961
- edit_box "small one", :width => 100, :height => 160
1992
+ edit_box text: "HORRAY EDIT ME"
1993
+ edit_box text: "small one", :width => 100, :height => 160
1962
1994
  end
1963
1995
  }}}
1964
1996
 
@@ -2131,6 +2163,7 @@ window. This way the child window can call the parent.
2131
2163
 
2132
2164
  {{{
2133
2165
  #!ruby
2166
+ # Not yet available
2134
2167
  Shoes.app :title => "The Owner" do
2135
2168
  button "Pop up?" do
2136
2169
  window do
@@ -2158,6 +2191,7 @@ away.
2158
2191
 
2159
2192
  {{{
2160
2193
  #!ruby
2194
+ # Not yet available
2161
2195
  Shoes.app do
2162
2196
  s = stack :width => 200, :height => 200 do
2163
2197
  background red
@@ -2254,7 +2288,7 @@ The block is handed the cursor's `left` and `top` coordinates.
2254
2288
  background black
2255
2289
  fill white
2256
2290
  @circ = oval 0, 0, 100, 100
2257
-
2291
+
2258
2292
  motion do |top, left|
2259
2293
  @circ.move top - 50, left - 50
2260
2294
  end
@@ -2286,6 +2320,7 @@ Adds elements to the end of a slot.
2286
2320
 
2287
2321
  {{{
2288
2322
  #!ruby
2323
+ # Not yet available
2289
2324
  Shoes.app do
2290
2325
  @slot = stack { para 'Good Morning' }
2291
2326
  timer 3 do
@@ -2339,6 +2374,7 @@ Adds elements to the beginning of a slot.
2339
2374
 
2340
2375
  {{{
2341
2376
  #!ruby
2377
+ # Not yet available
2342
2378
  Shoes.app do
2343
2379
  @slot = stack { para 'Good Morning' }
2344
2380
  timer 3 do
@@ -2389,6 +2425,7 @@ This is commonly used to pad elements on the right, like so:
2389
2425
 
2390
2426
  {{{
2391
2427
  #!ruby
2428
+ # Not yet available
2392
2429
  Shoes.app do
2393
2430
  stack :margin_right => 20 + gutter do
2394
2431
  para "Insert fat and ratified declaration of independence here..."
@@ -2465,6 +2502,7 @@ originally requested.
2465
2502
 
2466
2503
  {{{
2467
2504
  #!ruby
2505
+ # Not yet available
2468
2506
  Shoes.app do
2469
2507
  @s = stack :width => "100%"
2470
2508
  para @s.style[:width]
@@ -2481,6 +2519,7 @@ example, there is a `width` method, thus there is also a `width` style.
2481
2519
 
2482
2520
  {{{
2483
2521
  #!ruby
2522
+ # Not yet available
2484
2523
  Shoes.app do
2485
2524
  @s = stack { background green }
2486
2525
  @s.style(:width => 400, :height => 200)
@@ -2554,13 +2593,14 @@ covered as the [[Position.style]] method for slots.)
2554
2593
 
2555
2594
  {{{
2556
2595
  #!ruby
2596
+ # Not yet available
2557
2597
  Shoes.app do
2558
2598
  stack do
2559
2599
  # Background, text and a button: both are elements!
2560
2600
  @back = background green
2561
2601
  @text = banner "A Message for You, Rudy"
2562
2602
  @press = button "Stop your messin about!"
2563
-
2603
+
2564
2604
  # And so, both can be styled.
2565
2605
  @text.style :size => 12, :stroke => red, :margin => 10
2566
2606
  @press.style :width => 400
@@ -2587,13 +2627,14 @@ displace it 2 pixels left and 6 pixels on top, you end up with the coordinates
2587
2627
 
2588
2628
  {{{
2589
2629
  #!ruby
2630
+ # Not yet available
2590
2631
  Shoes.app do
2591
2632
  flow :margin => 12 do
2592
2633
  # Set up three buttons
2593
2634
  button "One"
2594
2635
  @two = button "Two"
2595
2636
  button "Three"
2596
-
2637
+
2597
2638
  # Bounce the second button
2598
2639
  animate do |i|
2599
2640
  @two.displace(0, (Math.sin(i) * 6).to_i)
@@ -2647,7 +2688,7 @@ positioned instead.
2647
2688
  button "One"
2648
2689
  @two = button "Two"
2649
2690
  button "Three"
2650
-
2691
+
2651
2692
  # Bounce the second button
2652
2693
  animate do |i|
2653
2694
  @two.move(40, 40 + (Math.sin(i) * 6).to_i)
@@ -2684,10 +2725,11 @@ original setting (things like "100%" for width or "10px" for top.)
2684
2725
 
2685
2726
  {{{
2686
2727
  #!ruby
2728
+ # Not yet available
2687
2729
  Shoes.app do
2688
2730
  # A button which take up the whole page
2689
2731
  @b = button "All of it", :width => 1.0, :height => 1.0
2690
-
2732
+
2691
2733
  # When clicked, show the styles
2692
2734
  @b.click { alert(@b.style.inspect) }
2693
2735
  end
@@ -2720,6 +2762,7 @@ a stack which is 120 pixels wide, you'll get back `120`. However, if you call
2720
2762
 
2721
2763
  {{{
2722
2764
  #!ruby
2765
+ # Not yet available
2723
2766
  Shoes.app do
2724
2767
  stack :width => 120 do
2725
2768
  @b = button "Click me", :width => "100%" do
@@ -2864,6 +2907,7 @@ order to get them to work, you've got to hook up a block to each button.
2864
2907
 
2865
2908
  {{{
2866
2909
  #!ruby
2910
+ # Not yet available
2867
2911
  Shoes.app do
2868
2912
  button "OK!" do
2869
2913
  append { para "Well okay then." }
@@ -2923,6 +2967,7 @@ Here's a sample checklist.
2923
2967
 
2924
2968
  {{{
2925
2969
  #!ruby
2970
+ # Not yet available
2926
2971
  Shoes.app do
2927
2972
  stack do
2928
2973
  flow { check; para "Frances Johnson" }
@@ -2940,16 +2985,17 @@ Okay, let's add to the above example.
2940
2985
 
2941
2986
  {{{
2942
2987
  #!ruby
2988
+ # Not yet available
2943
2989
  Shoes.app do
2944
2990
  @list = ['Frances Johnson', 'Ignatius J. Reilly',
2945
2991
  'Winston Niles Rumfoord']
2946
-
2992
+
2947
2993
  stack do
2948
2994
  @list.map! do |name|
2949
2995
  flow { @c = check; para name }
2950
2996
  [@c, name]
2951
2997
  end
2952
-
2998
+
2953
2999
  button "What's been checked?" do
2954
3000
  selected = @list.map { |c, name| name if c.checked? }.compact
2955
3001
  alert("You selected: " + selected.join(', '))
@@ -3010,10 +3056,9 @@ every time someone types into or deletes from the box.
3010
3056
  #!ruby
3011
3057
  Shoes.app do
3012
3058
  edit_box do |e|
3013
- @counter.text = e.text.size
3059
+ @counter.text = "#{e.text.size} characters"
3014
3060
  end
3015
- @counter = strong("0")
3016
- para @counter, " characters"
3061
+ @counter = para strong("0"), " characters"
3017
3062
  end
3018
3063
  }}}
3019
3064
 
@@ -3102,7 +3147,7 @@ To create an image, use the `image` method in a slot:
3102
3147
  #!ruby
3103
3148
  Shoes.app do
3104
3149
  para "Nice, nice, very nice. Busy, busy, busy."
3105
- image "static/shoes-manual-apps.gif"
3150
+ image "../static/shoes-manual-apps.png"
3106
3151
  end
3107
3152
  }}}
3108
3153
 
@@ -3177,9 +3222,9 @@ You can adjust this length using the `:width` style.
3177
3222
  para "Choose a fruit:"
3178
3223
  list_box :items => ["Grapes", "Pears", "Apricots"],
3179
3224
  :width => 120, :choose => "Apricots" do |list|
3180
- @fruit.text = list.text
3225
+ @fruit.text = list
3181
3226
  end
3182
-
3227
+
3183
3228
  @fruit = para "No fruit selected"
3184
3229
  end
3185
3230
  }}}
@@ -3236,13 +3281,11 @@ A simple progress bar is 200 pixels wide, but you can use the `:width` style
3236
3281
 
3237
3282
  {{{
3238
3283
  Shoes.app do
3239
- stack :margin => 0.1 do
3240
- title "Progress example"
3241
- @p = progress :width => 1.0
3242
-
3243
- animate do |i|
3244
- @p.fraction = (i % 100) / 100.0
3245
- end
3284
+ title "Progress example"
3285
+ @p = progress left: 10, top: 100, width: width - 20
3286
+
3287
+ animate do |i|
3288
+ @p.fraction = (i % 100) / 100.0
3246
3289
  end
3247
3290
  end
3248
3291
  }}}
@@ -3272,6 +3315,7 @@ marked.
3272
3315
 
3273
3316
  {{{
3274
3317
  #!ruby
3318
+ # Not yet available
3275
3319
  Shoes.app do
3276
3320
  para "Among these films, which do you prefer?\n"
3277
3321
  radio; para strong("The Taste of Tea"), " by Katsuhito Ishii\n"
@@ -3287,6 +3331,7 @@ If we move them each into their own slot, the example breaks.
3287
3331
 
3288
3332
  {{{
3289
3333
  #!ruby
3334
+ # Not yet available
3290
3335
  Shoes.app do
3291
3336
  stack do
3292
3337
  para "Among these films, which do you prefer?"
@@ -3304,6 +3349,7 @@ Here, let's group all these radios in the `:films` group.
3304
3349
 
3305
3350
  {{{
3306
3351
  #!ruby
3352
+ # Not yet available
3307
3353
  Shoes.app do
3308
3354
  stack do
3309
3355
  para "Among these films, which do you prefer?"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 138
7
+ - 139
8
8
  - 0
9
- version: 0.138.0
9
+ version: 0.139.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - ashbb
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-05 00:00:00 +09:00
17
+ date: 2011-02-06 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies: []
20
20