glimmer-dsl-fx 0.0.1 → 0.0.2

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: ee2c82b5a89c8d320b83b272d1c0291b6027ac4c2760276146e180c42ab9801d
4
- data.tar.gz: db77449c81eb1c9da2860a55bd89ff5a067326e0f21a34c5041f14c37e0ab0d5
3
+ metadata.gz: 02d5c6e11384d865fe3ffe75c3512baf4f2c2e6f1f3afef8baeeaca78f72adc3
4
+ data.tar.gz: f377b9dbad1d072137d044dacbaf63165e535cf2fb8c73181e605ad2903b4554
5
5
  SHA512:
6
- metadata.gz: 618d244b3abcbcd42571f25cf04ec5ebd261bd78f557d067e8c7b971eeab06009e8e3cd934dc5c5af3f561d209745ba39a9c0a26faf911873f02b392b1375577
7
- data.tar.gz: 1f57ea3a301de20a427e0af491a1f43d9e5d731e6621b0e3ddb5604479f32347ee4ede6f9e23f777f02851b099f5c5b363184d2463ad05ae72a2e00248edbcae
6
+ metadata.gz: b9c5f94b545c2d96abe68eb174144f8eec6e6da913a5c740547c1985a32ad69d34cfa20a7a2546bda9f1389a65c46838196872a1f36ec9948dbe4f0dc3ec727f
7
+ data.tar.gz: 7fa321097ec377f657cfc833e1be1191f0b7a3786411e9a87c70cc169588c9b16e59b9f66f9f3b0c2357dd347ed11c0fd5fd613d507732b8e9460b5b16588260
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.2
4
+
5
+ - Support `Symbol`-style `:opts` in kwargs of controls (e.g. `button('Click', opts: [:frame_raised, :frame_thick, :layout_center_x, :layout_center_y])`)
6
+
3
7
  ## 0.0.1
4
8
 
5
9
  - Initial version of Glimmer DSL for FX
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 FX 0.0.1
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 FX 0.0.2
2
2
  ## FOX Toolkit Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-fx.svg)](http://badge.fury.io/rb/glimmer-dsl-fx)
4
4
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -21,7 +21,7 @@ Hello, World!
21
21
  ```ruby
22
22
  app('HelloWorld', 'Glimmer') {
23
23
  main_window('Hello, World!') {
24
- label('Hello, World!')
24
+ label('Hello, World!', opts: [:layout_center_x, :layout_center_y])
25
25
  }
26
26
  }.run
27
27
  ```
@@ -76,7 +76,7 @@ gem install glimmer-dsl-fx
76
76
 
77
77
  Add the following to `Gemfile`:
78
78
  ```
79
- gem 'glimmer-dsl-fx', '~> 0.0.1'
79
+ gem 'glimmer-dsl-fx', '~> 0.0.2'
80
80
  ```
81
81
 
82
82
  And, then run:
@@ -91,7 +91,7 @@ Require the library and mixin the `Glimmer` module to utilize the Glimmer GUI DS
91
91
  ```ruby
92
92
  app('HelloWorld', 'Glimmer') {
93
93
  main_window('Hello, World!') {
94
- label('Hello, World!')
94
+ label('Hello, World!', opts: [:layout_center_x, :layout_center_y])
95
95
  }
96
96
  }.run
97
97
  ```
@@ -107,7 +107,7 @@ class SomeGlimmerApplication
107
107
  def launch
108
108
  app('HelloWorld', 'Glimmer') {
109
109
  main_window('Hello, World!') {
110
- label('Hello, World!')
110
+ label('Hello, World!', opts: [:layout_center_x, :layout_center_y])
111
111
  }
112
112
  }.run
113
113
  end
@@ -256,7 +256,7 @@ class HelloButton
256
256
  def launch
257
257
  app('HelloButton', 'Glimmer') {
258
258
  main_window('Hello, Button!') {
259
- @button = button('Click To Increment: 0') {
259
+ @button = button('Click To Increment: 0', opts: [:frame_raised, :frame_thick, :layout_center_x, :layout_center_y]) {
260
260
  on(:command) do
261
261
  @counter.count += 1
262
262
  end
@@ -289,7 +289,7 @@ girb
289
289
 
290
290
  This gives you `irb` with the `glimmer-dsl-fx` gem loaded and the `Glimmer` module mixed into the main object for easy experimentation with GUI.
291
291
 
292
- Note: GIRB for Glimmer DSL for FX 0.0.1 is still very rudimentary and does not support entering code for multiple applications, yet only one. You would have to exit and re-enter after each application entered.
292
+ Note: GIRB for Glimmer DSL for FX 0.0.2 is still very rudimentary and does not support entering code for multiple applications, yet only one. You would have to exit and re-enter after each application entered.
293
293
 
294
294
  Gotcha: On the Mac, when you close a window opened in `girb`, it remains open until you enter `exit`.
295
295
 
@@ -364,7 +364,7 @@ class HelloButton
364
364
  def launch
365
365
  app('HelloButton', 'Glimmer') {
366
366
  main_window('Hello, Button!') {
367
- @button = button("Click To Increment: 0") {
367
+ @button = button("Click To Increment: 0", opts: [:frame_raised, :frame_thick, :layout_center_x, :layout_center_y]) {
368
368
  on(:command) do
369
369
  @count += 1
370
370
  @button.text = "Click To Increment: #{@count}"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
Binary file
@@ -165,9 +165,7 @@ module Glimmer
165
165
 
166
166
  def window_proxy
167
167
  found_proxy = self
168
- until found_proxy.nil? || found_proxy.is_a?(WindowProxy)
169
- found_proxy = found_proxy.parent_proxy
170
- end
168
+ found_proxy = found_proxy.parent_proxy until found_proxy.nil? || found_proxy.is_a?(WindowProxy)
171
169
  found_proxy
172
170
  end
173
171
 
@@ -208,9 +206,16 @@ module Glimmer
208
206
  end
209
207
 
210
208
  def normalize_args(args)
211
- args.map do |arg|
209
+ result_args = args.map do |arg|
212
210
  arg.is_a?(ControlProxy) ? arg.fx : arg
213
211
  end
212
+ kwargs = result_args.last.is_a?(Hash) ? result_args.pop : {}
213
+ opts = [kwargs.delete(:opts) || kwargs.delete('opts')].flatten.compact
214
+ opts_value = opts.map do |opt|
215
+ ::Fox.const_get(opt.upcase.to_sym)
216
+ end.reduce(:|)
217
+ kwargs = kwargs.merge(opts: opts_value) unless opts.empty?
218
+ kwargs.empty? ? result_args : result_args + [kwargs]
214
219
  end
215
220
  end
216
221
  end
@@ -10,7 +10,7 @@ class HelloButton
10
10
  def launch
11
11
  app('HelloButton', 'Glimmer') {
12
12
  main_window('Hello, Button!') {
13
- @button = button("Click To Increment: 0") {
13
+ @button = button("Click To Increment: 0", opts: [:frame_raised, :frame_thick, :layout_center_x, :layout_center_y]) {
14
14
  on(:command) do
15
15
  @count += 1
16
16
  @button.text = "Click To Increment: #{@count}"
@@ -4,6 +4,6 @@ include Glimmer
4
4
 
5
5
  app('HelloWorld', 'Glimmer') {
6
6
  main_window('Hello, World!') {
7
- label('Hello, World!')
7
+ label('Hello, World!', opts: [:layout_center_x, :layout_center_y])
8
8
  }
9
9
  }.run
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-fx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh