glimmer-dsl-tk 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +70 -20
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/samples/hello/hello_button.rb +48 -0
- data/samples/hello/hello_message_box.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 497468a4ac3cef00c77957d6cb216ba1aed9916214e54561e8bff752c5117261
|
4
|
+
data.tar.gz: 3da1ce8af59ea3e03f45b1ab7c218c375fd86a145959657e8251d431bc6d0d90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8def1bfc6f2263a3557a0fd6ccdf48b53180a259a63972463341e9afa235610634b4070b3b5b425c7a0205b73d2b22f3f9562cdebb53b3792232723f7a3a0bb
|
7
|
+
data.tar.gz: 7bd54e692f828e9134876bf9b00f3f3d2413235c919673ffe44be294c6890fcf1c2655ab5928a92a3e814049a37bd458e82f5870c0d051c91f0f60f14eebcd6b
|
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.14
|
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
|
[![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)
|
@@ -81,7 +81,7 @@ gem install glimmer-dsl-tk
|
|
81
81
|
|
82
82
|
Add the following to `Gemfile`:
|
83
83
|
```
|
84
|
-
gem 'glimmer-dsl-tk', '~> 0.0.
|
84
|
+
gem 'glimmer-dsl-tk', '~> 0.0.14'
|
85
85
|
```
|
86
86
|
|
87
87
|
And, then run:
|
@@ -238,6 +238,24 @@ More details can be found in the [Hello, Computed!](#hello-computed) sample belo
|
|
238
238
|
|
239
239
|
Glimmer supports Shine syntax bidirectional data-binding via the `<=>` operator (read-write) and unidirectional data-binding via the `<=` operator (read-only), which takes a model and an attribute (the `bind` keyword may also be used as the old-style of data-binding).
|
240
240
|
|
241
|
+
### General Property Data-Binding
|
242
|
+
|
243
|
+
Example:
|
244
|
+
|
245
|
+
This assumes a `Person` model with a `country` attribute.
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
label {
|
249
|
+
text <=> [person, :country]
|
250
|
+
}
|
251
|
+
```
|
252
|
+
|
253
|
+
That code binds the `textvariable` value of the `label` to the `country` property on the `person` model.
|
254
|
+
|
255
|
+
It automatically handles all the Tk plumbing behind the scenes.
|
256
|
+
|
257
|
+
More details can be found in the [Hello, Computed!](#hello-computed) sample below.
|
258
|
+
|
241
259
|
### Combobox Data-Binding
|
242
260
|
|
243
261
|
Example:
|
@@ -301,24 +319,6 @@ It automatically handles all the Tk plumbing behind the scenes.
|
|
301
319
|
|
302
320
|
More details can be found in the [Hello, List Multi Selection!](#hello-list-multi-selection) sample below.
|
303
321
|
|
304
|
-
### Label Data-Binding
|
305
|
-
|
306
|
-
Example:
|
307
|
-
|
308
|
-
This assumes a `Person` model with a `country` attribute.
|
309
|
-
|
310
|
-
```ruby
|
311
|
-
label {
|
312
|
-
text <=> [person, :country]
|
313
|
-
}
|
314
|
-
```
|
315
|
-
|
316
|
-
That code binds the `textvariable` value of the `label` to the `country` property on the `person` model.
|
317
|
-
|
318
|
-
It automatically handles all the Tk plumbing behind the scenes.
|
319
|
-
|
320
|
-
More details can be found in the [Hello, Computed!](#hello-computed) sample below.
|
321
|
-
|
322
322
|
### Entry Data-Binding
|
323
323
|
|
324
324
|
Example:
|
@@ -388,6 +388,56 @@ Glimmer app:
|
|
388
388
|
|
389
389
|
![glimmer dsl tk screenshot sample hello world](images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
390
390
|
|
391
|
+
### Hello, Button!
|
392
|
+
|
393
|
+
Glimmer code (from [samples/hello/hello_button.rb](samples/hello/hello_button.rb)):
|
394
|
+
|
395
|
+
```ruby
|
396
|
+
require 'glimmer-dsl-tk'
|
397
|
+
|
398
|
+
class HelloButton
|
399
|
+
include Glimmer
|
400
|
+
|
401
|
+
attr_accessor :count
|
402
|
+
|
403
|
+
def initialize
|
404
|
+
@count = 0
|
405
|
+
end
|
406
|
+
|
407
|
+
def launch
|
408
|
+
root {
|
409
|
+
title 'Hello, Button!'
|
410
|
+
|
411
|
+
button {
|
412
|
+
text <= [self, :count, on_read: ->(value) { "Click To Increment: #{value} " }]
|
413
|
+
|
414
|
+
command {
|
415
|
+
self.count += 1
|
416
|
+
}
|
417
|
+
}
|
418
|
+
}.open
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
HelloButton.new.launch
|
423
|
+
```
|
424
|
+
|
425
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
426
|
+
|
427
|
+
```
|
428
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_button'"
|
429
|
+
```
|
430
|
+
|
431
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
432
|
+
|
433
|
+
```
|
434
|
+
ruby -e "require './lib/glimmer-dsl-tk'; require './samples/hello/hello_button'"
|
435
|
+
```
|
436
|
+
|
437
|
+
Glimmer app:
|
438
|
+
|
439
|
+
![glimmer dsl tk screenshot sample hello button](images/glimmer-dsl-tk-screenshot-sample-hello-button.png)
|
440
|
+
|
391
441
|
### Hello, Tab!
|
392
442
|
|
393
443
|
Glimmer code (from [samples/hello/hello_tab.rb](samples/hello/hello_tab.rb)):
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.14
|
data/glimmer-dsl-tk.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,48 @@
|
|
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 HelloButton
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
attr_accessor :count
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@count = 0
|
31
|
+
end
|
32
|
+
|
33
|
+
def launch
|
34
|
+
root {
|
35
|
+
title 'Hello, Button!'
|
36
|
+
|
37
|
+
button {
|
38
|
+
text <= [self, :count, on_read: ->(value) { "Click To Increment: #{value} " }]
|
39
|
+
|
40
|
+
command {
|
41
|
+
self.count += 1
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}.open
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
HelloButton.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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/glimmer/tk/root_proxy.rb
|
211
211
|
- lib/glimmer/tk/treeview_proxy.rb
|
212
212
|
- lib/glimmer/tk/widget_proxy.rb
|
213
|
+
- samples/hello/hello_button.rb
|
213
214
|
- samples/hello/hello_combobox.rb
|
214
215
|
- samples/hello/hello_computed.rb
|
215
216
|
- samples/hello/hello_computed/contact.rb
|