glimmer-dsl-swt 4.20.8.0 → 4.20.9.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: 22394bc84cfc12938603e2566009365c2d23f9eee64f49b9da159f201438ca78
4
- data.tar.gz: d00cd63f2663d46628e26a9dd974705e29d6d97e5c4b9d686194899662b34218
3
+ metadata.gz: 67146280061b1d25faa20a00e53ee4afed1f45c28ab2e7fd8054b528db26076c
4
+ data.tar.gz: 8c5a14a627a19f5247bf49ed7b73aeed59b057b6eabeab6d6a554c7828a4885b
5
5
  SHA512:
6
- metadata.gz: ab487ddda276df797b56bdc5ad201ec6a9f02abcda356d13f8bdaa7c70eb3a90252459cc83872e28e88bf0b14284eafcaf05ee1f1dfca1468b88730eb1364b74
7
- data.tar.gz: 1a8bb076d8bfb3daa0678477039c3220c5e49e206e08e641d2c701a5ef72a1ac3820a4f19539077be5d6d7ee5e65332f9118e88214b9d1cc9e6960a6c84339a9
6
+ metadata.gz: aa70e97297e9d502fad7fa4456e161302aa32ba9c44bf6ee7a7d4aabca2fcdb1ade0946c912f3c705987238738fdb5be4a9c0c9615638dabf891f58ed128a656
7
+ data.tar.gz: a72892383f756b6b990ce37ed319fa6f36de7a4d8832ea380921cd4a6bcda827f43f94dfa4419843ab146804081a9b6393c29f21a55056ffd94b870811c42a3b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.9.0
4
+
5
+ - Canvas animation fps/frame_rate property to set frames-per-second rate of rendering (alternative to every)
6
+
3
7
  ### 4.20.8.0
4
8
 
5
9
  - Support data-binding Animation `duration_limit` property
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.8.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.9.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.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).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.9.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.8.0
350
+ jgem install glimmer-dsl-swt -v 4.20.9.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.8.0'
378
+ gem 'glimmer-dsl-swt', '~> 4.20.9.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.8.0
399
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.9.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.8.0
1
+ 4.20.9.0
@@ -2239,7 +2239,7 @@ Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-can
2239
2239
 
2240
2240
  ### Canvas Animation DSL
2241
2241
 
2242
- **(ALPHA FEATURE)**
2242
+ **(EXPERIMENTAL EARLY ALPHA FEATURE)**
2243
2243
 
2244
2244
  (note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
2245
2245
 
@@ -2281,7 +2281,8 @@ Screenshot:
2281
2281
 
2282
2282
  Keywords:
2283
2283
  - `animation` declares an animation under a canvas, which renders frames using a frame block indefinitely or finitely depending on (cycle_count/frame_count) properties
2284
- - `every` specifies delay in seconds between every two frame renders
2284
+ - `every` specifies delay in seconds between every two frame renders (an alternative to `fps`, cannot use together)
2285
+ - `fps` (alias: `frame_rate`) specifies frame rate as frames per second (an alternative to `every`, cannot use together)
2285
2286
  - `frame {|index, cycle_var| }` a block that can contain Shape DSL syntax that is rendered dynamically with variables calculated on the fly
2286
2287
  - `cycle` an optional property that takes an array to cycle into a second variable for the `frame` block
2287
2288
  - `cycle_count` an optional cycle count limit after which the animation stops (finishes)
Binary file
@@ -21,6 +21,7 @@
21
21
 
22
22
  require 'glimmer/swt/properties'
23
23
  require 'glimmer/swt/custom/shape'
24
+ require 'bigdecimal'
24
25
 
25
26
  module Glimmer
26
27
  module SWT
@@ -79,10 +80,12 @@ module Glimmer
79
80
  end
80
81
 
81
82
  attr_reader :parent, :options
82
- attr_accessor :frame_index, :cycle, :frame_block, :every, :cycle_count, :frame_count, :started, :duration_limit, :duration, :finished, :cycle_count_index
83
+ attr_accessor :frame_index, :cycle, :frame_block, :every, :fps, :cycle_count, :frame_count, :started, :duration_limit, :duration, :finished, :cycle_count_index
83
84
  alias current_frame_index frame_index
84
85
  alias started? started
85
86
  alias finished? finished
87
+ alias frame_rate fps
88
+ alias frame_rate= fps=
86
89
  # TODO consider supporting an async: false option
87
90
 
88
91
  def initialize(parent)
@@ -266,7 +269,12 @@ module Glimmer
266
269
  end
267
270
  self.frame_index += 1
268
271
  self.cycle_count_index += 1 if cycle_limited? && (@frame_index % @cycle&.length&.to_i) == 0
269
- sleep(every) if every.is_a?(Numeric) # TODO consider using timer_exec as a perhaps more reliable alternative
272
+ # TODO consider using timer_exec as a perhaps more reliable alternative
273
+ if every.is_a?(Numeric) && every > 0
274
+ sleep(every)
275
+ elsif fps.is_a?(Numeric) && fps > 0
276
+ sleep((BigDecimal(1.0.to_s) / BigDecimal(fps.to_f.to_s)).to_f)
277
+ end
270
278
  true
271
279
  rescue => e
272
280
  Glimmer::Config.logger.error {e}
@@ -25,11 +25,11 @@ require 'bigdecimal'
25
25
  class HelloCanvasAnimation
26
26
  include Glimmer::UI::CustomShell
27
27
 
28
- # data-bindable attributes (names must vary from attribute names on animation)
29
- attr_accessor :animation_every, :animation_frame_count, :animation_duration_limit, :animation_started, :animation_finished
28
+ attr_accessor :animation_every, :animation_fps, :animation_frame_count, :animation_duration_limit, :animation_started, :animation_finished
30
29
 
31
30
  before_body {
32
31
  @animation_every = 0.050 # seconds
32
+ @animation_fps = 0
33
33
  @animation_frame_count = 100
34
34
  @animation_duration_limit = 0 # seconds
35
35
  @animation_started = true
@@ -69,14 +69,14 @@ class HelloCanvasAnimation
69
69
  text 'every'
70
70
  }
71
71
  label {
72
- text 'frame count (0=unlimited)'
72
+ text 'frames per second'
73
73
  }
74
74
 
75
75
  # row 3
76
76
  spinner {
77
77
  layout_data(:fill, :center, true, false)
78
78
  digits 3
79
- minimum 1
79
+ minimum 0
80
80
  maximum 100
81
81
  selection <=> [self, :animation_every, on_read: ->(v) {(BigDecimal(v.to_s)*1000).to_f}, on_write: ->(v) {(BigDecimal(v.to_s)/1000).to_f}]
82
82
  }
@@ -84,16 +84,24 @@ class HelloCanvasAnimation
84
84
  layout_data(:fill, :center, true, false)
85
85
  minimum 0
86
86
  maximum 100
87
- selection <=> [self, :animation_frame_count]
87
+ selection <=> [self, :animation_fps]
88
88
  }
89
89
 
90
90
  # row 4
91
+ label {
92
+ text 'frame count (0=unlimited)'
93
+ }
91
94
  label {
92
95
  text 'duration limit (0=unlimited)'
93
96
  }
94
- label # filler
95
97
 
96
98
  # row 5
99
+ spinner {
100
+ layout_data(:fill, :center, true, false)
101
+ minimum 0
102
+ maximum 100
103
+ selection <=> [self, :animation_frame_count]
104
+ }
97
105
  spinner {
98
106
  layout_data(:fill, :center, true, false)
99
107
  minimum 0
@@ -108,11 +116,12 @@ class HelloCanvasAnimation
108
116
  height_hint 320
109
117
  }
110
118
  @animation = animation {
111
- every <= [self, :animation_every]
112
- frame_count <= [self, :animation_frame_count]
113
- duration_limit <= [self, :animation_duration_limit]
114
- started <=> [self, :animation_started]
115
- finished <=> [self, :animation_finished]
119
+ every <= [self, :animation_every]
120
+ fps <= [self, :animation_fps]
121
+ frame_count <= [self, :animation_frame_count]
122
+ duration_limit <= [self, :animation_duration_limit]
123
+ started <=> [self, :animation_started]
124
+ finished <=> [self, :animation_finished]
116
125
 
117
126
  frame { |index|
118
127
  background rgb(index%100, index%100 + 100, index%55 + 200)
@@ -124,6 +133,16 @@ class HelloCanvasAnimation
124
133
  }
125
134
  }
126
135
  }
136
+
137
+ def animation_every=(value)
138
+ @animation_every = value
139
+ self.animation_fps = 0 if @animation_every.to_f > 0
140
+ end
141
+
142
+ def animation_fps=(value)
143
+ @animation_fps = value
144
+ self.animation_every = 0 if @animation_fps.to_f > 0
145
+ end
127
146
  end
128
147
 
129
148
  HelloCanvasAnimation.launch
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.8.0
4
+ version: 4.20.9.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-19 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement