glimmer-dsl-tk 0.0.6 → 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 +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +20 -18
- data/VERSION +1 -1
- data/bin/girb +27 -7
- data/lib/glimmer-dsl-tk.rb +4 -4
- data/lib/glimmer/data_binding/tk/list_selection_binding.rb +6 -6
- 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 +22 -1
- data/lib/glimmer/dsl/tk/dsl.rb +4 -4
- data/lib/glimmer/dsl/tk/list_selection_data_binding_expression.rb +4 -4
- data/lib/glimmer/dsl/tk/root_expression.rb +4 -4
- data/lib/glimmer/dsl/tk/widget_expression.rb +4 -4
- data/lib/glimmer/tk/button_proxy.rb +5 -5
- data/lib/glimmer/tk/entry_proxy.rb +5 -5
- data/lib/glimmer/tk/frame_proxy.rb +5 -5
- data/lib/glimmer/tk/label_proxy.rb +6 -6
- data/lib/glimmer/tk/list_proxy.rb +8 -8
- 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 +27 -27
- data/samples/hello/hello_combo.rb +7 -7
- data/samples/hello/hello_computed.rb +22 -1
- data/samples/hello/hello_list_multi_selection.rb +4 -4
- data/samples/hello/hello_list_single_selection.rb +6 -6
- data/samples/hello/hello_tab.rb +5 -5
- data/samples/hello/hello_world.rb +4 -4
- metadata +6 -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
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,18 +1,20 @@
|
|
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.
|
2
|
-
## Ruby Desktop Development GUI Library
|
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
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-tk.svg)](http://badge.fury.io/rb/glimmer-dsl-tk)
|
4
|
-
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-tk.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-tk)
|
5
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)
|
6
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-tk/maintainability)
|
7
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)
|
8
8
|
|
9
|
+
**[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](CONTRIBUTING.md)**
|
10
|
+
|
9
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).
|
10
12
|
|
11
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.).
|
12
14
|
|
13
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).
|
14
16
|
|
15
|
-
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/).
|
16
18
|
|
17
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:
|
18
20
|
- Declarative DSL syntax that visually maps to the GUI widget hierarchy
|
@@ -48,8 +50,8 @@ Glimmer app:
|
|
48
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.
|
49
51
|
|
50
52
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
51
|
-
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop GUI)
|
52
|
-
- [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)
|
53
55
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
54
56
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
55
57
|
|
@@ -58,7 +60,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
58
60
|
- [Tcl/Tk](https://www.tcl.tk/): Follow the [install instructions](https://tkdocs.com/tutorial/install.html)
|
59
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).
|
60
62
|
|
61
|
-
For example, on the Mac, you can:
|
63
|
+
For example, on the Mac, you can:
|
62
64
|
- Install the ActiveTcl Mac package from [ActiveState.com](ActiveState.com)
|
63
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)
|
64
66
|
- Run: `rvm install 2.7.1 --enable-shared --enable-pthread --with-tk --with-tcl`
|
@@ -74,11 +76,11 @@ Run this command to install directly:
|
|
74
76
|
gem install glimmer-dsl-tk
|
75
77
|
```
|
76
78
|
|
77
|
-
### Option 2: Bundler
|
79
|
+
### Option 2: Bundler
|
78
80
|
|
79
81
|
Add the following to `Gemfile`:
|
80
82
|
```
|
81
|
-
gem 'glimmer-dsl-tk', '~> 0.0.
|
83
|
+
gem 'glimmer-dsl-tk', '~> 0.0.7'
|
82
84
|
```
|
83
85
|
|
84
86
|
And, then run:
|
@@ -145,7 +147,7 @@ root.mainloop
|
|
145
147
|
Example of the same app written in [Glimmer](https://github.com/AndyObtiva/glimmer) declarative syntax:
|
146
148
|
|
147
149
|
```ruby
|
148
|
-
root {
|
150
|
+
root {
|
149
151
|
title 'Hello, Tab!'
|
150
152
|
|
151
153
|
notebook {
|
@@ -196,7 +198,7 @@ This assumes a `Person` model with a `country` attribute representing their curr
|
|
196
198
|
|
197
199
|
```ruby
|
198
200
|
combobox {
|
199
|
-
state 'readonly'
|
201
|
+
state 'readonly'
|
200
202
|
text bind(person, :country)
|
201
203
|
}
|
202
204
|
```
|
@@ -218,7 +220,7 @@ This assumes a `Person` model with a `country` attribute representing their curr
|
|
218
220
|
|
219
221
|
```ruby
|
220
222
|
list {
|
221
|
-
selectmode 'browse'
|
223
|
+
selectmode 'browse'
|
222
224
|
text bind(person, :country)
|
223
225
|
}
|
224
226
|
```
|
@@ -339,7 +341,7 @@ Glimmer code (from [samples/hello/hello_tab.rb](samples/hello/hello_tab.rb)):
|
|
339
341
|
```ruby
|
340
342
|
include Glimmer
|
341
343
|
|
342
|
-
root {
|
344
|
+
root {
|
343
345
|
title 'Hello, Tab!'
|
344
346
|
|
345
347
|
notebook {
|
@@ -379,7 +381,7 @@ root {
|
|
379
381
|
title 'Hello, Combo!'
|
380
382
|
|
381
383
|
combobox { |proxy|
|
382
|
-
state 'readonly'
|
384
|
+
state 'readonly'
|
383
385
|
text bind(person, :country)
|
384
386
|
}
|
385
387
|
|
@@ -410,7 +412,7 @@ Glimmer code (from [samples/hello/hello_list_single_selection.rb](samples/hello/
|
|
410
412
|
|
411
413
|
```ruby
|
412
414
|
# ... more code precedes
|
413
|
-
root {
|
415
|
+
root {
|
414
416
|
title 'Hello, List Single Selection!'
|
415
417
|
|
416
418
|
list {
|
@@ -478,7 +480,7 @@ Glimmer code (from [samples/hello/hello_computed.rb](samples/hello/hello_compute
|
|
478
480
|
root {
|
479
481
|
title 'Hello, Computed!'
|
480
482
|
|
481
|
-
frame {
|
483
|
+
frame {
|
482
484
|
grid column: 0, row: 0, padx: 5, pady: 5
|
483
485
|
|
484
486
|
label {
|
@@ -583,8 +585,8 @@ These features have been planned or suggested. You might see them in a future ve
|
|
583
585
|
|
584
586
|
[MIT](LICENSE.txt)
|
585
587
|
|
586
|
-
Copyright (c) 2020 - Andy Maleh.
|
588
|
+
Copyright (c) 2020-2021 - Andy Maleh.
|
587
589
|
|
588
590
|
--
|
589
591
|
|
590
|
-
[<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).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/bin/girb
CHANGED
@@ -1,10 +1,30 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
4
23
|
|
5
|
-
|
24
|
+
# This script was written for Windows and Linux only
|
6
25
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
26
|
+
require_relative 'girb_runner'
|
27
|
+
|
28
|
+
require 'irb'
|
29
|
+
|
30
|
+
IRB.start('.')
|
data/lib/glimmer-dsl-tk.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -34,10 +34,10 @@ module Glimmer
|
|
34
34
|
attr_reader :widget_proxy
|
35
35
|
|
36
36
|
PROPERTY_TYPE_UPDATERS = {
|
37
|
-
:string => lambda do |widget_proxy, value|
|
37
|
+
:string => lambda do |widget_proxy, value|
|
38
38
|
widget_proxy.selection = value.to_s
|
39
39
|
end,
|
40
|
-
:array => lambda do |widget_proxy, value|
|
40
|
+
:array => lambda do |widget_proxy, value|
|
41
41
|
widget_proxy.selection = (value || [])
|
42
42
|
end
|
43
43
|
}
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer/data_binding/observable'
|
2
23
|
require 'glimmer/data_binding/observer'
|
3
24
|
|
@@ -12,7 +33,7 @@ module Glimmer
|
|
12
33
|
attr_reader :widget, :attribute
|
13
34
|
def initialize(widget, attribute)
|
14
35
|
@widget = widget
|
15
|
-
@attribute = attribute
|
36
|
+
@attribute = attribute
|
16
37
|
end
|
17
38
|
|
18
39
|
def call(value)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer/dsl/static_expression'
|
2
23
|
require 'glimmer/data_binding/model_binding'
|
3
24
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer/dsl/expression'
|
2
23
|
require 'glimmer/data_binding/model_binding'
|
3
24
|
require 'glimmer/data_binding/tk/widget_binding'
|
@@ -26,7 +47,7 @@ module Glimmer
|
|
26
47
|
# TODO simplify this logic and put it where it belongs
|
27
48
|
parent.add_observer(model_binding, keyword) if parent.respond_to?(:add_observer, [model_binding, keyword])
|
28
49
|
widget_binding.call(model_binding.evaluate_property)
|
29
|
-
end
|
50
|
+
end
|
30
51
|
end
|
31
52
|
end
|
32
53
|
end
|
data/lib/glimmer/dsl/tk/dsl.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,7 +22,7 @@
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
23
|
|
24
24
|
module Glimmer
|
25
|
-
module Tk
|
25
|
+
module Tk
|
26
26
|
# Proxy for Tk::Tile::Button
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,7 +22,7 @@
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
23
|
|
24
24
|
module Glimmer
|
25
|
-
module Tk
|
25
|
+
module Tk
|
26
26
|
# Proxy for Tk::Tile::TEntry
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,7 +22,7 @@
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
23
|
|
24
24
|
module Glimmer
|
25
|
-
module Tk
|
25
|
+
module Tk
|
26
26
|
# Proxy for Tk::Tile::Frame
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,7 +22,7 @@
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
23
|
|
24
24
|
module Glimmer
|
25
|
-
module Tk
|
25
|
+
module Tk
|
26
26
|
# Proxy for Tk::Tile::TLabel
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
@@ -34,7 +34,7 @@ module Glimmer
|
|
34
34
|
# else
|
35
35
|
# super
|
36
36
|
# end
|
37
|
-
# end
|
37
|
+
# end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,7 +22,7 @@
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
23
|
|
24
24
|
module Glimmer
|
25
|
-
module Tk
|
25
|
+
module Tk
|
26
26
|
# Custom list widget implementation
|
27
27
|
class ListProxy < WidgetProxy
|
28
28
|
def initialize(underscored_widget_name, parent_proxy, args)
|
@@ -35,16 +35,16 @@ module Glimmer
|
|
35
35
|
::Tk::Tile::Treeview => {
|
36
36
|
'items' => {
|
37
37
|
getter: {name: 'items', invoker: lambda { |widget, args| tk.children('').map(&:text) }},
|
38
|
-
setter: {name: 'items=', invoker: lambda { |widget, args|
|
38
|
+
setter: {name: 'items=', invoker: lambda { |widget, args|
|
39
39
|
@tk.delete @tk.children('')
|
40
40
|
args.first.each do |child|
|
41
41
|
@tk.insert('', 'end', :text => child)
|
42
|
-
end
|
42
|
+
end
|
43
43
|
}},
|
44
44
|
},
|
45
45
|
'selection' => {
|
46
46
|
getter: {name: 'selection', invoker: lambda { |widget, args| @tk.selection.map(&:text) }},
|
47
|
-
setter: {name: 'selection=', invoker: lambda { |widget, args|
|
47
|
+
setter: {name: 'selection=', invoker: lambda { |widget, args|
|
48
48
|
selection_args = args.first.is_a?(Array) ? args.first : [args.first]
|
49
49
|
selection_items = selection_args.map do |arg|
|
50
50
|
@tk.children('').detect {|item| item.text == arg}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -22,7 +22,7 @@
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
23
|
|
24
24
|
module Glimmer
|
25
|
-
module Tk
|
25
|
+
module Tk
|
26
26
|
# Proxy for Tk::Tile::Notebook
|
27
27
|
#
|
28
28
|
# Follows the Proxy Design Pattern
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -29,13 +29,13 @@ module Glimmer
|
|
29
29
|
|
30
30
|
DEFAULT_INITIALIZERS = {
|
31
31
|
'combobox' => lambda do |tk|
|
32
|
-
tk.textvariable = ::TkVariable.new
|
32
|
+
tk.textvariable = ::TkVariable.new
|
33
33
|
end,
|
34
34
|
'label' => lambda do |tk|
|
35
|
-
tk.textvariable = ::TkVariable.new
|
35
|
+
tk.textvariable = ::TkVariable.new
|
36
36
|
end,
|
37
37
|
'entry' => lambda do |tk|
|
38
|
-
tk.textvariable = ::TkVariable.new
|
38
|
+
tk.textvariable = ::TkVariable.new
|
39
39
|
end,
|
40
40
|
}
|
41
41
|
|
@@ -50,17 +50,17 @@ module Glimmer
|
|
50
50
|
Glimmer::Tk.const_get(class_name)
|
51
51
|
rescue
|
52
52
|
Glimmer::Tk::WidgetProxy
|
53
|
-
end
|
53
|
+
end
|
54
54
|
end
|
55
55
|
|
56
56
|
# This supports widgets in and out of basic Tk
|
57
57
|
def tk_widget_class_for(underscored_widget_name)
|
58
58
|
tk_widget_class_basename = underscored_widget_name.camelcase(:upper)
|
59
59
|
potential_tk_widget_class_names = [
|
60
|
-
"::Tk::Tile::#{tk_widget_class_basename}",
|
61
|
-
"::Tk::#{tk_widget_class_basename}",
|
62
|
-
"::Tk#{tk_widget_class_basename}",
|
63
|
-
"::Glimmer::Tk::#{tk_widget_class_basename}Proxy",
|
60
|
+
"::Tk::Tile::#{tk_widget_class_basename}",
|
61
|
+
"::Tk::#{tk_widget_class_basename}",
|
62
|
+
"::Tk#{tk_widget_class_basename}",
|
63
|
+
"::Glimmer::Tk::#{tk_widget_class_basename}Proxy",
|
64
64
|
]
|
65
65
|
tk_widget_class = nil
|
66
66
|
potential_tk_widget_class_names.each do |tk_widget_name|
|
@@ -69,11 +69,11 @@ module Glimmer
|
|
69
69
|
break
|
70
70
|
rescue RuntimeError, SyntaxError, NameError => e
|
71
71
|
Glimmer::Config.logger.debug e.full_message
|
72
|
-
end
|
72
|
+
end
|
73
73
|
end
|
74
74
|
tk_widget_class
|
75
75
|
end
|
76
|
-
end
|
76
|
+
end
|
77
77
|
|
78
78
|
# Initializes a new Tk Widget
|
79
79
|
#
|
@@ -81,11 +81,11 @@ module Glimmer
|
|
81
81
|
def initialize(underscored_widget_name, parent_proxy, args)
|
82
82
|
@parent_proxy = parent_proxy
|
83
83
|
@args = args
|
84
|
-
tk_widget_class = self.class.tk_widget_class_for(underscored_widget_name)
|
84
|
+
tk_widget_class = self.class.tk_widget_class_for(underscored_widget_name)
|
85
85
|
@tk = tk_widget_class.new(@parent_proxy.tk, *args)
|
86
86
|
# a common widget initializer
|
87
87
|
@tk.grid
|
88
|
-
DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@tk)
|
88
|
+
DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@tk)
|
89
89
|
@parent_proxy.post_initialize_child(self)
|
90
90
|
end
|
91
91
|
|
@@ -105,32 +105,32 @@ module Glimmer
|
|
105
105
|
|
106
106
|
def tk_widget_has_attribute_setter?(attribute)
|
107
107
|
result = nil
|
108
|
-
begin
|
109
|
-
# TK Widget currently doesn't support respond_to? properly, so I have to resort to this trick for now
|
108
|
+
begin
|
109
|
+
# TK Widget currently doesn't support respond_to? properly, so I have to resort to this trick for now
|
110
110
|
@tk.send(attribute_setter(attribute), @tk.send(attribute))
|
111
111
|
result = true
|
112
112
|
rescue => e
|
113
113
|
result = false
|
114
114
|
end
|
115
|
-
result
|
115
|
+
result
|
116
116
|
end
|
117
117
|
|
118
118
|
def tk_widget_has_attribute_getter_setter?(attribute)
|
119
119
|
result = nil
|
120
|
-
begin
|
121
|
-
# TK Widget currently doesn't support respond_to? properly, so I have to resort to this trick for now
|
120
|
+
begin
|
121
|
+
# TK Widget currently doesn't support respond_to? properly, so I have to resort to this trick for now
|
122
122
|
@tk.send(attribute, @tk.send(attribute))
|
123
123
|
result = true
|
124
124
|
rescue => e
|
125
125
|
result = false
|
126
126
|
end
|
127
|
-
result
|
127
|
+
result
|
128
128
|
end
|
129
129
|
|
130
130
|
def has_attribute?(attribute, *args)
|
131
|
-
(widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][attribute.to_s]) ||
|
132
|
-
tk_widget_has_attribute_setter?(attribute) ||
|
133
|
-
tk_widget_has_attribute_getter_setter?(attribute) ||
|
131
|
+
(widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][attribute.to_s]) ||
|
132
|
+
tk_widget_has_attribute_setter?(attribute) ||
|
133
|
+
tk_widget_has_attribute_getter_setter?(attribute) ||
|
134
134
|
respond_to?(attribute_setter(attribute), args)
|
135
135
|
end
|
136
136
|
|
@@ -221,7 +221,7 @@ module Glimmer
|
|
221
221
|
attribute_listener_installers = @tk.class.ancestors.map {|ancestor| widget_attribute_listener_installers[ancestor]}.compact
|
222
222
|
widget_listener_installers = attribute_listener_installers.map{|installer| installer[attribute.to_s]}.compact if !attribute_listener_installers.empty?
|
223
223
|
widget_listener_installers.to_a.first&.call(observer)
|
224
|
-
end
|
224
|
+
end
|
225
225
|
|
226
226
|
def content(&block)
|
227
227
|
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Tk::WidgetExpression.new, &block)
|
@@ -242,7 +242,7 @@ module Glimmer
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def respond_to?(method, *args, &block)
|
245
|
-
super ||
|
245
|
+
super ||
|
246
246
|
tk.respond_to?(method, *args, &block)
|
247
247
|
end
|
248
248
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -21,10 +21,10 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-tk'
|
23
23
|
|
24
|
-
class Person
|
24
|
+
class Person
|
25
25
|
attr_accessor :country, :country_options
|
26
26
|
|
27
|
-
def initialize
|
27
|
+
def initialize
|
28
28
|
self.country_options=["", "Canada", "US", "Mexico"]
|
29
29
|
self.country = "Canada"
|
30
30
|
end
|
@@ -44,7 +44,7 @@ class HelloCombo
|
|
44
44
|
title 'Hello, Combo!'
|
45
45
|
|
46
46
|
combobox {
|
47
|
-
state 'readonly'
|
47
|
+
state 'readonly'
|
48
48
|
text bind(person, :country)
|
49
49
|
}
|
50
50
|
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer-dsl-tk'
|
2
23
|
|
3
24
|
require_relative 'hello_computed/contact'
|
@@ -17,7 +38,7 @@ class HelloComputed
|
|
17
38
|
root {
|
18
39
|
title 'Hello, Computed!'
|
19
40
|
|
20
|
-
frame {
|
41
|
+
frame {
|
21
42
|
grid column: 0, row: 0, padx: 5, pady: 5
|
22
43
|
|
23
44
|
label {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-tk'
|
23
23
|
|
24
|
-
class Person
|
24
|
+
class Person
|
25
25
|
attr_accessor :country, :country_options
|
26
26
|
|
27
27
|
def initialize
|
@@ -40,7 +40,7 @@ class HelloListSingleSelection
|
|
40
40
|
def launch
|
41
41
|
person = Person.new
|
42
42
|
|
43
|
-
root {
|
43
|
+
root {
|
44
44
|
title 'Hello, List Single Selection!'
|
45
45
|
|
46
46
|
list {
|
data/samples/hello/hello_tab.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -25,7 +25,7 @@ class HelloTab
|
|
25
25
|
include Glimmer
|
26
26
|
|
27
27
|
def launch
|
28
|
-
root {
|
28
|
+
root {
|
29
29
|
title 'Hello, Tab!'
|
30
30
|
|
31
31
|
notebook {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-tk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.4.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,7 +170,7 @@ dependencies:
|
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: 0.7.0
|
173
|
-
description: Glimmer DSL for Tk (Ruby Desktop GUI)
|
173
|
+
description: Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
174
174
|
email: andy.am@gmail.com
|
175
175
|
executables:
|
176
176
|
- girb
|
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: '0'
|
233
233
|
requirements: []
|
234
|
-
rubygems_version: 3.1.
|
234
|
+
rubygems_version: 3.1.2
|
235
235
|
signing_key:
|
236
236
|
specification_version: 4
|
237
237
|
summary: Glimmer DSL for Tk
|