glimmer-dsl-tk 0.0.50 → 0.0.54

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +243 -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 +46 -11
  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/scrollbar_frame_proxy.rb +1 -1
  42. data/lib/glimmer/tk/spinbox_proxy.rb +1 -1
  43. data/lib/glimmer/tk/text_proxy.rb +1 -1
  44. data/lib/glimmer/tk/text_variable_owner.rb +1 -1
  45. data/lib/glimmer/tk/toplevel_proxy.rb +16 -2
  46. data/lib/glimmer/tk/treeview_proxy.rb +1 -1
  47. data/lib/glimmer/tk/variable_owner.rb +1 -1
  48. data/lib/glimmer/tk/widget.rb +1 -1
  49. data/lib/glimmer/tk/widget_proxy.rb +8 -3
  50. data/lib/glimmer-dsl-tk.rb +1 -1
  51. data/samples/elaborate/meta_sample.rb +1 -1
  52. data/samples/hello/hello_built_in_dialog.rb +1 -1
  53. data/samples/hello/hello_button.rb +1 -1
  54. data/samples/hello/hello_checkbutton.rb +1 -1
  55. data/samples/hello/hello_combobox.rb +1 -2
  56. data/samples/hello/hello_computed.rb +1 -1
  57. data/samples/hello/hello_contextual_menu.rb +9 -1
  58. data/samples/hello/hello_drag_and_drop.rb +1 -1
  59. data/samples/hello/hello_entry.rb +1 -1
  60. data/samples/hello/hello_frame.rb +1 -1
  61. data/samples/hello/hello_label.rb +1 -1
  62. data/samples/hello/hello_labelframe.rb +161 -0
  63. data/samples/hello/hello_list_multi_selection.rb +1 -1
  64. data/samples/hello/hello_list_single_selection.rb +1 -1
  65. data/samples/hello/hello_menu_bar.rb +13 -2
  66. data/samples/hello/hello_message_box.rb +1 -1
  67. data/samples/hello/hello_notebook.rb +1 -1
  68. data/samples/hello/hello_radiobutton.rb +1 -1
  69. data/samples/hello/hello_root.rb +1 -1
  70. data/samples/hello/hello_scrollbar.rb +1 -1
  71. data/samples/hello/hello_scrollbar_frame.rb +1 -1
  72. data/samples/hello/hello_separator.rb +1 -1
  73. data/samples/hello/hello_spinbox.rb +1 -1
  74. data/samples/hello/hello_text.rb +1 -1
  75. data/samples/hello/hello_toplevel.rb +1 -1
  76. data/samples/hello/hello_world.rb +1 -1
  77. metadata +7 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 275b189ef447a6e367ee34c453b2e1b0e3764b7a6bfb44d505287b9aa2ae7918
4
- data.tar.gz: f6a737cfc3db92a03bb0004cae4b9c3fe539c8550836a0bcff04d22519f9d3de
3
+ metadata.gz: 556b89d33cee530135e72cd6f31a79a355db86cf45bbacfd65dbf14b8184b4c3
4
+ data.tar.gz: 7c5c0750b19380e8561a16e7789273bd742d33e50294d8100cd5759b6fa2d329
5
5
  SHA512:
6
- metadata.gz: de44c79d480b46078c796ca9bbb83a452c8f8a933f1444c8b83eba5b162e0b5bcbf39a44c63403451146172aeab831a39770a98575b0b715ae2e7e1fde2fac30
7
- data.tar.gz: a33417fbf638f89b71db35778e9e7977a5c137af40334d26a0aa4e52cf399cb643babaad25ed2c49c75ab2898a9cbe35747beeaa66a8a454abb902c7fb359048
6
+ metadata.gz: 2c25d0b5f8a677a82adf158fa7685a4dfb1e4ea006d4fc6a134d1046c3468e3af1261f37aa66678f802a0f4b0d6b2951ea49bf89cab76db89bcedd92d8eb78cd
7
+ data.tar.gz: 4bc9c4b2dd59849206e95f85118b230735d72bfb06810fa38fb39a71d4fc3419dc4415b1d5261a465dbf07a0b4d183a673f75f24872a8f4b2ece0f362bde1ad3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.54
4
+
5
+ - Hello, Labelframe!
6
+ - Add default padding to `labelframe`
7
+
8
+ ## 0.0.53
9
+
10
+ - Support menu item accelerators that include or end with function keys (e.g. `'Alt+F4'`)
11
+ - Default `:about` Menu Item label to 'About' if not specified
12
+
13
+ ## 0.0.52
14
+
15
+ - Upgrade to glimmer 2.6.0
16
+ - Remove default height for root/toplevel (automatically calculated from children)
17
+ - Support data-binding `_options` method items on `combobox` (not just main value), thus making options update if `notify_observers(:some_attr_options)` is called
18
+
19
+ ## 0.0.51
20
+
21
+ - Center application root/toplevel within screen by default (if x or y are specified, they are respected instead)
22
+ - Enhance Hello, Contextual Menu! & Hello, Menu Bar! to display a message box upon selecting a Language/Country
23
+ - Explicitly support all menu item attributes: `activebackground`, `activeforeground`, `background`, `bitmap`, `columnbreak`, `compound`, `font`, `foreground`, `hidemargin`, `indicatoron`, `menu`, `offvalue`, `onvalue`, `selectcolor`, `selectimage`, `state`, `underline`, `value`
24
+
3
25
  ## 0.0.50
4
26
 
5
27
  - Support manual binding of contextual menu by passing `bind: false` option (e.g. `menu(bind: false) {...}` as demonstrated in samples/hello/hello_contextual_menu.rb)
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.50
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.54
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
 
@@ -86,6 +90,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
86
90
  - [Icon Photo](#icon-photo)
87
91
  - [Root Background](#root-background)
88
92
  - [Toplevel Mac Style](#toplevel-mac-style)
93
+ - [Root/Toplevel Centered Within Screen](#root-toplevel-centered-within-screen)
89
94
  - [Text Defaults](#text-defaults)
90
95
  - [The Grid Geometry Manager](#the-grid-geometry-manager)
91
96
  - [Data-Binding](#data-binding)
@@ -126,6 +131,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
126
131
  - [Hello, Scrollbar Frame!](#hello-scrollbar-frame)
127
132
  - [Hello, Menu Bar!](#hello-menu-bar)
128
133
  - [Hello, Contextual Menu!](#hello-contextual-menu)
134
+ - [Hello, Labelframe!](#hello-labelframe)
129
135
  - [Applications](#applications)
130
136
  - [Glimmer Tk Calculator](#glimmer-tk-calculator)
131
137
  - [Y3network Ruby UI](#y3network-ruby-ui)
@@ -144,24 +150,24 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
144
150
 
145
151
  ## Pre-requisites
146
152
 
147
- - [Tcl/Tk](https://www.tcl.tk/): Follow the [install instructions](https://tkdocs.com/tutorial/install.html)
153
+ - [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))
148
154
  - [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).
149
155
 
150
- For example, on the Mac, you can:
151
- - Install the ActiveTcl Mac package from [ActiveState.com](https://activestate.com)
156
+ **Mac:**
157
+ - Install the ActiveTcl 8.6 Mac package from [ActiveState.com](https://activestate.com)
152
158
  - 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)
153
159
  - Run: `rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl`
154
160
  - Run: `gem install tk -v0.4.0`
155
161
 
156
- For example, on Windows, you can follow the [instructions over here](https://tkdocs.com/tutorial/install.html), specifically the following:
162
+ **Windows:**
157
163
  - Install Ruby+Devkit (including MSYS/MINGW toolchains) through Windows Installer: https://rubyinstaller.org/downloads/
158
- - Install the ActiveTcl Windows package from [ActiveState.com](https://activestate.com)
164
+ - Install the ActiveTcl 8.6 Windows package from [ActiveState.com](https://activestate.com)
159
165
  - 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."
160
166
  - Setup environment variables TCL_LIBRARY=C:\ActiveTcl\lib\tcl8.6 & TK_LIBRARY=C:\ActiveTcl\lib\tk8.6
161
167
  - Run: `gem install tk -v0.4.0`
162
168
 
163
- For example, on Linux, you can:
164
- - Download the ActiveTcl Linux package from [ActiveState.com](https://activestate.com)
169
+ **Linux:**
170
+ - Download the ActiveTcl 8.6 Linux package from [ActiveState.com](https://activestate.com)
165
171
  - Extract the tar gz file using command `tar zxvf ActiveTcl-version-number.tar.gz`
166
172
  - Run included install shell script `./ActiveTcl-version-number/install.sh`
167
173
  - 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)
@@ -172,6 +178,8 @@ Afterwards, if you open `irb`, you should be able to run `require 'tk'` successf
172
178
 
173
179
  ## Setup
174
180
 
181
+ Assuming you have all [Pre-Requisites](#pre-requisites) ready, follow these instructions to setup the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-tk).
182
+
175
183
  ### Option 1: Install
176
184
 
177
185
  Run this command to install directly:
@@ -183,7 +191,7 @@ gem install glimmer-dsl-tk
183
191
 
184
192
  Add the following to `Gemfile`:
185
193
  ```
186
- gem 'glimmer-dsl-tk', '0.0.50'
194
+ gem 'glimmer-dsl-tk', '0.0.54'
187
195
  ```
188
196
 
189
197
  And, then run:
@@ -209,6 +217,7 @@ Tk Concepts consist of:
209
217
  - [Widgets](https://tkdocs.com/tutorial/concepts.html#widgets): Widgets are all the things that you see onscreen. In our example, we had a button, an entry, a few labels, and a frame. Others are things like checkboxes, tree views, scrollbars, text areas, and so on. Widgets are what are often referred to as "controls"; you'll also often see them referred to as "windows," particularly in Tk's documentation, a holdover from its X11 roots (so under that terminology, both a toplevel window and things like a button would be called windows).
210
218
  - [Geometry Management](https://tkdocs.com/tutorial/concepts.html#geometry): If you've been playing around creating widgets, you've probably noticed that just by creating them, they didn't end up showing up onscreen. Having things actually put in the onscreen window, and precisely where in the window they show up is a separate step called geometry management.
211
219
  - [Event Handling](https://tkdocs.com/tutorial/concepts.html#events): In Tk, as in most other user interface toolkits, there is an event loop which receives events from the operating system. These are things like button presses, keystrokes, mouse movement, window resizing, and so on.
220
+ - [Themes](https://tkdocs.com/tutorial/styles.html): Tk apps are themable. You can list available themes with `::Tk::Tile::Style.theme_names` (e.g. `["aqua", "clam", "alt", "default", "classic"]` on Mac) and select a theme with `::Tk::Tile::Style.theme_use 'theme_name'` (e.g. `::Tk::Tile::Style.theme_use 'classic'`). Theme defaults to `'clam'` in Linux and `'aqua'` in Mac.
212
221
 
213
222
  Learn more at the official [Tk Concepts Tutorial](https://tkdocs.com/tutorial/concepts.html)
214
223
 
@@ -482,13 +491,13 @@ Check out the [Hello, Scrollbar!](#hello-scrollbar) sample for a `text` demo wit
482
491
 
483
492
  #### Drag and Drop API
484
493
 
485
- 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`.
494
+ 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`.
486
495
 
487
- Alternatively, add listeners on the drag source:
496
+ Alternatively, for advanced customization, add listeners on the draggable:
488
497
  - `on('drag_start') {|event| ...}`: fires on drag start receiving an `event` arg to set `data` and configure `source`
489
498
  - `on('drag_motion') {|event| ...}`: fires on drag motion receiving an `event` arg to check `event#drop_accepted`, and configure `source` and `tooltip`
490
499
 
491
- And on the drop target, add listener:
500
+ And, add a listener on the droppable:
492
501
  - `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.
493
502
 
494
503
  These are all the available attributes on event, which is of type `DragAndDropEvent`:
@@ -580,6 +589,10 @@ Tk.tk_call("::tk::unsupported::MacWindowStyle", "style", tk_toplevel_widget, mac
580
589
 
581
590
  More details can be found at the [Hello, Toplevel!](#hello-toplevel) sample.
582
591
 
592
+ #### Root/Toplevel Centered Within Screen
593
+
594
+ `root` and `toplevel` are centered within screen by default unless `x` or `y` attributes are specified, in which case, they are honored instead.
595
+
583
596
  #### Text Defaults
584
597
 
585
598
  `text` widget has these defaults:
@@ -618,7 +631,25 @@ More details can be found in the [Hello, Computed!](#hello-computed) sample belo
618
631
 
619
632
  ## Data-Binding
620
633
 
621
- 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).
634
+ 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).
635
+
636
+ To summarize the data-binding API:
637
+ - `view_property <=> [model, attribute, *read_or_write_options]`: Bidirectional (two-way) data-binding to Model attribute accessor
638
+ - `view_property <= [model, attribute, *read_only_options]`: Unidirectional (one-way) data-binding to Model attribute reader
639
+
640
+ Data-bound model attribute can be:
641
+ - **Direct:** `Symbol` representing attribute reader/writer (e.g. `[person, :name`])
642
+ - **Nested:** `String` representing nested attribute path (e.g. `[company, 'address.street']`). That results in "nested data-binding"
643
+ - **Indexed:** `String` containing array attribute index (e.g. `[customer, 'addresses[0].street']`). That results in "indexed data-binding"
644
+
645
+ Data-binding options include:
646
+ - `before_read {|value| ...}`: performs an operation before reading data from Model to update View.
647
+ - `on_read {|value| ...}`: converts value read from Model to update the View.
648
+ - `after_read {|converted_value| ...}`: performs an operation after read from Model to update View.
649
+ - `before_write {|value| ...}`: performs an operation before writing data to Model from View.
650
+ - `on_write {|value| ...}`: converts value read from View to update the Model.
651
+ - `after_write {|converted_value| ...}`: performs an operation after writing to Model from View.
652
+ - `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".
622
653
 
623
654
  ### Label Data-Binding
624
655
 
@@ -3359,16 +3390,24 @@ root { |r|
3359
3390
  menu_item(:radiobutton, label: image_name.capitalize) {
3360
3391
  selection image_name == 'usa'
3361
3392
  image File.expand_path("images/#{image_name}.png", __dir__)
3393
+
3394
+ on('command') do
3395
+ message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
3396
+ end
3362
3397
  }
3363
3398
  end
3364
3399
  }
3365
3400
 
3366
- menu(label: 'Country', underline: 3) {
3401
+ menu(label: 'Country', underline: 0) {
3367
3402
  ['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
3368
3403
  menu_item(:radiobutton, label: image_name.capitalize) {
3369
3404
  selection image_name == 'usa'
3370
3405
  image File.expand_path("images/#{image_name}.png", __dir__)
3371
3406
  compound 'left'
3407
+
3408
+ on('command') do
3409
+ message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
3410
+ end
3372
3411
  }
3373
3412
  end
3374
3413
  }
@@ -3576,6 +3615,10 @@ root { |r|
3576
3615
  menu_item(:radiobutton, label: image_name.capitalize) {
3577
3616
  selection image_name == 'usa'
3578
3617
  image File.expand_path("images/#{image_name}.png", __dir__)
3618
+
3619
+ on('command') do
3620
+ message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
3621
+ end
3579
3622
  }
3580
3623
  end
3581
3624
  }
@@ -3586,10 +3629,14 @@ root { |r|
3586
3629
  selection image_name == 'usa'
3587
3630
  image File.expand_path("images/#{image_name}.png", __dir__)
3588
3631
  compound 'left'
3632
+
3633
+ on('command') do
3634
+ message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
3635
+ end
3589
3636
  }
3590
3637
  end
3591
3638
  }
3592
-
3639
+
3593
3640
  menu(label: 'Format', underline: 3) {
3594
3641
  menu(label: 'Background Color', underline: 0) {
3595
3642
  COLORS.each { |color_style|
@@ -3684,6 +3731,169 @@ Glimmer app:
3684
3731
 
3685
3732
  ![glimmer dsl tk screenshot sample hello contextual-menu](images/glimmer-dsl-tk-screenshot-sample-hello-contextual-menu.png)
3686
3733
 
3734
+ ### Hello, Labelframe!
3735
+
3736
+ Glimmer code (from [samples/hello/hello_labelframe.rb](samples/hello/hello_labelframe.rb)):
3737
+
3738
+ ```ruby
3739
+ require 'glimmer-dsl-tk'
3740
+
3741
+ include Glimmer
3742
+
3743
+ root {
3744
+ title 'Hello, Labelframe!'
3745
+
3746
+ labelframe {
3747
+ grid column: 0, row: 0, padx: 10, pady: 10
3748
+ text 'Name:'
3749
+ # labelanchor 'nw' # Default. Other options: 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'
3750
+
3751
+ label {
3752
+ grid column: 0, row: 0, sticky: 'w'
3753
+ text 'First Name:'
3754
+ }
3755
+ entry {
3756
+ grid column: 1, row: 0
3757
+ width 15
3758
+ }
3759
+
3760
+ label {
3761
+ grid column: 0, row: 1, sticky: 'w'
3762
+ text 'Last Name:'
3763
+ }
3764
+ entry {
3765
+ grid column: 1, row: 1
3766
+ width 15
3767
+ }
3768
+ }
3769
+
3770
+ labelframe {
3771
+ grid column: 0, row: 1, padx: 10, pady: 10
3772
+ text 'Address:'
3773
+
3774
+ label {
3775
+ grid column: 0, row: 0, sticky: 'w'
3776
+ text 'Street:'
3777
+ }
3778
+ entry {
3779
+ grid column: 1, row: 0
3780
+ width 15
3781
+ }
3782
+
3783
+ label {
3784
+ grid column: 0, row: 1, sticky: 'w'
3785
+ text 'City:'
3786
+ }
3787
+ entry {
3788
+ grid column: 1, row: 1
3789
+ width 15
3790
+ }
3791
+
3792
+ label {
3793
+ grid column: 0, row: 2, sticky: 'w'
3794
+ text 'State:'
3795
+ }
3796
+ entry {
3797
+ grid column: 1, row: 2
3798
+ width 15
3799
+ }
3800
+
3801
+ label {
3802
+ grid column: 0, row: 3, sticky: 'w'
3803
+ text 'Zip:'
3804
+ }
3805
+ entry {
3806
+ grid column: 1, row: 3
3807
+ width 15
3808
+ }
3809
+ }
3810
+
3811
+ labelframe {
3812
+ grid column: 1, row: 0, rowspan: 2, padx: 10, pady: 10
3813
+ text 'Medical Info:'
3814
+
3815
+ label {
3816
+ grid column: 0, row: 0, sticky: 'w'
3817
+ text 'Family Doctor:'
3818
+ }
3819
+ entry {
3820
+ grid column: 1, row: 0
3821
+ width 15
3822
+ }
3823
+
3824
+ label {
3825
+ grid column: 0, row: 1, sticky: 'w'
3826
+ text 'Chronic Conditions:'
3827
+ }
3828
+ entry {
3829
+ grid column: 1, row: 1
3830
+ width 15
3831
+ }
3832
+
3833
+ label {
3834
+ grid column: 0, row: 2, sticky: 'w'
3835
+ text 'Past Surgeries:'
3836
+ }
3837
+ entry {
3838
+ grid column: 1, row: 2
3839
+ width 15
3840
+ }
3841
+
3842
+ label {
3843
+ grid column: 0, row: 3, sticky: 'w'
3844
+ text 'Health Insurance Info:'
3845
+ }
3846
+ entry {
3847
+ grid column: 1, row: 3
3848
+ width 15
3849
+ }
3850
+
3851
+ label {
3852
+ grid column: 0, row: 4, sticky: 'w'
3853
+ text 'Dental Insurance Info:'
3854
+ }
3855
+ entry {
3856
+ grid column: 1, row: 4
3857
+ width 15
3858
+ }
3859
+
3860
+ label {
3861
+ grid column: 0, row: 5, sticky: 'w'
3862
+ text 'Diet:'
3863
+ }
3864
+ entry {
3865
+ grid column: 1, row: 5
3866
+ width 15
3867
+ }
3868
+
3869
+ label {
3870
+ grid column: 0, row: 6, sticky: 'w'
3871
+ text 'Exercise:'
3872
+ }
3873
+ entry {
3874
+ grid column: 1, row: 6
3875
+ width 15
3876
+ }
3877
+ }
3878
+ }.open
3879
+ ```
3880
+
3881
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3882
+
3883
+ ```
3884
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_labelframe'"
3885
+ ```
3886
+
3887
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3888
+
3889
+ ```
3890
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_labelframe.rb
3891
+ ```
3892
+
3893
+ Glimmer app:
3894
+
3895
+ ![glimmer dsl tk screenshot sample hello label-frame](images/glimmer-dsl-tk-screenshot-sample-hello-labelframe.png)
3896
+
3687
3897
  ## Applications
3688
3898
 
3689
3899
  ### Glimmer Tk Calculator
@@ -3710,10 +3920,10 @@ https://github.com/cryptopunksnotdead/cryptopunks-gui
3710
3920
 
3711
3921
  Generate an icon of overlapping circles derived from a hash.
3712
3922
 
3713
- https://gitlab.com/fjc/circule
3714
-
3715
3923
  [Demo Video](https://gitlab.com/fjc/circule/-/raw/master/circule-demo.mp4)
3716
3924
 
3925
+ https://gitlab.com/fjc/circule
3926
+
3717
3927
  ## Process
3718
3928
 
3719
3929
  [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
@@ -3721,6 +3931,7 @@ https://gitlab.com/fjc/circule
3721
3931
  ## Resources
3722
3932
 
3723
3933
  - [Tk Tutorial](https://tkdocs.com/tutorial/index.html)
3934
+ - [Official Tk Command Reference](https://tcl.tk/man/tcl8.6/TkCmd/contents.htm)
3724
3935
  - [Code Master Blog](https://andymaleh.blogspot.com/search/label/Tk)
3725
3936
 
3726
3937
  ## Help
@@ -3758,7 +3969,7 @@ These features have been planned or suggested. You might see them in a future ve
3758
3969
 
3759
3970
  [MIT](LICENSE.txt)
3760
3971
 
3761
- Copyright (c) 2020-2021 - Andy Maleh.
3972
+ Copyright (c) 2020-2022 - Andy Maleh.
3762
3973
 
3763
3974
  --
3764
3975
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.50
1
+ 0.0.54
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
@@ -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) 2007-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