shul 0.4.12 → 0.4.13

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/shul.rb +58 -18
  5. metadata +1 -1
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bdb142002afd2afc55e1acf0c866222f75a150fb
4
- data.tar.gz: 79f20519f543751458a7c7669769ec5e45585074
3
+ metadata.gz: 6a40c442c6edffc7a8c2223ad03c3bcc1afd2d76
4
+ data.tar.gz: f7765ee0733e9b57a1e6f603ed9df0e561e86a83
5
5
  SHA512:
6
- metadata.gz: 9f7efbfeb7487fc71376a7493d69c8f9fc58f26d253d23765544f53d56ca15a29292ef12c4c04c4ba3b20f41595e845e9c57428be5c843fe5baac9276b42a748
7
- data.tar.gz: d6834ec03b903943c373fd7cdc041aacf4171914e9840e355d19d09271205dfd03997e9785505b4e23bdc0b1d1733d053a85d2f00b8ce6ac3cbbe2102089e8e2
6
+ metadata.gz: e7a17bb64dcee9ff2ae7e31270e4a8dcf925b6bc72e05a884e381f17a38be71527c90f6e47947b97eb0a3bec354680e34b47e0a07bf9f2850584b1a1b5288724
7
+ data.tar.gz: 6d317325bb4b2758e28a2c4649e8f81a61badec7ec033fa32a22f67217665cc833b3e5b5f7caeea8a0ab6092b78592496959124b697640f9c6ff6934e46975b3
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -46,6 +46,7 @@ Shul::Main.new Shoes, doc
46
46
  # changed from script
47
47
  # feature: The default icon can now be changed by adding the
48
48
  # icon attribute to the app element
49
+ # feature: Implemented the onload event
49
50
  # 12-Aug-2017: feature: A Radiogroup can now be created or deleted dynamically
50
51
  # 11-Aug-2017: feature: An element can now be removed using method *remove*.
51
52
  # 10-Aug-2017: feature: A Textbox element can now be created dynamically
@@ -74,10 +75,9 @@ Shul::Main.new Shoes, doc
74
75
  # * tested using the green_shoes gem.
75
76
 
76
77
 
77
-
78
78
  require 'domle'
79
79
  require 'tempfile'
80
-
80
+ require 'shellwords'
81
81
 
82
82
 
83
83
  DEFAULT_SHUL_CSS = <<CSS
@@ -126,15 +126,14 @@ module Shul
126
126
 
127
127
  end
128
128
 
129
-
130
-
131
-
132
129
  def obj() @obj end
133
130
  def obj=(obj) @obj = obj end
134
131
 
135
132
  def remove()
133
+
136
134
  @rexle.callback.remove_element(self) if @rexle.callback
137
- self.delete
135
+ self.delete
136
+
138
137
  end
139
138
 
140
139
  end
@@ -186,6 +185,14 @@ module Shul
186
185
 
187
186
  end
188
187
 
188
+ def radio(index)
189
+
190
+ if index <= self.elements.length then
191
+ self.elements[index]
192
+ end
193
+
194
+ end
195
+
189
196
  end
190
197
 
191
198
  class Radio < Component
@@ -204,6 +211,15 @@ module Shul
204
211
  self.obj.contents[0].checked = true
205
212
 
206
213
  end
214
+
215
+ def unchecked
216
+
217
+ # unchecking an item programatically doesn't seem to
218
+ # be possible in green_shoes
219
+
220
+ self.obj.contents[0].checked = false
221
+
222
+ end
207
223
 
208
224
  end
209
225
 
@@ -370,6 +386,16 @@ module Shul
370
386
  end
371
387
 
372
388
  doc.callback = shul
389
+
390
+ h = doc.root.attributes
391
+
392
+ if h[:onload] then
393
+ name, raw_args = h[:onload].match(/(^[a-z]\w+)(?:\(([^\)]+))?/).captures
394
+
395
+ m = shul.method(name.to_sym)
396
+ raw_args ? m.call(Shellwords::shellwords(raw_args)) : m.call
397
+
398
+ end
373
399
 
374
400
  end
375
401
 
@@ -402,11 +428,25 @@ module Shul
402
428
  end
403
429
 
404
430
  def clear()
405
- @e.elements.each {|x| x.obj.clear}
431
+
432
+
433
+ @e.elements.each do |x|
434
+
435
+ x.obj.contents.clear_all
436
+
437
+ #x.obj.clear
438
+
439
+ x.obj = nil
440
+ x.delete
441
+ x = nil
442
+ end
443
+
444
+
406
445
  end
407
446
 
408
447
  end
409
448
 
449
+
410
450
  attr_reader :width, :height
411
451
 
412
452
  def initialize(shoes, doc)
@@ -434,6 +474,7 @@ module Shul
434
474
  end
435
475
  end
436
476
 
477
+
437
478
  icon = h[:icon]
438
479
 
439
480
  if icon then
@@ -442,13 +483,13 @@ module Shul
442
483
  File.write file, RXFHelper.read(icon).first
443
484
  shoes.win.icon = file
444
485
 
445
- end
486
+ end
446
487
 
447
488
  end
448
489
 
449
490
  def add_element(node)
450
491
 
451
- node.obj = method(node.name.sub(':','_').to_sym).call(node)
492
+ node.obj = method(node.name.sub(':','_').to_sym).call(node)
452
493
  refresh()
453
494
 
454
495
  end
@@ -458,7 +499,9 @@ module Shul
458
499
  end
459
500
 
460
501
  def remove_element(node)
502
+
461
503
  node.obj.clear
504
+ node.obj = nil
462
505
  refresh()
463
506
  end
464
507
 
@@ -645,8 +688,6 @@ module Shul
645
688
  #h.merge!({fill: e.attributes[:bgcolor]}) if e.attributes[:bgcolor]
646
689
 
647
690
  e.obj = @shoes.para e.attributes[:value] || e.text.strip , h
648
-
649
-
650
691
 
651
692
  def e.value()
652
693
  self.attributes[:value]
@@ -682,7 +723,7 @@ module Shul
682
723
 
683
724
  a = e.xpath('listitem/attribute::label').map(&:to_s)
684
725
  e.obj = @shoes.list_box items: a
685
- #
726
+
686
727
  end
687
728
 
688
729
  def listitem()
@@ -699,22 +740,20 @@ module Shul
699
740
 
700
741
  e.value = e.attributes[:value].to_s
701
742
 
702
- h = e.attributes
743
+ h = e.attributes
703
744
  e.obj = @shoes.flow do
704
745
  r = @shoes.radio :radiogroup01
705
- r.click {e.parent.value = e.value unless e.value.empty?}
746
+ r.click {e.parent.value = e.value}
706
747
 
707
748
  r.checked = h[:checked] == 'true'
708
749
  @shoes.para h[:label]
709
750
  end
710
-
711
-
751
+
712
752
  end
713
753
 
714
754
  def radiogroup(e)
715
-
755
+
716
756
  e.xpath('radio').each {|node| radio node }
717
- e.obj = Radiogroup.new e
718
757
 
719
758
  h = e.attributes
720
759
 
@@ -724,6 +763,7 @@ module Shul
724
763
  end
725
764
  end
726
765
 
766
+ Radiogroup.new e
727
767
  end
728
768
 
729
769
  def quit()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.12
4
+ version: 0.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file