glimmer-dsl-tk 0.0.4 → 0.0.8

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: 631bc5fe4586f68987c644c71f33768414c8088601dfbe1cc641d0fc13656729
4
- data.tar.gz: abe0f504f6b7fd897af3964e24041331bba475a966c9e75fc22554b86b31cbef
3
+ metadata.gz: 2f18bce2ab82f0e85d106d99e6508490b69172f1039e38d0e0208cf6a5ca70e6
4
+ data.tar.gz: '0779ed4a739d7ffa4e7c6d6b2556fe365741715165ff5c1bf7f9bc6456ba3443'
5
5
  SHA512:
6
- metadata.gz: c9d211b7f70cbf38c2ad231343a1d5b73c14767d89468a1e99bf418209c03db079edf5ea116ef78c211f4e35795607ea7a9911acf48bffc3913ed53a0adcbc7a
7
- data.tar.gz: b7a66a93ad9d478a215c0c3d6348c9e934ce6dc34b04716d8f2d61a908dd62dd2fa4a4bc42fd4804bd53e0a6c5e4413dc2ea6495b3d2c87417e46d435cb82da9
6
+ metadata.gz: 7cd74eff8e24f8152aa11c562fe410bc46a6d45193e7797afff970113eabd6604f3e0adee55882fc9b2e019bd36185ed95befc56f8376925c5292b7383814fa2
7
+ data.tar.gz: 98ba6609fd143106c4f9a66a5ed006742c53775bdb155bfe98be6b905aeecec8fb61690e9642113f7790c19d31006ef3fe4309a9d6b71bc703a02517a577128f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.8
4
+
5
+ - Fix issue #5 (https://github.com/AndyObtiva/glimmer-dsl-tk/issues/5)
6
+ - Support `iconphoto` attribute on `root` widget, intelligently accepting a direct image path or `TkPhotoImage` object
7
+ - Set `root` `iconphoto` attribute to Glimmer icon by default if not set in an application.
8
+ - Provide `iconphoto` code example in README
9
+ - Upgrade to glimmer 2.1.1
10
+
11
+ ## 0.0.7
12
+
13
+ - Upgraded to tk 0.4.0
14
+ - Fixed `girb` by changing to a pure Ruby script
15
+
16
+ ## 0.0.6
17
+
18
+ - Upgraded to tk 0.3.0
19
+
20
+ ## 0.0.5
21
+
22
+ - Label text data-binding
23
+ - Entry text data-binding
24
+ - The `grid` geometry manager
25
+ - Hello, Computed! sample
26
+
3
27
  ## 0.0.4
4
28
 
5
29
  - `list` custom widget (since listbox is not tile themed yet in Tk)
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Andy Maleh
1
+ Copyright (c) 2020-2021 Andy Maleh
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,26 +1,28 @@
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 Tk 0.0.4 (Desktop GUI)
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 Tk 0.0.8
2
+ ## MRI Ruby Desktop Development GUI Library
2
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-tk.svg)](http://badge.fury.io/rb/glimmer-dsl-tk)
3
- [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-tk.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-tk)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-tk/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-tk?branch=master)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-tk/maintainability)
6
6
  [![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)
7
7
 
8
+ **[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](CONTRIBUTING.md)**
9
+
8
10
  [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Tk](https://www.tcl.tk/) enables desktop development with [Glimmer](https://github.com/AndyObtiva/glimmer) in [Ruby](https://github.com/ruby/ruby).
9
11
 
10
- [Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining true native widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.).
12
+ [Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining truly native looking themed widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.).
11
13
 
12
14
  Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
13
15
 
14
- The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a plethora of high quality reusable widgets for the Enterprise (such as [Nebula](https://www.eclipse.org/nebula/)), [Tk](https://www.tcl.tk/) enables very fast app startup time via [MRI Ruby](https://www.ruby-lang.org/en/).
16
+ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a plethora of high quality reusable widgets for the Enterprise (such as [Nebula](https://www.eclipse.org/nebula/)), [Tk](https://www.tcl.tk/) enables very fast app startup time and a small memory footprint via [MRI Ruby](https://www.ruby-lang.org/en/).
15
17
 
16
- [Glimmer](https://github.com/AndyObtiva/glimmer) provides a DSL to enable more productive desktop development in Ruby with:
18
+ [Glimmer](https://github.com/AndyObtiva/glimmer) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
17
19
  - Declarative DSL syntax that visually maps to the GUI widget hierarchy
18
20
  - Convention over configuration via smart defaults and automation of low-level details
19
21
  - Requiring the least amount of syntax possible to build GUI
20
22
  - Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
23
+ - Custom Widget support
21
24
  - Scaffolding for new custom widgets, apps, and gems
22
25
  - Native-Executable packaging on Mac, Windows, and Linux
23
- - Custom Widget support
24
26
 
25
27
  **Hello, World!**
26
28
 
@@ -34,21 +36,21 @@ root {
34
36
  }.open
35
37
  ```
36
38
 
37
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
39
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
38
40
 
39
41
  ```
40
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
42
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_world'"
41
43
  ```
42
44
 
43
45
  Glimmer app:
44
46
 
45
47
  ![glimmer dsl tk screenshot sample hello world](images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
46
48
 
47
- NOTE: Glimmer DSL for Tk is in alpha mode. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is by no means perfect, so the more feedback and issues you report the better.
49
+ NOTE: Glimmer DSL for Tk is in alpha mode. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
48
50
 
49
51
  Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
50
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop GUI)
51
- - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
52
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
53
+ - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
52
54
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
53
55
  - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
54
56
 
@@ -57,10 +59,11 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
57
59
  - [Tcl/Tk](https://www.tcl.tk/): Follow the [install instructions](https://tkdocs.com/tutorial/install.html)
58
60
  - [Ruby](https://www.ruby-lang.org/en/): On Windows, obtain from the Ruby [download page](https://www.ruby-lang.org/en/downloads/). On the Mac and Linux, it is more convenient to just use [RVM](http://rvm.io) and follow the [RVM Tk instructions](https://rvm.io/integration/tk).
59
61
 
60
- For example, on the Mac, you can:
61
- - Install the ActiveTcl Mac package from [ActiveState.com](ActiveState.com)
62
+ For example, on the Mac, you can:
63
+ - Install the ActiveTcl Mac package from [ActiveState.com](https://activestate.com)
62
64
  - Install [RVM](https://rvm.io/) by running `\curl -sSL https://get.rvm.io | bash -s stable` (and run `curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -` if needed for mentioned security reasons)
63
65
  - Run: `rvm install 2.7.1 --enable-shared --enable-pthread --with-tk --with-tcl`
66
+ - Run: `gem install tk -v0.4.0`
64
67
 
65
68
  Afterwards, if you open `irb`, you should be able to run `require 'tk'` successfully.
66
69
 
@@ -73,11 +76,11 @@ Run this command to install directly:
73
76
  gem install glimmer-dsl-tk
74
77
  ```
75
78
 
76
- ### Option 2: Bundler
79
+ ### Option 2: Bundler
77
80
 
78
81
  Add the following to `Gemfile`:
79
82
  ```
80
- gem 'glimmer-dsl-tk', '~> 0.0.4'
83
+ gem 'glimmer-dsl-tk', '~> 0.0.8'
81
84
  ```
82
85
 
83
86
  And, then run:
@@ -144,7 +147,7 @@ root.mainloop
144
147
  Example of the same app written in [Glimmer](https://github.com/AndyObtiva/glimmer) declarative syntax:
145
148
 
146
149
  ```ruby
147
- root {
150
+ root {
148
151
  title 'Hello, Tab!'
149
152
 
150
153
  notebook {
@@ -163,6 +166,56 @@ root {
163
166
  }.open
164
167
  ```
165
168
 
169
+ ### Smart Defaults and Convensions
170
+
171
+ #### Grid Layout
172
+
173
+ `grid` layout is the default on most widgets (which support it).
174
+
175
+ #### Icon Photo
176
+
177
+ The `iconphoto` attribute on `root` is set to the Glimmer icon by default if no icon photo is supplied.
178
+
179
+ Otherwise, [Glimmer DSL for Tk](https://rubygems.org/gems/glimmer-dsl-tk) is smart enough to accept an image path directly (no need to wrap with `TkPhotoImage`)
180
+
181
+ Example with direct image path (you may copy/paste in [`girb`](#girb-glimmer-irb)):
182
+
183
+ ```ruby
184
+ root {
185
+ title 'Title'
186
+ iconphoto 'icons/glimmer.png'
187
+ }.open
188
+ ```
189
+
190
+ Example with `TkPhotoImage` object (you may copy/paste in [`girb`](#girb-glimmer-irb)):
191
+
192
+ ```ruby
193
+ root {
194
+ title 'Title'
195
+ iconphoto TkPhotoImage.new(file: 'icons/glimmer.png')
196
+ }.open
197
+ ```
198
+
199
+ ## The Grid Geometry Manager
200
+
201
+ The Grid Geometry Manager is supported via the `grid` keyword just as per the [Tk documentation](https://tkdocs.com/tutorial/grid.html), except by nesting under the widget it concerns.
202
+
203
+ Example:
204
+
205
+ ```ruby
206
+ label {
207
+ grid column: 0, row: 2, sticky: 'w'
208
+ text 'Year of Birth: '
209
+ }
210
+ entry {
211
+ grid column: 1, row: 2
212
+ width 15
213
+ text bind(@contact, :year_of_birth)
214
+ }
215
+ ```
216
+
217
+ More details can be found in the [Hello, Computed!](#hello-computed) sample below.
218
+
166
219
  ## Bidirectional Data-Binding
167
220
 
168
221
  Glimmer supports bidirectional data-binding via the `bind` keyword, which takes a model and an attribute.
@@ -174,14 +227,14 @@ Example:
174
227
  This assumes a `Person` model with a `country` attribute representing their current country and a `country_options` attribute representing available options for the country attribute.
175
228
 
176
229
  ```ruby
177
- combobox { |proxy|
178
- state 'readonly'
230
+ combobox {
231
+ state 'readonly'
179
232
  text bind(person, :country)
180
233
  }
181
234
  ```
182
235
 
183
- It binds the `values` of the `combobox` to the `country_options` property on the `person` model (data-binding attribute + "_options" by convention).
184
- That binds the `text` selection of the `combobox` to the `country` property on the `person` model.
236
+ That code sets the `values` of the `combobox` to the `country_options` property on the `person` model (data-binding attribute + "_options" by convention).
237
+ It also binds the `text` selection of the `combobox` to the `country` property on the `person` model.
185
238
 
186
239
  It automatically handles all the Tk plumbing behind the scenes, such as using `TkVariable` and setting `combobox` `values` from `person.country_options` by convention (attribute_name + "_options").
187
240
 
@@ -197,12 +250,12 @@ This assumes a `Person` model with a `country` attribute representing their curr
197
250
 
198
251
  ```ruby
199
252
  list {
200
- selectmode 'browse'
253
+ selectmode 'browse'
201
254
  text bind(person, :country)
202
255
  }
203
256
  ```
204
257
 
205
- It binds the `items` text of the `list` to the `country_options` property on the `person` model (data-binding attribute + "_options" by convention).
258
+ That code binds the `items` text of the `list` to the `country_options` property on the `person` model (data-binding attribute + "_options" by convention).
206
259
  It also binds the `selection` text of the `list` to the `country` property on the `person` model.
207
260
 
208
261
  It automatically handles all the Tk plumbing behind the scenes.
@@ -223,13 +276,49 @@ This assumes a `Person` model with a `provinces` attribute representing their cu
223
276
  }
224
277
  ```
225
278
 
226
- It binds the `items` text of the `list` to the `provinces_options` property on the `person` model (data-binding attribute + "_options" by convention)
227
- That binds the `selection` text of the `list` to the `provinces` property on the `person` model.
279
+ That code binds the `items` text of the `list` to the `provinces_options` property on the `person` model (data-binding attribute + "_options" by convention).
280
+ It also binds the `selection` text of the `list` to the `provinces` property on the `person` model.
228
281
 
229
282
  It automatically handles all the Tk plumbing behind the scenes.
230
283
 
231
284
  More details can be found in the [Hello, List Multi Selection!](#hello-list-multi-selection) sample below.
232
285
 
286
+ ### Label Data-Binding
287
+
288
+ Example:
289
+
290
+ This assumes a `Person` model with a `country` attribute.
291
+
292
+ ```ruby
293
+ label {
294
+ text bind(person, :country)
295
+ }
296
+ ```
297
+
298
+ That code binds the `textvariable` value of the `label` to the `country` property on the `person` model.
299
+
300
+ It automatically handles all the Tk plumbing behind the scenes.
301
+
302
+ More details can be found in the [Hello, Computed!](#hello-computed) sample below.
303
+
304
+ ### Entry Data-Binding
305
+
306
+ Example:
307
+
308
+ This assumes a `Person` model with a `country` attribute.
309
+
310
+ ```ruby
311
+ entry {
312
+ text bind(person, :country)
313
+ }
314
+ ```
315
+
316
+ That code binds the `textvariable` value of the `entry` to the `country` property on the `person` model.
317
+
318
+ It automatically handles all the Tk plumbing behind the scenes.
319
+
320
+ More details can be found in the [Hello, Computed!](#hello-computed) sample below.
321
+
233
322
  ## Command Observer
234
323
 
235
324
  Buttons can set a `command` option to trigger when the user clicks the button. This may be done with the `command` keyword, passing in a block directly (no need for `proc` as per Tk)
@@ -265,10 +354,16 @@ root {
265
354
  }.open
266
355
  ```
267
356
 
268
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
357
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
358
+
359
+ ```
360
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_world'"
361
+ ```
362
+
363
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
269
364
 
270
365
  ```
271
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
366
+ ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_world'"
272
367
  ```
273
368
 
274
369
  Glimmer app:
@@ -282,7 +377,7 @@ Glimmer code (from [samples/hello/hello_tab.rb](samples/hello/hello_tab.rb)):
282
377
  ```ruby
283
378
  include Glimmer
284
379
 
285
- root {
380
+ root {
286
381
  title 'Hello, Tab!'
287
382
 
288
383
  notebook {
@@ -301,10 +396,16 @@ root {
301
396
  }.open
302
397
  ```
303
398
 
304
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
399
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
400
+
401
+ ```
402
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_tab'"
403
+ ```
404
+
405
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
305
406
 
306
407
  ```
307
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_tab.rb'"
408
+ ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_tab'"
308
409
  ```
309
410
 
310
411
  Glimmer app:
@@ -322,7 +423,7 @@ root {
322
423
  title 'Hello, Combo!'
323
424
 
324
425
  combobox { |proxy|
325
- state 'readonly'
426
+ state 'readonly'
326
427
  text bind(person, :country)
327
428
  }
328
429
 
@@ -336,10 +437,16 @@ root {
336
437
  # ... more code follows
337
438
  ```
338
439
 
339
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
440
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
441
+
442
+ ```
443
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_combo'"
444
+ ```
445
+
446
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
340
447
 
341
448
  ```
342
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combo.rb'"
449
+ ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_combo'"
343
450
  ```
344
451
 
345
452
  Glimmer app:
@@ -353,7 +460,7 @@ Glimmer code (from [samples/hello/hello_list_single_selection.rb](samples/hello/
353
460
 
354
461
  ```ruby
355
462
  # ... more code precedes
356
- root {
463
+ root {
357
464
  title 'Hello, List Single Selection!'
358
465
 
359
466
  list {
@@ -370,10 +477,16 @@ root {
370
477
  # ... more code follows
371
478
  ```
372
479
 
373
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
480
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
481
+
482
+ ```
483
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_list_single_selection'"
484
+ ```
485
+
486
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
374
487
 
375
488
  ```
376
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_list_single_selection.rb'"
489
+ ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_list_single_selection'"
377
490
  ```
378
491
 
379
492
  Glimmer app:
@@ -402,16 +515,102 @@ root {
402
515
  # ... more code follows
403
516
  ```
404
517
 
405
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
518
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
406
519
 
407
520
  ```
408
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_list_multi_selection.rb'"
521
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_list_multi_selection'"
522
+ ```
523
+
524
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
525
+
526
+ ```
527
+ ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_list_multi_selection'"
409
528
  ```
410
529
 
411
530
  Glimmer app:
412
531
 
413
532
  ![glimmer dsl tk screenshot sample hello list multi selection](images/glimmer-dsl-tk-screenshot-sample-hello-list-multi-selection.png)
414
533
 
534
+ ### Hello, Computed!
535
+
536
+ Glimmer code (from [samples/hello/hello_computed.rb](samples/hello/hello_computed.rb)):
537
+
538
+ ```ruby
539
+ # ... more code precedes
540
+ root {
541
+ title 'Hello, Computed!'
542
+
543
+ frame {
544
+ grid column: 0, row: 0, padx: 5, pady: 5
545
+
546
+ label {
547
+ grid column: 0, row: 0, sticky: 'w'
548
+ text 'First Name: '
549
+ }
550
+ entry {
551
+ grid column: 1, row: 0
552
+ width 15
553
+ text bind(@contact, :first_name)
554
+ }
555
+
556
+ label {
557
+ grid column: 0, row: 1, sticky: 'w'
558
+ text 'Last Name: '
559
+ }
560
+ entry {
561
+ grid column: 1, row: 1
562
+ width 15
563
+ text bind(@contact, :last_name)
564
+ }
565
+
566
+ label {
567
+ grid column: 0, row: 2, sticky: 'w'
568
+ text 'Year of Birth: '
569
+ }
570
+ entry {
571
+ grid column: 1, row: 2
572
+ width 15
573
+ text bind(@contact, :year_of_birth)
574
+ }
575
+
576
+ label {
577
+ grid column: 0, row: 3, sticky: 'w'
578
+ text 'Name: '
579
+ }
580
+ label {
581
+ grid column: 1, row: 3, sticky: 'w'
582
+ text bind(@contact, :name, computed_by: [:first_name, :last_name])
583
+ }
584
+
585
+ label {
586
+ grid column: 0, row: 4, sticky: 'w'
587
+ text 'Age: '
588
+ }
589
+ label {
590
+ grid column: 1, row: 4, sticky: 'w'
591
+ text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
592
+ }
593
+ }
594
+ }.open
595
+ # ... more code follows
596
+ ```
597
+
598
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
599
+
600
+ ```
601
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_computed'"
602
+ ```
603
+
604
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
605
+
606
+ ```
607
+ ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_computed'"
608
+ ```
609
+
610
+ Glimmer app:
611
+
612
+ ![glimmer dsl tk screenshot sample hello computed](images/glimmer-dsl-tk-screenshot-sample-hello-computed.png)
613
+
415
614
  ## Help
416
615
 
417
616
  ### Issues
@@ -428,9 +627,9 @@ If you need live help, try to [![Join the chat at https://gitter.im/AndyObtiva/g
428
627
 
429
628
  [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
430
629
 
431
- ## Feature Suggestions
630
+ ## Planned Features and Feature Suggestions
432
631
 
433
- These features have been suggested. You might see them in a future version of Glimmer DSL for Tk. You are welcome to contribute more feature suggestions.
632
+ These features have been planned or suggested. You might see them in a future version of Glimmer DSL for Tk. You are welcome to contribute more feature suggestions.
434
633
 
435
634
  [TODO.md](TODO.md)
436
635
 
@@ -452,8 +651,8 @@ These features have been suggested. You might see them in a future version of Gl
452
651
 
453
652
  [MIT](LICENSE.txt)
454
653
 
455
- Copyright (c) 2020 - Andy Maleh.
654
+ Copyright (c) 2020-2021 - Andy Maleh.
456
655
 
457
656
  --
458
657
 
459
- [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
658
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (DSL Framework).