glimmer-dsl-tk 0.0.51 → 0.0.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +316 -32
  5. data/VERSION +1 -1
  6. data/bin/girb +1 -1
  7. data/bin/girb_runner.rb +1 -1
  8. data/glimmer-dsl-tk.gemspec +0 -0
  9. data/lib/glimmer/data_binding/tk/list_selection_binding.rb +1 -1
  10. data/lib/glimmer/data_binding/tk/one_time_observer.rb +1 -1
  11. data/lib/glimmer/data_binding/tk/widget_binding.rb +1 -1
  12. data/lib/glimmer/dsl/tk/attribute_expression.rb +1 -1
  13. data/lib/glimmer/dsl/tk/bind_expression.rb +1 -1
  14. data/lib/glimmer/dsl/tk/block_attribute_expression.rb +1 -1
  15. data/lib/glimmer/dsl/tk/built_in_dialog_expression.rb +1 -1
  16. data/lib/glimmer/dsl/tk/data_binding_expression.rb +1 -1
  17. data/lib/glimmer/dsl/tk/dsl.rb +1 -1
  18. data/lib/glimmer/dsl/tk/format_expression.rb +1 -1
  19. data/lib/glimmer/dsl/tk/list_selection_data_binding_expression.rb +1 -1
  20. data/lib/glimmer/dsl/tk/message_box_expression.rb +1 -1
  21. data/lib/glimmer/dsl/tk/on_expression.rb +1 -1
  22. data/lib/glimmer/dsl/tk/root_expression.rb +1 -1
  23. data/lib/glimmer/dsl/tk/shine_data_binding_expression.rb +1 -1
  24. data/lib/glimmer/dsl/tk/widget_expression.rb +1 -1
  25. data/lib/glimmer/tk/checkbutton_proxy.rb +1 -1
  26. data/lib/glimmer/tk/combobox_proxy.rb +1 -1
  27. data/lib/glimmer/tk/drag_and_drop_event.rb +21 -0
  28. data/lib/glimmer/tk/draggable_and_droppable.rb +1 -1
  29. data/lib/glimmer/tk/entry_proxy.rb +1 -1
  30. data/lib/glimmer/tk/frame_proxy.rb +1 -1
  31. data/lib/glimmer/tk/label_proxy.rb +1 -1
  32. data/lib/glimmer/tk/labelframe_proxy.rb +39 -0
  33. data/lib/glimmer/tk/lbl_proxy.rb +1 -1
  34. data/lib/glimmer/tk/list_proxy.rb +1 -1
  35. data/lib/glimmer/tk/menu_item_proxy.rb +10 -2
  36. data/lib/glimmer/tk/menu_proxy.rb +1 -1
  37. data/lib/glimmer/tk/notebook_proxy.rb +1 -1
  38. data/lib/glimmer/tk/os.rb +1 -1
  39. data/lib/glimmer/tk/radiobutton_proxy.rb +1 -1
  40. data/lib/glimmer/tk/root_proxy.rb +1 -1
  41. data/lib/glimmer/tk/scale_proxy.rb +48 -0
  42. data/lib/glimmer/tk/scrollbar_frame_proxy.rb +1 -1
  43. data/lib/glimmer/tk/spinbox_proxy.rb +1 -1
  44. data/lib/glimmer/tk/text_proxy.rb +1 -1
  45. data/lib/glimmer/tk/text_variable_owner.rb +1 -1
  46. data/lib/glimmer/tk/toplevel_proxy.rb +2 -2
  47. data/lib/glimmer/tk/treeview_proxy.rb +1 -1
  48. data/lib/glimmer/tk/variable_owner.rb +1 -1
  49. data/lib/glimmer/tk/widget.rb +1 -1
  50. data/lib/glimmer/tk/widget_proxy.rb +21 -3
  51. data/lib/glimmer-dsl-tk.rb +1 -1
  52. data/samples/elaborate/meta_sample.rb +1 -1
  53. data/samples/hello/hello_built_in_dialog.rb +1 -1
  54. data/samples/hello/hello_button.rb +1 -1
  55. data/samples/hello/hello_checkbutton.rb +1 -1
  56. data/samples/hello/hello_combobox.rb +1 -2
  57. data/samples/hello/hello_computed.rb +1 -1
  58. data/samples/hello/hello_contextual_menu.rb +1 -1
  59. data/samples/hello/hello_drag_and_drop.rb +1 -1
  60. data/samples/hello/hello_entry.rb +1 -1
  61. data/samples/hello/hello_frame.rb +1 -1
  62. data/samples/hello/hello_label.rb +1 -1
  63. data/samples/hello/hello_labelframe.rb +161 -0
  64. data/samples/hello/hello_list_multi_selection.rb +1 -1
  65. data/samples/hello/hello_list_single_selection.rb +1 -1
  66. data/samples/hello/hello_menu_bar.rb +5 -2
  67. data/samples/hello/hello_message_box.rb +1 -1
  68. data/samples/hello/hello_notebook.rb +1 -1
  69. data/samples/hello/hello_radiobutton.rb +1 -1
  70. data/samples/hello/hello_root.rb +1 -1
  71. data/samples/hello/hello_scale.rb +53 -0
  72. data/samples/hello/hello_scrollbar.rb +1 -1
  73. data/samples/hello/hello_scrollbar_frame.rb +1 -1
  74. data/samples/hello/hello_separator.rb +1 -1
  75. data/samples/hello/hello_spinbox.rb +1 -1
  76. data/samples/hello/hello_text.rb +1 -1
  77. data/samples/hello/hello_toplevel.rb +1 -1
  78. data/samples/hello/hello_world.rb +1 -1
  79. metadata +9 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e73712c604d4ac237f122877e2c4a558570b212fcbf0c192b3c3cccf760cd10
4
- data.tar.gz: 6bf3e67c3cebdd497c2775d2a7f72cc5efefb68c2116bf61e0511a3fa4c54161
3
+ metadata.gz: c60d4ed3e0d36df11f12decc435cc03357dfb96ec95720e7bb830b527a473f9f
4
+ data.tar.gz: 1d33536b8b2e2c5700c8d3c320b28afc7b4c6d9eb976ce8d210cae94d7b731d5
5
5
  SHA512:
6
- metadata.gz: ffe9c7c5fb555f4419828d34cca5a86aca6c98756afa37d7b83d2c46086e6ca964651b5f256e092a7c1622bb30f86b52c9e3168529f6bc45426ff5cbb9fceb37
7
- data.tar.gz: aca17f0b69b67fa68ef13ac707a96416a3a88d16bf3607190c8cba553763fc9bebf7054a25db310dd5dd0975746f3f5e0717cba899fe8e9f0eaf0f4870fd2870
6
+ metadata.gz: fc9fffd9cfdc6f75b57bcec0bb2851efe21fbfc6b46376db9350f552e29930c0f452c84654aa74a2fe4cd06e757a5470be265f533479e0a37feb8795ce473d52
7
+ data.tar.gz: 8425516afcb5698463cd23ee20b34570772bf084b29f393a8cc12302f3c3cde95c9d90671d06d4e9be7f5ae953a8d582d8c6d183d2ae55f3d1d09ea5470d320e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.55
4
+
5
+ - Hello, Scale!
6
+ - `scale` `variable` data-binding
7
+
8
+ ## 0.0.54
9
+
10
+ - Hello, Labelframe!
11
+ - Add default padding to `labelframe`
12
+
13
+ ## 0.0.53
14
+
15
+ - Support menu item accelerators that include or end with function keys (e.g. `'Alt+F4'`)
16
+ - Default `:about` Menu Item label to 'About' if not specified
17
+
18
+ ## 0.0.52
19
+
20
+ - Upgrade to glimmer 2.6.0
21
+ - Remove default height for root/toplevel (automatically calculated from children)
22
+ - Support data-binding `_options` method items on `combobox` (not just main value), thus making options update if `notify_observers(:some_attr_options)` is called
23
+
3
24
  ## 0.0.51
4
25
 
5
26
  - Center application root/toplevel within screen by default (if x or y are specified, they are respected instead)
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2021 Andy Maleh
1
+ Copyright (c) 2020-2022 Andy Maleh
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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.51
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
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
  [![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)
@@ -6,8 +6,6 @@
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-tk/maintainability)
7
7
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
8
 
9
- **[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](CONTRIBUTING.md)**
10
-
11
9
  [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Tk](https://www.tcl.tk/) enables desktop development with [Glimmer](https://github.com/AndyObtiva/glimmer) in [Ruby](https://github.com/ruby/ruby).
12
10
 
13
11
  [Tcl/Tk](https://www.tcl.tk/) has recently improved by gaining native looking themed widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.). Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
@@ -19,9 +17,9 @@ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a pleth
19
17
  - Convention over configuration via smart defaults and automation of low-level details
20
18
  - Requiring the least amount of syntax possible to build GUI
21
19
  - Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
22
- - Custom Widget support
23
- - Scaffolding for new custom widgets, apps, and gems
24
- - Native-Executable packaging on Mac, Windows, and Linux
20
+ - (Future Plan) Custom Widget support
21
+ - (Future Plan) Scaffolding for new custom widgets, apps, and gems
22
+ - (Future Plan) Native-Executable packaging on Mac, Windows, and Linux
25
23
 
26
24
  **Hello, World!**
27
25
 
@@ -51,15 +49,21 @@ Glimmer app:
51
49
 
52
50
  ![glimmer dsl tk screenshot sample hello world](images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
53
51
 
54
- NOTE: Glimmer DSL for Tk is currently in early alpha mode (incomplete). Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
55
-
56
- Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be interested in:
57
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
58
- - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
59
- - [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
60
- - [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
61
- - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
62
- - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
52
+ NOTE: Glimmer DSL for Tk is currently in early alpha mode (only about 44% complete). If you want it developed faster, then [open an issue report](https://github.com/AndyObtiva/glimmer-dsl-tk/issues/new). I have completed some features much faster before due to [issue reports](https://github.com/AndyObtiva/glimmer-dsl-tk/issues) and [pull requests](https://github.com/AndyObtiva/glimmer-dsl-tk/pulls). Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
53
+
54
+ **[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
55
+ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
56
+ ----|-----------|---------|------------------|------|------|--------
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
+ [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
+ [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
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
+ [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
+ [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
64
+ [Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-swing) | Mac / Windows / Linux | No | Yes (Java2D) | Very Mature | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby
65
+ [Glimmer DSL for XML (& HTML)](https://github.com/AndyObtiva/glimmer-dsl-xml) | All Web Browsers | No | Yes (SVG) | Programmable / Lighter-weight Than Actual XML | XML Elements Are Sometimes Not Well-Named (Many Types of Input) | None
66
+ [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) | All Web Browsers | No | Yes | Programmable | CSS Is Over-Engineered / Too Many Features To Learn | None
63
67
 
64
68
  ## Table of Contents
65
69
 
@@ -96,6 +100,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
96
100
  - [List Multi Selection Data-Binding](#list-multi-selection-data-binding)
97
101
  - [Entry Data-Binding](#entry-data-binding)
98
102
  - [Text Data-Binding](#text-data-binding)
103
+ - [Scale Data-Binding](#scale-data-binding)
99
104
  - [Spinbox Data-Binding](#spinbox-data-binding)
100
105
  - [Checkbutton Data-Binding](#checkbutton-data-binding)
101
106
  - [Radiobutton Data-Binding](#radiobutton-data-binding)
@@ -127,6 +132,8 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
127
132
  - [Hello, Scrollbar Frame!](#hello-scrollbar-frame)
128
133
  - [Hello, Menu Bar!](#hello-menu-bar)
129
134
  - [Hello, Contextual Menu!](#hello-contextual-menu)
135
+ - [Hello, Labelframe!](#hello-labelframe)
136
+ - [Hello, Scale!](#hello-scale)
130
137
  - [Applications](#applications)
131
138
  - [Glimmer Tk Calculator](#glimmer-tk-calculator)
132
139
  - [Y3network Ruby UI](#y3network-ruby-ui)
@@ -145,24 +152,24 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
145
152
 
146
153
  ## Pre-requisites
147
154
 
148
- - [Tcl/Tk](https://www.tcl.tk/): Follow the [install instructions](https://tkdocs.com/tutorial/install.html)
155
+ - [Tcl/Tk 8.6](https://www.tcl.tk/): Follow the exact instructions below (if a further reference is needed, here are the [official install instructions](https://tkdocs.com/tutorial/install.html))
149
156
  - [Ruby](https://www.ruby-lang.org/en/): On Windows, obtain from the Ruby [download page](https://www.ruby-lang.org/en/downloads/). On the Mac and Linux, it is more convenient to just use [RVM](http://rvm.io) and follow the [RVM Tk instructions](https://rvm.io/integration/tk).
150
157
 
151
- For example, on the Mac, you can:
152
- - Install the ActiveTcl Mac package from [ActiveState.com](https://activestate.com)
158
+ **Mac:**
159
+ - Install the ActiveTcl 8.6 Mac package from [ActiveState.com](https://activestate.com)
153
160
  - Install [RVM](https://rvm.io/) by running `\curl -sSL https://get.rvm.io | bash -s stable` (and run `curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -` if needed for mentioned security reasons)
154
161
  - Run: `rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl`
155
162
  - Run: `gem install tk -v0.4.0`
156
163
 
157
- For example, on Windows, you can follow the [instructions over here](https://tkdocs.com/tutorial/install.html), specifically the following:
164
+ **Windows:**
158
165
  - Install Ruby+Devkit (including MSYS/MINGW toolchains) through Windows Installer: https://rubyinstaller.org/downloads/
159
- - Install the ActiveTcl Windows package from [ActiveState.com](https://activestate.com)
166
+ - Install the ActiveTcl 8.6 Windows package from [ActiveState.com](https://activestate.com)
160
167
  - Follow this instruction: "First, Ruby needs to find the tcl86t.dll and tk86t.dll shared libraries. These are located in C:\ActiveTcl\bin. Make a copy of them somewhere Ruby can find them, e.g. C:\Ruby26\bin."
161
168
  - Setup environment variables TCL_LIBRARY=C:\ActiveTcl\lib\tcl8.6 & TK_LIBRARY=C:\ActiveTcl\lib\tk8.6
162
169
  - Run: `gem install tk -v0.4.0`
163
170
 
164
- For example, on Linux, you can:
165
- - Download the ActiveTcl Linux package from [ActiveState.com](https://activestate.com)
171
+ **Linux:**
172
+ - Download the ActiveTcl 8.6 Linux package from [ActiveState.com](https://activestate.com)
166
173
  - Extract the tar gz file using command `tar zxvf ActiveTcl-version-number.tar.gz`
167
174
  - Run included install shell script `./ActiveTcl-version-number/install.sh`
168
175
  - Install [RVM](https://rvm.io/) by running `\curl -sSL https://get.rvm.io | bash -s stable` (and run `curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -` if needed for mentioned security reasons)
@@ -173,6 +180,8 @@ Afterwards, if you open `irb`, you should be able to run `require 'tk'` successf
173
180
 
174
181
  ## Setup
175
182
 
183
+ Assuming you have all [Pre-Requisites](#pre-requisites) ready, follow these instructions to setup the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-tk).
184
+
176
185
  ### Option 1: Install
177
186
 
178
187
  Run this command to install directly:
@@ -184,7 +193,7 @@ gem install glimmer-dsl-tk
184
193
 
185
194
  Add the following to `Gemfile`:
186
195
  ```
187
- gem 'glimmer-dsl-tk', '0.0.51'
196
+ gem 'glimmer-dsl-tk', '0.0.55'
188
197
  ```
189
198
 
190
199
  And, then run:
@@ -484,13 +493,13 @@ Check out the [Hello, Scrollbar!](#hello-scrollbar) sample for a `text` demo wit
484
493
 
485
494
  #### Drag and Drop API
486
495
 
487
- Drag and drop works by simply designating a widget as a drag source with attribute `drag_source true` and another widget as a drop target with attribute `drop_target true`.
496
+ Thanks to the vision of [vin1antme](https://github.com/vin1antme) (contributor), drag and drop works by simply designating a widget as a draggable with attribute `drag_source true` and another widget as a droppable with attribute `drop_target true`.
488
497
 
489
- Alternatively, add listeners on the drag source:
498
+ Alternatively, for advanced customization, add listeners on the draggable:
490
499
  - `on('drag_start') {|event| ...}`: fires on drag start receiving an `event` arg to set `data` and configure `source`
491
500
  - `on('drag_motion') {|event| ...}`: fires on drag motion receiving an `event` arg to check `event#drop_accepted`, and configure `source` and `tooltip`
492
501
 
493
- And on the drop target, add listener:
502
+ And, add a listener on the droppable:
494
503
  - `on('drop') { |event| ...}`: fires on drop, receiving an `event` arg with `event#target` and `event#data` (set during drag). You can even destroy the `event#source` if you want to get rid of the dragged widget.
495
504
 
496
505
  These are all the available attributes on event, which is of type `DragAndDropEvent`:
@@ -624,7 +633,25 @@ More details can be found in the [Hello, Computed!](#hello-computed) sample belo
624
633
 
625
634
  ## Data-Binding
626
635
 
627
- 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).
636
+ 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(model, attribute, *options)` keyword may also be used as the old-style of data-binding).
637
+
638
+ To summarize the data-binding API:
639
+ - `view_property <=> [model, attribute, *read_or_write_options]`: Bidirectional (two-way) data-binding to Model attribute accessor
640
+ - `view_property <= [model, attribute, *read_only_options]`: Unidirectional (one-way) data-binding to Model attribute reader
641
+
642
+ Data-bound model attribute can be:
643
+ - **Direct:** `Symbol` representing attribute reader/writer (e.g. `[person, :name`])
644
+ - **Nested:** `String` representing nested attribute path (e.g. `[company, 'address.street']`). That results in "nested data-binding"
645
+ - **Indexed:** `String` containing array attribute index (e.g. `[customer, 'addresses[0].street']`). That results in "indexed data-binding"
646
+
647
+ Data-binding options include:
648
+ - `before_read {|value| ...}`: performs an operation before reading data from Model to update View.
649
+ - `on_read {|value| ...}`: converts value read from Model to update the View.
650
+ - `after_read {|converted_value| ...}`: performs an operation after read from Model to update View.
651
+ - `before_write {|value| ...}`: performs an operation before writing data to Model from View.
652
+ - `on_write {|value| ...}`: converts value read from View to update the Model.
653
+ - `after_write {|converted_value| ...}`: performs an operation after writing to Model from View.
654
+ - `computed_by attribute` or `computed_by [attribute1, attribute2, ...]`: indicates model attribute is computed from specified attribute(s), thus updated when they are updated. That is known as "computed data-binding".
628
655
 
629
656
  ### Label Data-Binding
630
657
 
@@ -743,6 +770,28 @@ It automatically handles all the Tk plumbing behind the scenes.
743
770
 
744
771
  More details can be found in [Hello, Text!](#hello-text) sample below.
745
772
 
773
+ ### Scale Data-Binding
774
+
775
+ Example:
776
+
777
+ This assumes a `Person` model with an `age` attribute.
778
+
779
+ ```ruby
780
+ spinbox {
781
+ orient 'horizontal' # can be 'vertical' too
782
+ length 200
783
+ from 0.0
784
+ to 100.0
785
+ variable <=> [person, :age, on_write: ->(val) {val.to_i}]
786
+ }
787
+ ```
788
+
789
+ That code binds the `variable` value of the `scale` to the `age` attribute on the `person` model.
790
+
791
+ It automatically handles all the Tk plumbing behind the scenes.
792
+
793
+ More details can be found in [Hello, Scale!](#hello-scale) sample below.
794
+
746
795
  ### Spinbox Data-Binding
747
796
 
748
797
  Example:
@@ -3365,16 +3414,24 @@ root { |r|
3365
3414
  menu_item(:radiobutton, label: image_name.capitalize) {
3366
3415
  selection image_name == 'usa'
3367
3416
  image File.expand_path("images/#{image_name}.png", __dir__)
3417
+
3418
+ on('command') do
3419
+ message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
3420
+ end
3368
3421
  }
3369
3422
  end
3370
3423
  }
3371
3424
 
3372
- menu(label: 'Country', underline: 3) {
3425
+ menu(label: 'Country', underline: 0) {
3373
3426
  ['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
3374
3427
  menu_item(:radiobutton, label: image_name.capitalize) {
3375
3428
  selection image_name == 'usa'
3376
3429
  image File.expand_path("images/#{image_name}.png", __dir__)
3377
3430
  compound 'left'
3431
+
3432
+ on('command') do
3433
+ message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
3434
+ end
3378
3435
  }
3379
3436
  end
3380
3437
  }
@@ -3582,6 +3639,10 @@ root { |r|
3582
3639
  menu_item(:radiobutton, label: image_name.capitalize) {
3583
3640
  selection image_name == 'usa'
3584
3641
  image File.expand_path("images/#{image_name}.png", __dir__)
3642
+
3643
+ on('command') do
3644
+ message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
3645
+ end
3585
3646
  }
3586
3647
  end
3587
3648
  }
@@ -3592,10 +3653,14 @@ root { |r|
3592
3653
  selection image_name == 'usa'
3593
3654
  image File.expand_path("images/#{image_name}.png", __dir__)
3594
3655
  compound 'left'
3656
+
3657
+ on('command') do
3658
+ message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
3659
+ end
3595
3660
  }
3596
3661
  end
3597
3662
  }
3598
-
3663
+
3599
3664
  menu(label: 'Format', underline: 3) {
3600
3665
  menu(label: 'Background Color', underline: 0) {
3601
3666
  COLORS.each { |color_style|
@@ -3690,6 +3755,224 @@ Glimmer app:
3690
3755
 
3691
3756
  ![glimmer dsl tk screenshot sample hello contextual-menu](images/glimmer-dsl-tk-screenshot-sample-hello-contextual-menu.png)
3692
3757
 
3758
+ ### Hello, Labelframe!
3759
+
3760
+ Glimmer code (from [samples/hello/hello_labelframe.rb](samples/hello/hello_labelframe.rb)):
3761
+
3762
+ ```ruby
3763
+ require 'glimmer-dsl-tk'
3764
+
3765
+ include Glimmer
3766
+
3767
+ root {
3768
+ title 'Hello, Labelframe!'
3769
+
3770
+ labelframe {
3771
+ grid column: 0, row: 0, padx: 10, pady: 10
3772
+ text 'Name:'
3773
+ # labelanchor 'nw' # Default. Other options: 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'
3774
+
3775
+ label {
3776
+ grid column: 0, row: 0, sticky: 'w'
3777
+ text 'First Name:'
3778
+ }
3779
+ entry {
3780
+ grid column: 1, row: 0
3781
+ width 15
3782
+ }
3783
+
3784
+ label {
3785
+ grid column: 0, row: 1, sticky: 'w'
3786
+ text 'Last Name:'
3787
+ }
3788
+ entry {
3789
+ grid column: 1, row: 1
3790
+ width 15
3791
+ }
3792
+ }
3793
+
3794
+ labelframe {
3795
+ grid column: 0, row: 1, padx: 10, pady: 10
3796
+ text 'Address:'
3797
+
3798
+ label {
3799
+ grid column: 0, row: 0, sticky: 'w'
3800
+ text 'Street:'
3801
+ }
3802
+ entry {
3803
+ grid column: 1, row: 0
3804
+ width 15
3805
+ }
3806
+
3807
+ label {
3808
+ grid column: 0, row: 1, sticky: 'w'
3809
+ text 'City:'
3810
+ }
3811
+ entry {
3812
+ grid column: 1, row: 1
3813
+ width 15
3814
+ }
3815
+
3816
+ label {
3817
+ grid column: 0, row: 2, sticky: 'w'
3818
+ text 'State:'
3819
+ }
3820
+ entry {
3821
+ grid column: 1, row: 2
3822
+ width 15
3823
+ }
3824
+
3825
+ label {
3826
+ grid column: 0, row: 3, sticky: 'w'
3827
+ text 'Zip:'
3828
+ }
3829
+ entry {
3830
+ grid column: 1, row: 3
3831
+ width 15
3832
+ }
3833
+ }
3834
+
3835
+ labelframe {
3836
+ grid column: 1, row: 0, rowspan: 2, padx: 10, pady: 10
3837
+ text 'Medical Info:'
3838
+
3839
+ label {
3840
+ grid column: 0, row: 0, sticky: 'w'
3841
+ text 'Family Doctor:'
3842
+ }
3843
+ entry {
3844
+ grid column: 1, row: 0
3845
+ width 15
3846
+ }
3847
+
3848
+ label {
3849
+ grid column: 0, row: 1, sticky: 'w'
3850
+ text 'Chronic Conditions:'
3851
+ }
3852
+ entry {
3853
+ grid column: 1, row: 1
3854
+ width 15
3855
+ }
3856
+
3857
+ label {
3858
+ grid column: 0, row: 2, sticky: 'w'
3859
+ text 'Past Surgeries:'
3860
+ }
3861
+ entry {
3862
+ grid column: 1, row: 2
3863
+ width 15
3864
+ }
3865
+
3866
+ label {
3867
+ grid column: 0, row: 3, sticky: 'w'
3868
+ text 'Health Insurance Info:'
3869
+ }
3870
+ entry {
3871
+ grid column: 1, row: 3
3872
+ width 15
3873
+ }
3874
+
3875
+ label {
3876
+ grid column: 0, row: 4, sticky: 'w'
3877
+ text 'Dental Insurance Info:'
3878
+ }
3879
+ entry {
3880
+ grid column: 1, row: 4
3881
+ width 15
3882
+ }
3883
+
3884
+ label {
3885
+ grid column: 0, row: 5, sticky: 'w'
3886
+ text 'Diet:'
3887
+ }
3888
+ entry {
3889
+ grid column: 1, row: 5
3890
+ width 15
3891
+ }
3892
+
3893
+ label {
3894
+ grid column: 0, row: 6, sticky: 'w'
3895
+ text 'Exercise:'
3896
+ }
3897
+ entry {
3898
+ grid column: 1, row: 6
3899
+ width 15
3900
+ }
3901
+ }
3902
+ }.open
3903
+ ```
3904
+
3905
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3906
+
3907
+ ```
3908
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_labelframe'"
3909
+ ```
3910
+
3911
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3912
+
3913
+ ```
3914
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_labelframe.rb
3915
+ ```
3916
+
3917
+ Glimmer app:
3918
+
3919
+ ![glimmer dsl tk screenshot sample hello label-frame](images/glimmer-dsl-tk-screenshot-sample-hello-labelframe.png)
3920
+
3921
+ ### Hello, Scale!
3922
+
3923
+ Glimmer code (from [samples/hello/hello_scale.rb](samples/hello/hello_scale.rb)):
3924
+
3925
+ ```ruby
3926
+ require 'glimmer-dsl-tk'
3927
+
3928
+ class HelloScale
3929
+ include Glimmer
3930
+
3931
+ attr_accessor :scale_value
3932
+
3933
+ def initialize
3934
+ self.scale_value = 50
3935
+ end
3936
+
3937
+ def launch
3938
+ root {
3939
+ text 'Hello, Scale!'
3940
+
3941
+ label {
3942
+ anchor 'center'
3943
+ text <= [self, :scale_value]
3944
+ }
3945
+
3946
+ scale {
3947
+ orient 'horizontal'
3948
+ length 200
3949
+ from 0.0
3950
+ to 100.0
3951
+ variable <=> [self, :scale_value, on_write: ->(val) {val.to_i}]
3952
+ }
3953
+ }.open
3954
+ end
3955
+ end
3956
+
3957
+ HelloScale.new.launch
3958
+ ```
3959
+
3960
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3961
+
3962
+ ```
3963
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scale'"
3964
+ ```
3965
+
3966
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3967
+
3968
+ ```
3969
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scale.rb
3970
+ ```
3971
+
3972
+ Glimmer app:
3973
+
3974
+ ![glimmer dsl tk screenshot sample hello scale](images/glimmer-dsl-tk-screenshot-sample-hello-scale.png)
3975
+
3693
3976
  ## Applications
3694
3977
 
3695
3978
  ### Glimmer Tk Calculator
@@ -3716,10 +3999,10 @@ https://github.com/cryptopunksnotdead/cryptopunks-gui
3716
3999
 
3717
4000
  Generate an icon of overlapping circles derived from a hash.
3718
4001
 
3719
- https://gitlab.com/fjc/circule
3720
-
3721
4002
  [Demo Video](https://gitlab.com/fjc/circule/-/raw/master/circule-demo.mp4)
3722
4003
 
4004
+ https://gitlab.com/fjc/circule
4005
+
3723
4006
  ## Process
3724
4007
 
3725
4008
  [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
@@ -3727,6 +4010,7 @@ https://gitlab.com/fjc/circule
3727
4010
  ## Resources
3728
4011
 
3729
4012
  - [Tk Tutorial](https://tkdocs.com/tutorial/index.html)
4013
+ - [Official Tk Command Reference](https://tcl.tk/man/tcl8.6/TkCmd/contents.htm)
3730
4014
  - [Code Master Blog](https://andymaleh.blogspot.com/search/label/Tk)
3731
4015
 
3732
4016
  ## Help
@@ -3764,7 +4048,7 @@ These features have been planned or suggested. You might see them in a future ve
3764
4048
 
3765
4049
  [MIT](LICENSE.txt)
3766
4050
 
3767
- Copyright (c) 2020-2021 - Andy Maleh.
4051
+ Copyright (c) 2020-2022 - Andy Maleh.
3768
4052
 
3769
4053
  --
3770
4054
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.51
1
+ 0.0.55
data/bin/girb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # Copyright (c) 2020-2021 Andy Maleh
3
+ # Copyright (c) 2020-2022 Andy Maleh
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining
6
6
  # a copy of this software and associated documentation files (the
data/bin/girb_runner.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
Binary file
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the