purple_shoes 0.0.101 → 0.0.115
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.
- data/README.md +2 -0
- data/VERSION +1 -1
- data/lib/purple_shoes.rb +1 -0
- data/lib/shoes/app.rb +33 -10
- data/lib/shoes/basic.rb +11 -1
- data/lib/shoes/help.rb +24 -4
- data/lib/shoes/helper_methods.rb +6 -0
- data/lib/shoes/main.rb +2 -0
- data/lib/shoes/ruby.rb +56 -0
- data/lib/shoes/slot.rb +13 -0
- data/snapshots/sample21.png +0 -0
- data/snapshots/sample3-osx.png +0 -0
- data/snapshots/sample44-linux.png +0 -0
- data/static/manual-en.txt +29 -37
- metadata +5 -5
data/README.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.115
|
data/lib/purple_shoes.rb
CHANGED
|
@@ -9,6 +9,7 @@ Types = module Shoes; self end
|
|
|
9
9
|
|
|
10
10
|
module Shoes
|
|
11
11
|
DIR = Pathname.new(__FILE__).realpath.dirname.to_s
|
|
12
|
+
FONTS = []
|
|
12
13
|
SHOES_VERSION = IO.read(File.join(DIR, '../VERSION')).chomp
|
|
13
14
|
BASIC_ATTRIBUTES_DEFAULT = {left: 0, top: 0, width: 0, height: 0, angle: 0, curve: 0}
|
|
14
15
|
SLOT_ATTRIBUTES_DEFAULT = {left: nil, top: nil, width: 1.0, height: 0}
|
data/lib/shoes/app.rb
CHANGED
|
@@ -19,7 +19,15 @@ class Shoes
|
|
|
19
19
|
|
|
20
20
|
def visit url
|
|
21
21
|
if url =~ /^(http|https):\/\//
|
|
22
|
-
|
|
22
|
+
require 'rbconfig'
|
|
23
|
+
Thread.new do
|
|
24
|
+
case RbConfig::CONFIG['host_os']
|
|
25
|
+
when /mswin/; system "start #{url}"
|
|
26
|
+
when /linux/; system("/etc/alternatives/x-www-browser #{url} &")
|
|
27
|
+
else
|
|
28
|
+
puts "Sorry, your platform [#{RUBY_PLATFORM}] is not supported..."
|
|
29
|
+
end
|
|
30
|
+
end
|
|
23
31
|
else
|
|
24
32
|
$urls.each{|k, v| clear{init_app_vars; @location = url; v.call self, $1} if k =~ url}
|
|
25
33
|
end
|
|
@@ -87,7 +95,7 @@ class Shoes
|
|
|
87
95
|
instance_eval do
|
|
88
96
|
define_method :paintControl do |e|
|
|
89
97
|
gc = e.gc
|
|
90
|
-
s.dps
|
|
98
|
+
Shoes.dps_reset s.dps, gc
|
|
91
99
|
tl.setText s.markup
|
|
92
100
|
s.app.set_styles s, args
|
|
93
101
|
tl.setWidth s.width if s.width > 0
|
|
@@ -125,7 +133,7 @@ class Shoes
|
|
|
125
133
|
instance_eval do
|
|
126
134
|
define_method :paintControl do |e|
|
|
127
135
|
gc = e.gc
|
|
128
|
-
s.dps
|
|
136
|
+
Shoes.dps_reset s.dps, gc
|
|
129
137
|
unless s.hided
|
|
130
138
|
Shoes.set_rotate e.gc, *s.rotate do
|
|
131
139
|
if s.initials[:width].zero? and s.initials[:height].zero?
|
|
@@ -273,7 +281,7 @@ class Shoes
|
|
|
273
281
|
define_method :paintControl do |e|
|
|
274
282
|
unless s.hided
|
|
275
283
|
gc = e.gc
|
|
276
|
-
s.dps
|
|
284
|
+
Shoes.dps_reset s.dps, gc
|
|
277
285
|
gc.setAntialias Swt::SWT::ON
|
|
278
286
|
sw, pat1, pat2 = s.strokewidth, s.stroke, s.fill
|
|
279
287
|
Shoes.set_rotate gc, *s.rotate do
|
|
@@ -324,7 +332,7 @@ class Shoes
|
|
|
324
332
|
define_method :paintControl do |e|
|
|
325
333
|
unless s.hided
|
|
326
334
|
gc = e.gc
|
|
327
|
-
s.dps
|
|
335
|
+
Shoes.dps_reset s.dps, gc
|
|
328
336
|
gc.setAntialias Swt::SWT::ON
|
|
329
337
|
sw, pat1, pat2 = s.strokewidth, s.stroke, s.fill
|
|
330
338
|
Shoes.set_rotate gc, *s.rotate do
|
|
@@ -374,7 +382,7 @@ class Shoes
|
|
|
374
382
|
define_method :paintControl do |e|
|
|
375
383
|
unless s.hided
|
|
376
384
|
gc = e.gc
|
|
377
|
-
s.dps
|
|
385
|
+
Shoes.dps_reset s.dps, gc
|
|
378
386
|
gc.setAntialias Swt::SWT::ON
|
|
379
387
|
sw, pat1, pat2 = s.strokewidth, s.stroke, s.fill
|
|
380
388
|
Shoes.set_rotate gc, *s.rotate do
|
|
@@ -442,7 +450,7 @@ class Shoes
|
|
|
442
450
|
define_method :paintControl do |e|
|
|
443
451
|
unless s.hided
|
|
444
452
|
gc = e.gc
|
|
445
|
-
s.dps
|
|
453
|
+
Shoes.dps_reset s.dps, gc
|
|
446
454
|
gc.setAntialias Swt::SWT::ON
|
|
447
455
|
sw, pat = s.strokewidth, s.stroke
|
|
448
456
|
Shoes.set_rotate gc, *s.rotate do
|
|
@@ -485,7 +493,7 @@ class Shoes
|
|
|
485
493
|
define_method :paintControl do |e|
|
|
486
494
|
unless s.hided
|
|
487
495
|
gc = e.gc
|
|
488
|
-
s.dps
|
|
496
|
+
Shoes.dps_reset s.dps, gc
|
|
489
497
|
gc.setAntialias Swt::SWT::ON
|
|
490
498
|
sw, pat1, pat2 = s.strokewidth, s.stroke, s.fill
|
|
491
499
|
outer, inner, points, left, top = s.outer, s.inner, s.points, s.left, s.top
|
|
@@ -588,7 +596,7 @@ class Shoes
|
|
|
588
596
|
define_method :paintControl do |e|
|
|
589
597
|
unless s.hided
|
|
590
598
|
gc = e.gc
|
|
591
|
-
s.dps
|
|
599
|
+
Shoes.dps_reset s.dps, gc
|
|
592
600
|
gc.setAntialias Swt::SWT::ON
|
|
593
601
|
Shoes.set_pattern s, gc, pat
|
|
594
602
|
gc.fillRoundRectangle s.left, s.top, s.width, s.height, s.curve*2, s.curve*2
|
|
@@ -619,7 +627,7 @@ class Shoes
|
|
|
619
627
|
define_method :paintControl do |e|
|
|
620
628
|
unless s.hided
|
|
621
629
|
gc = e.gc
|
|
622
|
-
s.dps
|
|
630
|
+
Shoes.dps_reset s.dps, gc
|
|
623
631
|
gc.setAntialias Swt::SWT::ON
|
|
624
632
|
Shoes.set_pattern s, gc, pat, :Foreground
|
|
625
633
|
if sw > 0
|
|
@@ -669,6 +677,10 @@ class Shoes
|
|
|
669
677
|
shell.getVerticalBar.getMaximum - 10
|
|
670
678
|
end
|
|
671
679
|
|
|
680
|
+
def close
|
|
681
|
+
@shell.close
|
|
682
|
+
end
|
|
683
|
+
|
|
672
684
|
def flush
|
|
673
685
|
unless @cs.isDisposed
|
|
674
686
|
Shoes.call_back_procs self
|
|
@@ -684,5 +696,16 @@ class Shoes
|
|
|
684
696
|
@cs.redraw unless @cs.isDisposed
|
|
685
697
|
end
|
|
686
698
|
end
|
|
699
|
+
|
|
700
|
+
[:append, :prepend].each do |m|
|
|
701
|
+
define_method m do |*args, &blk|
|
|
702
|
+
top_slot.send m, *args, &blk
|
|
703
|
+
end
|
|
704
|
+
end
|
|
705
|
+
|
|
706
|
+
def gray *attrs
|
|
707
|
+
g, a = attrs
|
|
708
|
+
g ? rgb(g*255, g*255, g*255, a) : rgb(128, 128, 128)[0..2]
|
|
709
|
+
end
|
|
687
710
|
end
|
|
688
711
|
end
|
data/lib/shoes/basic.rb
CHANGED
|
@@ -155,7 +155,17 @@ class Shoes
|
|
|
155
155
|
class Rect < ShapeBase; end
|
|
156
156
|
class Oval < ShapeBase; end
|
|
157
157
|
class Line < ShapeBase; end
|
|
158
|
-
class Star < ShapeBase
|
|
158
|
+
class Star < ShapeBase
|
|
159
|
+
def move3 x, y
|
|
160
|
+
unless @app.cs.isDisposed
|
|
161
|
+
w, h = @width + 1, @height + 1
|
|
162
|
+
hw, hh = w / 2, h / 2
|
|
163
|
+
@app.cs.redraw @left - hw, @top - hh, w, h, false
|
|
164
|
+
@app.cs.redraw x-hw, y - hh, w, h, false
|
|
165
|
+
end
|
|
166
|
+
@left, @top = x, y
|
|
167
|
+
end
|
|
168
|
+
end
|
|
159
169
|
class Shape < ShapeBase
|
|
160
170
|
def move_to x, y
|
|
161
171
|
real.moveTo x + left, y + top
|
data/lib/shoes/help.rb
CHANGED
|
@@ -120,6 +120,7 @@ class Manual < Shoes
|
|
|
120
120
|
$1.split(/^ \* /).each do |txt|
|
|
121
121
|
image File.join(DIR, '../static/purple_shoes-icon.png'), width: 20, height: 20
|
|
122
122
|
flow(width: 510){show_paragraph txt, intro, i, term}
|
|
123
|
+
para NL
|
|
123
124
|
end
|
|
124
125
|
else
|
|
125
126
|
show_paragraph text, intro, i, term
|
|
@@ -129,9 +130,7 @@ class Manual < Shoes
|
|
|
129
130
|
end
|
|
130
131
|
|
|
131
132
|
def show_paragraph txt, intro, i, term = nil
|
|
132
|
-
txt = txt.gsub("\n", ' ').gsub(
|
|
133
|
-
gsub(/\^(.+?)\^/m, '\1').gsub(/'''(.+?)'''/m){strong($1)}.gsub(/''(.+?)''/m){em($1)}.
|
|
134
|
-
gsub(/\[\[BR\]\]/i, "\n")
|
|
133
|
+
txt = txt.gsub("\n", ' ').gsub(/\^(.+?)\^/m, '\1').gsub(/\[\[BR\]\]/i, "\n")
|
|
135
134
|
txts = txt.split(/(\[\[\S+?\]\])/m).map{|s| s.split(/(\[\[\S+? .+?\]\])/m)}.flatten
|
|
136
135
|
case txts[0]
|
|
137
136
|
when /\A==== (.+) ====/; caption *marker($1, term), size: 24
|
|
@@ -141,7 +140,7 @@ class Manual < Shoes
|
|
|
141
140
|
when /\A\{COLORS\}/; flow{color_page}
|
|
142
141
|
when /\A\{SAMPLES\}/; flow{sample_page}
|
|
143
142
|
else
|
|
144
|
-
para *mk_links(txts, term).flatten, NL, (intro and i.zero?) ? {size: 16} : ''
|
|
143
|
+
para *mk_deco(mk_links(txts, term).flatten), NL, (intro and i.zero?) ? {size: 16} : ''
|
|
145
144
|
txt.gsub IMAGE_RE do
|
|
146
145
|
para NL
|
|
147
146
|
image File.join(DIR, "../static/#{$3}"), eval("{#{$2 or "margin_left: 50"}}")
|
|
@@ -457,6 +456,27 @@ class Manual < Shoes
|
|
|
457
456
|
[txt]
|
|
458
457
|
end
|
|
459
458
|
end
|
|
459
|
+
|
|
460
|
+
def mk_deco datas
|
|
461
|
+
datas = decoration(datas, /`(.+?)`/m){|s| fg code(s), rgb(255, 30, 0)}
|
|
462
|
+
datas = decoration(datas, /'''(.+?)'''/m){|s| strong s}
|
|
463
|
+
decoration(datas, /''(.+?)''/m){|s| em s}
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
def decoration datas, re, &blk
|
|
467
|
+
datas.map do |data|
|
|
468
|
+
if data.is_a? String
|
|
469
|
+
txts = [data]
|
|
470
|
+
data.match re do |md|
|
|
471
|
+
n = data.index md[0]
|
|
472
|
+
txts = [data[0...n], blk[md[1]], decoration([data[n+md[0].length..-1]], re, &blk)]
|
|
473
|
+
end
|
|
474
|
+
txts
|
|
475
|
+
else
|
|
476
|
+
data
|
|
477
|
+
end
|
|
478
|
+
end.flatten
|
|
479
|
+
end
|
|
460
480
|
|
|
461
481
|
IMAGE_RE = /\!(\{([^}\n]+)\})?([^!\n]+\.\w+)\!/
|
|
462
482
|
CODE_RE = /\{{3}(?:\s*\#![^\n]+)?(.+?)\}{3}/m
|
data/lib/shoes/helper_methods.rb
CHANGED
data/lib/shoes/main.rb
CHANGED
|
@@ -14,6 +14,7 @@ class Shoes
|
|
|
14
14
|
args[:top] ||= 0
|
|
15
15
|
|
|
16
16
|
@display ||= Swt::Display.new
|
|
17
|
+
(@display.getFontList(nil, true).each{|f| FONTS << f.getName}; FONTS.uniq!) if FONTS.empty?
|
|
17
18
|
shell = Swt::Shell.new @display, Swt::SWT::SHELL_TRIM | Swt::SWT::V_SCROLL
|
|
18
19
|
shell.setSize args[:width] + 16, args[:height] + 38
|
|
19
20
|
shell.setText args[:title]
|
|
@@ -51,6 +52,7 @@ class Shoes
|
|
|
51
52
|
shell.addControlListener cl
|
|
52
53
|
|
|
53
54
|
vb = shell.getVerticalBar
|
|
55
|
+
vb.setIncrement 10
|
|
54
56
|
vb.setVisible false
|
|
55
57
|
ln = Swt::SelectionListener.new
|
|
56
58
|
class << ln; self end.
|
data/lib/shoes/ruby.rb
CHANGED
|
@@ -15,6 +15,13 @@ class Object
|
|
|
15
15
|
mb.open
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def confirm msg
|
|
19
|
+
shell = Swt::Shell.new Shoes.display
|
|
20
|
+
mb = Swt::MessageBox.new shell, Swt::SWT::YES | Swt::SWT::NO | Swt::SWT::ICON_QUESTION
|
|
21
|
+
mb.setMessage msg.to_s
|
|
22
|
+
mb.open == Swt::SWT::YES ? true : false
|
|
23
|
+
end
|
|
24
|
+
|
|
18
25
|
def ask_open_file
|
|
19
26
|
dialog_chooser 'Open File...'
|
|
20
27
|
end
|
|
@@ -37,6 +44,18 @@ class Object
|
|
|
37
44
|
fd.setText title
|
|
38
45
|
fd.open
|
|
39
46
|
end
|
|
47
|
+
|
|
48
|
+
def ask_color title = 'Pick a color...'
|
|
49
|
+
shell = Swt::Shell.new Shoes.display
|
|
50
|
+
cd = Swt::ColorDialog.new shell
|
|
51
|
+
cd.setText title
|
|
52
|
+
color = cd.open
|
|
53
|
+
color ? [color.red, color.green, color.blue] : [255, 255, 255]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def ask msg, args={}
|
|
57
|
+
AskDialog.new(Swt::Shell.new, msg, args).open
|
|
58
|
+
end
|
|
40
59
|
end
|
|
41
60
|
|
|
42
61
|
class Array
|
|
@@ -59,3 +78,40 @@ class Array
|
|
|
59
78
|
r + g + b > 0xAA * 3
|
|
60
79
|
end
|
|
61
80
|
end
|
|
81
|
+
|
|
82
|
+
class AskDialog < Swt::Dialog
|
|
83
|
+
def initialize shell, msg, args
|
|
84
|
+
@shell, @msg, @args= shell, msg, args
|
|
85
|
+
super shell
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def open
|
|
89
|
+
display = getParent.getDisplay
|
|
90
|
+
icon = Swt::Image.new display, File.join(DIR, '../static/purple_shoes-icon.png')
|
|
91
|
+
@shell.setImage icon
|
|
92
|
+
@shell.setSize 300, 125
|
|
93
|
+
@shell.setText 'Purple Shoes asks:'
|
|
94
|
+
label = Swt::Label.new @shell, Swt::SWT::NONE
|
|
95
|
+
label.setText @msg
|
|
96
|
+
label.setLocation 10, 10
|
|
97
|
+
label.pack
|
|
98
|
+
text = Swt::Text.new @shell, Swt::SWT::BORDER | Swt::SWT::SINGLE
|
|
99
|
+
text.setLocation 10, 30
|
|
100
|
+
text.setSize 270, 20
|
|
101
|
+
b = Swt::Button.new @shell, Swt::SWT::NULL
|
|
102
|
+
b.setText 'OK'
|
|
103
|
+
b.setLocation 180, 55
|
|
104
|
+
b.pack
|
|
105
|
+
b.addSelectionListener{|e| @ret = text.getText; @shell.close}
|
|
106
|
+
b = Swt::Button.new @shell, Swt::SWT::NULL
|
|
107
|
+
b.setText 'CANCEL'
|
|
108
|
+
b.setLocation 222, 55
|
|
109
|
+
b.pack
|
|
110
|
+
b.addSelectionListener{|e| @ret = nil; @shell.close}
|
|
111
|
+
@shell.open
|
|
112
|
+
while !@shell.isDisposed do
|
|
113
|
+
display.sleep unless display.readAndDispatch
|
|
114
|
+
end
|
|
115
|
+
@ret
|
|
116
|
+
end
|
|
117
|
+
end
|
data/lib/shoes/slot.rb
CHANGED
|
@@ -77,6 +77,19 @@ class Shoes
|
|
|
77
77
|
end
|
|
78
78
|
@app.flush
|
|
79
79
|
end
|
|
80
|
+
|
|
81
|
+
def append &blk
|
|
82
|
+
prepend contents.length, &blk
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def prepend n = 0
|
|
86
|
+
self.contents, tmp = contents[0...n], contents[n..-1]
|
|
87
|
+
cslot, @app.cslot = @app.cslot, self
|
|
88
|
+
yield
|
|
89
|
+
self.contents += tmp
|
|
90
|
+
@app.cslot = cslot
|
|
91
|
+
Shoes.call_back_procs @app
|
|
92
|
+
end
|
|
80
93
|
|
|
81
94
|
def show
|
|
82
95
|
@hided = true
|
data/snapshots/sample21.png
CHANGED
|
Binary file
|
data/snapshots/sample3-osx.png
CHANGED
|
Binary file
|
|
Binary file
|
data/static/manual-en.txt
CHANGED
|
@@ -38,7 +38,7 @@ just check out some screenshots, to give you an idea of what you can do.
|
|
|
38
38
|
|
|
39
39
|
==== Mac OS X ====
|
|
40
40
|
|
|
41
|
-
Purple Shoes is confirmed on Apple Mac
|
|
41
|
+
Purple Shoes is confirmed on Apple Mac OS X.
|
|
42
42
|
!{margin_left: 100}../snapshots/sample3-osx.png!
|
|
43
43
|
|
|
44
44
|
This is the `sample3.rb` on Mac OS X.
|
|
@@ -48,19 +48,16 @@ All circles are drawn randomly. You can draw and animate shapes in Purple Shoes.
|
|
|
48
48
|
==== Windows ====
|
|
49
49
|
|
|
50
50
|
Purple Shoes is confirmed to run on '''Microsoft Windows XP''' and '''Windows 7'''.
|
|
51
|
-
!{margin_left:
|
|
51
|
+
!{margin_left: 100}../snapshots/sample21.png!
|
|
52
52
|
|
|
53
|
-
Above is pictured the `
|
|
54
|
-
has three extended libraries for chipmunk physics, bloopsaphone and 3D texture
|
|
55
|
-
mapping. First two are binary libraries, so far work on Windows only.
|
|
53
|
+
Above is pictured the `sample21.rb` running on Windows 7.
|
|
56
54
|
|
|
57
55
|
==== Linux ====
|
|
58
56
|
|
|
59
|
-
Here's a screenshot of the `sample44.rb` running on '''Ubuntu
|
|
60
|
-
on VirtualBox for Windows'''. !{margin_left: 130}../snapshots/sample44-linux.png!
|
|
57
|
+
Here's a screenshot of the `sample44.rb` running on '''Ubuntu'''. !{margin_left: 130}../snapshots/sample44-linux.png!
|
|
61
58
|
|
|
62
59
|
This example is also draws ovals and lines to build the clock, which is animated to
|
|
63
|
-
|
|
60
|
+
rotate clock hands several times each second.
|
|
64
61
|
|
|
65
62
|
Notice the text on the top of the app, showing the current time. Purple Shoes has the
|
|
66
63
|
skills to layout words using any color, bold, italics, underlines, and supports
|
|
@@ -71,22 +68,22 @@ loading fonts.
|
|
|
71
68
|
Okay, on to installing Purple Shoes. I'm sure you're wondering: do I need to install
|
|
72
69
|
Ruby? Do I need to unzip anything? What commands do I need to type?
|
|
73
70
|
|
|
74
|
-
Yeah. You need to install
|
|
71
|
+
Yeah. You need to install JRuby and Gems. But, no need to worry about it.
|
|
75
72
|
We'll talk through all the steps.
|
|
76
73
|
|
|
77
74
|
==== Step 1: Installing Purple Shoes ====
|
|
78
75
|
|
|
79
|
-
At first, install
|
|
80
|
-
visit the site of [[http://
|
|
81
|
-
download the latest '''
|
|
76
|
+
At first, install JRuby. On '''Windows''',
|
|
77
|
+
visit the site of [[http://jruby.org/download JRuby Downloads]] to
|
|
78
|
+
download the latest '''JRuby 1.6.7 Windows Executable'''.
|
|
82
79
|
|
|
83
80
|
Then just do the following one line.
|
|
84
81
|
|
|
85
|
-
* gem install
|
|
82
|
+
* jruby --1.9 -S gem install purple_shoes
|
|
86
83
|
|
|
87
84
|
That's all. Too easy?
|
|
88
85
|
|
|
89
|
-
'''Note:'''
|
|
86
|
+
'''Note:''' purple_shoes gem is on [[http://rubygems.org/gems/purple_shoes RubyGems.org]].
|
|
90
87
|
If you get some errors of rdoc, try to add `--no-ri --no-rdoc` option.
|
|
91
88
|
|
|
92
89
|
==== Step 2: Start a New Text File ====
|
|
@@ -102,7 +99,7 @@ Here are a few ways to create a blank text file:
|
|
|
102
99
|
Now, in your blank window, type in the following:
|
|
103
100
|
|
|
104
101
|
{{{
|
|
105
|
-
require '
|
|
102
|
+
require 'purple_shoes'
|
|
106
103
|
Shoes.app do
|
|
107
104
|
para "Welcome to Shoes"
|
|
108
105
|
end
|
|
@@ -114,7 +111,7 @@ Save to your desktop as `welcome.rb`.
|
|
|
114
111
|
|
|
115
112
|
To run your program, just open console window and run the following.
|
|
116
113
|
|
|
117
|
-
*
|
|
114
|
+
* jruby --1.9 welcome.rb !man-editor-osx.png!
|
|
118
115
|
|
|
119
116
|
So, not much of a program yet. But it's something! You've got the knack of it, at least!
|
|
120
117
|
|
|
@@ -129,10 +126,9 @@ Still, Shoes does have a few widgets like buttons and edit boxes. And many
|
|
|
129
126
|
missing elements (like tabbed controls or toolbars) can be simulated with
|
|
130
127
|
images.
|
|
131
128
|
|
|
132
|
-
Shoes is written in part thanks to a very good
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
NodeBox and Processing, two very good languages for drawing animated graphics.
|
|
129
|
+
Shoes is written in part thanks to a very good graphical widget toolkit called '''SWT'''.
|
|
130
|
+
In this way, Shoes is inspired by NodeBox and Processing, two very good languages
|
|
131
|
+
for drawing animated graphics.
|
|
136
132
|
|
|
137
133
|
== The Rules of Purple Shoes ==
|
|
138
134
|
|
|
@@ -186,7 +182,7 @@ block changes `self`.
|
|
|
186
182
|
|
|
187
183
|
The other block is the `stack` block. That block does NOT change self.
|
|
188
184
|
|
|
189
|
-
'''For what reason does the `app` block change self?''' Let's start by
|
|
185
|
+
'''For what reason does the''' `app` '''block change self?''' Let's start by
|
|
190
186
|
spelling out that last example completely.
|
|
191
187
|
|
|
192
188
|
{{{
|
|
@@ -217,7 +213,7 @@ All of the `self`s in the above example are the App object. Purple Shoes uses R
|
|
|
217
213
|
|
|
218
214
|
These instance variables will all end up inside the App object.
|
|
219
215
|
|
|
220
|
-
'''Whenever you create a new Shoes.app window, `self` is also changed.'''
|
|
216
|
+
'''Whenever you create a new Shoes.app window,''' `self` '''is also changed.'''
|
|
221
217
|
|
|
222
218
|
{{{
|
|
223
219
|
Shoes.app title: "MAIN" do
|
|
@@ -311,7 +307,7 @@ As you can imagine, the `app` object changes `self` to the App object.
|
|
|
311
307
|
|
|
312
308
|
So the rules here are:
|
|
313
309
|
|
|
314
|
-
1. '''Methods named "app" or which create new windows alter `self` to the App
|
|
310
|
+
1. '''Methods named "app" or which create new windows alter''' `self` '''to the App
|
|
315
311
|
object.'''[[BR]](This is true for both Shoes.app and Slot.app, as well as
|
|
316
312
|
[[Element.window]] and [[Element.dialog]].)[[BR]]
|
|
317
313
|
2. '''Blocks attached to stacks, flows or any manipulation method (such as
|
|
@@ -352,6 +348,7 @@ One difference between normal slots and nested window slots is that the latter
|
|
|
352
348
|
can have scrollbars.
|
|
353
349
|
|
|
354
350
|
{{{
|
|
351
|
+
# Not yet available
|
|
355
352
|
Shoes.app do
|
|
356
353
|
stack width: 200, height: 200, scroll: true do
|
|
357
354
|
background "#DFA"
|
|
@@ -367,8 +364,8 @@ These nested windows require more memory. They tax the application a bit more.
|
|
|
367
364
|
So if you're experiencing some slowness with hundreds of fixed-height slots,
|
|
368
365
|
try a different approach.
|
|
369
366
|
|
|
370
|
-
'''Note:''' Fixed height magic (the slot becomes a nested window) is implemented
|
|
371
|
-
in Purple Shoes
|
|
367
|
+
'''Note:''' Fixed height magic (the slot becomes a nested window) is not implemented
|
|
368
|
+
in Purple Shoes.
|
|
372
369
|
|
|
373
370
|
{{{
|
|
374
371
|
Shoes.app do
|
|
@@ -628,19 +625,20 @@ are trying to sniff out what release of Purple Shoes is running.
|
|
|
628
625
|
|
|
629
626
|
'''FONTS''' is a complete list of fonts available to the app.
|
|
630
627
|
|
|
631
|
-
'''
|
|
628
|
+
'''SHOES_VERSION''' is a Purple Shoes version.
|
|
632
629
|
|
|
633
630
|
{{{
|
|
634
631
|
Shoes.app do
|
|
635
|
-
para
|
|
632
|
+
para SHOES_VERSION
|
|
636
633
|
para fg(DIR, red)
|
|
637
|
-
image File.join(DIR,
|
|
634
|
+
image File.join(DIR,
|
|
635
|
+
'../static/purple_shoes-icon.png')
|
|
638
636
|
para fg(FONTS.join(', '), green)
|
|
639
637
|
para COLORS.map{|k, v| [k, v]}
|
|
640
638
|
end
|
|
641
639
|
}}}
|
|
642
640
|
|
|
643
|
-
=== alert(message: a string
|
|
641
|
+
=== alert(message: a string) » nil ===
|
|
644
642
|
|
|
645
643
|
Pops up a window containing a short message.
|
|
646
644
|
|
|
@@ -653,9 +651,6 @@ Please use alerts sparingly, as they are incredibly annoying! If you are using
|
|
|
653
651
|
alerts to show messages to help you debug your program, try checking out the
|
|
654
652
|
standard Ruby method `puts` or `p` methods.
|
|
655
653
|
|
|
656
|
-
If you want to make alert() thread safe, i.e. unblock main thread, use `:block => false` option.
|
|
657
|
-
If you want to change window title, use `:title => a string` option.
|
|
658
|
-
|
|
659
654
|
=== ask(message: a string) » a string ===
|
|
660
655
|
|
|
661
656
|
Pops up a window and asks a question. For example, you may want to ask someone
|
|
@@ -757,9 +752,6 @@ you'll get back a `true`. If not, you'll get back `false`.
|
|
|
757
752
|
|
|
758
753
|
Stops your program. Call this anytime you want to suddenly call it quits.
|
|
759
754
|
|
|
760
|
-
'''PLEASE NOTE:''' If you need to use Ruby's own `exit` method (like in a
|
|
761
|
-
forked Ruby process,) call `Kernel.exit`.
|
|
762
|
-
|
|
763
755
|
=== font(message: a string) » an array of font family names ===
|
|
764
756
|
|
|
765
757
|
Loads a TrueType (or other type of font) from a file. While TrueType is
|
|
@@ -841,7 +833,7 @@ When passing in a whole number, use values from 0 to 255.
|
|
|
841
833
|
blueviolet = rgb(138, 43, 226, 0.5)
|
|
842
834
|
darkgreen = rgb(0, 100, 0, 0.5)
|
|
843
835
|
oval 100, 100, 100,
|
|
844
|
-
fill: [blueviolet, darkgreen].sample
|
|
836
|
+
fill: [blueviolet, darkgreen].sample
|
|
845
837
|
end
|
|
846
838
|
}}}
|
|
847
839
|
|
|
@@ -852,7 +844,7 @@ Or, use a decimal number from 0.0 to 1.0.
|
|
|
852
844
|
blueviolet = rgb(0.54, 0.17, 0.89)
|
|
853
845
|
darkgreen = rgb(0, 0.4, 0)
|
|
854
846
|
oval 100, 100, 100,
|
|
855
|
-
fill: [blueviolet, darkgreen].sample
|
|
847
|
+
fill: [blueviolet, darkgreen].sample
|
|
856
848
|
end
|
|
857
849
|
}}}
|
|
858
850
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: purple_shoes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.115
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-04-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: swt
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &18076020 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,8 +21,8 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
25
|
-
description: Purple Shoes is one of colorful Shoes, written in JRuby
|
|
24
|
+
version_requirements: *18076020
|
|
25
|
+
description: Purple Shoes is one of colorful Shoes, written in JRuby and SWT.
|
|
26
26
|
email: ashbbb@gmail.com
|
|
27
27
|
executables:
|
|
28
28
|
- pshoes
|