glimmer-dsl-tk 0.0.55 → 0.0.56

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: c60d4ed3e0d36df11f12decc435cc03357dfb96ec95720e7bb830b527a473f9f
4
- data.tar.gz: 1d33536b8b2e2c5700c8d3c320b28afc7b4c6d9eb976ce8d210cae94d7b731d5
3
+ metadata.gz: 951b8e62423c7092e9d3d34c25ea583cab0e5195b84f2553a47f36bcce2703c3
4
+ data.tar.gz: 35017367771d0668aa955d0edc9776fb5d5072ffdd1b63519f920d1edc73b70f
5
5
  SHA512:
6
- metadata.gz: fc9fffd9cfdc6f75b57bcec0bb2851efe21fbfc6b46376db9350f552e29930c0f452c84654aa74a2fe4cd06e757a5470be265f533479e0a37feb8795ce473d52
7
- data.tar.gz: 8425516afcb5698463cd23ee20b34570772bf084b29f393a8cc12302f3c3cde95c9d90671d06d4e9be7f5ae953a8d582d8c6d183d2ae55f3d1d09ea5470d320e
6
+ metadata.gz: 78bd1d1296b43903d306daa043cbaa21f4b898703c43021387c32ed4e96019ebcff3690ac2a6e70e810ea7ccc70181df3ccefb5412e9fcebaecd9c762f14c511
7
+ data.tar.gz: 3aa1e66860f386a919a63c141023d20baba0e7aaff885560d9433a817baa9e930eed812242f2a203775254eabbb4f50fb29ab905f40223a0697c7600c58c9e02
data/CHANGELOG.md CHANGED
@@ -1,13 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.56
4
+
5
+ - Hello, Progressbar! sample
6
+ - Upgrade to glimmer 2.7.3
7
+
3
8
  ## 0.0.55
4
9
 
5
- - Hello, Scale!
10
+ - Hello, Scale! sample
6
11
  - `scale` `variable` data-binding
7
12
 
8
13
  ## 0.0.54
9
14
 
10
- - Hello, Labelframe!
15
+ - Hello, Labelframe! sample
11
16
  - Add default padding to `labelframe`
12
17
 
13
18
  ## 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.55
2
- ## MRI Ruby Desktop Development GUI Library
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.56
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 (MRI Ruby 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
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
@@ -134,6 +134,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
134
134
  - [Hello, Contextual Menu!](#hello-contextual-menu)
135
135
  - [Hello, Labelframe!](#hello-labelframe)
136
136
  - [Hello, Scale!](#hello-scale)
137
+ - [Hello, Progressbar!](#hello-progressbar)
137
138
  - [Applications](#applications)
138
139
  - [Glimmer Tk Calculator](#glimmer-tk-calculator)
139
140
  - [Y3network Ruby UI](#y3network-ruby-ui)
@@ -193,7 +194,7 @@ gem install glimmer-dsl-tk
193
194
 
194
195
  Add the following to `Gemfile`:
195
196
  ```
196
- gem 'glimmer-dsl-tk', '0.0.55'
197
+ gem 'glimmer-dsl-tk', '0.0.56'
197
198
  ```
198
199
 
199
200
  And, then run:
@@ -792,6 +793,28 @@ It automatically handles all the Tk plumbing behind the scenes.
792
793
 
793
794
  More details can be found in [Hello, Scale!](#hello-scale) sample below.
794
795
 
796
+ ### Progressbar Data-Binding
797
+
798
+ Example:
799
+
800
+ This assumes a `Worker` model with a `progress_value` attribute.
801
+
802
+ ```ruby
803
+ progressbar {
804
+ orient 'horizontal' # can be vertical too
805
+ length 200
806
+ mode 'determinate'
807
+ maximum 100
808
+ value <= [worker, :progress_value]
809
+ }
810
+ ```
811
+
812
+ That code binds the value of the `progressbar` to the `progress_value` attribute on the `worker` model.
813
+
814
+ It automatically handles all the Tk plumbing behind the scenes.
815
+
816
+ More details can be found in [Hello, Progressbar!](#hello-progressbar) sample below.
817
+
795
818
  ### Spinbox Data-Binding
796
819
 
797
820
  Example:
@@ -3973,6 +3996,128 @@ Glimmer app:
3973
3996
 
3974
3997
  ![glimmer dsl tk screenshot sample hello scale](images/glimmer-dsl-tk-screenshot-sample-hello-scale.png)
3975
3998
 
3999
+ ### Hello, Progressbar!
4000
+
4001
+ Glimmer code (from [samples/hello/hello_progressbar.rb](samples/hello/hello_progressbar.rb)):
4002
+
4003
+ ```ruby
4004
+ require 'glimmer-dsl-tk'
4005
+
4006
+ class HelloProgressbar
4007
+ include Glimmer
4008
+
4009
+ attr_accessor :progress_value, :maximum_value, :delay_value
4010
+
4011
+ def initialize
4012
+ self.progress_value = 0
4013
+ self.maximum_value = 100
4014
+ self.delay_value = 0.01
4015
+
4016
+ Thread.new do
4017
+ loop do
4018
+ self.progress_value = (self.progress_value.to_i + 1) % (maximum_value.to_i + 1)
4019
+ sleep(delay_value) # yields to main thread
4020
+ end
4021
+ end
4022
+ end
4023
+
4024
+ def launch
4025
+ root {
4026
+ text 'Hello, Progressbar!'
4027
+
4028
+ progressbar {
4029
+ grid row: 0, column: 0, columnspan: 3
4030
+ orient 'horizontal'
4031
+ length 200
4032
+ mode 'indeterminate'
4033
+ maximum <= [self, :maximum_value]
4034
+ value <= [self, :progress_value]
4035
+ }
4036
+
4037
+ label {
4038
+ grid row: 1, column: 0
4039
+ text 'Value'
4040
+ }
4041
+
4042
+ label {
4043
+ grid row: 1, column: 1
4044
+ text 'Maximum'
4045
+ }
4046
+
4047
+ label {
4048
+ grid row: 1, column: 2
4049
+ text 'Delay in Seconds'
4050
+ }
4051
+
4052
+ spinbox {
4053
+ grid row: 2, column: 0
4054
+ from 0.0
4055
+ to 100.0
4056
+ increment 1.0
4057
+ format '%0f'
4058
+ text <=> [self, :progress_value, on_read: :to_i, on_write: :to_i]
4059
+ }
4060
+
4061
+ spinbox {
4062
+ grid row: 2, column: 1
4063
+ from 1.0
4064
+ to 100.0
4065
+ increment 1.0
4066
+ format '%0f'
4067
+ text <=> [self, :maximum_value, on_read: :to_i, on_write: :to_i]
4068
+ }
4069
+
4070
+ spinbox {
4071
+ grid row: 2, column: 2
4072
+ from 0.01
4073
+ to 1.0
4074
+ increment 0.1
4075
+ format '%0.2f'
4076
+ text <=> [self, :delay_value, on_write: ->(val) {[val.to_f, 1.0].min}]
4077
+ }
4078
+
4079
+ progressbar {
4080
+ grid row: 3, column: 0, columnspan: 3
4081
+ orient 'horizontal'
4082
+ length 200
4083
+ mode 'determinate'
4084
+ maximum <= [self, :maximum_value]
4085
+ value <= [self, :progress_value]
4086
+ }
4087
+
4088
+ progressbar {
4089
+ grid row: 4, column: 0, columnspan: 3
4090
+ orient 'vertical'
4091
+ length 200
4092
+ mode 'determinate'
4093
+ maximum <= [self, :maximum_value]
4094
+ value <= [self, :progress_value]
4095
+ }
4096
+ }.open
4097
+ end
4098
+ end
4099
+
4100
+ HelloProgressbar.new.launch
4101
+ ```
4102
+
4103
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
4104
+
4105
+ ```
4106
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_progressbar'"
4107
+ ```
4108
+
4109
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
4110
+
4111
+ ```
4112
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_progressbar.rb
4113
+ ```
4114
+
4115
+ Glimmer app:
4116
+
4117
+ ![glimmer dsl tk screenshot sample hello progressbar](images/glimmer-dsl-tk-screenshot-sample-hello-progressbar.png)
4118
+
4119
+ ![glimmer dsl tk screenshot sample hello progressbar gif](images/glimmer-dsl-tk-screenshot-sample-hello-progressbar.gif)
4120
+
3976
4121
  ## Applications
3977
4122
 
3978
4123
  ### Glimmer Tk Calculator
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.55
1
+ 0.0.56
Binary file
@@ -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
@@ -44,7 +44,7 @@ class HelloScale
44
44
  length 200
45
45
  from 0.0
46
46
  to 100.0
47
- variable <=> [self, :scale_value, on_write: ->(val) {val.to_i}]
47
+ variable <=> [self, :scale_value, on_write: :to_i]
48
48
  }
49
49
  }.open
50
50
  end
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.55
4
+ version: 0.0.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-20 00:00:00.000000000 Z
11
+ date: 2022-03-26 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.6.0
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.6.0
26
+ version: 2.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: puts_debuggerer
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -250,6 +250,7 @@ files:
250
250
  - samples/hello/hello_menu_bar.rb
251
251
  - samples/hello/hello_message_box.rb
252
252
  - samples/hello/hello_notebook.rb
253
+ - samples/hello/hello_progressbar.rb
253
254
  - samples/hello/hello_radiobutton.rb
254
255
  - samples/hello/hello_root.rb
255
256
  - samples/hello/hello_scale.rb