atome 0.5.3.2 → 0.5.3.4

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: d3b3eb14241b108a8fff26a1d336211199a4cf7a133069e399383f8c590be948
4
- data.tar.gz: 4bab390e92b2b65a180a2537902ca68bbb7a78faed8debf8cbf2e05063647b7f
3
+ metadata.gz: 2ca60550f747734b730b5f7bcc9e71f25bb116c0d084f2e8cb5f0bf601d33940
4
+ data.tar.gz: 175f194889b09b9969e7720bc10b9b100804685bad61fe7739bcd0ecba5e556f
5
5
  SHA512:
6
- metadata.gz: 71670c634ee463c0de14a00749d760174831029b1c6e45df1cb4fd6101ea51f083ff4c895d35a93de28a472bb63feb40ee23cd5c27d12f56571f62e6276654e6
7
- data.tar.gz: def487b5d20de25b4c112d65d850d94a454651750dfc240a329128b3cfbd42088bb391c29667f7de65297da2ed65bda55dea446ff436580bd3195891818c7947
6
+ metadata.gz: 2e7f1a2204f2551e05bdced2ffcc52d060af88156d7c43d824537abdfe00f75a7d574e52d18002835cf047d54176fdbe3dd80b0eecb9abf1c3ffe7c3dcbc3fce
7
+ data.tar.gz: 5ce1039aae51524cfbf2a91ca03d19f41e745640932eddd1362ae4fded9f1a5ee601ab8170c569d1d8f94a2927689be88716e8e4fcd8600f5630e213460815f5
data/exe/atome CHANGED
@@ -127,6 +127,10 @@ def browser_case(location)
127
127
  guard_check
128
128
  end
129
129
 
130
+ def osx_case(location)
131
+ `cd #{location};cargo tauri dev `
132
+ end
133
+
130
134
  def compile_case(location)
131
135
  `cd #{location}/src`
132
136
  guard_check
@@ -161,6 +165,8 @@ def run_case(build_target, location, port)
161
165
  server_case(port, location)
162
166
  when :browser
163
167
  browser_case(location)
168
+ when :osx
169
+ osx_case(location)
164
170
  when :compile
165
171
  compile_case(location)
166
172
  when :native
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Atome
4
4
  def content(items = nil)
5
- if items.instance_of?(Array)
5
+ if items.instance_of?(Array)
6
6
  items.each do |item|
7
7
  content(item)
8
8
  end
@@ -19,18 +19,17 @@ class Atome
19
19
  @cell_content ||= {}
20
20
  @cell_content[i_found] = { width_ratio: 1, height_ratio: 1, top_ratio: 1, left_ratio: 1 }
21
21
  # alert @cell_content
22
- items.parents([self.id])
22
+ items.parents([id])
23
23
  else
24
24
  @cell_content
25
25
  end
26
-
27
26
  end
28
27
 
29
28
  def cells(cell_nb)
30
29
  collector_object = collector({})
31
30
  collected_atomes = []
32
31
  cell_nb.each do |cell_found|
33
- atome_found = grab ("#{id}_#{cell_found}")
32
+ atome_found = grab("#{id}_#{cell_found}")
34
33
  collected_atomes << atome_found
35
34
  end
36
35
  collector_object.data(collected_atomes)
@@ -38,8 +37,7 @@ class Atome
38
37
  end
39
38
 
40
39
  def cell(cell_nb)
41
- cell_found = grab ("#{id}_#{cell_nb}")
42
- cell_found
40
+ grab("#{id}_#{cell_nb}")
43
41
  end
44
42
 
45
43
  def columns(column_requested, &proc)
@@ -81,7 +79,7 @@ class Atome
81
79
  cells_to_alter = cells_in_column[value[0]..value[1]]
82
80
  cells_to_alter.each_with_index do |cell_nb, index|
83
81
  current_cell = grab("#{id.value}_#{cell_nb}")
84
- if index == 0
82
+ if index.zero?
85
83
  current_cell.height(cell_height * cells_to_alter.length + @margin * (cells_to_alter.length - 1))
86
84
  else
87
85
  current_cell.hide(true)
@@ -97,7 +95,7 @@ class Atome
97
95
 
98
96
  cells_to_alter.each_with_index do |cell_nb, index|
99
97
  current_cell = grab("#{id.value}_#{cell_nb}")
100
- if index == 0
98
+ if index.zero?
101
99
  current_cell.width(cell_width * cells_to_alter.length + @margin * (cells_to_alter.length - 1))
102
100
  else
103
101
  current_cell.hide(true)
@@ -105,7 +103,6 @@ class Atome
105
103
  end
106
104
  end
107
105
  end
108
-
109
106
  end
110
107
 
111
108
  def divide(params)
@@ -141,7 +138,6 @@ class Atome
141
138
  end
142
139
  end
143
140
  end
144
-
145
141
  end
146
142
 
147
143
  # def override(params)
@@ -168,7 +164,7 @@ class Atome
168
164
  def format_matrix(matrix_id, matrix_width, matrix_height, nb_of_rows, nb_of_cols, margin, exceptions = {})
169
165
  cell_width = (matrix_width - margin * (nb_of_cols + 1)) / nb_of_cols
170
166
  cell_height = (matrix_height - margin * (nb_of_rows + 1)) / nb_of_rows
171
- ratio=cell_height/cell_width
167
+ ratio = cell_height / cell_width
172
168
  i = 0
173
169
  nb_of_rows.times do |row_index|
174
170
  nb_of_cols.times do |col_index|
@@ -182,8 +178,8 @@ class Atome
182
178
  grab(child).width(cell_width)
183
179
  grab(child).height(cell_width)
184
180
  end
185
- current_cell.width= cell_width
186
- current_cell.height= cell_height
181
+ current_cell.width = cell_width
182
+ current_cell.height = cell_height
187
183
  current_cell.left(x)
188
184
  current_cell.top(y)
189
185
  i += 1
@@ -194,43 +190,52 @@ class Atome
194
190
 
195
191
  number_of_cells = nb_of_rows * nb_of_cols
196
192
  # columns exceptions
197
- if exceptions
198
- fusion({ columns: exceptions[:columns_fusion] }) if exceptions[:columns_fusion]
199
- fusion({ rows: exceptions[:rows_fusion] }) if exceptions[:rows_fusion]
200
- divide({ columns: exceptions[:columns_divided] }) if exceptions[:columns_divided]
201
- divide({ rows: exceptions[:rows_divided] }) if exceptions[:rows_divided]
202
- end
193
+ return unless exceptions
203
194
 
195
+ fusion({ columns: exceptions[:columns_fusion] }) if exceptions[:columns_fusion]
196
+ fusion({ rows: exceptions[:rows_fusion] }) if exceptions[:rows_fusion]
197
+ divide({ columns: exceptions[:columns_divided] }) if exceptions[:columns_divided]
198
+ divide({ rows: exceptions[:rows_divided] }) if exceptions[:rows_divided]
204
199
  end
205
200
 
206
201
  def apply_style(current_cell, style)
207
202
  current_cell.set(style)
208
203
  end
204
+ def matrix_sanitizer(params)
205
+ default_params = {
209
206
 
207
+ id: :my_table, left: 33, top: 33, width: 369, height: 369, smooth: 8, color: :gray,
208
+ columns: { count: 4 },
209
+ rows: { count: 4 },
210
+ cells: { particles: { margin: 9, color: :lightgray, smooth: 9, shadow: { blur: 9, left: 3, top: 3 } }
211
+ }
212
+ }
213
+ default_params.merge(params)
214
+ end
210
215
  def matrix(params = {}, &bloc)
211
-
212
- if params[:columns]
213
- columns_data = params.delete(:columns)
214
- else
215
- columns_data= { count: 4 }
216
- end
217
-
218
- if params[:rows]
219
- rows_data = params.delete(:rows)
220
- else
221
- rows_data= { count: 4 }
222
- end
223
-
224
- if params[:cells]
225
- cells_data = params.delete(:cells)
226
- else
227
- cells_data= { particles: { margin: 9, color: :lightgray } }
228
- end
229
- cells_color=cells_data[:particles].delete(:color)
230
- cells_color_id= color(cells_color).id.value
231
-
232
- cells_shadow=cells_data[:particles].delete(:shadow)
233
- cells_shadow_id= shadow(cells_shadow).id.value
216
+ params= matrix_sanitizer(params)
217
+ columns_data = if params[:columns]
218
+ params.delete(:columns)
219
+ else
220
+ { count: 4 }
221
+ end
222
+
223
+ rows_data = if params[:rows]
224
+ params.delete(:rows)
225
+ else
226
+ { count: 4 }
227
+ end
228
+
229
+ cells_data = if params[:cells]
230
+ params.delete(:cells)
231
+ else
232
+ { particles: { margin: 9, color: :lightgray } }
233
+ end
234
+ cells_color = cells_data[:particles].delete(:color)
235
+ cells_color_id = color(cells_color).id.value
236
+
237
+ cells_shadow = cells_data[:particles].delete(:shadow)
238
+ cells_shadow_id = shadow(cells_shadow).id.value
234
239
 
235
240
  exceptions_data = params.delete(:exceptions)
236
241
  default_renderer = Essentials.default_params[:render_engines]
@@ -251,12 +256,12 @@ class Atome
251
256
  columns = columns_data[:count]
252
257
  rows = rows_data[:count]
253
258
  margin = cells_data[:particles].delete(:margin)
254
- the_matrix.instance_variable_set("@columns", columns)
255
- the_matrix.instance_variable_set("@rows", rows)
256
- the_matrix.instance_variable_set("@margin", margin)
257
- the_matrix.instance_variable_set("@cell_style", cells_data[:particles])
258
- the_matrix.instance_variable_set("@matrix_width", matrix_width)
259
- the_matrix.instance_variable_set("@matrix_height", matrix_height)
259
+ the_matrix.instance_variable_set('@columns', columns)
260
+ the_matrix.instance_variable_set('@rows', rows)
261
+ the_matrix.instance_variable_set('@margin', margin)
262
+ the_matrix.instance_variable_set('@cell_style', cells_data[:particles])
263
+ the_matrix.instance_variable_set('@matrix_width', matrix_width)
264
+ the_matrix.instance_variable_set('@matrix_height', matrix_height)
260
265
 
261
266
  rows = rows_data[:count]
262
267
  columns = columns_data[:count]
@@ -279,7 +284,6 @@ class Atome
279
284
  columns_divided: columns_divided_exceptions,
280
285
  rows_fusion: rows_fusion_exceptions,
281
286
  rows_divided: rows_divided_exceptions }
282
- the_matrix.instance_variable_set("@exceptions", exceptions)
283
287
  # @exceptions = {
284
288
  # columns_fusion: columns_fusion_exceptions,
285
289
  # columns_divided: columns_divided_exceptions,
@@ -291,9 +295,8 @@ class Atome
291
295
  columns_fusion: {},
292
296
  columns_divided: {},
293
297
  rows_fusion: {},
294
- rows_divided: {},
298
+ rows_divided: {}
295
299
  }
296
- the_matrix.instance_variable_set("@exceptions", exceptions)
297
300
  # @exceptions = {
298
301
  # columns_fusion: {},
299
302
  # columns_divided: {},
@@ -301,6 +304,7 @@ class Atome
301
304
  # rows_divided: {},
302
305
  # }
303
306
  end
307
+ the_matrix.instance_variable_set('@exceptions', exceptions)
304
308
 
305
309
  # let's create the matrix background
306
310
  # current_matrix = grab(:view).box({ id: matrix_id })
@@ -310,7 +314,7 @@ class Atome
310
314
  number_of_cells = rows * columns
311
315
  number_of_cells.times do |index|
312
316
  current_cell = grab(matrix_id).box({ id: "#{matrix_id}_#{index}" })
313
- the_matrix.instance_variable_set("@cell_style", cells_data[:particles])
317
+ the_matrix.instance_variable_set('@cell_style', cells_data[:particles])
314
318
  current_cell.attached([cells_shadow_id])
315
319
  current_cell.attached([cells_color_id])
316
320
  apply_style(current_cell, cells_data[:particles])
@@ -330,10 +334,10 @@ class Atome
330
334
  # puts index
331
335
  #
332
336
  end
333
- current_cell = self.box({ id: "#{id}_#{index}" })
337
+ current_cell = box({ id: "#{id}_#{index}" })
334
338
  apply_style(current_cell, @cell_style)
335
339
  end
336
- @columns = @columns + nb
340
+ @columns += nb
337
341
  ########## old algo
338
342
  # nb_of_cells_to_adds = nb * @rows
339
343
  # prev_nb_of_cells = @columns * @rows
@@ -355,10 +359,10 @@ class Atome
355
359
  # puts index
356
360
  #
357
361
  end
358
- current_cell = self.box({ id: "#{id}_#{index}" })
362
+ current_cell = box({ id: "#{id}_#{index}" })
359
363
  apply_style(current_cell, @cell_style)
360
364
  end
361
- @rows = @rows + nb
365
+ @rows += nb
362
366
  ########## old algo
363
367
  # nb_of_cells_to_adds = nb * @columns
364
368
  # prev_nb_of_cells = @columns * @rows
@@ -387,12 +391,11 @@ class Atome
387
391
  (0...num_rows).each do |row|
388
392
  result << (index + row * num_columns)
389
393
  end
390
- return result
394
+ result
391
395
  else
392
396
  start_index = index * num_columns
393
397
  end_index = start_index + num_columns - 1
394
- return (start_index..end_index).to_a
398
+ (start_index..end_index).to_a
395
399
  end
396
400
  end
397
-
398
401
  end
data/lib/atome/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Atome
4
- VERSION = '0.5.3.2'
4
+ VERSION = '0.5.3.4'
5
5
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ params = {
4
+
5
+ id: :my_table, left: 0, top: 0, width: 500, height: 399, smooth: 8, color: :yellowgreen,
6
+ columns: { count: 8,
7
+ titles: { 1 => :col1, 3 => :mycol },
8
+ data: { 3 => :col_content },
9
+ actions: { 2 => { touch: :the_action } },
10
+ particles: { color: :blue }
11
+ },
12
+ rows: { count: 6,
13
+ titles: { 1 => :my_first_row, 5 => :other_row },
14
+ data: { 0 => :col_content },
15
+ actions: {},
16
+ particles: { shadows: :black }
17
+ },
18
+ cells: {
19
+ # data: { 0 => :here, 2 => "hello", 4 => :hi, 5 => :good, 7 => :super },
20
+ # actions: { 2 => { touch: :my_lambda } },
21
+ particles: { margin: 9, color: :blue, smooth: 9, shadow: { blur: 9, left: 3, top: 3 } }
22
+ },
23
+ exceptions: {
24
+ columns: {
25
+ # divided: { 2 => 3 },
26
+ fusion: { 1 => [3, 5], 7 => [2, 5] }
27
+ },
28
+ rows: {
29
+ divided: { 1 => 3 },
30
+ fusion: { 2 => [0, 3], 5 => [2, 5] }
31
+ }
32
+ }
33
+ }
34
+
35
+
36
+ matrix(params)
37
+ # matrix({ id: :totot,columns: { count: 24 } })
38
+ # matrix
@@ -4,7 +4,7 @@ a=Atome.new(code: { type: :code, renderers: [:headless], parents: [], children:
4
4
  puts "the param is #{params_found}"
5
5
  end
6
6
  a.run(:super)
7
- c=element do |params_found|
7
+ c=element({}) do |params_found|
8
8
  puts "you want me to print: #{params_found}"
9
9
  end
10
10
 
@@ -2,9 +2,12 @@
2
2
 
3
3
  _alarm_format = '2022,11,27,12,06,0'
4
4
  time_to_run = Time.now + 3
5
- puts 'event schedule'
6
- a = element
5
+ t=text ({ data: "an event schedule will create a box" })
6
+ t.width(555)
7
+ a = element({})
7
8
 
8
9
  a.schedule(time_to_run) do
9
10
  puts 'event executed'
11
+ t.delete(true)
12
+ grab(:view).box #FIXME: box doesnt work we must use a grab , plaese fix
10
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3.2
4
+ version: 0.5.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-09 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino_firmata
@@ -649,6 +649,7 @@ files:
649
649
  - vendor/assets/src/medias/rubies/examples/_audio.rb
650
650
  - vendor/assets/src/medias/rubies/examples/_dataset.rb
651
651
  - vendor/assets/src/medias/rubies/examples/_os.rb
652
+ - vendor/assets/src/medias/rubies/examples/_table2.rb
652
653
  - vendor/assets/src/medias/rubies/examples/_test.rb
653
654
  - vendor/assets/src/medias/rubies/examples/_vie.rb
654
655
  - vendor/assets/src/medias/rubies/examples/add.rb