glimmer 1.0.7 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +244 -257
- data/VERSION +1 -1
- data/glimmer.gemspec +36 -19
- data/lib/glimmer.rb +13 -1
- data/lib/glimmer/data_binding/model_binding.rb +37 -24
- data/lib/glimmer/data_binding/observable_array.rb +6 -5
- data/lib/glimmer/data_binding/observable_model.rb +3 -2
- data/lib/glimmer/data_binding/observer.rb +6 -2
- data/lib/glimmer/dsl/engine.rb +15 -13
- data/lib/glimmer/ext/module.rb +11 -0
- metadata +36 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c181d967c5d8c834867570a112937498dd4d45c9585f357a683368de979967c1
|
4
|
+
data.tar.gz: 50a1ed33fd43a34e500de9ce2954d02ffc511204108c8d80b99eb31b885c8f1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1d46f0e7f051000acbcf5756dd3c15a892583557388a181d47186e74a39f4eeb27c3c05b94780cae47c67f8b5a3e4c8a237cd5ce94c551cbb0eec8a6494af3
|
7
|
+
data.tar.gz: 54ce9ae27a6f5f4b320783ec1e107cde725435da3e3bb3199bb6ff44a89f647de81339654be98d06a903aed3feb4caf096bbc80d9c9e9df8ef194e3c9789b8a4
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,28 @@
|
|
3
3
|
Related Change Logs:
|
4
4
|
- [glimmer-dsl-swt/CHANGELOG.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/CHANGELOG.md)
|
5
5
|
|
6
|
+
## 1.1.0
|
7
|
+
|
8
|
+
- ModelBinding hooks for before_read, after_read, before_write, after_write
|
9
|
+
|
10
|
+
## 1.0.11
|
11
|
+
|
12
|
+
- Alias unregister as deregister everywhere
|
13
|
+
- Optimize performance of `Glimmer::Config.excluded_keyword_checkers` in glimmer method_missing
|
14
|
+
|
15
|
+
## 1.0.10
|
16
|
+
|
17
|
+
- Avoid using concurrent-ruby in Opal
|
18
|
+
|
19
|
+
## 1.0.9
|
20
|
+
|
21
|
+
- Fixed issue with top-level static expressions sometimes not working (e.g. async_exec in DSL for SWT) with DSL detected as nil
|
22
|
+
|
23
|
+
## 1.0.8
|
24
|
+
|
25
|
+
- Concurrent Array/Hash/Set data structures to better support parallel multi-threading
|
26
|
+
- Fix issue with a certain nil static_expression case not handled properly in Glimmer::DSL::Engine
|
27
|
+
|
6
28
|
## 1.0.7
|
7
29
|
|
8
30
|
- Refactor generated `__original_{method_name}` methods in `ObservableModel` to have double-underscore after the word "original" as `__original__{method_name}` to improve clarity that the method is generated via meta-programming of a pre-existing method
|
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 style="position: relative; top: 20px;" />](https://rubygems.org/gems/glimmer) Glimmer 1.0
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 style="position: relative; top: 20px;" />](https://rubygems.org/gems/glimmer) Glimmer 1.1.0 - DSL Framework for GUI and More
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
|
3
3
|
[![rspec](https://github.com/AndyObtiva/glimmer/workflows/rspec/badge.svg)](https://github.com/AndyObtiva/glimmer/actions?query=workflow%3Arspec)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer?branch=master)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
**(The Original Glimmer Library Since 2007. Beware of Imitators!)**
|
11
11
|
|
12
|
-
[**Glimmer**](https://rubygems.org/gems/glimmer) started out as a [GUI Library](https://github.com/AndyObtiva/glimmer-dsl-swt) and grew into a full-fledged [DSL Framework](#dsl-engine) with support for multiple GUI DSLs. Glimmer's namesake is referring to the Glimmer of Ruby in Graphical User Interfaces (contrary to popular myth perpetrated by [Charles Nutter](http://blog.headius.com/2007/11/tab-sweep.html), Glimmer has nothing to do with the ill-fated Whitney Houston movie, which does not in fact share the same name)
|
12
|
+
[**Glimmer**](https://rubygems.org/gems/glimmer) started out as a [GUI Library](https://github.com/AndyObtiva/glimmer-dsl-swt) and grew into a full-fledged [DSL Framework](#dsl-engine) with support for multiple GUI DSLs. Glimmer's namesake is referring to the Glimmer of Ruby in Graphical User Interfaces (contrary to [popular myth](http://blog.headius.com/2007/11/tab-sweep.html) perpetrated by [Charles Nutter](http://blog.headius.com/2007/11/tab-sweep.html), Glimmer has nothing to do with the ill-fated Whitney Houston movie, which does not in fact share the same name)
|
13
13
|
|
14
14
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
15
15
|
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)
|
@@ -32,19 +32,19 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
32
32
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
33
33
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
34
34
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
35
|
-
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
35
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
36
36
|
|
37
37
|
[Glimmer and/or Glimmer DSLs receive two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby development needs.
|
38
38
|
|
39
39
|
## Table of Contents
|
40
40
|
|
41
|
-
- [Glimmer 1.0
|
41
|
+
- [Glimmer 1.1.0](#-glimmer-110---dsl-framework-for-gui-and-more)
|
42
42
|
- [Official DSLs](#official-dsls)
|
43
43
|
- [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](#glimmer-dsl-for-swt-jruby-desktop-development-gui-framework)
|
44
|
-
- [Glimmer DSL for Tk (Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-ruby-desktop-development-gui-library)
|
45
44
|
- [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](#glimmer-dsl-for-opal-pure-ruby-web-gui-and-auto-webifier-of-desktop-apps)
|
46
45
|
- [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
|
47
46
|
- [Glimmer DSL for CSS](#glimmer-dsl-for-css)
|
47
|
+
- [Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-mri-ruby-desktop-development-gui-library)
|
48
48
|
- [DSL Engine](#dsl-engine)
|
49
49
|
- [Multi-DSL Support](#multi-dsl-support)
|
50
50
|
- [Data-Binding Library](#data-binding-library)
|
@@ -76,6 +76,8 @@ To get started, visit the [Glimmer DSL for SWT project page](https://github.com/
|
|
76
76
|
|
77
77
|
##### Hello, World!
|
78
78
|
|
79
|
+
![Hello World](images/glimmer-hello-world.png)
|
80
|
+
|
79
81
|
Glimmer GUI code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
|
80
82
|
```ruby
|
81
83
|
include Glimmer
|
@@ -88,162 +90,141 @@ shell {
|
|
88
90
|
}.open
|
89
91
|
```
|
90
92
|
|
91
|
-
Glimmer
|
92
|
-
|
93
|
-
![Hello World](images/glimmer-hello-world.png)
|
93
|
+
##### Glimmer Tetris
|
94
94
|
|
95
|
-
|
95
|
+
![Tetris](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-swt/v4.18.3.1/images/glimmer-tetris.png)
|
96
96
|
|
97
|
-
Glimmer GUI code (from [samples/elaborate/
|
97
|
+
Glimmer GUI code (from [samples/elaborate/tetris.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/v4.18.3.1/samples/elaborate/tetris.rb)):
|
98
98
|
|
99
99
|
```ruby
|
100
100
|
# ...
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
101
|
+
shell(:no_resize) {
|
102
|
+
grid_layout {
|
103
|
+
num_columns 2
|
104
|
+
make_columns_equal_width false
|
105
|
+
margin_width 0
|
106
|
+
margin_height 0
|
107
|
+
horizontal_spacing 0
|
108
|
+
}
|
109
|
+
|
110
|
+
text 'Glimmer Tetris'
|
111
|
+
minimum_size 475, 500
|
112
|
+
background :gray
|
113
|
+
|
114
|
+
tetris_menu_bar(game: game)
|
115
|
+
|
116
|
+
playfield(game_playfield: game.playfield, playfield_width: playfield_width, playfield_height: playfield_height, block_size: BLOCK_SIZE)
|
117
|
+
|
118
|
+
score_lane(game: game, block_size: BLOCK_SIZE) {
|
119
|
+
layout_data(:fill, :fill, true, true)
|
120
|
+
}
|
121
|
+
|
122
|
+
on_widget_disposed {
|
123
|
+
deregister_observers
|
119
124
|
}
|
120
125
|
}
|
121
126
|
# ...
|
122
127
|
```
|
123
128
|
|
124
|
-
|
125
|
-
|
126
|
-
![Tic Tac Toe](images/glimmer-tic-tac-toe-in-progress.png)
|
129
|
+
##### Hello, Table!
|
127
130
|
|
128
|
-
|
131
|
+
![Hello Table](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-swt/master/images/glimmer-hello-table.png)
|
129
132
|
|
130
|
-
Glimmer GUI code (from [samples/
|
133
|
+
Glimmer GUI code (from [samples/hello/hello_table.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_table.rb)):
|
131
134
|
|
132
135
|
```ruby
|
133
136
|
# ...
|
134
137
|
shell {
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
138
|
+
grid_layout
|
139
|
+
|
140
|
+
text 'Hello, Table!'
|
141
|
+
|
142
|
+
label {
|
143
|
+
layout_data :center, :center, true, false
|
144
|
+
|
145
|
+
text 'Baseball Playoff Schedule'
|
146
|
+
font height: 30, style: :bold
|
147
|
+
}
|
148
|
+
|
149
|
+
combo(:read_only) {
|
150
|
+
layout_data :center, :center, true, false
|
151
|
+
selection bind(BaseballGame, :playoff_type)
|
152
|
+
font height: 16
|
153
|
+
}
|
154
|
+
|
155
|
+
table(:editable) { |table_proxy|
|
156
|
+
layout_data :fill, :fill, true, true
|
157
|
+
|
158
|
+
table_column {
|
159
|
+
text 'Game Date'
|
160
|
+
width 150
|
161
|
+
sort_property :date # ensure sorting by real date value (not `game_date` string specified in items below)
|
162
|
+
editor :date_drop_down, property: :date_time
|
163
|
+
}
|
164
|
+
table_column {
|
165
|
+
text 'Game Time'
|
166
|
+
width 150
|
167
|
+
sort_property :time # ensure sorting by real time value (not `game_time` string specified in items below)
|
168
|
+
editor :time, property: :date_time
|
169
|
+
}
|
170
|
+
table_column {
|
171
|
+
text 'Ballpark'
|
172
|
+
width 180
|
173
|
+
editor :none
|
174
|
+
}
|
175
|
+
table_column {
|
176
|
+
text 'Home Team'
|
177
|
+
width 150
|
178
|
+
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
|
179
|
+
}
|
180
|
+
table_column {
|
181
|
+
text 'Away Team'
|
182
|
+
width 150
|
183
|
+
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
|
184
|
+
}
|
185
|
+
table_column {
|
186
|
+
text 'Promotion'
|
187
|
+
width 150
|
188
|
+
# default text editor is used here
|
189
|
+
}
|
190
|
+
|
191
|
+
# Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
|
192
|
+
items bind(BaseballGame, :schedule), column_properties(:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion)
|
193
|
+
|
194
|
+
# Data-bind table selection
|
195
|
+
selection bind(BaseballGame, :selected_game)
|
196
|
+
|
197
|
+
# Default initial sort property
|
198
|
+
sort_property :date
|
199
|
+
|
200
|
+
# Sort by these additional properties after handling sort by the column the user clicked
|
201
|
+
additional_sort_properties :date, :time, :home_team, :away_team, :ballpark, :promotion
|
202
|
+
|
203
|
+
menu {
|
204
|
+
menu_item {
|
205
|
+
text 'Book'
|
201
206
|
|
202
|
-
|
203
|
-
|
204
|
-
on_widget_selected { @contact_manager_presenter.list }
|
205
|
-
on_key_pressed {|key_event|
|
206
|
-
@contact_manager_presenter.list if key_event.keyCode == swt(:cr)
|
207
|
-
}
|
207
|
+
on_widget_selected {
|
208
|
+
book_selected_game
|
208
209
|
}
|
209
210
|
}
|
210
211
|
}
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
text "First Name"
|
222
|
-
width 80
|
223
|
-
}
|
224
|
-
table_column {
|
225
|
-
text "Last Name"
|
226
|
-
width 80
|
227
|
-
}
|
228
|
-
table_column {
|
229
|
-
text "Email"
|
230
|
-
width 200
|
231
|
-
}
|
232
|
-
items bind(@contact_manager_presenter, :results),
|
233
|
-
column_properties(:first_name, :last_name, :email)
|
234
|
-
on_mouse_up { |event|
|
235
|
-
table_proxy.edit_table_item(event.table_item, event.column_index)
|
236
|
-
}
|
212
|
+
}
|
213
|
+
|
214
|
+
button {
|
215
|
+
text 'Book Selected Game'
|
216
|
+
layout_data :center, :center, true, false
|
217
|
+
font height: 16
|
218
|
+
enabled bind(BaseballGame, :selected_game)
|
219
|
+
|
220
|
+
on_widget_selected {
|
221
|
+
book_selected_game
|
237
222
|
}
|
238
223
|
}
|
239
224
|
}.open
|
240
225
|
# ...
|
241
226
|
```
|
242
227
|
|
243
|
-
Glimmer App:
|
244
|
-
|
245
|
-
![Contact Manager](images/glimmer-contact-manager.png)
|
246
|
-
|
247
228
|
#### Production Desktop Apps Built with Glimmer DSL for SWT
|
248
229
|
|
249
230
|
[<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet) - Small Project Tracking App
|
@@ -254,122 +235,9 @@ Glimmer App:
|
|
254
235
|
|
255
236
|
[![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)](https://github.com/AndyObtiva/MathBowling)
|
256
237
|
|
257
|
-
|
258
|
-
|
259
|
-
[Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining truely native looking 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.).
|
260
|
-
|
261
|
-
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).
|
262
|
-
|
263
|
-
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/).
|
264
|
-
|
265
|
-
[Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) 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:
|
266
|
-
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
267
|
-
- Convention over configuration via smart defaults and automation of low-level details
|
268
|
-
- Requiring the least amount of syntax possible to build GUI
|
269
|
-
- Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
|
270
|
-
- Custom Widget support
|
271
|
-
- Scaffolding for new custom widgets, apps, and gems
|
272
|
-
- Native-Executable packaging on Mac, Windows, and Linux
|
273
|
-
|
274
|
-
To get started, visit the [Glimmer DSL for Tk project page](https://github.com/AndyObtiva/glimmer-dsl-tk#pre-requisites) for instructions on installing the [glimmer-dsl-tk gem](https://rubygems.org/gems/glimmer-dsl-tk).
|
275
|
-
|
276
|
-
#### Glimmer DSL for Tk Samples
|
277
|
-
|
278
|
-
##### Hello, World!
|
279
|
-
|
280
|
-
Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
|
281
|
-
|
282
|
-
```ruby
|
283
|
-
include Glimmer
|
284
|
-
|
285
|
-
root {
|
286
|
-
label {
|
287
|
-
text 'Hello, World!'
|
288
|
-
}
|
289
|
-
}.open
|
290
|
-
```
|
291
|
-
|
292
|
-
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
293
|
-
|
294
|
-
```
|
295
|
-
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
|
296
|
-
```
|
297
|
-
|
298
|
-
Glimmer app:
|
299
|
-
|
300
|
-
![glimmer dsl tk screenshot sample hello world](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
301
|
-
|
302
|
-
##### Hello, Tab!
|
303
|
-
|
304
|
-
Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
|
305
|
-
|
306
|
-
```ruby
|
307
|
-
include Glimmer
|
308
|
-
|
309
|
-
root {
|
310
|
-
title 'Hello, Tab!'
|
311
|
-
|
312
|
-
notebook {
|
313
|
-
frame(text: 'English') {
|
314
|
-
label {
|
315
|
-
text 'Hello, World!'
|
316
|
-
}
|
317
|
-
}
|
318
|
-
|
319
|
-
frame(text: 'French') {
|
320
|
-
label {
|
321
|
-
text 'Bonjour, Univers!'
|
322
|
-
}
|
323
|
-
}
|
324
|
-
}
|
325
|
-
}.open
|
326
|
-
```
|
327
|
-
|
328
|
-
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
329
|
-
|
330
|
-
```
|
331
|
-
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_tab.rb'"
|
332
|
-
```
|
333
|
-
|
334
|
-
Glimmer app:
|
335
|
-
|
336
|
-
![glimmer dsl tk screenshot sample hello tab English](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-english.png)
|
337
|
-
![glimmer dsl tk screenshot sample hello tab French](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-french.png)
|
338
|
-
|
339
|
-
##### Hello, Combo!
|
340
|
-
|
341
|
-
Glimmer code (from [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combo.rb)):
|
342
|
-
|
343
|
-
```ruby
|
344
|
-
# ... more code precedes
|
345
|
-
root {
|
346
|
-
title 'Hello, Combo!'
|
347
|
-
|
348
|
-
combobox { |proxy|
|
349
|
-
state 'readonly'
|
350
|
-
text bind(person, :country)
|
351
|
-
}
|
352
|
-
|
353
|
-
button { |proxy|
|
354
|
-
text "Reset Selection"
|
355
|
-
command {
|
356
|
-
person.reset_country
|
357
|
-
}
|
358
|
-
}
|
359
|
-
}.open
|
360
|
-
# ... more code follows
|
361
|
-
```
|
362
|
-
|
363
|
-
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
238
|
+
[<img alt="Garderie Rainbow Daily Agenda Logo" src="https://raw.githubusercontent.com/AndyObtiva/garderie_rainbow_daily_agenda/master/images/garderie_rainbow_daily_agenda_logo.png" width="40" />Garderie Rainbow Daily Agenda](https://github.com/AndyObtiva/garderie_rainbow_daily_agenda) - A child nursery daily agenda reporting desktop app
|
364
239
|
|
365
|
-
|
366
|
-
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combo.rb'"
|
367
|
-
```
|
368
|
-
|
369
|
-
Glimmer app:
|
370
|
-
|
371
|
-
![glimmer dsl tk screenshot sample hello combo](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo.png)
|
372
|
-
![glimmer dsl tk screenshot sample hello combo dropdown](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo-dropdown.png)
|
240
|
+
[![Garderie Rainbow Daily Agenda App Screenshot](https://raw.githubusercontent.com/AndyObtiva/garderie_rainbow_daily_agenda/master/images/garderie_rainbow_daily_agenda_screenshot.png)](https://github.com/AndyObtiva/garderie_rainbow_daily_agenda)
|
373
241
|
|
374
242
|
### Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
375
243
|
|
@@ -535,9 +403,9 @@ shell {
|
|
535
403
|
caret nil
|
536
404
|
}
|
537
405
|
command_button('AC')
|
538
|
-
operation_button('
|
539
|
-
operation_button('
|
540
|
-
operation_button('
|
406
|
+
operation_button('÷')
|
407
|
+
operation_button('�')
|
408
|
+
operation_button('−')
|
541
409
|
(7..9).each { |number|
|
542
410
|
number_button(number)
|
543
411
|
}
|
@@ -657,6 +525,123 @@ Output:
|
|
657
525
|
body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2em}
|
658
526
|
```
|
659
527
|
|
528
|
+
### Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
529
|
+
|
530
|
+
[Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining truely native looking 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.).
|
531
|
+
|
532
|
+
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).
|
533
|
+
|
534
|
+
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/).
|
535
|
+
|
536
|
+
[Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) 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:
|
537
|
+
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
538
|
+
- Convention over configuration via smart defaults and automation of low-level details
|
539
|
+
- Requiring the least amount of syntax possible to build GUI
|
540
|
+
- Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
|
541
|
+
- Custom Widget support
|
542
|
+
- Scaffolding for new custom widgets, apps, and gems
|
543
|
+
- Native-Executable packaging on Mac, Windows, and Linux
|
544
|
+
|
545
|
+
To get started, visit the [Glimmer DSL for Tk project page](https://github.com/AndyObtiva/glimmer-dsl-tk#pre-requisites) for instructions on installing the [glimmer-dsl-tk gem](https://rubygems.org/gems/glimmer-dsl-tk).
|
546
|
+
|
547
|
+
#### Glimmer DSL for Tk Samples
|
548
|
+
|
549
|
+
##### Hello, World!
|
550
|
+
|
551
|
+
Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
|
552
|
+
|
553
|
+
```ruby
|
554
|
+
include Glimmer
|
555
|
+
|
556
|
+
root {
|
557
|
+
label {
|
558
|
+
text 'Hello, World!'
|
559
|
+
}
|
560
|
+
}.open
|
561
|
+
```
|
562
|
+
|
563
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
564
|
+
|
565
|
+
```
|
566
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
|
567
|
+
```
|
568
|
+
|
569
|
+
Glimmer app:
|
570
|
+
|
571
|
+
![glimmer dsl tk screenshot sample hello world](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
572
|
+
|
573
|
+
##### Hello, Tab!
|
574
|
+
|
575
|
+
Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
|
576
|
+
|
577
|
+
```ruby
|
578
|
+
include Glimmer
|
579
|
+
|
580
|
+
root {
|
581
|
+
title 'Hello, Tab!'
|
582
|
+
|
583
|
+
notebook {
|
584
|
+
frame(text: 'English') {
|
585
|
+
label {
|
586
|
+
text 'Hello, World!'
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
frame(text: 'French') {
|
591
|
+
label {
|
592
|
+
text 'Bonjour, Univers!'
|
593
|
+
}
|
594
|
+
}
|
595
|
+
}
|
596
|
+
}.open
|
597
|
+
```
|
598
|
+
|
599
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
600
|
+
|
601
|
+
```
|
602
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_tab.rb'"
|
603
|
+
```
|
604
|
+
|
605
|
+
Glimmer app:
|
606
|
+
|
607
|
+
![glimmer dsl tk screenshot sample hello tab English](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-english.png)
|
608
|
+
![glimmer dsl tk screenshot sample hello tab French](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-french.png)
|
609
|
+
|
610
|
+
##### Hello, Combo!
|
611
|
+
|
612
|
+
Glimmer code (from [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combo.rb)):
|
613
|
+
|
614
|
+
```ruby
|
615
|
+
# ... more code precedes
|
616
|
+
root {
|
617
|
+
title 'Hello, Combo!'
|
618
|
+
|
619
|
+
combobox { |proxy|
|
620
|
+
state 'readonly'
|
621
|
+
text bind(person, :country)
|
622
|
+
}
|
623
|
+
|
624
|
+
button { |proxy|
|
625
|
+
text "Reset Selection"
|
626
|
+
command {
|
627
|
+
person.reset_country
|
628
|
+
}
|
629
|
+
}
|
630
|
+
}.open
|
631
|
+
# ... more code follows
|
632
|
+
```
|
633
|
+
|
634
|
+
Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
|
635
|
+
|
636
|
+
```
|
637
|
+
ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combo.rb'"
|
638
|
+
```
|
639
|
+
|
640
|
+
Glimmer app:
|
641
|
+
|
642
|
+
![glimmer dsl tk screenshot sample hello combo](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo.png)
|
643
|
+
![glimmer dsl tk screenshot sample hello combo dropdown](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo-dropdown.png)
|
644
|
+
|
660
645
|
## DSL Engine
|
661
646
|
|
662
647
|
Glimmer is fundamentally a DSL Engine that can support any number of DSLs like the official Glimmer DSLs (gems starting with the `glimmer-dsl-` prefix like `glimmer-dsl-swt`) or any DSLs for that matter.
|
@@ -852,9 +837,11 @@ Example: `Glimmer::DSL::Engine.enabled_dsls = [:xml, :css]`
|
|
852
837
|
|
853
838
|
## Data-Binding Library
|
854
839
|
|
855
|
-
Data-Binding enables
|
840
|
+
Data-Binding enables mapping GUI properties (like text and color) to Model attributes (like name and age).
|
856
841
|
|
857
|
-
|
842
|
+
Glimmer enhances observed models automatically (including array operations like `<<` and `reject!`) on first observation. As such, you get automatic observable support, including nested and computed observations. No need to change your model code to data-bind it to the view or add repetitive boilerplate modules. View data-binding is truly decoupled from model logic by being able to observe any model attribute (Ruby attribute reader/writer combo or Ruby attribute reader alone for read-only data-binding when needed)
|
843
|
+
|
844
|
+
This relies mainly on the Observer Design Pattern and the MVP (Model-View-Presenter) Architectural Pattern (a variation on MVC)
|
858
845
|
|
859
846
|
These are the main classes concerning data-binding:
|
860
847
|
- `Observer`: Provides general observer support including unique registration and deregistration for cleanup and prevention of memory leaks. Main methods concerned are: `call`, `register` (alias: `observe`), and `unregister` (alias: `unobserve` or `deregister`)
|
@@ -914,8 +901,8 @@ If you would like to contribute to Glimmer, please study up on Glimmer and [SWT]
|
|
914
901
|
|
915
902
|
You may apply for contributing to any of these Glimmer DSL gems whether you prefer to focus on the desktop or web:
|
916
903
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
917
|
-
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
918
|
-
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI
|
904
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
905
|
+
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
919
906
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
920
907
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
921
908
|
|