atome 0.5.6.8.3 → 0.5.6.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56128962742a3c148f7ce1187577af8438466642a81d1b227e0c3ab66275e322
4
- data.tar.gz: aada78b1931101f52fe14e414e0396e9e15eb03754005d0836b1198f1b0091ac
3
+ metadata.gz: bc11996c8508fa65ea2a2401926454c5486140404ef425fdd7b74225358a8e75
4
+ data.tar.gz: ac2a247d50790d1ea6d72acdbb180d8108db50b2338a367494f9b085c5a9c4f8
5
5
  SHA512:
6
- metadata.gz: 817bee9de2868ed5983838b98a6b650423f04dbf4d5f35ceb20c2315b6ae54c991465e31c2e10ee74f8300d963e4106e53d036f1ecbd2ef10d668783e3194cc9
7
- data.tar.gz: 6f075107a7e5b85f33ae0d0e757025a0702447365d7ffdb048b65a4f89138ac3d8e95acfb53b795b9a9743b2229692bae3edf32f17597a5bdc5e578dc26cede5
6
+ metadata.gz: 5fce46bde01f078febc6818ec8b294763c957531715c2c22100e32a8f23fcd5e524d03d9e4e05d6ecd239c0c70c14b65275f7753a4d5e86d8a4f8ab37e56efd0
7
+ data.tar.gz: b1d15a32434a85c3966316767d0bcd098d71f919878ce2d84f86af8370efe09192cd55a259ab88393f386412645fb211ac1d1d8267f7f73b8a61176709fa2695
data/lib/atome/atome.rb CHANGED
@@ -38,6 +38,7 @@ class Atome
38
38
  # @language = :english
39
39
  # @callback = {}
40
40
  @tag = {}
41
+ @tick={}
41
42
  @behavior = {}
42
43
  @selected = false
43
44
  #@metrics = {}
@@ -245,3 +245,10 @@ new({particle: :executor, category: :utility, type: :hash}) do |params|
245
245
  end
246
246
  params
247
247
  end
248
+
249
+
250
+ new({ particle: :tick, store: false }) do |val|
251
+ @tick[val] ||= 0
252
+ @tick[val]= @tick[val] += 1
253
+ @tick[val]
254
+ end
@@ -32,13 +32,13 @@ class Universe
32
32
  @messages
33
33
  end
34
34
 
35
- def eVe(val = nil)
36
- if val
37
- @eve = val
38
- else
39
- @eve
40
- end
41
- end
35
+ # def eVe(val = nil)
36
+ # if val
37
+ # @eve = val
38
+ # else
39
+ # @eve
40
+ # end
41
+ # end
42
42
 
43
43
  def store_messages(new_msg)
44
44
  @messages[new_msg[:msg_nb]] = new_msg[:proc]
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.6.8.3'
5
+ VERSION = '0.5.6.8.5'
6
6
  end
@@ -3,6 +3,8 @@
3
3
  new(molecule: :input) do |params, bloc|
4
4
  params[:height] ||= 15
5
5
  params[:width] ||= 222
6
+ new_id = params.delete(:id) || identity_generator
7
+
6
8
  trigger = params.delete(:trigger)
7
9
  trigger ||= :return
8
10
  limit = params.delete(:limit)
@@ -21,7 +23,7 @@ new(molecule: :input) do |params, bloc|
21
23
  attach_to = params[:attach] || default_parent
22
24
  renderer_found = grab(attach_to).renderers
23
25
  input_back = Atome.new(
24
- { renderers: renderer_found, type: :shape, color: back_col,
26
+ { renderers: renderer_found,id: new_id, type: :shape, color: back_col,
25
27
  left: 0, top: 0, data: '', attach: attach_to,
26
28
  smooth: 6, overflow: :hidden,
27
29
  })
@@ -34,9 +36,17 @@ new(molecule: :input) do |params, bloc|
34
36
  )
35
37
 
36
38
  text_input.touch(:down) do
39
+ tick(:input)
37
40
  text_input.edit(true)
38
41
  end
39
42
 
43
+ input_back.touch(:up) do
44
+ if tick[:input] == 1
45
+ text_input.component({ selected: true })
46
+ end
47
+ end
48
+
49
+
40
50
  text_input.keyboard(:down) do |native_event|
41
51
  # text_input.component({ selected: { color: :red, text: :red } })
42
52
 
@@ -75,6 +85,7 @@ new(molecule: :list) do |params, _bloc|
75
85
  styles_found = params.delete(:styles)
76
86
  element = params.delete(:element)
77
87
  listing = params.delete(:listing)
88
+ new_id = params.delete(:id) || identity_generator
78
89
 
79
90
  styles_found ||= {
80
91
  width: 99,
@@ -107,7 +118,7 @@ new(molecule: :list) do |params, _bloc|
107
118
  end
108
119
  attach_to = params[:attach] || default_parent
109
120
  renderer_found = grab(attach_to).renderers
110
- list = Atome.new({ renderers: renderer_found, type: :shape, color: { alpha: 0 }, attach: attach_to }.merge(params))
121
+ list = Atome.new({ renderers: renderer_found,id: new_id, type: :shape, color: { alpha: 0 }, attach: attach_to }.merge(params))
111
122
  # Atome.new(
112
123
  # { renderers: [:html], type: :shape, attach: :view, color: back_col,
113
124
  # left: 0, top: 0, data: '', attach: attach_to,
@@ -133,8 +144,10 @@ new({ molecule: :slider }) do |params, bloc|
133
144
  min_value = params.delete(:min) || 0
134
145
  max_value = params.delete(:max) || 100
135
146
  color_found = params[:color] ||= :gray
147
+ new_id = params.delete(:id) || identity_generator
148
+
136
149
  default_smooth = 9
137
- default_slider_particles = { color: color_found, width: 333, height: 33, left: 0, top: 0, smooth: default_smooth }
150
+ default_slider_particles = {id: new_id, color: color_found, width: 333, height: 33, left: 0, top: 0, smooth: default_smooth }
138
151
  default_cursor_particles = { color: color_found, width: 29, height: 29, left: 0, smooth: '100%' }
139
152
  cursor_found = params.delete(:cursor)
140
153
  slider_particle = default_slider_particles.merge(params)
@@ -266,4 +279,43 @@ new({ molecule: :slider }) do |params, bloc|
266
279
  slider
267
280
 
268
281
  end
269
- new({ particle: :behavior })
282
+ new(molecule: :button) do |params, bloc|
283
+ params[:height] ||= 25
284
+ params[:width] ||= 25
285
+ states=params.delete(:states) || 1
286
+ new_id = params.delete(:id) || identity_generator
287
+
288
+
289
+ back_col = params.delete(:back)
290
+ back_col ||= :grey
291
+
292
+ default_parent = if self.instance_of?(Atome)
293
+ id
294
+ else
295
+ :view
296
+ end
297
+ attach_to = params[:attach] || default_parent
298
+ renderer_found = grab(attach_to).renderers
299
+ button = box(
300
+ { renderers: renderer_found,id: new_id, type: :shape, color: back_col,
301
+ left: 0, top: 0, data: '', attach: attach_to,
302
+ smooth: 3, overflow: :hidden,
303
+ })
304
+
305
+
306
+
307
+ button.touch(:down) do
308
+ tick(:button)
309
+ bloc.call(tick[:button]%states)
310
+ end
311
+
312
+
313
+
314
+ params.each do |part_f, val_f|
315
+ button.send(part_f, val_f)
316
+ end
317
+ button.left(55)
318
+
319
+
320
+ button
321
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  t = text({ left: 33, top: 33, data: 'data collected', id: :infos })
3
3
 
4
- inp=input({ width: 166,
4
+ inp=A.input({ width: 166,
5
5
  trigger: :up,
6
6
  back: :orange,
7
7
  shadow: {
@@ -32,4 +32,3 @@ end
32
32
 
33
33
 
34
34
 
35
-
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tick allow you to automatise any action counting
4
+ # it can be added into any new created particle ex: here a dummy
5
+
6
+ new({ particle: :dummy }) do |_p|
7
+ tick(:dummy )
8
+ end
9
+
10
+ new({ particle: :dummy2 }) do |_p|
11
+ tick(:dummy2 )
12
+ end
13
+
14
+ a=box
15
+ a.dummy(:hi)
16
+
17
+ puts a.tick[:dummy]
18
+ a.dummy(:ho)
19
+ puts a.tick[:dummy]
20
+
21
+ a.dummy2(:ho)
22
+ puts a.tick[:dummy2]
23
+
24
+ c=circle({left: 99})
25
+
26
+ c.touch(true) do
27
+ c.tick(:my_counter)
28
+ puts c.tick[:my_counter]
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6.8.3
4
+ version: 0.5.6.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
@@ -637,6 +637,7 @@ files:
637
637
  - vendor/assets/application/examples/terminal.rb
638
638
  - vendor/assets/application/examples/test.rb
639
639
  - vendor/assets/application/examples/text.rb
640
+ - vendor/assets/application/examples/tick.rb
640
641
  - vendor/assets/application/examples/tools.rb
641
642
  - vendor/assets/application/examples/touch.rb
642
643
  - vendor/assets/application/examples/type_mutation.rb