glimmer-dsl-tk 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +121 -29
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/tk/widget_proxy.rb +1 -1
- data/samples/hello/hello_frame.rb +71 -0
- data/samples/hello/{hello_tab.rb → hello_notebook.rb} +3 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa03163d6b0577d65e67d245b810079da4ddd6aca50cde649963e9448defe1ee
|
4
|
+
data.tar.gz: 3d2cadbe0dff5e003ada1938a461785b11d5899d671d12f998b0c783983fa4dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6160cea03e0e6ed6e1511271cd780db176ba569b2774e9a304749e612ec242ad65d611dce0c475f29dfe3f9dce869bee8c660825a90fff0b3a0f5315cf7fbb47
|
7
|
+
data.tar.gz: abc75b8c436416257770b9af8e38470bbf4ab53f448a281c6626fa56ef7617ffee4d551038fa9618b00d33cd63f9c8cf19f51b311406497e1ce99a54ba22d2f0
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.18
|
4
|
+
|
5
|
+
- Hello, Frame! sample
|
6
|
+
- Avoid setting grid geometry manager on `toplevel` widget
|
7
|
+
- Support `frame` `width` and `height` attributes
|
8
|
+
- Support `frame` `borderwidth` attribute
|
9
|
+
- Support `frame` `relief` attribute
|
10
|
+
- Support `frame` `padding` attribute
|
11
|
+
- Rename Hello, Tab! to Hello, Notebook!
|
12
|
+
|
3
13
|
## 0.0.17
|
4
14
|
|
15
|
+
- Hello, Label! sample
|
5
16
|
- Support `label` `anchor` attribute (`'e'`, `'se'`, `'s'`, `'sw'`, `'w'`, `'nw'` or `'center'`)
|
6
17
|
- Support `label` `width` attributes
|
7
18
|
- Support `label` `image` attribute
|
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 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Tk 0.0.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Tk 0.0.18
|
2
2
|
## MRI Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-tk.svg)](http://badge.fury.io/rb/glimmer-dsl-tk)
|
4
4
|
[![Ruby](https://github.com/AndyObtiva/glimmer-dsl-tk/actions/workflows/ruby.yml/badge.svg)](https://github.com/AndyObtiva/glimmer-dsl-tk/actions/workflows/ruby.yml)
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Tk](https://www.tcl.tk/) enables desktop development with [Glimmer](https://github.com/AndyObtiva/glimmer) in [Ruby](https://github.com/ruby/ruby).
|
12
12
|
|
13
|
-
[Tcl/Tk](https://www.tcl.tk/) has
|
13
|
+
[Tcl/Tk](https://www.tcl.tk/) has recently improved by gaining 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.).
|
14
14
|
|
15
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).
|
16
16
|
|
@@ -79,6 +79,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
79
79
|
- [Smart Defaults and Convensions](#smart-defaults-and-convensions)
|
80
80
|
- [Grid Layout](#grid-layout)
|
81
81
|
- [Label/Button Image](#labelbutton-image)
|
82
|
+
- [Notebook Frame](#notebook-frame)
|
82
83
|
- [Icon Photo](#icon-photo)
|
83
84
|
- [The Grid Geometry Manager](#the-grid-geometry-manager)
|
84
85
|
- [Bidirectional Data-Binding](#bidirectional-data-binding)
|
@@ -88,10 +89,12 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
88
89
|
- [List Multi Selection Data-Binding](#list-multi-selection-data-binding)
|
89
90
|
- [Entry Data-Binding](#entry-data-binding)
|
90
91
|
- [Command Observer](#command-observer)
|
92
|
+
- [Gotchas](#gotchas)
|
91
93
|
- [Samples](#samples)
|
92
94
|
- [Hello, World!](#hello-world)
|
93
95
|
- [Hello, Button!](#hello-button)
|
94
|
-
- [Hello,
|
96
|
+
- [Hello, Frame!](#hello-frame)
|
97
|
+
- [Hello, Notebook!](#hello-notebook)
|
95
98
|
- [Hello, Label!](#hello-label)
|
96
99
|
- [Hello, Message Box!](#hello-message-box)
|
97
100
|
- [Hello, Combobox!](#hello-combobox)
|
@@ -134,7 +137,7 @@ gem install glimmer-dsl-tk
|
|
134
137
|
|
135
138
|
Add the following to `Gemfile`:
|
136
139
|
```
|
137
|
-
gem 'glimmer-dsl-tk', '~> 0.0.
|
140
|
+
gem 'glimmer-dsl-tk', '~> 0.0.18'
|
138
141
|
```
|
139
142
|
|
140
143
|
And, then run:
|
@@ -181,7 +184,7 @@ Example of an app written in [Tk](https://www.tcl.tk/) imperative syntax:
|
|
181
184
|
|
182
185
|
```ruby
|
183
186
|
root = TkRoot.new
|
184
|
-
root.title = 'Hello,
|
187
|
+
root.title = 'Hello, Notebook!'
|
185
188
|
|
186
189
|
notebook = ::Tk::Tile::Notebook.new(root).grid
|
187
190
|
|
@@ -202,7 +205,7 @@ Example of the same app written in [Glimmer](https://github.com/AndyObtiva/glimm
|
|
202
205
|
|
203
206
|
```ruby
|
204
207
|
root {
|
205
|
-
title 'Hello,
|
208
|
+
title 'Hello, Notebook!'
|
206
209
|
|
207
210
|
notebook {
|
208
211
|
frame(text: 'English') {
|
@@ -226,7 +229,7 @@ keyword(args) | attributes | event bindings & callbacks
|
|
226
229
|
------------- | ---------- | ---------
|
227
230
|
`button` | `text`, `image` (optional keyword args: `subsample`, `zoom`, `from`, `to`, `shrink`, `compositingrule`), `compound` (`'center', 'top', 'bottom', 'left', 'right'`), `default` (`'active', 'normal'`) | `command`
|
228
231
|
`entry` | `width`, `text` | None
|
229
|
-
`frame(text: nil)` |
|
232
|
+
`frame(text: nil)` | `width`, `height`, `borderwidth`, `relief` (`'flat' (default), 'raised', 'sunken', 'solid', 'ridge', 'groove'`) | None
|
230
233
|
`label` | `text`, `image` (optional keyword args: `subsample`, `zoom`, `from`, `to`, `shrink`, `compositingrule`), `compound` (`'center', 'top', 'bottom', 'left', 'right'`), `font` (`'default', 'text', 'fixed', 'menu', 'heading', 'caption', 'small_caption', 'icon', 'tooltip'`), `relief` (`'flat' (default), 'raised', 'sunken', 'solid', 'ridge', 'groove'`), `justify` (`'left', 'center', 'right'`), `foreground`, `background` | None
|
231
234
|
`list` | `selectmode`, `selection` | None
|
232
235
|
`message_box(type: , message: , detail: , title: , icon: , default: , parent: )` | None | None
|
@@ -260,6 +263,10 @@ keyword(args) | attributes | event bindings & callbacks
|
|
260
263
|
|
261
264
|
Label and Button `image` attribute can accept image path directly as an alternative to `TkPhotoImage` object in addition to key values for automatic processing of image (`subsample`, `zoom`, `from`, `to`, `shrink`, `compositingrule`)
|
262
265
|
|
266
|
+
#### Notebook Frame
|
267
|
+
|
268
|
+
When nesting `frame` under `notebook`, you can pass a `:text` keyword argument to indicate the tab title.
|
269
|
+
|
263
270
|
#### Icon Photo
|
264
271
|
|
265
272
|
The `iconphoto` attribute on `root` is set to the Glimmer icon by default if no icon photo is supplied.
|
@@ -426,6 +433,10 @@ This resets the person country.
|
|
426
433
|
|
427
434
|
More details can be found in the [Hello, Combobox!](#hello-combobox) sample below.
|
428
435
|
|
436
|
+
## Gotchas
|
437
|
+
|
438
|
+
- Setting `background` attribute on `frame` or `label` does not work in `'aqua'` theme on the Mac (only in `'classic'` theme)
|
439
|
+
|
429
440
|
## Samples
|
430
441
|
|
431
442
|
### Hello, World!
|
@@ -561,48 +572,129 @@ Glimmer app:
|
|
561
572
|
|
562
573
|
![glimmer dsl tk screenshot sample hello button](images/glimmer-dsl-tk-screenshot-sample-hello-button.png)
|
563
574
|
|
564
|
-
### Hello,
|
575
|
+
### Hello, Frame!
|
565
576
|
|
566
|
-
Glimmer code (from [samples/hello/
|
577
|
+
Glimmer code (from [samples/hello/hello_frame.rb](samples/hello/hello_frame.rb)):
|
567
578
|
|
568
579
|
```ruby
|
569
|
-
|
580
|
+
require 'glimmer-dsl-tk'
|
570
581
|
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
582
|
+
class HelloFrame
|
583
|
+
include Glimmer
|
584
|
+
|
585
|
+
def launch
|
586
|
+
root {
|
587
|
+
title 'Hello, Frame!'
|
588
|
+
|
589
|
+
frame { # frame simply contains widgets for visual organization via a layout
|
590
|
+
relief 'sunken'
|
591
|
+
|
592
|
+
label {
|
593
|
+
grid row: 0, column: 0, columnspan: 4, padx: 5, pady: 5
|
594
|
+
text 'Enter Your Full Name'
|
595
|
+
font 'caption'
|
596
|
+
anchor 'center'
|
597
|
+
}
|
598
|
+
|
599
|
+
label {
|
600
|
+
grid row: 1, column: 0, padx: 5
|
601
|
+
text "First Name:"
|
602
|
+
}
|
603
|
+
|
604
|
+
entry {
|
605
|
+
grid row: 1, column: 1, padx: 5
|
606
|
+
}
|
607
|
+
|
608
|
+
label {
|
609
|
+
grid row: 2, column: 0, padx: 5
|
610
|
+
text "Last Name:"
|
611
|
+
}
|
612
|
+
|
613
|
+
entry {
|
614
|
+
grid row: 2, column: 1, padx: 5
|
615
|
+
}
|
578
616
|
}
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
617
|
+
|
618
|
+
frame { # an empty frame can specify width and height
|
619
|
+
grid padx: 7, pady: 7
|
620
|
+
width 200
|
621
|
+
height 100
|
622
|
+
borderwidth 3
|
623
|
+
relief 'sunken'
|
584
624
|
}
|
585
|
-
}
|
586
|
-
|
587
|
-
|
625
|
+
}.open
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
HelloFrame.new.launch
|
630
|
+
```
|
631
|
+
|
632
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
633
|
+
|
634
|
+
```
|
635
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_frame'"
|
636
|
+
```
|
637
|
+
|
638
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
639
|
+
|
640
|
+
```
|
641
|
+
ruby -r ./lib/glimmer-dsl-tk.rb ./samples/hello/hello_frame.rb
|
642
|
+
```
|
643
|
+
|
644
|
+
Glimmer app:
|
645
|
+
|
646
|
+
![glimmer dsl tk screenshot sample hello frame](images/glimmer-dsl-tk-screenshot-sample-hello-frame.png)
|
647
|
+
|
648
|
+
### Hello, Notebook!
|
649
|
+
|
650
|
+
Glimmer code (from [samples/hello/hello_notebook.rb](samples/hello/hello_notebook.rb)):
|
651
|
+
|
652
|
+
```ruby
|
653
|
+
require 'glimmer-dsl-tk'
|
654
|
+
|
655
|
+
class HelloNotebook
|
656
|
+
include Glimmer
|
657
|
+
|
658
|
+
def launch
|
659
|
+
root {
|
660
|
+
title 'Hello, Notebook!'
|
661
|
+
|
662
|
+
notebook {
|
663
|
+
frame(text: 'English') {
|
664
|
+
label {
|
665
|
+
text 'Hello, World!'
|
666
|
+
}
|
667
|
+
}
|
668
|
+
|
669
|
+
frame(text: 'French') {
|
670
|
+
label {
|
671
|
+
text 'Bonjour, Univers!'
|
672
|
+
}
|
673
|
+
}
|
674
|
+
}
|
675
|
+
}.open
|
676
|
+
end
|
677
|
+
end
|
678
|
+
|
679
|
+
HelloNotebook.new.launch
|
588
680
|
```
|
589
681
|
|
590
682
|
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
591
683
|
|
592
684
|
```
|
593
|
-
ruby -r glimmer-dsl-tk -e "require 'samples/hello/
|
685
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_notebook'"
|
594
686
|
```
|
595
687
|
|
596
688
|
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
597
689
|
|
598
690
|
```
|
599
|
-
ruby -r ./lib/glimmer-dsl-tk.rb ./samples/hello/
|
691
|
+
ruby -r ./lib/glimmer-dsl-tk.rb ./samples/hello/hello_notebook.rb
|
600
692
|
```
|
601
693
|
|
602
694
|
Glimmer app:
|
603
695
|
|
604
|
-
![glimmer dsl tk screenshot sample hello
|
605
|
-
![glimmer dsl tk screenshot sample hello
|
696
|
+
![glimmer dsl tk screenshot sample hello notebook English](images/glimmer-dsl-tk-screenshot-sample-hello-notebook-english.png)
|
697
|
+
![glimmer dsl tk screenshot sample hello notebook French](images/glimmer-dsl-tk-screenshot-sample-hello-notebook-french.png)
|
606
698
|
|
607
699
|
### Hello, Label!
|
608
700
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.18
|
data/glimmer-dsl-tk.gemspec
CHANGED
Binary file
|
@@ -85,7 +85,7 @@ module Glimmer
|
|
85
85
|
tk_widget_class = self.class.tk_widget_class_for(underscored_widget_name)
|
86
86
|
@tk = tk_widget_class.new(@parent_proxy.tk, *args)
|
87
87
|
# a common widget initializer
|
88
|
-
@tk.grid
|
88
|
+
@tk.grid unless @tk.is_a?(::Tk::Toplevel)
|
89
89
|
DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@tk)
|
90
90
|
@parent_proxy.post_initialize_child(self)
|
91
91
|
end
|
@@ -0,0 +1,71 @@
|
|
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 HelloFrame
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
def launch
|
28
|
+
root {
|
29
|
+
title 'Hello, Frame!'
|
30
|
+
|
31
|
+
frame { # frame simply contains widgets for visual organization via a layout
|
32
|
+
relief 'sunken'
|
33
|
+
|
34
|
+
label {
|
35
|
+
grid row: 0, column: 0, columnspan: 4, padx: 5, pady: 5
|
36
|
+
text 'Enter Your Full Name'
|
37
|
+
font 'caption'
|
38
|
+
anchor 'center'
|
39
|
+
}
|
40
|
+
|
41
|
+
label {
|
42
|
+
grid row: 1, column: 0, padx: 5
|
43
|
+
text "First Name:"
|
44
|
+
}
|
45
|
+
|
46
|
+
entry {
|
47
|
+
grid row: 1, column: 1, padx: 5
|
48
|
+
}
|
49
|
+
|
50
|
+
label {
|
51
|
+
grid row: 2, column: 0, padx: 5
|
52
|
+
text "Last Name:"
|
53
|
+
}
|
54
|
+
|
55
|
+
entry {
|
56
|
+
grid row: 2, column: 1, padx: 5
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
frame { # an empty frame can specify width and height
|
61
|
+
grid padx: 7, pady: 7
|
62
|
+
width 200
|
63
|
+
height 100
|
64
|
+
borderwidth 3
|
65
|
+
relief 'sunken'
|
66
|
+
}
|
67
|
+
}.open
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
HelloFrame.new.launch
|
@@ -21,12 +21,12 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-tk'
|
23
23
|
|
24
|
-
class
|
24
|
+
class HelloNotebook
|
25
25
|
include Glimmer
|
26
26
|
|
27
27
|
def launch
|
28
28
|
root {
|
29
|
-
title 'Hello,
|
29
|
+
title 'Hello, Notebook!'
|
30
30
|
|
31
31
|
notebook {
|
32
32
|
frame(text: 'English') {
|
@@ -45,4 +45,4 @@ class HelloTab
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
HelloNotebook.new.launch
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
@@ -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 Development GUI Library)
|
173
|
+
description: Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
174
174
|
email: andy.am@gmail.com
|
175
175
|
executables:
|
176
176
|
- girb
|
@@ -214,11 +214,12 @@ files:
|
|
214
214
|
- samples/hello/hello_combobox.rb
|
215
215
|
- samples/hello/hello_computed.rb
|
216
216
|
- samples/hello/hello_computed/contact.rb
|
217
|
+
- samples/hello/hello_frame.rb
|
217
218
|
- samples/hello/hello_label.rb
|
218
219
|
- samples/hello/hello_list_multi_selection.rb
|
219
220
|
- samples/hello/hello_list_single_selection.rb
|
220
221
|
- samples/hello/hello_message_box.rb
|
221
|
-
- samples/hello/
|
222
|
+
- samples/hello/hello_notebook.rb
|
222
223
|
- samples/hello/hello_world.rb
|
223
224
|
- samples/hello/images/denmark.png
|
224
225
|
- samples/hello/images/finland.png
|