shoes 4.0.0.pre2 → 4.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -21
- metadata +18 -337
- data/CHANGELOG +0 -84
- data/Gemfile +0 -24
- data/Guardfile +0 -11
- data/Rakefile +0 -14
- data/app.yaml +0 -60
- data/benchmark/app_clear.rb +0 -21
- data/benchmark/clear.rb +0 -69
- data/benchmark/memory/text_dispose.rb +0 -9
- data/benchmark/para_creator.rb +0 -9
- data/benchmark/paras.rb +0 -52
- data/benchmark/urls.rb +0 -40
- data/bin/ruby-shoes +0 -6
- data/bin/shoes-guard +0 -8
- data/bin/shoes-stub +0 -59
- data/ext/install/Rakefile +0 -29
- data/ext/install/shoes.bat +0 -9
- data/lib/shoes.rb +0 -5
- data/lib/shoes/ui/cli.rb +0 -102
- data/lib/shoes/ui/help.rb +0 -535
- data/lib/shoes/ui/manual.rb +0 -6
- data/lib/shoes/version.rb +0 -3
- data/manifests/common.rb +0 -34
- data/manifests/shoes.rb +0 -44
- data/samples/Gemfile +0 -3
- data/samples/Gemfile.lock +0 -35
- data/samples/README +0 -97
- data/samples/boom.rb +0 -239
- data/samples/class-book-adjusted.rb +0 -45
- data/samples/class-book.rb +0 -43
- data/samples/class-book.yaml +0 -387
- data/samples/clicky.rb +0 -24
- data/samples/cy.png +0 -0
- data/samples/expert-definr.rb +0 -23
- data/samples/expert-funnies.rb +0 -60
- data/samples/expert-game-of-life-adjusted.rb +0 -249
- data/samples/expert-game-of-life.rb +0 -243
- data/samples/expert-irb-adjusted.rb +0 -110
- data/samples/expert-irb.rb +0 -112
- data/samples/expert-minesweeper-adjusted.rb +0 -272
- data/samples/expert-minesweeper.rb +0 -267
- data/samples/expert-othello-adjusted.rb +0 -325
- data/samples/expert-othello.rb +0 -318
- data/samples/expert-pong.rb +0 -62
- data/samples/expert-snake.rb +0 -78
- data/samples/expert-tankspank.rb +0 -385
- data/samples/flow.rb +0 -63
- data/samples/good-arc.rb +0 -45
- data/samples/good-clock.rb +0 -51
- data/samples/good-displace.rb +0 -98
- data/samples/good-follow.rb +0 -26
- data/samples/good-potato-chopping.rb +0 -22
- data/samples/good-reminder.rb +0 -174
- data/samples/good-vjot.rb +0 -58
- data/samples/gray.rb +0 -11
- data/samples/loogink.png +0 -0
- data/samples/nks_booklist.rb +0 -24
- data/samples/nks_breadsticks.rb +0 -7
- data/samples/nks_dancing_circle.rb +0 -13
- data/samples/nks_dictionary.rb +0 -23
- data/samples/nks_edit_box.rb +0 -4
- data/samples/nks_edit_line.rb +0 -6
- data/samples/nks_notes.rb +0 -16
- data/samples/nks_poem.rb +0 -22
- data/samples/nks_self.rb +0 -6
- data/samples/nks_text_sizes.rb +0 -10
- data/samples/nks_trurl.rb +0 -5
- data/samples/original-manual-adjusted.rb +0 -475
- data/samples/original-manual.rb +0 -472
- data/samples/packaging/package_me.rb +0 -6
- data/samples/potato_chopping/1258_s001.gif +0 -0
- data/samples/potato_chopping/1258_s002.gif +0 -0
- data/samples/potato_chopping/1258_s003.gif +0 -0
- data/samples/potato_chopping/1258_s004.gif +0 -0
- data/samples/potato_chopping/1258_s005.gif +0 -0
- data/samples/potato_chopping/1258_s006.gif +0 -0
- data/samples/potato_chopping/1258_s007.gif +0 -0
- data/samples/potato_chopping/1258_s008.gif +0 -0
- data/samples/potato_chopping/1258_s009.gif +0 -0
- data/samples/potato_chopping/1258_s010.gif +0 -0
- data/samples/potato_chopping/1258_s011.gif +0 -0
- data/samples/potato_chopping/1258_s012.gif +0 -0
- data/samples/potato_chopping/1258_s013.gif +0 -0
- data/samples/potato_chopping/1258_s014.gif +0 -0
- data/samples/potato_chopping/1258_s015.gif +0 -0
- data/samples/potato_chopping/1258_s016.gif +0 -0
- data/samples/potato_chopping/1258_s017.gif +0 -0
- data/samples/potato_chopping/1258_s018.gif +0 -0
- data/samples/potato_chopping/1258_s019.gif +0 -0
- data/samples/potato_chopping/1258_s020.gif +0 -0
- data/samples/potato_chopping/1258_s021.gif +0 -0
- data/samples/potato_chopping/1258_s022.gif +0 -0
- data/samples/potato_chopping/1258_s023.gif +0 -0
- data/samples/potato_chopping/1258_s024.gif +0 -0
- data/samples/potato_chopping/1258_s025.gif +0 -0
- data/samples/potato_chopping/1258_s026.gif +0 -0
- data/samples/potato_chopping/1258_s027.gif +0 -0
- data/samples/potato_chopping/1258_s028.gif +0 -0
- data/samples/potato_chopping/1258_s029.gif +0 -0
- data/samples/potato_chopping/1258_s030.gif +0 -0
- data/samples/potato_chopping/1258_s031.gif +0 -0
- data/samples/potato_chopping/1258_s032.gif +0 -0
- data/samples/potato_chopping/1258_s033.gif +0 -0
- data/samples/potato_chopping/1258_s034.gif +0 -0
- data/samples/potato_chopping/1258_s035.gif +0 -0
- data/samples/potato_chopping/1258_s036.gif +0 -0
- data/samples/potato_chopping/1258_s037.gif +0 -0
- data/samples/potato_chopping/1258_s038.gif +0 -0
- data/samples/potato_chopping/1258_s039.gif +0 -0
- data/samples/potato_chopping/1258_s040.gif +0 -0
- data/samples/potato_chopping/1258_s041.gif +0 -0
- data/samples/potato_chopping/1258_s042.gif +0 -0
- data/samples/potato_chopping/1258_s043.gif +0 -0
- data/samples/potato_chopping/1258_s044.gif +0 -0
- data/samples/potato_chopping/1258_s045.gif +0 -0
- data/samples/potato_chopping/1258_s046.gif +0 -0
- data/samples/potato_chopping/1258_s047.gif +0 -0
- data/samples/potato_chopping/1258_s048.gif +0 -0
- data/samples/potato_chopping/1258_s049.gif +0 -0
- data/samples/potato_chopping/1258_s050.gif +0 -0
- data/samples/potato_chopping/1258_s051.gif +0 -0
- data/samples/potato_chopping/1258_s052.gif +0 -0
- data/samples/potato_chopping/1258_s053.gif +0 -0
- data/samples/potato_chopping/1258_s054.gif +0 -0
- data/samples/potato_chopping/1258_s055.gif +0 -0
- data/samples/potato_chopping/1258_s056.gif +0 -0
- data/samples/potato_chopping/1258_s057.gif +0 -0
- data/samples/potato_chopping/1258_s058.gif +0 -0
- data/samples/potato_chopping/1258_s059.gif +0 -0
- data/samples/present.rb +0 -27
- data/samples/progress.rb +0 -10
- data/samples/sample1.rb +0 -30
- data/samples/sample12.rb +0 -21
- data/samples/sample13.rb +0 -13
- data/samples/sample14.rb +0 -64
- data/samples/sample15.rb +0 -18
- data/samples/sample16.rb +0 -10
- data/samples/sample17.rb +0 -10
- data/samples/sample2.rb +0 -14
- data/samples/sample21.rb +0 -5
- data/samples/sample23.rb +0 -8
- data/samples/sample24.rb +0 -21
- data/samples/sample27.rb +0 -18
- data/samples/sample3.rb +0 -14
- data/samples/sample31.rb +0 -22
- data/samples/sample34.rb +0 -27
- data/samples/sample35.rb +0 -32
- data/samples/sample37.rb +0 -8
- data/samples/sample4.rb +0 -7
- data/samples/sample42.rb +0 -14
- data/samples/sample45.rb +0 -11
- data/samples/sample56.rb +0 -10
- data/samples/sample6.rb +0 -9
- data/samples/sample7.rb +0 -3
- data/samples/sample8.rb +0 -7
- data/samples/sample9.rb +0 -10
- data/samples/simple-accordion.rb +0 -75
- data/samples/simple-anim-shapes.rb +0 -17
- data/samples/simple-anim-text.rb +0 -13
- data/samples/simple-animate.rb +0 -12
- data/samples/simple-arc.rb +0 -23
- data/samples/simple-bounce.rb +0 -24
- data/samples/simple-brightness-transitions.rb +0 -8
- data/samples/simple-button-animate.rb +0 -16
- data/samples/simple-calc-2.rb +0 -34
- data/samples/simple-calc.rb +0 -70
- data/samples/simple-color-selector.rb +0 -10
- data/samples/simple-color-transitions.rb +0 -11
- data/samples/simple-control-sizes.rb +0 -24
- data/samples/simple-curve.rb +0 -26
- data/samples/simple-dialogs-outside.rb +0 -12
- data/samples/simple-dialogs.rb +0 -32
- data/samples/simple-displace.rb +0 -15
- data/samples/simple-downloader.rb +0 -27
- data/samples/simple-draw.rb +0 -13
- data/samples/simple-editor.rb +0 -28
- data/samples/simple-face.rb +0 -14
- data/samples/simple-flow-wrap.rb +0 -11
- data/samples/simple-font.rb +0 -17
- data/samples/simple-form.rb +0 -29
- data/samples/simple-form.shy +0 -0
- data/samples/simple-fullscreen.rb +0 -4
- data/samples/simple-guess-game.rb +0 -28
- data/samples/simple-keypress.rb +0 -14
- data/samples/simple-manual.rb +0 -2
- data/samples/simple-mask.rb +0 -21
- data/samples/simple-menu.rb +0 -47
- data/samples/simple-mouse-follow.rb +0 -8
- data/samples/simple-move.rb +0 -13
- data/samples/simple-oval.rb +0 -3
- data/samples/simple-sample-executor.rb +0 -6
- data/samples/simple-shoes-intro.rb +0 -22
- data/samples/simple-slide.rb +0 -56
- data/samples/simple-sound.rb +0 -30
- data/samples/simple-sphere.rb +0 -28
- data/samples/simple-stripes.rb +0 -8
- data/samples/simple-tictactoe.rb +0 -238
- data/samples/simple-timer.rb +0 -15
- data/samples/simple-video.rb +0 -13
- data/samples/simple-visibility.rb +0 -11
- data/samples/simple-widget.rb +0 -9
- data/samples/sounds/102719__sarge4267__explosion.mp3 +0 -0
- data/samples/sounds/145622__andybrannan__train-fog-horn-long-wyomming.aiff +0 -0
- data/samples/sounds/46492__phreaksaccount__shields1.ogg +0 -0
- data/samples/sounds/61847__simon-rue__boink-v3.wav +0 -0
- data/samples/swt-raw.rb +0 -20
- data/samples/troll.rb +0 -22
- data/shoes.gemspec +0 -29
- data/snapshots/sample1.png +0 -0
- data/snapshots/sample10.png +0 -0
- data/snapshots/sample11.png +0 -0
- data/snapshots/sample12.png +0 -0
- data/snapshots/sample13.png +0 -0
- data/snapshots/sample14.png +0 -0
- data/snapshots/sample15.png +0 -0
- data/snapshots/sample16.png +0 -0
- data/snapshots/sample17.png +0 -0
- data/snapshots/sample18.png +0 -0
- data/snapshots/sample19.png +0 -0
- data/snapshots/sample2.png +0 -0
- data/snapshots/sample20.png +0 -0
- data/snapshots/sample21.png +0 -0
- data/snapshots/sample22.png +0 -0
- data/snapshots/sample23.png +0 -0
- data/snapshots/sample24.png +0 -0
- data/snapshots/sample27.png +0 -0
- data/snapshots/sample28.png +0 -0
- data/snapshots/sample29.png +0 -0
- data/snapshots/sample3.png +0 -0
- data/snapshots/sample30.png +0 -0
- data/snapshots/sample31.png +0 -0
- data/snapshots/sample34.png +0 -0
- data/snapshots/sample35.png +0 -0
- data/snapshots/sample36.png +0 -0
- data/snapshots/sample37.png +0 -0
- data/snapshots/sample4.png +0 -0
- data/snapshots/sample42.png +0 -0
- data/snapshots/sample44.png +0 -0
- data/snapshots/sample45.png +0 -0
- data/snapshots/sample46.png +0 -0
- data/snapshots/sample5.png +0 -0
- data/snapshots/sample56.png +0 -0
- data/snapshots/sample6.png +0 -0
- data/snapshots/sample7.png +0 -0
- data/snapshots/sample8.png +0 -0
- data/snapshots/sample9.png +0 -0
- data/snapshots/sample99.png +0 -0
- data/static/PKGBUILD +0 -47
- data/static/Shoes.icns +0 -0
- data/static/avatar.png +0 -0
- data/static/code_highlighter.js +0 -188
- data/static/code_highlighter_ruby.js +0 -26
- data/static/downloading.png +0 -0
- data/static/icon-debug.png +0 -0
- data/static/icon-error.png +0 -0
- data/static/icon-info.png +0 -0
- data/static/icon-warn.png +0 -0
- data/static/listbox_button1.png +0 -0
- data/static/listbox_button2.png +0 -0
- data/static/man-app.png +0 -0
- data/static/man-builds.png +0 -0
- data/static/man-builds1.png +0 -0
- data/static/man-editor-notepad.png +0 -0
- data/static/man-editor-osx.png +0 -0
- data/static/man-ele-background.png +0 -0
- data/static/man-ele-border.png +0 -0
- data/static/man-ele-button.png +0 -0
- data/static/man-ele-check.png +0 -0
- data/static/man-ele-editbox.png +0 -0
- data/static/man-ele-editline.png +0 -0
- data/static/man-ele-image.png +0 -0
- data/static/man-ele-listbox.png +0 -0
- data/static/man-ele-progress.png +0 -0
- data/static/man-ele-radio.png +0 -0
- data/static/man-ele-shape.png +0 -0
- data/static/man-ele-textblock.png +0 -0
- data/static/man-ele-video.png +0 -0
- data/static/man-intro-dmg.png +0 -0
- data/static/man-intro-exe.png +0 -0
- data/static/man-look-tiger.png +0 -0
- data/static/man-look-ubuntu.png +0 -0
- data/static/man-look-vista.png +0 -0
- data/static/man-run-osx.png +0 -0
- data/static/man-run-vista.png +0 -0
- data/static/man-run-xp.png +0 -0
- data/static/man-shot1.png +0 -0
- data/static/manual-en.txt +0 -3531
- data/static/manual-ja.txt +0 -2829
- data/static/manual.css +0 -184
- data/static/menu-corner1.png +0 -0
- data/static/menu-corner2.png +0 -0
- data/static/menu-gray.png +0 -0
- data/static/menu-left.png +0 -0
- data/static/menu-right.png +0 -0
- data/static/menu-top.png +0 -0
- data/static/shoes-dmg.jpg +0 -0
- data/static/shoes-icon-blue.png +0 -0
- data/static/shoes-icon-brown.png +0 -0
- data/static/shoes-icon.png +0 -0
- data/static/shoes-manual-apps.gif +0 -0
- data/static/shoes-manual-apps.png +0 -0
- data/static/shoes_main_window.png +0 -0
- data/static/stripe.png +0 -0
- data/static/tutor-back.png +0 -0
- data/tasks/changelog.rb +0 -92
- data/tasks/gem.rb +0 -38
- data/tasks/rspec.rb +0 -106
- data/tasks/sample.rb +0 -66
- data/tasks/yard.rb +0 -13
data/samples/good-clock.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Shoes Clock by Thomas Bell
|
3
|
-
# posted to the Shoes mailing list on 04 Dec 2007
|
4
|
-
#
|
5
|
-
Shoes.app height: 260, width: 250 do
|
6
|
-
@radius, @centerx, @centery = 90, 126, 140
|
7
|
-
animate(8) do
|
8
|
-
@time = Time.now
|
9
|
-
clear do
|
10
|
-
draw_background
|
11
|
-
stack do
|
12
|
-
background black
|
13
|
-
para @time.strftime("%a"),
|
14
|
-
span(@time.strftime(" %b %d, %Y "), stroke: "#ccc"),
|
15
|
-
strong(@time.strftime("%I:%M"), stroke: white),
|
16
|
-
@time.strftime(".%S"), align: "center", stroke: "#666",
|
17
|
-
margin: 4
|
18
|
-
end
|
19
|
-
clock_hand @time.sec + (@time.usec * 0.000001),2,30,red
|
20
|
-
clock_hand @time.min + (@time.sec / 60.0),5
|
21
|
-
clock_hand @time.hour + (@time.min / 60.0),8,6
|
22
|
-
end
|
23
|
-
end
|
24
|
-
def draw_background
|
25
|
-
background rgb(230, 240, 200)
|
26
|
-
|
27
|
-
fill white
|
28
|
-
stroke black
|
29
|
-
strokewidth 4
|
30
|
-
oval @centerx - 102, @centery - 102, 204, 204
|
31
|
-
|
32
|
-
fill black
|
33
|
-
nostroke
|
34
|
-
oval @centerx - 5, @centery - 5, 10, 10
|
35
|
-
|
36
|
-
stroke black
|
37
|
-
strokewidth 1
|
38
|
-
line(@centerx, @centery - 102, @centerx, @centery - 95)
|
39
|
-
line(@centerx - 102, @centery, @centerx - 95, @centery)
|
40
|
-
line(@centerx + 95, @centery, @centerx + 102, @centery)
|
41
|
-
line(@centerx, @centery + 95, @centerx, @centery + 102)
|
42
|
-
end
|
43
|
-
def clock_hand(time, sw, unit=30, color=black)
|
44
|
-
radius_local = unit == 30 ? @radius : @radius - 15
|
45
|
-
_x = radius_local * Math.sin( time * Math::PI / unit )
|
46
|
-
_y = radius_local * Math.cos( time * Math::PI / unit )
|
47
|
-
stroke color
|
48
|
-
strokewidth sw
|
49
|
-
line(@centerx, @centery, @centerx + _x, @centery - _y)
|
50
|
-
end
|
51
|
-
end
|
data/samples/good-displace.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
class Layout
|
2
|
-
def initialize(app, art, elements)
|
3
|
-
@app = app
|
4
|
-
@art = art
|
5
|
-
@elements = elements
|
6
|
-
@position = {}
|
7
|
-
@width = 50
|
8
|
-
@margin = 10
|
9
|
-
@top = 4
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_reader :art, :elements, :width, :margin, :top
|
13
|
-
|
14
|
-
def oval
|
15
|
-
@app.oval *position(:oval), width
|
16
|
-
end
|
17
|
-
|
18
|
-
def rect
|
19
|
-
@app.rect *position(:rect), width
|
20
|
-
end
|
21
|
-
|
22
|
-
def image
|
23
|
-
@app.image "#{Shoes::DIR}/static/avatar.png", :left => left(:image), :top => top
|
24
|
-
end
|
25
|
-
|
26
|
-
def edit_box
|
27
|
-
@app.edit_box "Edit me", :left => left(:edit_box), :top => top, :width => width
|
28
|
-
end
|
29
|
-
|
30
|
-
def offset(element)
|
31
|
-
art.index(element.to_sym) || elements.index(element.to_sym)
|
32
|
-
end
|
33
|
-
|
34
|
-
def left(element)
|
35
|
-
(width + margin) * offset(element)
|
36
|
-
end
|
37
|
-
|
38
|
-
def position(element)
|
39
|
-
[left(element), top]
|
40
|
-
end
|
41
|
-
|
42
|
-
def remember(name, element)
|
43
|
-
@app.info "Remembering #{name} at #{[element.left, element.top]}"
|
44
|
-
@position[name] = [element.left, element.top]
|
45
|
-
end
|
46
|
-
|
47
|
-
def recall(name)
|
48
|
-
position = @position.fetch(name, "...oops, can't find it...[0, 0]")
|
49
|
-
@app.info "Recalling #{name} was at #{position}"
|
50
|
-
@position.fetch(name, [0, 0])
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
Shoes.app do
|
55
|
-
@art = [:oval, :rect]
|
56
|
-
@elements = [:image, :edit_box]
|
57
|
-
@objects = {}
|
58
|
-
@layout = Layout.new self, @art, @elements
|
59
|
-
@create_object = lambda do |name|
|
60
|
-
info "#{name} starts at #{@layout.position(name)}"
|
61
|
-
@objects[name] = @layout.send(name)
|
62
|
-
@layout.remember name, @objects[name]
|
63
|
-
end
|
64
|
-
|
65
|
-
stack do
|
66
|
-
title "Art"
|
67
|
-
flow :height => 100 do
|
68
|
-
@art.each &@create_object
|
69
|
-
end
|
70
|
-
|
71
|
-
title "Elements"
|
72
|
-
flow :height => 100 do
|
73
|
-
@elements.each &@create_object
|
74
|
-
end
|
75
|
-
|
76
|
-
flow do
|
77
|
-
x = 400
|
78
|
-
colors = [seagreen, salmon, papayawhip, goldenrod]
|
79
|
-
@art.concat(@elements).each_with_index do |name, i|
|
80
|
-
stack :width => 100, :margin => 4 do
|
81
|
-
background colors[i]
|
82
|
-
tagline name.to_s
|
83
|
-
button "displace" do
|
84
|
-
@layout.remember(name, @objects[name])
|
85
|
-
position = [x - @layout.left(name), @layout.top]
|
86
|
-
info "#{name} displaces to #{position}"
|
87
|
-
@objects[name].displace(*position)
|
88
|
-
end
|
89
|
-
button "replace" do
|
90
|
-
position = @layout.recall(name)
|
91
|
-
info "#{name} replaces to #{position}"
|
92
|
-
@objects[name].displace(*position)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
data/samples/good-follow.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
trails = [[0, 0]] * 60
|
2
|
-
Shoes.app width: 200, height: 200, resizable: false do
|
3
|
-
nostroke
|
4
|
-
fill rgb(0x3, 0x1, 0x3, 0.6)
|
5
|
-
|
6
|
-
# animation at 100 frames per second
|
7
|
-
animate(60) do
|
8
|
-
trails.shift
|
9
|
-
trails << self.mouse[1, 2]
|
10
|
-
|
11
|
-
clear do
|
12
|
-
# change the background based on where the pointer is
|
13
|
-
background rgb(
|
14
|
-
20 + (70 * (trails.last[0].to_f / self.width)).to_i,
|
15
|
-
20 + (70 * (trails.last[1].to_f / self.height)).to_i,
|
16
|
-
51)
|
17
|
-
|
18
|
-
# draw circles progressively bigger
|
19
|
-
trails.each_with_index do |(x, y), i|
|
20
|
-
i += 1
|
21
|
-
oval left: x, top: y, radius: (i*0.5), center: true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Shoes.app title: 'potacho', width: 175, height: 160 do
|
2
|
-
background tan
|
3
|
-
|
4
|
-
@imgs = []
|
5
|
-
1.upto 59 do |i|
|
6
|
-
@imgs << image(File.join(Shoes::DIR, "samples/potato_chopping/1258_s#{"%03d" % i}.gif")).hide
|
7
|
-
@imgs.last.move(10, 10)
|
8
|
-
end
|
9
|
-
|
10
|
-
@imgs.first.show
|
11
|
-
|
12
|
-
def potacho
|
13
|
-
@imgs[58].hide
|
14
|
-
a = animate 12 do |i|
|
15
|
-
@imgs[i].show
|
16
|
-
@imgs[i-1].hide if i > 0
|
17
|
-
a.remove if i > 57
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
button(' start '){potacho}.move 10, 130
|
22
|
-
end
|
data/samples/good-reminder.rb
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
Shoes.app title: "A Gentle Reminder",
|
4
|
-
width: 370, height: 560, resizable: false do
|
5
|
-
|
6
|
-
background white
|
7
|
-
background tan, height: 40
|
8
|
-
|
9
|
-
caption "A Gentle Reminder", margin: 8, stroke: white
|
10
|
-
|
11
|
-
stack margin: 10, margin_top: 50 do
|
12
|
-
para "You need to", stroke: red, fill: yellow
|
13
|
-
|
14
|
-
stack margin_left: 5, margin_right: 10, width: 1.0, height: 200, scroll: true do
|
15
|
-
background white
|
16
|
-
border white, strokewidth: 3
|
17
|
-
@gui_todo = para
|
18
|
-
end
|
19
|
-
|
20
|
-
flow margin_top: 10 do
|
21
|
-
para "Remember to"
|
22
|
-
@add = edit_line(margin_left: 10, width: 180)
|
23
|
-
button("Add", margin_left: 5) { add_todo(@add.text); @add.text = '' }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
stack margin_top: 10 do
|
28
|
-
background darkgray
|
29
|
-
para strong('Completed'), stroke: white
|
30
|
-
end
|
31
|
-
|
32
|
-
@gui_completed = stack width: 1.0, height: 207, margin_right: 20
|
33
|
-
|
34
|
-
|
35
|
-
def data_path
|
36
|
-
if RUBY_PLATFORM =~ /win32/
|
37
|
-
if ENV['USERPROFILE']
|
38
|
-
if File.exist?(File.join(File.expand_path(ENV['USERPROFILE']), "Application Data"))
|
39
|
-
user_data_directory = File.join File.expand_path(ENV['USERPROFILE']), "Application Data", "GentleReminder"
|
40
|
-
else
|
41
|
-
user_data_directory = File.join File.expand_path(ENV['USERPROFILE']), "GentleReminder"
|
42
|
-
end
|
43
|
-
else
|
44
|
-
user_data_directory = File.join File.expand_path(Dir.getwd), "data"
|
45
|
-
end
|
46
|
-
else
|
47
|
-
user_data_directory = File.expand_path(File.join("~", ".gentlereminder"))
|
48
|
-
end
|
49
|
-
|
50
|
-
unless File.exist?(user_data_directory)
|
51
|
-
Dir.mkdir(user_data_directory)
|
52
|
-
end
|
53
|
-
|
54
|
-
return File.join(user_data_directory, "data.yaml")
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def refresh_todo
|
59
|
-
@gui_todo.replace *(
|
60
|
-
@todo.map { |item|
|
61
|
-
[ item, ' ' ] + [ link('Done') { complete_todo item } ] + [ ' ' ] +
|
62
|
-
[ link('Forget it') { forget_todo item } ] + [ "\n" ]
|
63
|
-
}.flatten
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def refresh
|
69
|
-
refresh_todo
|
70
|
-
|
71
|
-
@gui_completed.clear
|
72
|
-
|
73
|
-
@gui_completed.append do
|
74
|
-
background white
|
75
|
-
|
76
|
-
@completed.keys.sort.reverse.each { |day|
|
77
|
-
stack do
|
78
|
-
background lightgray
|
79
|
-
para strong(day.strftime('%B %d, %Y')), stroke: white
|
80
|
-
end
|
81
|
-
|
82
|
-
stack do
|
83
|
-
inscription *(
|
84
|
-
@completed[day].map { |item|
|
85
|
-
[ item ] + [ ' ' ] + [ link('Not Done') { undo_todo day, item } ] +
|
86
|
-
(@completed[day].index(item) == @completed[day].length - 1 ? [ '' ] : [ "\n" ])
|
87
|
-
}.flatten
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
}
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
def complete_todo(item)
|
97
|
-
day = Date.today
|
98
|
-
|
99
|
-
if @completed.keys.include? day
|
100
|
-
@completed[day] << item
|
101
|
-
else
|
102
|
-
@completed[day] = [ item ]
|
103
|
-
end
|
104
|
-
|
105
|
-
@todo.delete(item)
|
106
|
-
|
107
|
-
save
|
108
|
-
|
109
|
-
refresh
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
def undo_todo(day, item)
|
114
|
-
@completed[day].delete item
|
115
|
-
|
116
|
-
@completed.delete(day) if @completed[day].empty?
|
117
|
-
|
118
|
-
@todo << item unless @todo.include? item
|
119
|
-
|
120
|
-
save
|
121
|
-
|
122
|
-
refresh
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
def add_todo(item)
|
127
|
-
item = item.strip
|
128
|
-
|
129
|
-
return if item == ''
|
130
|
-
|
131
|
-
if @todo.include? item
|
132
|
-
alert('You have already added that to the list!')
|
133
|
-
return
|
134
|
-
end
|
135
|
-
|
136
|
-
@todo << item
|
137
|
-
|
138
|
-
save
|
139
|
-
|
140
|
-
refresh_todo
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
def forget_todo(item)
|
145
|
-
@todo.delete item
|
146
|
-
|
147
|
-
save
|
148
|
-
|
149
|
-
refresh_todo
|
150
|
-
end
|
151
|
-
|
152
|
-
|
153
|
-
def load
|
154
|
-
if File.exist?(data_path)
|
155
|
-
@todo, @completed = YAML::load(File.open(data_path, 'r'))
|
156
|
-
else
|
157
|
-
@todo = []
|
158
|
-
@completed = {}
|
159
|
-
end
|
160
|
-
|
161
|
-
refresh
|
162
|
-
end
|
163
|
-
|
164
|
-
|
165
|
-
def save
|
166
|
-
File.open(data_path, 'w') { |f|
|
167
|
-
f.write [ @todo, @completed ].to_yaml
|
168
|
-
}
|
169
|
-
end
|
170
|
-
|
171
|
-
|
172
|
-
load
|
173
|
-
|
174
|
-
end
|
data/samples/good-vjot.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
NOTES = [['Welcome to the vJot Clone', <<-'END']]
|
2
|
-
This sample app is a notetaker, a clone of PJ Hyett's vjot.com.
|
3
|
-
|
4
|
-
Creating
|
5
|
-
----------
|
6
|
-
Click "Add a New Note" and the jot will be loaded into the editor for reading or editing.
|
7
|
-
|
8
|
-
Editing
|
9
|
-
---------
|
10
|
-
Click a jot's title to load it.
|
11
|
-
|
12
|
-
Saving
|
13
|
-
--------
|
14
|
-
There is no save button, the jot is saved as you edit.
|
15
|
-
|
16
|
-
END
|
17
|
-
|
18
|
-
Shoes.app title: "vJot", width: 420, height: 560, resizable: false do
|
19
|
-
|
20
|
-
@note = NOTES.first
|
21
|
-
background "#C7EAFB"
|
22
|
-
stack width: 400, margin: 20 do
|
23
|
-
background "#eee", curve: 12
|
24
|
-
border "#00D0FF", strokewidth: 3, curve: 12
|
25
|
-
stack margin: 20 do
|
26
|
-
caption "vJot"
|
27
|
-
@title = edit_line @note[0], width: 1.0 do
|
28
|
-
@note[0] = @title.text
|
29
|
-
load_list
|
30
|
-
end
|
31
|
-
stack width: 1.0, height: 200, scroll: true do
|
32
|
-
@list = para
|
33
|
-
end
|
34
|
-
@jot = edit_box @note[1], width: 1.0, height: 200, margin_bottom: 20 do
|
35
|
-
@note[1] = @jot.text
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def load_list
|
41
|
-
note_list = NOTES.map do |note|
|
42
|
-
[link(note.first) { @note = load_note(note); load_list }, "\n"]
|
43
|
-
end.flatten + [link("+ Add a new Note") do
|
44
|
-
NOTES << (@note = load_note)
|
45
|
-
load_list
|
46
|
-
end]
|
47
|
-
@list.replace *note_list
|
48
|
-
end
|
49
|
-
|
50
|
-
def load_note(note = ['New Note', ''])
|
51
|
-
@note = note
|
52
|
-
@title.text = note[0]
|
53
|
-
@jot.text = note[1]
|
54
|
-
note
|
55
|
-
end
|
56
|
-
|
57
|
-
load_list
|
58
|
-
end
|