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
@@ -1,9 +1,30 @@
|
|
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
|
-
class Person
|
24
|
+
class Person
|
4
25
|
attr_accessor :country, :country_options
|
5
26
|
|
6
|
-
def initialize
|
27
|
+
def initialize
|
7
28
|
self.country_options=["", "Canada", "US", "Mexico"]
|
8
29
|
self.country = "Canada"
|
9
30
|
end
|
@@ -22,12 +43,12 @@ class HelloCombo
|
|
22
43
|
root {
|
23
44
|
title 'Hello, Combo!'
|
24
45
|
|
25
|
-
combobox {
|
26
|
-
state 'readonly'
|
46
|
+
combobox {
|
47
|
+
state 'readonly'
|
27
48
|
text bind(person, :country)
|
28
49
|
}
|
29
50
|
|
30
|
-
button {
|
51
|
+
button {
|
31
52
|
text "Reset Selection"
|
32
53
|
command {
|
33
54
|
person.reset_country
|
@@ -0,0 +1,96 @@
|
|
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
|
+
|
22
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
require_relative 'hello_computed/contact'
|
25
|
+
|
26
|
+
class HelloComputed
|
27
|
+
include Glimmer
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@contact = Contact.new(
|
31
|
+
first_name: 'Barry',
|
32
|
+
last_name: 'McKibbin',
|
33
|
+
year_of_birth: 1985
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def launch
|
38
|
+
root {
|
39
|
+
title 'Hello, Computed!'
|
40
|
+
|
41
|
+
frame {
|
42
|
+
grid column: 0, row: 0, padx: 5, pady: 5
|
43
|
+
|
44
|
+
label {
|
45
|
+
grid column: 0, row: 0, sticky: 'w'
|
46
|
+
text 'First Name: '
|
47
|
+
}
|
48
|
+
entry {
|
49
|
+
grid column: 1, row: 0
|
50
|
+
width 15
|
51
|
+
text bind(@contact, :first_name)
|
52
|
+
}
|
53
|
+
|
54
|
+
label {
|
55
|
+
grid column: 0, row: 1, sticky: 'w'
|
56
|
+
text 'Last Name: '
|
57
|
+
}
|
58
|
+
entry {
|
59
|
+
grid column: 1, row: 1
|
60
|
+
width 15
|
61
|
+
text bind(@contact, :last_name)
|
62
|
+
}
|
63
|
+
|
64
|
+
label {
|
65
|
+
grid column: 0, row: 2, sticky: 'w'
|
66
|
+
text 'Year of Birth: '
|
67
|
+
}
|
68
|
+
entry {
|
69
|
+
grid column: 1, row: 2
|
70
|
+
width 15
|
71
|
+
text bind(@contact, :year_of_birth)
|
72
|
+
}
|
73
|
+
|
74
|
+
label {
|
75
|
+
grid column: 0, row: 3, sticky: 'w'
|
76
|
+
text 'Name: '
|
77
|
+
}
|
78
|
+
label {
|
79
|
+
grid column: 1, row: 3, sticky: 'w'
|
80
|
+
text bind(@contact, :name, computed_by: [:first_name, :last_name])
|
81
|
+
}
|
82
|
+
|
83
|
+
label {
|
84
|
+
grid column: 0, row: 4, sticky: 'w'
|
85
|
+
text 'Age: '
|
86
|
+
}
|
87
|
+
label {
|
88
|
+
grid column: 1, row: 4, sticky: 'w'
|
89
|
+
text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}.open
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
HelloComputed.new.launch
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class HelloComputed
|
2
|
+
class Contact
|
3
|
+
attr_accessor :first_name, :last_name, :year_of_birth
|
4
|
+
|
5
|
+
def initialize(attribute_map)
|
6
|
+
@first_name = attribute_map[:first_name]
|
7
|
+
@last_name = attribute_map[:last_name]
|
8
|
+
@year_of_birth = attribute_map[:year_of_birth]
|
9
|
+
end
|
10
|
+
|
11
|
+
def name
|
12
|
+
"#{last_name}, #{first_name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def age
|
16
|
+
Time.now.year - year_of_birth.to_i
|
17
|
+
rescue
|
18
|
+
0
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,69 @@
|
|
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
|
+
|
22
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
class Person
|
25
|
+
attr_accessor :provinces, :provinces_options
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
self.provinces_options=[
|
29
|
+
"",
|
30
|
+
"Quebec",
|
31
|
+
"Ontario",
|
32
|
+
"Manitoba",
|
33
|
+
"Saskatchewan",
|
34
|
+
"Alberta",
|
35
|
+
"British Columbia",
|
36
|
+
"Nova Skotia",
|
37
|
+
"Newfoundland"
|
38
|
+
]
|
39
|
+
self.provinces = ["Quebec", "Manitoba", "Alberta"]
|
40
|
+
end
|
41
|
+
|
42
|
+
def reset_provinces
|
43
|
+
self.provinces = ["Quebec", "Manitoba", "Alberta"]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class HelloListMultiSelection
|
48
|
+
include Glimmer
|
49
|
+
|
50
|
+
def launch
|
51
|
+
person = Person.new
|
52
|
+
|
53
|
+
root {
|
54
|
+
title 'Hello, List Multi Selection!'
|
55
|
+
|
56
|
+
list {
|
57
|
+
selection bind(person, :provinces)
|
58
|
+
}
|
59
|
+
|
60
|
+
button {
|
61
|
+
text "Reset Selection To Defaults"
|
62
|
+
|
63
|
+
command { person.reset_provinces }
|
64
|
+
}
|
65
|
+
}.open
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
HelloListMultiSelection.new.launch
|
@@ -0,0 +1,60 @@
|
|
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
|
+
|
22
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
class Person
|
25
|
+
attr_accessor :country, :country_options
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
self.country_options=["", "Canada", "US", "Mexico"]
|
29
|
+
self.country = "Canada"
|
30
|
+
end
|
31
|
+
|
32
|
+
def reset_country
|
33
|
+
self.country = "Canada"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class HelloListSingleSelection
|
38
|
+
include Glimmer
|
39
|
+
|
40
|
+
def launch
|
41
|
+
person = Person.new
|
42
|
+
|
43
|
+
root {
|
44
|
+
title 'Hello, List Single Selection!'
|
45
|
+
|
46
|
+
list {
|
47
|
+
selectmode 'browse'
|
48
|
+
selection bind(person, :country)
|
49
|
+
}
|
50
|
+
|
51
|
+
button {
|
52
|
+
text "Reset Selection To Default Value"
|
53
|
+
|
54
|
+
command { person.reset_country }
|
55
|
+
}
|
56
|
+
}.open
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
HelloListSingleSelection.new.launch
|
data/samples/hello/hello_tab.rb
CHANGED
@@ -1,10 +1,31 @@
|
|
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
|
class HelloTab
|
4
25
|
include Glimmer
|
5
26
|
|
6
27
|
def launch
|
7
|
-
root {
|
28
|
+
root {
|
8
29
|
title 'Hello, Tab!'
|
9
30
|
|
10
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,9 +170,10 @@ 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
|
-
executables:
|
175
|
+
executables:
|
176
|
+
- girb
|
176
177
|
extensions: []
|
177
178
|
extra_rdoc_files:
|
178
179
|
- CHANGELOG.md
|
@@ -183,21 +184,32 @@ files:
|
|
183
184
|
- LICENSE.txt
|
184
185
|
- README.md
|
185
186
|
- VERSION
|
187
|
+
- bin/girb
|
188
|
+
- bin/girb_runner.rb
|
186
189
|
- lib/glimmer-dsl-tk.rb
|
190
|
+
- lib/glimmer/data_binding/tk/list_selection_binding.rb
|
187
191
|
- lib/glimmer/data_binding/tk/widget_binding.rb
|
188
192
|
- lib/glimmer/dsl/tk/attribute_expression.rb
|
189
193
|
- lib/glimmer/dsl/tk/bind_expression.rb
|
190
194
|
- lib/glimmer/dsl/tk/block_attribute_expression.rb
|
191
195
|
- lib/glimmer/dsl/tk/data_binding_expression.rb
|
192
196
|
- lib/glimmer/dsl/tk/dsl.rb
|
197
|
+
- lib/glimmer/dsl/tk/list_selection_data_binding_expression.rb
|
193
198
|
- lib/glimmer/dsl/tk/root_expression.rb
|
194
199
|
- lib/glimmer/dsl/tk/widget_expression.rb
|
195
200
|
- lib/glimmer/tk/button_proxy.rb
|
201
|
+
- lib/glimmer/tk/entry_proxy.rb
|
196
202
|
- lib/glimmer/tk/frame_proxy.rb
|
203
|
+
- lib/glimmer/tk/label_proxy.rb
|
204
|
+
- lib/glimmer/tk/list_proxy.rb
|
197
205
|
- lib/glimmer/tk/notebook_proxy.rb
|
198
206
|
- lib/glimmer/tk/root_proxy.rb
|
199
207
|
- lib/glimmer/tk/widget_proxy.rb
|
200
208
|
- samples/hello/hello_combo.rb
|
209
|
+
- samples/hello/hello_computed.rb
|
210
|
+
- samples/hello/hello_computed/contact.rb
|
211
|
+
- samples/hello/hello_list_multi_selection.rb
|
212
|
+
- samples/hello/hello_list_single_selection.rb
|
201
213
|
- samples/hello/hello_tab.rb
|
202
214
|
- samples/hello/hello_world.rb
|
203
215
|
homepage: http://github.com/AndyObtiva/glimmer-dsl-tk
|