green_shoes 0.263.0 → 1.0.273

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -57,6 +57,17 @@ Bugs & Requests
57
57
 
58
58
  See [Issues](http://github.com/ashbb/green_shoes/issues) for any bugs or feature requests.
59
59
 
60
+ Note on Patches/Pull Requests
61
+ ------------------------------
62
+
63
+ * (create your github account)
64
+ * Fork the project green_shoes to your github account
65
+ * Clone the fork to your home machine : git clone http://youraccount@github.com/youraccount/green_shoes
66
+ * Make your features additions or bug fix ( additions to lib/plugins or lib/ext, bug fix directly in sources)
67
+ * Add a sampleXX.rb in sample dir (if feature addition) for a demo of your feature(s)
68
+ * Commit your fork : git commit -a -m "..." ; git push origin master
69
+ * Send me a pull request : on GitHub on your green_shoe fork, click 'pull request' on the head of the page
70
+
60
71
 
61
72
  License
62
73
  =========
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.263.0
1
+ 1.0.273
data/lib/shoes/app.rb CHANGED
@@ -190,7 +190,7 @@ class Shoes
190
190
  @canvas.put img, args[:left], args[:top]
191
191
  img.show_now
192
192
  @canvas.remove img if args[:hidden]
193
- args[:real], args[:app] = img, self
193
+ args[:real], args[:app], args[:path] = img, self, name
194
194
  Image.new(args).tap do |s|
195
195
  @dics.push([s, d, tmpname]) if downloading
196
196
  s.click &click_proc if click_proc
@@ -232,6 +232,7 @@ class Shoes
232
232
  def radio *attrs
233
233
  args = attrs.last.class == Hash ? attrs.pop : {}
234
234
  group = attrs.first unless attrs.empty?
235
+ group = args[:group] if args[:group]
235
236
  group = group ? (@radio_groups[group] ||= Gtk::RadioButton.new) : cslot.radio_group
236
237
  args = basic_attributes args
237
238
  (click_proc = args[:click]; args.delete :click) if args[:click]
data/lib/shoes/basic.rb CHANGED
@@ -10,7 +10,11 @@ class Shoes
10
10
  (@app.order << self) unless @noorder or self.is_a?(EditBox) or self.is_a?(EditLine)
11
11
  (@app.cslot.contents << self) unless @nocontrol or @app.cmask
12
12
  (@app.cmask.contents << self) if @app.cmask
13
- (@app.focusables << self) if self.is_a? Native
13
+ if self.is_a? Native
14
+ @app.focusables << self
15
+ self.state = args[:state] if args[:state]
16
+ args.delete :state
17
+ end
14
18
  @parent = @app.cslot
15
19
 
16
20
  Basic.class_eval do
@@ -88,8 +92,10 @@ class Shoes
88
92
  @app.cslot.contents.delete self
89
93
  remove
90
94
  @real = nil
95
+ when TextBlock
96
+ @real.clear if @real
91
97
  else
92
- @real.clear if @real
98
+ (@real.clear; @real.destroy) if @real
93
99
  end
94
100
  end
95
101
 
@@ -134,7 +140,23 @@ class Shoes
134
140
  end
135
141
  end
136
142
 
137
- class Image < Basic; end
143
+ class Image < Basic
144
+ def initialize args
145
+ @path = args[:path]
146
+ args.delete :path
147
+ super args
148
+ end
149
+
150
+ attr_reader :path
151
+
152
+ def path=(name)
153
+ @path = name
154
+ @real.clear
155
+ args = {width: @width, height: @height}
156
+ args.merge!({hidden: true}) if @hided
157
+ @real = @app.image(name, args).move(@left, @top).real
158
+ end
159
+ end
138
160
 
139
161
  class Pattern < Basic
140
162
  def move2 x, y
@@ -252,6 +274,33 @@ class Shoes
252
274
  def focus
253
275
  @app.focus_ele = self
254
276
  end
277
+
278
+ attr_reader :state
279
+
280
+ def state=(ctl)
281
+ real = self.is_a?(EditBox) ? @textview : @real
282
+ case ctl
283
+ when "disabled"
284
+ real.sensitive = false
285
+ when 'readonly'
286
+ case self
287
+ when EditLine, EditBox
288
+ real.sensitive, real.editable = true, false
289
+ real.modify_base Gtk::STATE_NORMAL, Gdk::Color.new(56540, 56540, 54227)
290
+ else
291
+ end
292
+ when nil
293
+ real.sensitive = true
294
+ case self
295
+ when EditLine, EditBox
296
+ real.editable = true
297
+ real.modify_base Gtk::STATE_NORMAL, Gdk::Color.new(65535, 65535, 65535)
298
+ else
299
+ end
300
+ else
301
+ end
302
+ @state = ctl
303
+ end
255
304
  end
256
305
  class Button < Native
257
306
  def click &blk
@@ -342,6 +391,6 @@ class Shoes
342
391
  real.fraction = n
343
392
  end
344
393
 
345
- undef_method :focus
394
+ undef_method :focus, :state, :state=
346
395
  end
347
396
  end
@@ -184,7 +184,7 @@ class Shoes
184
184
  tmp = app.order
185
185
  (app.fronts + app.backs).each{|e| tmp.delete e}
186
186
  (app.backs + tmp + app.fronts).each do |e|
187
- if e.real and !e.is_a?(Pattern) and !e.hided
187
+ if e.real and !e.is_a?(Pattern) and !e.hided and !e.real.destroyed?
188
188
  app.canvas.remove e.real
189
189
  app.canvas.put e.real, e.left, e.top
190
190
  end
@@ -0,0 +1,27 @@
1
+ # Almost same snippet as
2
+ # http://shoes-tutorial-note.heroku.com/html/00526_The__state_style.html
3
+ require '../lib/green_shoes'
4
+
5
+ Shoes.app width: 570, height: 600 do
6
+ src = IO.read File.join(DIR, '../samples/sample55.rb')
7
+ background deepskyblue
8
+
9
+ stack do
10
+ caption strong ":state >> string"
11
+ para '# sample55.rb'
12
+ end
13
+
14
+ eb = edit_box text: src, width: width, height: height*0.85, state: 'readonly'
15
+
16
+ button('edit'){eb.state = eb.state ? nil : 'readonly'}
17
+
18
+ b1 = button 'save', state: 'disabled' do
19
+ file = ask_save_file
20
+ open(file, 'wb'){|f| f.puts eb.text} if file
21
+ end
22
+
23
+ b2 = button 'password' do
24
+ pw = ask 'Enter your password: ', secret: true
25
+ (b1.state = nil; b2.state = 'disabled') if pw == 'Ruby&Shoes'
26
+ end
27
+ end
Binary file
data/static/manual-en.txt CHANGED
@@ -1324,8 +1324,6 @@ at a time.
1324
1324
  By giving this style a string, the radio button will be grouped with other
1325
1325
  radio buttons that have the same group name.
1326
1326
 
1327
- '''Note:''' Green Shoes doesn't support ''radio''.
1328
-
1329
1327
  === :height » a number ===
1330
1328
 
1331
1329
  For: ''all slots and elements''.
@@ -1545,8 +1543,6 @@ Here are the possible style settings:
1545
1543
  * "readonly" - the control is active but cannot be edited.
1546
1544
  * "disabled" - the control is not active (grayed out) and cannot be edited.
1547
1545
 
1548
- '''Note:''' Green Shoes doesn't support `:state` style.
1549
-
1550
1546
  === :stretch » a string ===
1551
1547
 
1552
1548
  For: ''banner, caption, code, del, em, ins, inscription, link, para, span,
@@ -3391,14 +3387,10 @@ explanation of why you might use this method rather than [[Common.width]].
3391
3387
 
3392
3388
  The URL or file name of the image.
3393
3389
 
3394
- '''Note:''' Green Shoes doesn't support `path` method.
3395
-
3396
3390
  === path = a string ===
3397
3391
 
3398
3392
  Swaps the image with a different one, loaded from a file or URL.
3399
3393
 
3400
- '''Note:''' Green Shoes doesn't support `path=` method.
3401
-
3402
3394
  == ListBox ==
3403
3395
 
3404
3396
  List boxes (also called "combo boxes" or "drop-down boxes" or "select boxes" in
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_shoes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.263.0
4
+ version: 1.0.273
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: 2011-08-02 00:00:00.000000000Z
12
+ date: 2011-08-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk2
16
- requirement: &15873072 !ruby/object:Gem::Requirement
16
+ requirement: &16045188 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15873072
24
+ version_requirements: *16045188
25
25
  description: Green Shoes is one of colorful Shoes, written in pure Ruby with Ruby/GTK2.
26
26
  email: ashbbb@gmail.com
27
27
  executables: []
@@ -199,6 +199,7 @@ files:
199
199
  - samples/sample52.rb
200
200
  - samples/sample53.rb
201
201
  - samples/sample54.rb
202
+ - samples/sample55.rb
202
203
  - samples/sample6.rb
203
204
  - samples/sample7.rb
204
205
  - samples/sample8.rb
@@ -261,6 +262,7 @@ files:
261
262
  - snapshots/sample52.png
262
263
  - snapshots/sample53.png
263
264
  - snapshots/sample54.png
265
+ - snapshots/sample55.png
264
266
  - snapshots/sample6.png
265
267
  - snapshots/sample7.png
266
268
  - snapshots/sample8.png