glimmer-dsl-tk 0.0.54 → 0.0.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/README.md +366 -4
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/tk/scale_proxy.rb +48 -0
- data/lib/glimmer/tk/widget_proxy.rb +13 -0
- data/samples/hello/hello_progressbar.rb +118 -0
- data/samples/hello/hello_scale.rb +53 -0
- data/samples/hello/hello_theme.rb +113 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e0e1ed1843f904d42892c7fe2546383717da65d7cfd0690b1b66101a5b68576
|
4
|
+
data.tar.gz: af96af00f8b06606ac584ab14d5d8d360977a58ec354053a0826edc470c0d57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '01787afce29bc0b1d4656b8ab646f0eb4501a8b8feb23979ad99970f6e5d6bb75d5945bb0b9a9a91cdb34f36d6bdf9226ec3e3aa60368206cd98b40daa2cd0a1'
|
7
|
+
data.tar.gz: 677f8d13ab20b7857c613167d1d21eed0dec3f1b19a8b29ba4b4cec49545186446c2c9bacbaf9e0741c16ceb2d20e60136c482dc6e78783d8b1d435ed4239be8
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.57
|
4
|
+
|
5
|
+
- Hello, Theme! sample
|
6
|
+
|
7
|
+
## 0.0.56
|
8
|
+
|
9
|
+
- Hello, Progressbar! sample
|
10
|
+
- Upgrade to glimmer 2.7.3
|
11
|
+
|
12
|
+
## 0.0.55
|
13
|
+
|
14
|
+
- Hello, Scale! sample
|
15
|
+
- `scale` `variable` data-binding
|
16
|
+
|
3
17
|
## 0.0.54
|
4
18
|
|
5
|
-
- Hello, Labelframe!
|
19
|
+
- Hello, Labelframe! sample
|
6
20
|
- Add default padding to `labelframe`
|
7
21
|
|
8
22
|
## 0.0.53
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
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
|
-
##
|
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.57
|
2
|
+
## Ruby Tk 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)
|
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)
|
@@ -57,7 +57,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
57
57
|
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
58
58
|
[Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Incomplete Alpha | Rails
|
59
59
|
[Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
|
60
|
-
[Glimmer DSL for Tk (
|
60
|
+
[Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Complicated setup / Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
|
61
61
|
[Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
|
62
62
|
[Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
|
63
63
|
[Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
|
@@ -100,6 +100,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
100
100
|
- [List Multi Selection Data-Binding](#list-multi-selection-data-binding)
|
101
101
|
- [Entry Data-Binding](#entry-data-binding)
|
102
102
|
- [Text Data-Binding](#text-data-binding)
|
103
|
+
- [Scale Data-Binding](#scale-data-binding)
|
103
104
|
- [Spinbox Data-Binding](#spinbox-data-binding)
|
104
105
|
- [Checkbutton Data-Binding](#checkbutton-data-binding)
|
105
106
|
- [Radiobutton Data-Binding](#radiobutton-data-binding)
|
@@ -132,6 +133,9 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
132
133
|
- [Hello, Menu Bar!](#hello-menu-bar)
|
133
134
|
- [Hello, Contextual Menu!](#hello-contextual-menu)
|
134
135
|
- [Hello, Labelframe!](#hello-labelframe)
|
136
|
+
- [Hello, Scale!](#hello-scale)
|
137
|
+
- [Hello, Progressbar!](#hello-progressbar)
|
138
|
+
- [Hello, Theme!](#hello-theme)
|
135
139
|
- [Applications](#applications)
|
136
140
|
- [Glimmer Tk Calculator](#glimmer-tk-calculator)
|
137
141
|
- [Y3network Ruby UI](#y3network-ruby-ui)
|
@@ -191,7 +195,7 @@ gem install glimmer-dsl-tk
|
|
191
195
|
|
192
196
|
Add the following to `Gemfile`:
|
193
197
|
```
|
194
|
-
gem 'glimmer-dsl-tk', '0.0.
|
198
|
+
gem 'glimmer-dsl-tk', '0.0.57'
|
195
199
|
```
|
196
200
|
|
197
201
|
And, then run:
|
@@ -768,6 +772,50 @@ It automatically handles all the Tk plumbing behind the scenes.
|
|
768
772
|
|
769
773
|
More details can be found in [Hello, Text!](#hello-text) sample below.
|
770
774
|
|
775
|
+
### Scale Data-Binding
|
776
|
+
|
777
|
+
Example:
|
778
|
+
|
779
|
+
This assumes a `Person` model with an `age` attribute.
|
780
|
+
|
781
|
+
```ruby
|
782
|
+
spinbox {
|
783
|
+
orient 'horizontal' # can be 'vertical' too
|
784
|
+
length 200
|
785
|
+
from 0.0
|
786
|
+
to 100.0
|
787
|
+
variable <=> [person, :age, on_write: ->(val) {val.to_i}]
|
788
|
+
}
|
789
|
+
```
|
790
|
+
|
791
|
+
That code binds the `variable` value of the `scale` to the `age` attribute on the `person` model.
|
792
|
+
|
793
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
794
|
+
|
795
|
+
More details can be found in [Hello, Scale!](#hello-scale) sample below.
|
796
|
+
|
797
|
+
### Progressbar Data-Binding
|
798
|
+
|
799
|
+
Example:
|
800
|
+
|
801
|
+
This assumes a `Worker` model with a `progress_value` attribute.
|
802
|
+
|
803
|
+
```ruby
|
804
|
+
progressbar {
|
805
|
+
orient 'horizontal' # can be vertical too
|
806
|
+
length 200
|
807
|
+
mode 'determinate'
|
808
|
+
maximum 100
|
809
|
+
value <= [worker, :progress_value]
|
810
|
+
}
|
811
|
+
```
|
812
|
+
|
813
|
+
That code binds the value of the `progressbar` to the `progress_value` attribute on the `worker` model.
|
814
|
+
|
815
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
816
|
+
|
817
|
+
More details can be found in [Hello, Progressbar!](#hello-progressbar) sample below.
|
818
|
+
|
771
819
|
### Spinbox Data-Binding
|
772
820
|
|
773
821
|
Example:
|
@@ -3894,6 +3942,320 @@ Glimmer app:
|
|
3894
3942
|
|
3895
3943
|
![glimmer dsl tk screenshot sample hello label-frame](images/glimmer-dsl-tk-screenshot-sample-hello-labelframe.png)
|
3896
3944
|
|
3945
|
+
### Hello, Scale!
|
3946
|
+
|
3947
|
+
Glimmer code (from [samples/hello/hello_scale.rb](samples/hello/hello_scale.rb)):
|
3948
|
+
|
3949
|
+
```ruby
|
3950
|
+
require 'glimmer-dsl-tk'
|
3951
|
+
|
3952
|
+
class HelloScale
|
3953
|
+
include Glimmer
|
3954
|
+
|
3955
|
+
attr_accessor :scale_value
|
3956
|
+
|
3957
|
+
def initialize
|
3958
|
+
self.scale_value = 50
|
3959
|
+
end
|
3960
|
+
|
3961
|
+
def launch
|
3962
|
+
root {
|
3963
|
+
text 'Hello, Scale!'
|
3964
|
+
|
3965
|
+
label {
|
3966
|
+
anchor 'center'
|
3967
|
+
text <= [self, :scale_value]
|
3968
|
+
}
|
3969
|
+
|
3970
|
+
scale {
|
3971
|
+
orient 'horizontal'
|
3972
|
+
length 200
|
3973
|
+
from 0.0
|
3974
|
+
to 100.0
|
3975
|
+
variable <=> [self, :scale_value, on_write: ->(val) {val.to_i}]
|
3976
|
+
}
|
3977
|
+
}.open
|
3978
|
+
end
|
3979
|
+
end
|
3980
|
+
|
3981
|
+
HelloScale.new.launch
|
3982
|
+
```
|
3983
|
+
|
3984
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3985
|
+
|
3986
|
+
```
|
3987
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scale'"
|
3988
|
+
```
|
3989
|
+
|
3990
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3991
|
+
|
3992
|
+
```
|
3993
|
+
ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scale.rb
|
3994
|
+
```
|
3995
|
+
|
3996
|
+
Glimmer app:
|
3997
|
+
|
3998
|
+
![glimmer dsl tk screenshot sample hello scale](images/glimmer-dsl-tk-screenshot-sample-hello-scale.png)
|
3999
|
+
|
4000
|
+
### Hello, Progressbar!
|
4001
|
+
|
4002
|
+
Glimmer code (from [samples/hello/hello_progressbar.rb](samples/hello/hello_progressbar.rb)):
|
4003
|
+
|
4004
|
+
```ruby
|
4005
|
+
require 'glimmer-dsl-tk'
|
4006
|
+
|
4007
|
+
class HelloProgressbar
|
4008
|
+
include Glimmer
|
4009
|
+
|
4010
|
+
attr_accessor :progress_value, :maximum_value, :delay_value
|
4011
|
+
|
4012
|
+
def initialize
|
4013
|
+
self.progress_value = 0
|
4014
|
+
self.maximum_value = 100
|
4015
|
+
self.delay_value = 0.01
|
4016
|
+
|
4017
|
+
Thread.new do
|
4018
|
+
loop do
|
4019
|
+
self.progress_value = (self.progress_value.to_i + 1) % (maximum_value.to_i + 1)
|
4020
|
+
sleep(delay_value) # yields to main thread
|
4021
|
+
end
|
4022
|
+
end
|
4023
|
+
end
|
4024
|
+
|
4025
|
+
def launch
|
4026
|
+
root {
|
4027
|
+
text 'Hello, Progressbar!'
|
4028
|
+
|
4029
|
+
progressbar {
|
4030
|
+
grid row: 0, column: 0, columnspan: 3
|
4031
|
+
orient 'horizontal'
|
4032
|
+
length 200
|
4033
|
+
mode 'indeterminate'
|
4034
|
+
maximum <= [self, :maximum_value]
|
4035
|
+
value <= [self, :progress_value]
|
4036
|
+
}
|
4037
|
+
|
4038
|
+
label {
|
4039
|
+
grid row: 1, column: 0
|
4040
|
+
text 'Value'
|
4041
|
+
}
|
4042
|
+
|
4043
|
+
label {
|
4044
|
+
grid row: 1, column: 1
|
4045
|
+
text 'Maximum'
|
4046
|
+
}
|
4047
|
+
|
4048
|
+
label {
|
4049
|
+
grid row: 1, column: 2
|
4050
|
+
text 'Delay in Seconds'
|
4051
|
+
}
|
4052
|
+
|
4053
|
+
spinbox {
|
4054
|
+
grid row: 2, column: 0
|
4055
|
+
from 0.0
|
4056
|
+
to 100.0
|
4057
|
+
increment 1.0
|
4058
|
+
format '%0f'
|
4059
|
+
text <=> [self, :progress_value, on_read: :to_i, on_write: :to_i]
|
4060
|
+
}
|
4061
|
+
|
4062
|
+
spinbox {
|
4063
|
+
grid row: 2, column: 1
|
4064
|
+
from 1.0
|
4065
|
+
to 100.0
|
4066
|
+
increment 1.0
|
4067
|
+
format '%0f'
|
4068
|
+
text <=> [self, :maximum_value, on_read: :to_i, on_write: :to_i]
|
4069
|
+
}
|
4070
|
+
|
4071
|
+
spinbox {
|
4072
|
+
grid row: 2, column: 2
|
4073
|
+
from 0.01
|
4074
|
+
to 1.0
|
4075
|
+
increment 0.1
|
4076
|
+
format '%0.2f'
|
4077
|
+
text <=> [self, :delay_value, on_write: ->(val) {[val.to_f, 1.0].min}]
|
4078
|
+
}
|
4079
|
+
|
4080
|
+
progressbar {
|
4081
|
+
grid row: 3, column: 0, columnspan: 3
|
4082
|
+
orient 'horizontal'
|
4083
|
+
length 200
|
4084
|
+
mode 'determinate'
|
4085
|
+
maximum <= [self, :maximum_value]
|
4086
|
+
value <= [self, :progress_value]
|
4087
|
+
}
|
4088
|
+
|
4089
|
+
progressbar {
|
4090
|
+
grid row: 4, column: 0, columnspan: 3
|
4091
|
+
orient 'vertical'
|
4092
|
+
length 200
|
4093
|
+
mode 'determinate'
|
4094
|
+
maximum <= [self, :maximum_value]
|
4095
|
+
value <= [self, :progress_value]
|
4096
|
+
}
|
4097
|
+
}.open
|
4098
|
+
end
|
4099
|
+
end
|
4100
|
+
|
4101
|
+
HelloProgressbar.new.launch
|
4102
|
+
```
|
4103
|
+
|
4104
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
4105
|
+
|
4106
|
+
```
|
4107
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_progressbar'"
|
4108
|
+
```
|
4109
|
+
|
4110
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
4111
|
+
|
4112
|
+
```
|
4113
|
+
ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_progressbar.rb
|
4114
|
+
```
|
4115
|
+
|
4116
|
+
Glimmer app:
|
4117
|
+
|
4118
|
+
![glimmer dsl tk screenshot sample hello progressbar](images/glimmer-dsl-tk-screenshot-sample-hello-progressbar.png)
|
4119
|
+
|
4120
|
+
![glimmer dsl tk screenshot sample hello progressbar gif](images/glimmer-dsl-tk-screenshot-sample-hello-progressbar.gif)
|
4121
|
+
|
4122
|
+
### Hello, Theme!
|
4123
|
+
|
4124
|
+
Glimmer code (from [samples/hello/hello_theme.rb](samples/hello/hello_theme.rb)):
|
4125
|
+
|
4126
|
+
```ruby
|
4127
|
+
require 'glimmer-dsl-tk'
|
4128
|
+
|
4129
|
+
class HelloTheme
|
4130
|
+
include Glimmer
|
4131
|
+
|
4132
|
+
def launch
|
4133
|
+
root {
|
4134
|
+
title 'Hello, Theme!'
|
4135
|
+
|
4136
|
+
labelframe {
|
4137
|
+
text 'Theme'
|
4138
|
+
|
4139
|
+
combobox { |cb|
|
4140
|
+
readonly true
|
4141
|
+
values ::Tk::Tile::Style.theme_names
|
4142
|
+
text 'aqua'
|
4143
|
+
|
4144
|
+
on('<ComboboxSelected>') do
|
4145
|
+
::Tk::Tile::Style.theme_use cb.tk.textvariable.value
|
4146
|
+
end
|
4147
|
+
}
|
4148
|
+
}
|
4149
|
+
|
4150
|
+
labelframe {
|
4151
|
+
text 'Widgets'
|
4152
|
+
|
4153
|
+
notebook {
|
4154
|
+
frame(text: 'One') {
|
4155
|
+
label {
|
4156
|
+
text 'label'
|
4157
|
+
}
|
4158
|
+
|
4159
|
+
entry {
|
4160
|
+
text 'entry'
|
4161
|
+
}
|
4162
|
+
|
4163
|
+
entry {
|
4164
|
+
text 'password'
|
4165
|
+
show '*'
|
4166
|
+
}
|
4167
|
+
|
4168
|
+
spinbox {
|
4169
|
+
text '100'
|
4170
|
+
}
|
4171
|
+
}
|
4172
|
+
|
4173
|
+
frame(text: 'Two') {
|
4174
|
+
button {
|
4175
|
+
text 'button'
|
4176
|
+
}
|
4177
|
+
|
4178
|
+
checkbutton {
|
4179
|
+
text 'checkbutton'
|
4180
|
+
}
|
4181
|
+
|
4182
|
+
radiobutton {
|
4183
|
+
text 'radiobutton'
|
4184
|
+
}
|
4185
|
+
}
|
4186
|
+
|
4187
|
+
frame(text: 'Three') {
|
4188
|
+
scale {
|
4189
|
+
orient 'horizontal'
|
4190
|
+
length 200
|
4191
|
+
from 0.0
|
4192
|
+
to 100.0
|
4193
|
+
value 50
|
4194
|
+
}
|
4195
|
+
|
4196
|
+
progressbar {
|
4197
|
+
orient 'horizontal'
|
4198
|
+
length 200
|
4199
|
+
mode 'determinate'
|
4200
|
+
maximum 100
|
4201
|
+
value 50
|
4202
|
+
}
|
4203
|
+
|
4204
|
+
progressbar {
|
4205
|
+
orient 'vertical'
|
4206
|
+
length 100
|
4207
|
+
mode 'determinate'
|
4208
|
+
maximum 100
|
4209
|
+
value 50
|
4210
|
+
}
|
4211
|
+
}
|
4212
|
+
}
|
4213
|
+
}
|
4214
|
+
}.open
|
4215
|
+
end
|
4216
|
+
end
|
4217
|
+
|
4218
|
+
HelloTheme.new.launch
|
4219
|
+
```
|
4220
|
+
|
4221
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
4222
|
+
|
4223
|
+
```
|
4224
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_theme'"
|
4225
|
+
```
|
4226
|
+
|
4227
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
4228
|
+
|
4229
|
+
```
|
4230
|
+
ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_theme.rb
|
4231
|
+
```
|
4232
|
+
|
4233
|
+
Glimmer app:
|
4234
|
+
|
4235
|
+
Aqua Theme Tab One
|
4236
|
+
|
4237
|
+
![glimmer dsl tk screenshot sample hello theme aqua 1](images/glimmer-dsl-tk-screenshot-sample-hello-theme-aqua-tab-one.png)
|
4238
|
+
|
4239
|
+
Aqua Theme Tab Two
|
4240
|
+
|
4241
|
+
![glimmer dsl tk screenshot sample hello theme aqua 2](images/glimmer-dsl-tk-screenshot-sample-hello-theme-aqua-tab-two.png)
|
4242
|
+
|
4243
|
+
Aqua Theme Tab Three
|
4244
|
+
|
4245
|
+
![glimmer dsl tk screenshot sample hello theme aqua 3](images/glimmer-dsl-tk-screenshot-sample-hello-theme-aqua-tab-three.png)
|
4246
|
+
|
4247
|
+
Clam Theme Tab One
|
4248
|
+
|
4249
|
+
![glimmer dsl tk screenshot sample hello theme clam 1](images/glimmer-dsl-tk-screenshot-sample-hello-theme-clam-tab-one.png)
|
4250
|
+
|
4251
|
+
Clam Theme Tab Two
|
4252
|
+
|
4253
|
+
![glimmer dsl tk screenshot sample hello theme clam 2](images/glimmer-dsl-tk-screenshot-sample-hello-theme-clam-tab-two.png)
|
4254
|
+
|
4255
|
+
Clam Theme Tab Three
|
4256
|
+
|
4257
|
+
![glimmer dsl tk screenshot sample hello theme clam 3](images/glimmer-dsl-tk-screenshot-sample-hello-theme-clam-tab-three.png)
|
4258
|
+
|
3897
4259
|
## Applications
|
3898
4260
|
|
3899
4261
|
### Glimmer Tk Calculator
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.57
|
data/glimmer-dsl-tk.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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/tk/widget_proxy'
|
23
|
+
require 'glimmer/tk/variable_owner'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module Tk
|
27
|
+
# Proxy for Tk::Tile::TScale
|
28
|
+
#
|
29
|
+
# Follows the Proxy Design Pattern
|
30
|
+
class ScaleProxy < WidgetProxy
|
31
|
+
include VariableOwner
|
32
|
+
|
33
|
+
def command_block=(proc)
|
34
|
+
tk.command(proc)
|
35
|
+
end
|
36
|
+
|
37
|
+
def handle_listener(listener_name, &listener)
|
38
|
+
case listener_name.to_s.downcase
|
39
|
+
when 'command', 'change'
|
40
|
+
command(&listener)
|
41
|
+
else
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -369,6 +369,12 @@ module Glimmer
|
|
369
369
|
setter: {name: 'text=', invoker: lambda { |widget, args| @tk.textvariable&.value = args.first }},
|
370
370
|
},
|
371
371
|
},
|
372
|
+
::Tk::Tile::TScale => {
|
373
|
+
'variable' => {
|
374
|
+
getter: {name: 'variable', invoker: lambda { |widget, args| @tk.variable&.value }},
|
375
|
+
setter: {name: 'variable=', invoker: lambda { |widget, args| @tk.variable&.value = args.first }},
|
376
|
+
},
|
377
|
+
},
|
372
378
|
::Tk::Root => {
|
373
379
|
'text' => {
|
374
380
|
getter: {name: 'text', invoker: lambda { |widget, args| @tk.title }},
|
@@ -428,6 +434,13 @@ module Glimmer
|
|
428
434
|
}
|
429
435
|
end,
|
430
436
|
},
|
437
|
+
::Tk::Tile::TScale => {
|
438
|
+
'variable' => lambda do |observer|
|
439
|
+
@tk.command {
|
440
|
+
observer.call(@tk.variable&.value)
|
441
|
+
}
|
442
|
+
end,
|
443
|
+
},
|
431
444
|
::Tk::Text => {
|
432
445
|
'value' => lambda do |observer|
|
433
446
|
handle_listener('modified') do
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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 HelloProgressbar
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
attr_accessor :progress_value, :maximum_value, :delay_value
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
self.progress_value = 0
|
31
|
+
self.maximum_value = 100
|
32
|
+
self.delay_value = 0.01
|
33
|
+
|
34
|
+
Thread.new do
|
35
|
+
loop do
|
36
|
+
self.progress_value = (self.progress_value.to_i + 1) % (maximum_value.to_i + 1)
|
37
|
+
sleep(delay_value) # yields to main thread
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def launch
|
43
|
+
root {
|
44
|
+
text 'Hello, Progressbar!'
|
45
|
+
|
46
|
+
progressbar {
|
47
|
+
grid row: 0, column: 0, columnspan: 3
|
48
|
+
orient 'horizontal'
|
49
|
+
length 200
|
50
|
+
mode 'indeterminate'
|
51
|
+
maximum <= [self, :maximum_value]
|
52
|
+
value <= [self, :progress_value]
|
53
|
+
}
|
54
|
+
|
55
|
+
label {
|
56
|
+
grid row: 1, column: 0
|
57
|
+
text 'Value'
|
58
|
+
}
|
59
|
+
|
60
|
+
label {
|
61
|
+
grid row: 1, column: 1
|
62
|
+
text 'Maximum'
|
63
|
+
}
|
64
|
+
|
65
|
+
label {
|
66
|
+
grid row: 1, column: 2
|
67
|
+
text 'Delay in Seconds'
|
68
|
+
}
|
69
|
+
|
70
|
+
spinbox {
|
71
|
+
grid row: 2, column: 0
|
72
|
+
from 0.0
|
73
|
+
to 100.0
|
74
|
+
increment 1.0
|
75
|
+
format '%0f'
|
76
|
+
text <=> [self, :progress_value, on_read: :to_i, on_write: :to_i]
|
77
|
+
}
|
78
|
+
|
79
|
+
spinbox {
|
80
|
+
grid row: 2, column: 1
|
81
|
+
from 1.0
|
82
|
+
to 100.0
|
83
|
+
increment 1.0
|
84
|
+
format '%0f'
|
85
|
+
text <=> [self, :maximum_value, on_read: :to_i, on_write: :to_i]
|
86
|
+
}
|
87
|
+
|
88
|
+
spinbox {
|
89
|
+
grid row: 2, column: 2
|
90
|
+
from 0.01
|
91
|
+
to 1.0
|
92
|
+
increment 0.1
|
93
|
+
format '%0.2f'
|
94
|
+
text <=> [self, :delay_value, on_write: ->(val) {[val.to_f, 1.0].min}]
|
95
|
+
}
|
96
|
+
|
97
|
+
progressbar {
|
98
|
+
grid row: 3, column: 0, columnspan: 3
|
99
|
+
orient 'horizontal'
|
100
|
+
length 200
|
101
|
+
mode 'determinate'
|
102
|
+
maximum <= [self, :maximum_value]
|
103
|
+
value <= [self, :progress_value]
|
104
|
+
}
|
105
|
+
|
106
|
+
progressbar {
|
107
|
+
grid row: 4, column: 0, columnspan: 3
|
108
|
+
orient 'vertical'
|
109
|
+
length 200
|
110
|
+
mode 'determinate'
|
111
|
+
maximum <= [self, :maximum_value]
|
112
|
+
value <= [self, :progress_value]
|
113
|
+
}
|
114
|
+
}.open
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
HelloProgressbar.new.launch
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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 HelloScale
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
attr_accessor :scale_value
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
self.scale_value = 50
|
31
|
+
end
|
32
|
+
|
33
|
+
def launch
|
34
|
+
root {
|
35
|
+
text 'Hello, Scale!'
|
36
|
+
|
37
|
+
label {
|
38
|
+
anchor 'center'
|
39
|
+
text <= [self, :scale_value]
|
40
|
+
}
|
41
|
+
|
42
|
+
scale {
|
43
|
+
orient 'horizontal' # can be 'vertical' too
|
44
|
+
length 200
|
45
|
+
from 0.0
|
46
|
+
to 100.0
|
47
|
+
variable <=> [self, :scale_value, on_write: :to_i]
|
48
|
+
}
|
49
|
+
}.open
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
HelloScale.new.launch
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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 HelloTheme
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
def launch
|
28
|
+
root {
|
29
|
+
title 'Hello, Theme!'
|
30
|
+
|
31
|
+
labelframe {
|
32
|
+
text 'Theme'
|
33
|
+
|
34
|
+
combobox { |cb|
|
35
|
+
readonly true
|
36
|
+
values ::Tk::Tile::Style.theme_names
|
37
|
+
text 'aqua'
|
38
|
+
|
39
|
+
on('<ComboboxSelected>') do
|
40
|
+
::Tk::Tile::Style.theme_use cb.tk.textvariable.value
|
41
|
+
end
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
labelframe {
|
46
|
+
text 'Widgets'
|
47
|
+
|
48
|
+
notebook {
|
49
|
+
frame(text: 'One') {
|
50
|
+
label {
|
51
|
+
text 'label'
|
52
|
+
}
|
53
|
+
|
54
|
+
entry {
|
55
|
+
text 'entry'
|
56
|
+
}
|
57
|
+
|
58
|
+
entry {
|
59
|
+
text 'password'
|
60
|
+
show '*'
|
61
|
+
}
|
62
|
+
|
63
|
+
spinbox {
|
64
|
+
text '100'
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
frame(text: 'Two') {
|
69
|
+
button {
|
70
|
+
text 'button'
|
71
|
+
}
|
72
|
+
|
73
|
+
checkbutton {
|
74
|
+
text 'checkbutton'
|
75
|
+
}
|
76
|
+
|
77
|
+
radiobutton {
|
78
|
+
text 'radiobutton'
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
frame(text: 'Three') {
|
83
|
+
scale {
|
84
|
+
orient 'horizontal'
|
85
|
+
length 200
|
86
|
+
from 0.0
|
87
|
+
to 100.0
|
88
|
+
value 50
|
89
|
+
}
|
90
|
+
|
91
|
+
progressbar {
|
92
|
+
orient 'horizontal'
|
93
|
+
length 200
|
94
|
+
mode 'determinate'
|
95
|
+
maximum 100
|
96
|
+
value 50
|
97
|
+
}
|
98
|
+
|
99
|
+
progressbar {
|
100
|
+
orient 'vertical'
|
101
|
+
length 100
|
102
|
+
mode 'determinate'
|
103
|
+
maximum 100
|
104
|
+
value 50
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}.open
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
HelloTheme.new.launch
|
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.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: puts_debuggerer
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/glimmer/tk/os.rb
|
223
223
|
- lib/glimmer/tk/radiobutton_proxy.rb
|
224
224
|
- lib/glimmer/tk/root_proxy.rb
|
225
|
+
- lib/glimmer/tk/scale_proxy.rb
|
225
226
|
- lib/glimmer/tk/scrollbar_frame_proxy.rb
|
226
227
|
- lib/glimmer/tk/spinbox_proxy.rb
|
227
228
|
- lib/glimmer/tk/text_proxy.rb
|
@@ -249,13 +250,16 @@ files:
|
|
249
250
|
- samples/hello/hello_menu_bar.rb
|
250
251
|
- samples/hello/hello_message_box.rb
|
251
252
|
- samples/hello/hello_notebook.rb
|
253
|
+
- samples/hello/hello_progressbar.rb
|
252
254
|
- samples/hello/hello_radiobutton.rb
|
253
255
|
- samples/hello/hello_root.rb
|
256
|
+
- samples/hello/hello_scale.rb
|
254
257
|
- samples/hello/hello_scrollbar.rb
|
255
258
|
- samples/hello/hello_scrollbar_frame.rb
|
256
259
|
- samples/hello/hello_separator.rb
|
257
260
|
- samples/hello/hello_spinbox.rb
|
258
261
|
- samples/hello/hello_text.rb
|
262
|
+
- samples/hello/hello_theme.rb
|
259
263
|
- samples/hello/hello_toplevel.rb
|
260
264
|
- samples/hello/hello_world.rb
|
261
265
|
- samples/hello/images/align-center.png
|