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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf96d61575c30434197c7edfe2bfb6e6fd9fb84c70c18c0e924d688418351315
4
- data.tar.gz: eaa003fd150d7fac2e85196e477714ea7df87d7a4651e44c0a909b8c566085c3
3
+ metadata.gz: 26c20e8d681d57d11f540136ad94fd26a4f7ab51a5663eba95599dd5fa1589fe
4
+ data.tar.gz: 6f70dd20a48487e0c73135790b24e38f8080fa376cda20f1da2c8db83cb78d4c
5
5
  SHA512:
6
- metadata.gz: 9451fadd605400721e4fd02a601e2720a2e4a41daa28aa0fa69b32f43ae1334de5ecde54ed2cd7d0f13bebdcdfe666daa4391c585fbea24302556eec8389f8af
7
- data.tar.gz: c9e1ad3acd64c17b7642500ed7764c8f3be955de5a5a34d9cd482ac65a23aaba613396d6b14cfaddcd1537d63df6c3e810e723cd48c46bbcb318b00e4b5bc1ed
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.58
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.58'
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.string} is not valid!"
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/master/screenshots/cryptopunks-gui-screenshot.png)
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.58
1
+ 0.0.59
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.58
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-07 00:00:00.000000000 Z
11
+ date: 2022-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer