glimmer-dsl-tk 0.0.3 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/LICENSE.txt +1 -1
- data/README.md +282 -28
- data/VERSION +1 -1
- data/bin/girb +30 -0
- data/bin/girb_runner.rb +26 -0
- data/lib/glimmer-dsl-tk.rb +4 -4
- data/lib/glimmer/data_binding/tk/list_selection_binding.rb +75 -0
- data/lib/glimmer/data_binding/tk/widget_binding.rb +22 -1
- data/lib/glimmer/dsl/tk/attribute_expression.rb +4 -4
- data/lib/glimmer/dsl/tk/bind_expression.rb +21 -0
- data/lib/glimmer/dsl/tk/block_attribute_expression.rb +4 -4
- data/lib/glimmer/dsl/tk/data_binding_expression.rb +24 -2
- data/lib/glimmer/dsl/tk/dsl.rb +5 -4
- data/lib/glimmer/dsl/tk/list_selection_data_binding_expression.rb +60 -0
- data/lib/glimmer/dsl/tk/root_expression.rb +4 -4
- data/lib/glimmer/dsl/tk/widget_expression.rb +7 -4
- data/lib/glimmer/tk/button_proxy.rb +5 -5
- data/lib/glimmer/tk/entry_proxy.rb +38 -0
- data/lib/glimmer/tk/frame_proxy.rb +5 -5
- data/lib/glimmer/tk/label_proxy.rb +40 -0
- data/lib/glimmer/tk/list_proxy.rb +60 -0
- data/lib/glimmer/tk/notebook_proxy.rb +5 -5
- data/lib/glimmer/tk/root_proxy.rb +4 -4
- data/lib/glimmer/tk/widget_proxy.rb +118 -56
- data/samples/hello/hello_combo.rb +26 -5
- data/samples/hello/hello_computed.rb +96 -0
- data/samples/hello/hello_computed/contact.rb +21 -0
- data/samples/hello/hello_list_multi_selection.rb +69 -0
- data/samples/hello/hello_list_single_selection.rb +60 -0
- data/samples/hello/hello_tab.rb +22 -1
- data/samples/hello/hello_world.rb +4 -4
- metadata +18 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7048451aa588f11c433d93073beb1a3eda6d03877e076ed9a3c23d432746e492
|
4
|
+
data.tar.gz: 4797910066441f8d0bf8960ca5bc3732ea39d6b0bd4103a3246349921a133bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d25ea1d5a2c22ecc11fcc526cf264c207e21bbb018a1e05627aee01d6ce50aa8f9ce94a7fc57f0546221c0db9ab9bba46dc91a10c9ab0329de73bf7c9d56241
|
7
|
+
data.tar.gz: eccf58d86c03fb9b0383180025a7cc30d31f9b2dd98cfa36d422592170fbe01266d4a0487e020e241e69637e17754361207524a51a487b62494cd963fc6fb829
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.7
|
4
|
+
|
5
|
+
- Upgraded to tk 0.4.0
|
6
|
+
- Fixed `girb` by changing to a pure Ruby script
|
7
|
+
|
8
|
+
## 0.0.6
|
9
|
+
|
10
|
+
- Upgraded to tk 0.3.0
|
11
|
+
|
12
|
+
## 0.0.5
|
13
|
+
|
14
|
+
- Label text data-binding
|
15
|
+
- Entry text data-binding
|
16
|
+
- The `grid` geometry manager
|
17
|
+
- Hello, Computed! sample
|
18
|
+
|
19
|
+
## 0.0.4
|
20
|
+
|
21
|
+
- `list` custom widget (since listbox is not tile themed yet in Tk)
|
22
|
+
- `girb` (Glimmer IRB)
|
23
|
+
- Hello, List Single Selection! sample
|
24
|
+
- Hello, List Multi Selection! sample
|
25
|
+
|
26
|
+
## 0.0.3
|
27
|
+
|
28
|
+
- Combobox support
|
29
|
+
- Button command event observer support
|
30
|
+
- Combobox text data-binding
|
31
|
+
- Hello, Combo! sample
|
32
|
+
|
3
33
|
## 0.0.2
|
4
34
|
|
5
35
|
- Notebook/frame support
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,29 @@
|
|
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.
|
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.7
|
2
|
+
## MRI Ruby Desktop Development GUI Library
|
3
|
+
GUI Library
|
2
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-tk.svg)](http://badge.fury.io/rb/glimmer-dsl-tk)
|
5
|
+
[![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)
|
3
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-tk/maintainability)
|
4
7
|
[![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)
|
5
8
|
|
6
|
-
[
|
9
|
+
**[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](CONTRIBUTING.md)**
|
7
10
|
|
8
|
-
[
|
11
|
+
[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).
|
12
|
+
|
13
|
+
[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.).
|
9
14
|
|
10
15
|
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).
|
11
16
|
|
12
|
-
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/).
|
17
|
+
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/).
|
13
18
|
|
14
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer)
|
19
|
+
[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:
|
15
20
|
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
16
21
|
- Convention over configuration via smart defaults and automation of low-level details
|
17
22
|
- Requiring the least amount of syntax possible to build GUI
|
18
23
|
- Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
|
24
|
+
- Custom Widget support
|
19
25
|
- Scaffolding for new custom widgets, apps, and gems
|
20
26
|
- Native-Executable packaging on Mac, Windows, and Linux
|
21
|
-
- Custom Widget support
|
22
27
|
|
23
28
|
**Hello, World!**
|
24
29
|
|
@@ -42,9 +47,11 @@ Glimmer app:
|
|
42
47
|
|
43
48
|
![glimmer dsl tk screenshot sample hello world](images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
44
49
|
|
50
|
+
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.
|
51
|
+
|
45
52
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
46
|
-
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop GUI)
|
47
|
-
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI
|
53
|
+
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
54
|
+
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
48
55
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
49
56
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
50
57
|
|
@@ -53,7 +60,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
53
60
|
- [Tcl/Tk](https://www.tcl.tk/): Follow the [install instructions](https://tkdocs.com/tutorial/install.html)
|
54
61
|
- [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).
|
55
62
|
|
56
|
-
For example, on the Mac, you can:
|
63
|
+
For example, on the Mac, you can:
|
57
64
|
- Install the ActiveTcl Mac package from [ActiveState.com](ActiveState.com)
|
58
65
|
- 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)
|
59
66
|
- Run: `rvm install 2.7.1 --enable-shared --enable-pthread --with-tk --with-tcl`
|
@@ -66,18 +73,14 @@ Afterwards, if you open `irb`, you should be able to run `require 'tk'` successf
|
|
66
73
|
|
67
74
|
Run this command to install directly:
|
68
75
|
```
|
69
|
-
gem install logging
|
70
|
-
gem install super_module
|
71
76
|
gem install glimmer-dsl-tk
|
72
77
|
```
|
73
78
|
|
74
|
-
### Option 2: Bundler
|
79
|
+
### Option 2: Bundler
|
75
80
|
|
76
81
|
Add the following to `Gemfile`:
|
77
82
|
```
|
78
|
-
gem '
|
79
|
-
gem 'super_module'
|
80
|
-
gem 'glimmer-dsl-tk', '~> 0.0.3'
|
83
|
+
gem 'glimmer-dsl-tk', '~> 0.0.7'
|
81
84
|
```
|
82
85
|
|
83
86
|
And, then run:
|
@@ -85,6 +88,16 @@ And, then run:
|
|
85
88
|
bundle
|
86
89
|
```
|
87
90
|
|
91
|
+
## Girb (Glimmer IRB)
|
92
|
+
|
93
|
+
You can run the `girb` command (`bin/girb` if you cloned the project locally):
|
94
|
+
|
95
|
+
```
|
96
|
+
girb
|
97
|
+
```
|
98
|
+
|
99
|
+
This gives you `irb` with the `glimmer-dsl-tk` gem loaded and the `Glimmer` module mixed into the main object for easy experimentation with GUI.
|
100
|
+
|
88
101
|
## Tk Concepts
|
89
102
|
|
90
103
|
Here is a summary taken from the official [Tk Concepts Tutorial](https://tkdocs.com/tutorial/concepts.html)
|
@@ -134,7 +147,7 @@ root.mainloop
|
|
134
147
|
Example of the same app written in [Glimmer](https://github.com/AndyObtiva/glimmer) declarative syntax:
|
135
148
|
|
136
149
|
```ruby
|
137
|
-
root {
|
150
|
+
root {
|
138
151
|
title 'Hello, Tab!'
|
139
152
|
|
140
153
|
notebook {
|
@@ -153,35 +166,137 @@ root {
|
|
153
166
|
}.open
|
154
167
|
```
|
155
168
|
|
156
|
-
|
169
|
+
## The Grid Geometry Manager
|
170
|
+
|
171
|
+
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.
|
172
|
+
|
173
|
+
Example:
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
label {
|
177
|
+
grid column: 0, row: 2, sticky: 'w'
|
178
|
+
text 'Year of Birth: '
|
179
|
+
}
|
180
|
+
entry {
|
181
|
+
grid column: 1, row: 2
|
182
|
+
width 15
|
183
|
+
text bind(@contact, :year_of_birth)
|
184
|
+
}
|
185
|
+
```
|
186
|
+
|
187
|
+
More details can be found in the [Hello, Computed!](#hello-computed) sample below.
|
188
|
+
|
189
|
+
## Bidirectional Data-Binding
|
157
190
|
|
158
191
|
Glimmer supports bidirectional data-binding via the `bind` keyword, which takes a model and an attribute.
|
159
192
|
|
193
|
+
### Combo Data-Binding
|
194
|
+
|
160
195
|
Example:
|
161
196
|
|
162
197
|
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.
|
163
198
|
|
164
199
|
```ruby
|
165
|
-
combobox {
|
166
|
-
state 'readonly'
|
200
|
+
combobox {
|
201
|
+
state 'readonly'
|
167
202
|
text bind(person, :country)
|
168
203
|
}
|
169
204
|
```
|
170
205
|
|
171
|
-
That
|
206
|
+
That code sets the `values` of the `combobox` to the `country_options` property on the `person` model (data-binding attribute + "_options" by convention).
|
207
|
+
It also binds the `text` selection of the `combobox` to the `country` property on the `person` model.
|
172
208
|
|
173
209
|
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").
|
174
210
|
|
175
211
|
More details can be found in the [Hello, Combo!](#hello-combo) sample below.
|
176
212
|
|
177
|
-
###
|
213
|
+
### List Single Selection Data-Binding
|
214
|
+
|
215
|
+
Tk does not support a native themed listbox, so Glimmer implements its own `list` widget on top of `Tk::Tile::Treeview`. It is set to single selection via selectmode 'browse'.
|
216
|
+
|
217
|
+
Example:
|
218
|
+
|
219
|
+
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.
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
list {
|
223
|
+
selectmode 'browse'
|
224
|
+
text bind(person, :country)
|
225
|
+
}
|
226
|
+
```
|
227
|
+
|
228
|
+
That code binds the `items` text of the `list` to the `country_options` property on the `person` model (data-binding attribute + "_options" by convention).
|
229
|
+
It also binds the `selection` text of the `list` to the `country` property on the `person` model.
|
230
|
+
|
231
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
232
|
+
|
233
|
+
More details can be found in the [Hello, List Single Selection!](#hello-list-single-selection) sample below.
|
234
|
+
|
235
|
+
### List Multi Selection Data-Binding
|
236
|
+
|
237
|
+
Tk does not support a native themed listbox, so Glimmer implements its own `list` widget on top of `Tk::Tile::Treeview`. It is set to multi selection by default.
|
238
|
+
|
239
|
+
Example:
|
240
|
+
|
241
|
+
This assumes a `Person` model with a `provinces` attribute representing their current country and a `provinces_options` attribute representing available options for the provinces attribute.
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
list {
|
245
|
+
text bind(person, :provinces)
|
246
|
+
}
|
247
|
+
```
|
248
|
+
|
249
|
+
That code binds the `items` text of the `list` to the `provinces_options` property on the `person` model (data-binding attribute + "_options" by convention).
|
250
|
+
It also binds the `selection` text of the `list` to the `provinces` property on the `person` model.
|
251
|
+
|
252
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
253
|
+
|
254
|
+
More details can be found in the [Hello, List Multi Selection!](#hello-list-multi-selection) sample below.
|
255
|
+
|
256
|
+
### Label Data-Binding
|
257
|
+
|
258
|
+
Example:
|
259
|
+
|
260
|
+
This assumes a `Person` model with a `country` attribute.
|
261
|
+
|
262
|
+
```ruby
|
263
|
+
label {
|
264
|
+
text bind(person, :country)
|
265
|
+
}
|
266
|
+
```
|
267
|
+
|
268
|
+
That code binds the `textvariable` value of the `label` to the `country` property on the `person` model.
|
269
|
+
|
270
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
271
|
+
|
272
|
+
More details can be found in the [Hello, Computed!](#hello-computed) sample below.
|
273
|
+
|
274
|
+
### Entry Data-Binding
|
275
|
+
|
276
|
+
Example:
|
277
|
+
|
278
|
+
This assumes a `Person` model with a `country` attribute.
|
279
|
+
|
280
|
+
```ruby
|
281
|
+
entry {
|
282
|
+
text bind(person, :country)
|
283
|
+
}
|
284
|
+
```
|
285
|
+
|
286
|
+
That code binds the `textvariable` value of the `entry` to the `country` property on the `person` model.
|
287
|
+
|
288
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
289
|
+
|
290
|
+
More details can be found in the [Hello, Computed!](#hello-computed) sample below.
|
291
|
+
|
292
|
+
## Command Observer
|
178
293
|
|
179
294
|
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)
|
180
295
|
|
181
296
|
Example:
|
182
297
|
|
183
298
|
```ruby
|
184
|
-
button {
|
299
|
+
button {
|
185
300
|
text "Reset Selection"
|
186
301
|
command {
|
187
302
|
person.reset_country
|
@@ -226,7 +341,7 @@ Glimmer code (from [samples/hello/hello_tab.rb](samples/hello/hello_tab.rb)):
|
|
226
341
|
```ruby
|
227
342
|
include Glimmer
|
228
343
|
|
229
|
-
root {
|
344
|
+
root {
|
230
345
|
title 'Hello, Tab!'
|
231
346
|
|
232
347
|
notebook {
|
@@ -266,7 +381,7 @@ root {
|
|
266
381
|
title 'Hello, Combo!'
|
267
382
|
|
268
383
|
combobox { |proxy|
|
269
|
-
state 'readonly'
|
384
|
+
state 'readonly'
|
270
385
|
text bind(person, :country)
|
271
386
|
}
|
272
387
|
|
@@ -291,6 +406,145 @@ Glimmer app:
|
|
291
406
|
![glimmer dsl tk screenshot sample hello combo](images/glimmer-dsl-tk-screenshot-sample-hello-combo.png)
|
292
407
|
![glimmer dsl tk screenshot sample hello combo dropdown](images/glimmer-dsl-tk-screenshot-sample-hello-combo-dropdown.png)
|
293
408
|
|
409
|
+
### Hello, List Single Selection!
|
410
|
+
|
411
|
+
Glimmer code (from [samples/hello/hello_list_single_selection.rb](samples/hello/hello_list_single_selection.rb)):
|
412
|
+
|
413
|
+
```ruby
|
414
|
+
# ... more code precedes
|
415
|
+
root {
|
416
|
+
title 'Hello, List Single Selection!'
|
417
|
+
|
418
|
+
list {
|
419
|
+
selectmode 'browse'
|
420
|
+
selection bind(person, :country)
|
421
|
+
}
|
422
|
+
|
423
|
+
button {
|
424
|
+
text "Reset Selection To Default Value"
|
425
|
+
|
426
|
+
command { person.reset_country }
|
427
|
+
}
|
428
|
+
}.open
|
429
|
+
# ... more code follows
|
430
|
+
```
|
431
|
+
|
432
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
433
|
+
|
434
|
+
```
|
435
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_list_single_selection.rb'"
|
436
|
+
```
|
437
|
+
|
438
|
+
Glimmer app:
|
439
|
+
|
440
|
+
![glimmer dsl tk screenshot sample hello list single selection](images/glimmer-dsl-tk-screenshot-sample-hello-list-single-selection.png)
|
441
|
+
|
442
|
+
### Hello, List Multi Selection!
|
443
|
+
|
444
|
+
Glimmer code (from [samples/hello/hello_list_multi_selection.rb](samples/hello/hello_list_multi_selection.rb)):
|
445
|
+
|
446
|
+
```ruby
|
447
|
+
# ... more code precedes
|
448
|
+
root {
|
449
|
+
title 'Hello, List Multi Selection!'
|
450
|
+
|
451
|
+
list {
|
452
|
+
selection bind(person, :provinces)
|
453
|
+
}
|
454
|
+
|
455
|
+
button {
|
456
|
+
text "Reset Selection To Defaults"
|
457
|
+
|
458
|
+
command { person.reset_provinces }
|
459
|
+
}
|
460
|
+
}.open
|
461
|
+
# ... more code follows
|
462
|
+
```
|
463
|
+
|
464
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
465
|
+
|
466
|
+
```
|
467
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_list_multi_selection.rb'"
|
468
|
+
```
|
469
|
+
|
470
|
+
Glimmer app:
|
471
|
+
|
472
|
+
![glimmer dsl tk screenshot sample hello list multi selection](images/glimmer-dsl-tk-screenshot-sample-hello-list-multi-selection.png)
|
473
|
+
|
474
|
+
### Hello, Computed!
|
475
|
+
|
476
|
+
Glimmer code (from [samples/hello/hello_computed.rb](samples/hello/hello_computed.rb)):
|
477
|
+
|
478
|
+
```ruby
|
479
|
+
# ... more code precedes
|
480
|
+
root {
|
481
|
+
title 'Hello, Computed!'
|
482
|
+
|
483
|
+
frame {
|
484
|
+
grid column: 0, row: 0, padx: 5, pady: 5
|
485
|
+
|
486
|
+
label {
|
487
|
+
grid column: 0, row: 0, sticky: 'w'
|
488
|
+
text 'First Name: '
|
489
|
+
}
|
490
|
+
entry {
|
491
|
+
grid column: 1, row: 0
|
492
|
+
width 15
|
493
|
+
text bind(@contact, :first_name)
|
494
|
+
}
|
495
|
+
|
496
|
+
label {
|
497
|
+
grid column: 0, row: 1, sticky: 'w'
|
498
|
+
text 'Last Name: '
|
499
|
+
}
|
500
|
+
entry {
|
501
|
+
grid column: 1, row: 1
|
502
|
+
width 15
|
503
|
+
text bind(@contact, :last_name)
|
504
|
+
}
|
505
|
+
|
506
|
+
label {
|
507
|
+
grid column: 0, row: 2, sticky: 'w'
|
508
|
+
text 'Year of Birth: '
|
509
|
+
}
|
510
|
+
entry {
|
511
|
+
grid column: 1, row: 2
|
512
|
+
width 15
|
513
|
+
text bind(@contact, :year_of_birth)
|
514
|
+
}
|
515
|
+
|
516
|
+
label {
|
517
|
+
grid column: 0, row: 3, sticky: 'w'
|
518
|
+
text 'Name: '
|
519
|
+
}
|
520
|
+
label {
|
521
|
+
grid column: 1, row: 3, sticky: 'w'
|
522
|
+
text bind(@contact, :name, computed_by: [:first_name, :last_name])
|
523
|
+
}
|
524
|
+
|
525
|
+
label {
|
526
|
+
grid column: 0, row: 4, sticky: 'w'
|
527
|
+
text 'Age: '
|
528
|
+
}
|
529
|
+
label {
|
530
|
+
grid column: 1, row: 4, sticky: 'w'
|
531
|
+
text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
|
532
|
+
}
|
533
|
+
}
|
534
|
+
}.open
|
535
|
+
# ... more code follows
|
536
|
+
```
|
537
|
+
|
538
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
539
|
+
|
540
|
+
```
|
541
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_computed.rb'"
|
542
|
+
```
|
543
|
+
|
544
|
+
Glimmer app:
|
545
|
+
|
546
|
+
![glimmer dsl tk screenshot sample hello computed](images/glimmer-dsl-tk-screenshot-sample-hello-computed.png)
|
547
|
+
|
294
548
|
## Help
|
295
549
|
|
296
550
|
### Issues
|
@@ -307,9 +561,9 @@ If you need live help, try to [![Join the chat at https://gitter.im/AndyObtiva/g
|
|
307
561
|
|
308
562
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
309
563
|
|
310
|
-
## Feature Suggestions
|
564
|
+
## Planned Features and Feature Suggestions
|
311
565
|
|
312
|
-
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.
|
566
|
+
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.
|
313
567
|
|
314
568
|
[TODO.md](TODO.md)
|
315
569
|
|
@@ -331,8 +585,8 @@ These features have been suggested. You might see them in a future version of Gl
|
|
331
585
|
|
332
586
|
[MIT](LICENSE.txt)
|
333
587
|
|
334
|
-
Copyright (c) 2020 - Andy Maleh.
|
588
|
+
Copyright (c) 2020-2021 - Andy Maleh.
|
335
589
|
|
336
590
|
--
|
337
591
|
|
338
|
-
[<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) (
|
592
|
+
[<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).
|