glimmer-dsl-tk 0.0.58 → 0.0.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +20 -9
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/tk/entry_proxy.rb +11 -0
- data/samples/hello/hello_entry.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26c20e8d681d57d11f540136ad94fd26a4f7ab51a5663eba95599dd5fa1589fe
|
4
|
+
data.tar.gz: 6f70dd20a48487e0c73135790b24e38f8080fa376cda20f1da2c8db83cb78d4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97fc2a77f286aec0cef3f0733aa1642415a0cf5ae420ea7713344b4b9f0de676d96fbb40b6cdba8d5a3338f8340a6b94ef3e6497043b86cd154258d66e320616
|
7
|
+
data.tar.gz: d48746949f04d68643d6493cab85c04bc7951da0fcbced1c7f13ab9a968d3bab6e452b8c804b2b012ab6b662c8092e87c0bea4386a214b2ccd494a94e46b6299
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.59
|
4
|
+
|
5
|
+
- Auto-Default to `validate 'key'` on an `entry` when defining `validatecommand {}`, `on('validate') {}`, `invalidcommand {}`, `on('invalid') {}`
|
6
|
+
|
3
7
|
## 0.0.58
|
4
8
|
|
5
9
|
- Support `@tk.textvariable.trace('write')` kind of variable tracing via `on_var(trace_operation) {}` listeners (e.g. `on_textvariable('write') {}`)
|
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.59
|
2
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)
|
@@ -195,7 +195,7 @@ gem install glimmer-dsl-tk
|
|
195
195
|
|
196
196
|
Add the following to `Gemfile`:
|
197
197
|
```
|
198
|
-
gem 'glimmer-dsl-tk', '0.0.
|
198
|
+
gem 'glimmer-dsl-tk', '0.0.59'
|
199
199
|
```
|
200
200
|
|
201
201
|
And, then run:
|
@@ -2181,12 +2181,13 @@ class HelloEntry
|
|
2181
2181
|
def launch
|
2182
2182
|
root {
|
2183
2183
|
title 'Hello, Entry!'
|
2184
|
-
|
2184
|
+
minsize 230, 0
|
2185
|
+
|
2185
2186
|
label {
|
2186
2187
|
grid sticky: 'ew'
|
2187
2188
|
text 'default entry'
|
2188
2189
|
}
|
2189
|
-
entry {
|
2190
|
+
entry { |the_entry|
|
2190
2191
|
grid sticky: 'ew'
|
2191
2192
|
text <=> [self, :default]
|
2192
2193
|
}
|
@@ -2205,11 +2206,14 @@ class HelloEntry
|
|
2205
2206
|
grid sticky: 'ew'
|
2206
2207
|
text 'entry with event handlers'
|
2207
2208
|
}
|
2208
|
-
entry {
|
2209
|
+
entry { |the_entry|
|
2209
2210
|
grid sticky: 'ew'
|
2210
2211
|
text <=> [self, :telephone]
|
2211
|
-
validate 'key'
|
2212
2212
|
|
2213
|
+
# validate 'key' # default when on('validate') or on('invalid') is specified
|
2214
|
+
## Validation happens on key change by default when validation listeners are specified
|
2215
|
+
## (other accepted values: 'none', 'focus', 'focusin', 'focusout', 'key', or 'all')
|
2216
|
+
|
2213
2217
|
## this event kicks in just after the user typed and before modifying the text variable
|
2214
2218
|
on('validate') do |new_text_variable|
|
2215
2219
|
telephone?(new_text_variable.value)
|
@@ -2217,7 +2221,7 @@ class HelloEntry
|
|
2217
2221
|
|
2218
2222
|
## this event kicks in just after the text variable is validated and before it is modified
|
2219
2223
|
on('invalid') do |validate_args|
|
2220
|
-
@validated_entry_label.text = "#{validate_args.
|
2224
|
+
@validated_entry_label.text = "#{validate_args.value} is not a valid phone!"
|
2221
2225
|
@validated_entry_label.foreground = 'red'
|
2222
2226
|
end
|
2223
2227
|
|
@@ -2227,6 +2231,13 @@ class HelloEntry
|
|
2227
2231
|
@validated_entry_label.text = 'entry with event handlers'
|
2228
2232
|
@validated_entry_label.foreground = nil
|
2229
2233
|
end
|
2234
|
+
|
2235
|
+
## this is similar to on('change') (which is Glimmer-specific), but more low level at the Tk level
|
2236
|
+
## it is the equivalent of calling: the_entry.tk.textvariable.trace('write') { puts "..." }
|
2237
|
+
## More at: https://tkdocs.com/tutorial/widgets.html#entry and https://tcl.tk/man/tcl8.6/TclCmd/trace.htm#M14
|
2238
|
+
on_textvariable('write') do
|
2239
|
+
puts "\"#{the_entry.text}\" has been written to entry!"
|
2240
|
+
end
|
2230
2241
|
}
|
2231
2242
|
|
2232
2243
|
label {
|
@@ -4274,9 +4285,9 @@ https://github.com/ancorgs/y3network-ruby-ui
|
|
4274
4285
|
|
4275
4286
|
This is a Graphical User Interface for the famous [cryptopunks Ruby gem](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks).
|
4276
4287
|
|
4277
|
-
https://github.com/cryptopunksnotdead/cryptopunks-gui
|
4288
|
+
https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks-gui
|
4278
4289
|
|
4279
|
-
![CryptoPunks GUI Screenshot](https://raw.githubusercontent.com/cryptopunksnotdead/cryptopunks-gui/
|
4290
|
+
![CryptoPunks GUI Screenshot](https://raw.githubusercontent.com/cryptopunksnotdead/cryptopunks/master/cryptopunks-gui/screenshots/cryptopunks-gui-screenshot.png)
|
4280
4291
|
|
4281
4292
|
### Circule
|
4282
4293
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.59
|
data/glimmer-dsl-tk.gemspec
CHANGED
Binary file
|
@@ -31,13 +31,24 @@ module Glimmer
|
|
31
31
|
include TextVariableOwner
|
32
32
|
|
33
33
|
def validatecommand_block=(proc)
|
34
|
+
self.validate = 'key' unless validate
|
34
35
|
tk.validatecommand(proc)
|
35
36
|
end
|
36
37
|
|
37
38
|
def invalidcommand_block=(proc)
|
39
|
+
self.validate = 'key' unless validate
|
38
40
|
tk.invalidcommand(proc)
|
39
41
|
end
|
40
42
|
|
43
|
+
def validate
|
44
|
+
@validate
|
45
|
+
end
|
46
|
+
|
47
|
+
def validate=(value)
|
48
|
+
@validate = value
|
49
|
+
@tk.validate(value)
|
50
|
+
end
|
51
|
+
|
41
52
|
def handle_listener(listener_name, &listener)
|
42
53
|
case listener_name.to_s.downcase
|
43
54
|
when 'change', 'changed', 'modified'
|
@@ -64,8 +64,11 @@ class HelloEntry
|
|
64
64
|
entry { |the_entry|
|
65
65
|
grid sticky: 'ew'
|
66
66
|
text <=> [self, :telephone]
|
67
|
-
validate 'key'
|
68
67
|
|
68
|
+
# validate 'key' # default when on('validate') or on('invalid') is specified
|
69
|
+
## Validation happens on key change by default when validation listeners are specified
|
70
|
+
## (other accepted values: 'none', 'focus', 'focusin', 'focusout', 'key', or 'all')
|
71
|
+
|
69
72
|
## this event kicks in just after the user typed and before modifying the text variable
|
70
73
|
on('validate') do |new_text_variable|
|
71
74
|
telephone?(new_text_variable.value)
|
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.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|