glimmer-dsl-swt 4.20.7.0 → 4.20.8.0

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: 9a17e44008cc8425de7d3789c82e9bbaa11e0406e3f38ec71cee7f9427f07686
4
- data.tar.gz: abfaa95510ebb353849d8659f55f5336aa1fd9b2653e4baf44fa156ba4524174
3
+ metadata.gz: 22394bc84cfc12938603e2566009365c2d23f9eee64f49b9da159f201438ca78
4
+ data.tar.gz: d00cd63f2663d46628e26a9dd974705e29d6d97e5c4b9d686194899662b34218
5
5
  SHA512:
6
- metadata.gz: 2c9c41491e55320002c349ae791073ec386237d63d07dc8737bbc8ecee37e29fbebef3ed8b4b333577ac8627e128fc54ff7da96720ca7db1fbad7ae4f49d7a96
7
- data.tar.gz: 8a327ae96049e238fc36b40531e7bc9ae0d12303adae5183a4428de8cd3d39f49ef7ede3162b1b44a57102769f469200c556e394154eb65aba148679976ee12f
6
+ metadata.gz: ab487ddda276df797b56bdc5ad201ec6a9f02abcda356d13f8bdaa7c70eb3a90252459cc83872e28e88bf0b14284eafcaf05ee1f1dfca1468b88730eb1364b74
7
+ data.tar.gz: 1a8bb076d8bfb3daa0678477039c3220c5e49e206e08e641d2c701a5ef72a1ac3820a4f19539077be5d6d7ee5e65332f9118e88214b9d1cc9e6960a6c84339a9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.8.0
4
+
5
+ - Support data-binding Animation `duration_limit` property
6
+ - Improve support of Animation `duration_limit` property in recognizing when an animation is finished
7
+ - Added duration limit to Hello, Canvas Animation! sample
8
+
3
9
  ### 4.20.7.0
4
10
 
5
11
  - Add Canvas Animation DSL #finished, #finished?, #finished= properties
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.6.0
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.8.0
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -15,7 +15,7 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.6.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.8.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
19
19
 
20
20
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
@@ -347,7 +347,7 @@ jgem install glimmer-dsl-swt
347
347
 
348
348
  Or this command if you want a specific version:
349
349
  ```
350
- jgem install glimmer-dsl-swt -v 4.20.6.0
350
+ jgem install glimmer-dsl-swt -v 4.20.8.0
351
351
  ```
352
352
 
353
353
  `jgem` is JRuby's version of `gem` command.
@@ -375,7 +375,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
375
375
 
376
376
  Add the following to `Gemfile`:
377
377
  ```
378
- gem 'glimmer-dsl-swt', '~> 4.20.6.0'
378
+ gem 'glimmer-dsl-swt', '~> 4.20.8.0'
379
379
  ```
380
380
 
381
381
  And, then run:
@@ -396,7 +396,7 @@ glimmer
396
396
  ```
397
397
 
398
398
  ```
399
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.6.0
399
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.8.0
400
400
 
401
401
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
402
402
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.7.0
1
+ 4.20.8.0
@@ -2284,9 +2284,11 @@ Keywords:
2284
2284
  - `every` specifies delay in seconds between every two frame renders
2285
2285
  - `frame {|index, cycle_var| }` a block that can contain Shape DSL syntax that is rendered dynamically with variables calculated on the fly
2286
2286
  - `cycle` an optional property that takes an array to cycle into a second variable for the `frame` block
2287
- - `cycle_count` an optional cycle count limit after which the animation stops
2288
- - `frame_count` an optional frame count limit after which the animation stops
2289
- - `started` a boolean indicating if the animation is started right away or stopped waiting for manual startup via `#start` method
2287
+ - `cycle_count` an optional cycle count limit after which the animation stops (finishes)
2288
+ - `frame_count` an optional frame count limit after which the animation stops (finishes)
2289
+ - `duration_limit` an optional duration limit in seconds after which the animation stops (finishes)
2290
+ - `started`/`started?` a boolean indicating if the animation is started right away or stopped waiting for manual startup via `#start` method
2291
+ - `finished`/`finished?` a boolean indicating if the animation finished (for finite animations only)
2290
2292
 
2291
2293
  API of Animation Object (returned from `animation` keyword):
2292
2294
  - `#start` starts an animation that is indefinite or has never been started before (i.e. having `started: false` option). Otherwise, resumes a stopped animation that has not been completed.
Binary file
@@ -114,6 +114,7 @@ module Glimmer
114
114
  return if @start_number > 0 && started?
115
115
  @start_number += 1
116
116
  @start_time = Time.now
117
+ @duration = 0
117
118
  @original_start_time = @start_time if @duration.nil?
118
119
  self.finished = false if finished?
119
120
  self.started = true
@@ -141,8 +142,8 @@ module Glimmer
141
142
 
142
143
  # Restarts an animation (whether indefinite or not and whether stopped or not)
143
144
  def restart
144
- @original_start_time = @start_time = nil
145
- self.duration = nil
145
+ @original_start_time = @start_time = Time.now
146
+ self.duration = 0
146
147
  self.frame_index = 0
147
148
  self.cycle_count_index = 0
148
149
  stop
@@ -189,16 +190,19 @@ module Glimmer
189
190
  def cycle_count_index=(value)
190
191
  @cycle_count_index = value
191
192
  self.finished = true if cycle_limited? && @cycle_count_index == @cycle_count
193
+ @cycle_count_index
192
194
  end
193
195
 
194
196
  def frame_index=(value)
195
197
  @frame_index = value
196
198
  self.finished = true if frame_count_limited? && @frame_index == @frame_count
199
+ @frame_index
197
200
  end
198
201
 
199
202
  def duration=(value)
200
203
  @duration = value
201
204
  self.finished = true if surpassed_duration_limit?
205
+ @duration
202
206
  end
203
207
 
204
208
  def cycle_enabled?
@@ -210,7 +214,7 @@ module Glimmer
210
214
  end
211
215
 
212
216
  def duration_limited?
213
- @duration_limit.is_a?(Integer)
217
+ @duration_limit.is_a?(Numeric) && @duration_limit > 0
214
218
  end
215
219
 
216
220
  def frame_count_limited?
@@ -218,7 +222,7 @@ module Glimmer
218
222
  end
219
223
 
220
224
  def surpassed_duration_limit?
221
- duration_limited? && ((Time.now - @start_time) > (@duration_limit - @duration.to_f))
225
+ duration_limited? && ((Time.now - @start_time) > @duration_limit)
222
226
  end
223
227
 
224
228
  def within_duration_limit?
@@ -234,6 +238,7 @@ module Glimmer
234
238
  (frame_count_limited? && @frame_index == @frame_count) or
235
239
  (cycle_limited? && @cycle_count_index == @cycle_count) or
236
240
  surpassed_duration_limit?
241
+ self.duration = Time.now - @start_time
237
242
  return false
238
243
  end
239
244
  block_args = [@frame_index]
@@ -241,6 +246,7 @@ module Glimmer
241
246
  current_frame_index = @frame_index
242
247
  current_cycle_count_index = @cycle_count_index
243
248
  self.class.schedule_frame_animation(self) do
249
+ self.duration = Time.now - @start_time # TODO should this be set here, after the if statement, in the else too, or outside both?
244
250
  if started? && start_number == @start_number && within_duration_limit?
245
251
  unless @parent.isDisposed
246
252
  @shapes.to_a.each(&:dispose)
@@ -249,9 +255,9 @@ module Glimmer
249
255
  frame_block.call(*block_args)
250
256
  }
251
257
  @shapes = @parent.shapes - parent_shapes_before
258
+ self.duration = Time.now - @start_time # TODO consider if this is needed
252
259
  end
253
260
  else
254
- self.finished = true if surpassed_duration_limit?
255
261
  if stopped? && @frame_index > current_frame_index
256
262
  self.frame_index = current_frame_index
257
263
  self.cycle_count_index = current_cycle_count_index
@@ -260,7 +266,7 @@ module Glimmer
260
266
  end
261
267
  self.frame_index += 1
262
268
  self.cycle_count_index += 1 if cycle_limited? && (@frame_index % @cycle&.length&.to_i) == 0
263
- sleep(every) if every.is_a?(Numeric) # TODO consider using timer_exec as a more reliable alternative
269
+ sleep(every) if every.is_a?(Numeric) # TODO consider using timer_exec as a perhaps more reliable alternative
264
270
  true
265
271
  rescue => e
266
272
  Glimmer::Config.logger.error {e}
@@ -26,11 +26,12 @@ class HelloCanvasAnimation
26
26
  include Glimmer::UI::CustomShell
27
27
 
28
28
  # data-bindable attributes (names must vary from attribute names on animation)
29
- attr_accessor :animation_every, :animation_frame_count, :animation_started, :animation_finished
29
+ attr_accessor :animation_every, :animation_frame_count, :animation_duration_limit, :animation_started, :animation_finished
30
30
 
31
31
  before_body {
32
- @animation_every = 0.050
32
+ @animation_every = 0.050 # seconds
33
33
  @animation_frame_count = 100
34
+ @animation_duration_limit = 0 # seconds
34
35
  @animation_started = true
35
36
  @animation_finished = false
36
37
  }
@@ -40,6 +41,7 @@ class HelloCanvasAnimation
40
41
  grid_layout(2, true)
41
42
  text 'Hello, Canvas Animation!'
42
43
 
44
+ # row 1
43
45
  button {
44
46
  layout_data(:fill, :center, true, false)
45
47
  text <= [self, :animation_started, on_read: ->(value) { value ? 'Stop' : 'Resume' }]
@@ -61,12 +63,16 @@ class HelloCanvasAnimation
61
63
  @animation.restart
62
64
  end
63
65
  }
66
+
67
+ # row 2
64
68
  label {
65
- text 'every (milliseconds)'
69
+ text 'every'
66
70
  }
67
71
  label {
68
- text 'frame count (0 is unlimited)'
72
+ text 'frame count (0=unlimited)'
69
73
  }
74
+
75
+ # row 3
70
76
  spinner {
71
77
  layout_data(:fill, :center, true, false)
72
78
  digits 3
@@ -81,6 +87,20 @@ class HelloCanvasAnimation
81
87
  selection <=> [self, :animation_frame_count]
82
88
  }
83
89
 
90
+ # row 4
91
+ label {
92
+ text 'duration limit (0=unlimited)'
93
+ }
94
+ label # filler
95
+
96
+ # row 5
97
+ spinner {
98
+ layout_data(:fill, :center, true, false)
99
+ minimum 0
100
+ maximum 10
101
+ selection <=> [self, :animation_duration_limit]
102
+ }
103
+
84
104
  canvas {
85
105
  layout_data(:fill, :fill, true, true) {
86
106
  horizontal_span 2
@@ -90,6 +110,7 @@ class HelloCanvasAnimation
90
110
  @animation = animation {
91
111
  every <= [self, :animation_every]
92
112
  frame_count <= [self, :animation_frame_count]
113
+ duration_limit <= [self, :animation_duration_limit]
93
114
  started <=> [self, :animation_started]
94
115
  finished <=> [self, :animation_finished]
95
116
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.7.0
4
+ version: 4.20.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-18 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement