glimmer-dsl-tk 0.0.49 → 0.0.53
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/LICENSE.txt +1 -1
- data/README.md +94 -23
- data/VERSION +1 -1
- data/bin/girb +1 -1
- data/bin/girb_runner.rb +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/data_binding/tk/list_selection_binding.rb +1 -1
- data/lib/glimmer/data_binding/tk/one_time_observer.rb +1 -1
- data/lib/glimmer/data_binding/tk/widget_binding.rb +1 -1
- data/lib/glimmer/dsl/tk/attribute_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/block_attribute_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/built_in_dialog_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/dsl.rb +1 -1
- data/lib/glimmer/dsl/tk/format_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/list_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/message_box_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/on_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/root_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/shine_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/tk/widget_expression.rb +1 -1
- data/lib/glimmer/tk/checkbutton_proxy.rb +1 -1
- data/lib/glimmer/tk/combobox_proxy.rb +1 -1
- data/lib/glimmer/tk/drag_and_drop_event.rb +21 -0
- data/lib/glimmer/tk/draggable_and_droppable.rb +1 -1
- data/lib/glimmer/tk/entry_proxy.rb +1 -1
- data/lib/glimmer/tk/frame_proxy.rb +1 -1
- data/lib/glimmer/tk/label_proxy.rb +1 -1
- data/lib/glimmer/tk/lbl_proxy.rb +1 -1
- data/lib/glimmer/tk/list_proxy.rb +1 -1
- data/lib/glimmer/tk/menu_item_proxy.rb +46 -11
- data/lib/glimmer/tk/menu_proxy.rb +11 -5
- data/lib/glimmer/tk/notebook_proxy.rb +1 -1
- data/lib/glimmer/tk/os.rb +1 -1
- data/lib/glimmer/tk/radiobutton_proxy.rb +1 -1
- data/lib/glimmer/tk/root_proxy.rb +1 -1
- data/lib/glimmer/tk/scrollbar_frame_proxy.rb +1 -1
- data/lib/glimmer/tk/spinbox_proxy.rb +1 -1
- data/lib/glimmer/tk/text_proxy.rb +1 -1
- data/lib/glimmer/tk/text_variable_owner.rb +1 -1
- data/lib/glimmer/tk/toplevel_proxy.rb +16 -2
- data/lib/glimmer/tk/treeview_proxy.rb +1 -1
- data/lib/glimmer/tk/variable_owner.rb +1 -1
- data/lib/glimmer/tk/widget.rb +1 -1
- data/lib/glimmer/tk/widget_proxy.rb +8 -3
- data/lib/glimmer-dsl-tk.rb +1 -1
- data/samples/elaborate/meta_sample.rb +1 -1
- data/samples/hello/hello_built_in_dialog.rb +1 -1
- data/samples/hello/hello_button.rb +1 -1
- data/samples/hello/hello_checkbutton.rb +1 -1
- data/samples/hello/hello_combobox.rb +1 -2
- data/samples/hello/hello_computed.rb +1 -1
- data/samples/hello/hello_contextual_menu.rb +37 -1
- data/samples/hello/hello_drag_and_drop.rb +1 -1
- data/samples/hello/hello_entry.rb +1 -1
- data/samples/hello/hello_frame.rb +1 -1
- data/samples/hello/hello_label.rb +1 -1
- data/samples/hello/hello_list_multi_selection.rb +1 -1
- data/samples/hello/hello_list_single_selection.rb +1 -1
- data/samples/hello/hello_menu_bar.rb +13 -2
- data/samples/hello/hello_message_box.rb +1 -1
- data/samples/hello/hello_notebook.rb +1 -1
- data/samples/hello/hello_radiobutton.rb +1 -1
- data/samples/hello/hello_root.rb +1 -1
- data/samples/hello/hello_scrollbar.rb +1 -1
- data/samples/hello/hello_scrollbar_frame.rb +1 -1
- data/samples/hello/hello_separator.rb +1 -1
- data/samples/hello/hello_spinbox.rb +1 -1
- data/samples/hello/hello_text.rb +1 -1
- data/samples/hello/hello_toplevel.rb +1 -1
- data/samples/hello/hello_world.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bc998830956c028c331da19e9238e69fe15198a0c2741af217cd15cae8fceb8
|
4
|
+
data.tar.gz: '040971d080dae49ebcb201631802566bcb415ddcd72ca623d6cca350c4587058'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a573287857c8f89fb58226dc6c8f1c1629f5a7f7c2dac59952e3459738ba582b89539cc1365a8ebe0134d0c132e62757677fb438480a20b93f25c346846b20f8
|
7
|
+
data.tar.gz: 404e13705e7354d5e0bb2ae15993c7b17d09e77cb7161e111ab5dc908bbe18523501dffc041ff7ce69a71fb70db8d1cca8ef306fbab26f9d07faa2e5933eca53
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.53
|
4
|
+
|
5
|
+
- Support menu item accelerators that include or end with function keys (e.g. `'Alt+F4'`)
|
6
|
+
- Default `:about` Menu Item label to 'About' if not specified
|
7
|
+
|
8
|
+
## 0.0.52
|
9
|
+
|
10
|
+
- Upgrade to glimmer 2.6.0
|
11
|
+
- Remove default height for root/toplevel (automatically calculated from children)
|
12
|
+
- Support data-binding `_options` method items on `combobox` (not just main value), thus making options update if `notify_observers(:some_attr_options)` is called
|
13
|
+
|
14
|
+
## 0.0.51
|
15
|
+
|
16
|
+
- Center application root/toplevel within screen by default (if x or y are specified, they are respected instead)
|
17
|
+
- Enhance Hello, Contextual Menu! & Hello, Menu Bar! to display a message box upon selecting a Language/Country
|
18
|
+
- Explicitly support all menu item attributes: `activebackground`, `activeforeground`, `background`, `bitmap`, `columnbreak`, `compound`, `font`, `foreground`, `hidemargin`, `indicatoron`, `menu`, `offvalue`, `onvalue`, `selectcolor`, `selectimage`, `state`, `underline`, `value`
|
19
|
+
|
20
|
+
## 0.0.50
|
21
|
+
|
22
|
+
- 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)
|
23
|
+
- Support binding multiple contextual menus (they show up consecutively unless there is conditional logic to control showing them individually)
|
24
|
+
- Update Hello, Contextual Menu! to add a comment and an example about manual menu binding
|
25
|
+
- Upgrade to glimmer 2.5.4
|
26
|
+
|
3
27
|
## 0.0.49
|
4
28
|
|
5
29
|
- [API Breaking] Update menu bar support to require `menu_bar` keyword under `root` or `toplevel`
|
data/LICENSE.txt
CHANGED
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.53
|
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)
|
@@ -19,9 +19,9 @@ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a pleth
|
|
19
19
|
- Convention over configuration via smart defaults and automation of low-level details
|
20
20
|
- Requiring the least amount of syntax possible to build GUI
|
21
21
|
- 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
|
22
|
+
- (Future Plan) Custom Widget support
|
23
|
+
- (Future Plan) Scaffolding for new custom widgets, apps, and gems
|
24
|
+
- (Future Plan) Native-Executable packaging on Mac, Windows, and Linux
|
25
25
|
|
26
26
|
**Hello, World!**
|
27
27
|
|
@@ -51,7 +51,7 @@ Glimmer app:
|
|
51
51
|
|
52
52
|
![glimmer dsl tk screenshot sample hello world](images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
|
53
53
|
|
54
|
-
NOTE: Glimmer DSL for Tk is currently in early alpha mode (
|
54
|
+
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.
|
55
55
|
|
56
56
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be interested in:
|
57
57
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
@@ -86,6 +86,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
|
|
86
86
|
- [Icon Photo](#icon-photo)
|
87
87
|
- [Root Background](#root-background)
|
88
88
|
- [Toplevel Mac Style](#toplevel-mac-style)
|
89
|
+
- [Root/Toplevel Centered Within Screen](#root-toplevel-centered-within-screen)
|
89
90
|
- [Text Defaults](#text-defaults)
|
90
91
|
- [The Grid Geometry Manager](#the-grid-geometry-manager)
|
91
92
|
- [Data-Binding](#data-binding)
|
@@ -144,24 +145,24 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be int
|
|
144
145
|
|
145
146
|
## Pre-requisites
|
146
147
|
|
147
|
-
- [Tcl/Tk](https://www.tcl.tk/): Follow the [install instructions](https://tkdocs.com/tutorial/install.html)
|
148
|
+
- [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
149
|
- [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
150
|
|
150
|
-
|
151
|
-
- Install the ActiveTcl Mac package from [ActiveState.com](https://activestate.com)
|
151
|
+
**Mac:**
|
152
|
+
- Install the ActiveTcl 8.6 Mac package from [ActiveState.com](https://activestate.com)
|
152
153
|
- 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
154
|
- Run: `rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl`
|
154
155
|
- Run: `gem install tk -v0.4.0`
|
155
156
|
|
156
|
-
|
157
|
+
**Windows:**
|
157
158
|
- 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)
|
159
|
+
- Install the ActiveTcl 8.6 Windows package from [ActiveState.com](https://activestate.com)
|
159
160
|
- 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
161
|
- Setup environment variables TCL_LIBRARY=C:\ActiveTcl\lib\tcl8.6 & TK_LIBRARY=C:\ActiveTcl\lib\tk8.6
|
161
162
|
- Run: `gem install tk -v0.4.0`
|
162
163
|
|
163
|
-
|
164
|
-
- Download the ActiveTcl Linux package from [ActiveState.com](https://activestate.com)
|
164
|
+
**Linux:**
|
165
|
+
- Download the ActiveTcl 8.6 Linux package from [ActiveState.com](https://activestate.com)
|
165
166
|
- Extract the tar gz file using command `tar zxvf ActiveTcl-version-number.tar.gz`
|
166
167
|
- Run included install shell script `./ActiveTcl-version-number/install.sh`
|
167
168
|
- 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 +173,8 @@ Afterwards, if you open `irb`, you should be able to run `require 'tk'` successf
|
|
172
173
|
|
173
174
|
## Setup
|
174
175
|
|
176
|
+
Assuming you have all [Pre-Requisites](#pre-requisites) ready, follow these instructions to setup the [Ruby gem](https://rubygems.org/gems/glimmer-dsl-tk).
|
177
|
+
|
175
178
|
### Option 1: Install
|
176
179
|
|
177
180
|
Run this command to install directly:
|
@@ -183,7 +186,7 @@ gem install glimmer-dsl-tk
|
|
183
186
|
|
184
187
|
Add the following to `Gemfile`:
|
185
188
|
```
|
186
|
-
gem 'glimmer-dsl-tk', '0.0.
|
189
|
+
gem 'glimmer-dsl-tk', '0.0.53'
|
187
190
|
```
|
188
191
|
|
189
192
|
And, then run:
|
@@ -209,6 +212,7 @@ Tk Concepts consist of:
|
|
209
212
|
- [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
213
|
- [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
214
|
- [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.
|
215
|
+
- [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
216
|
|
213
217
|
Learn more at the official [Tk Concepts Tutorial](https://tkdocs.com/tutorial/concepts.html)
|
214
218
|
|
@@ -482,13 +486,13 @@ Check out the [Hello, Scrollbar!](#hello-scrollbar) sample for a `text` demo wit
|
|
482
486
|
|
483
487
|
#### Drag and Drop API
|
484
488
|
|
485
|
-
|
489
|
+
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
490
|
|
487
|
-
Alternatively, add listeners on the
|
491
|
+
Alternatively, for advanced customization, add listeners on the draggable:
|
488
492
|
- `on('drag_start') {|event| ...}`: fires on drag start receiving an `event` arg to set `data` and configure `source`
|
489
493
|
- `on('drag_motion') {|event| ...}`: fires on drag motion receiving an `event` arg to check `event#drop_accepted`, and configure `source` and `tooltip`
|
490
494
|
|
491
|
-
And
|
495
|
+
And, add a listener on the droppable:
|
492
496
|
- `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
497
|
|
494
498
|
These are all the available attributes on event, which is of type `DragAndDropEvent`:
|
@@ -580,6 +584,10 @@ Tk.tk_call("::tk::unsupported::MacWindowStyle", "style", tk_toplevel_widget, mac
|
|
580
584
|
|
581
585
|
More details can be found at the [Hello, Toplevel!](#hello-toplevel) sample.
|
582
586
|
|
587
|
+
#### Root/Toplevel Centered Within Screen
|
588
|
+
|
589
|
+
`root` and `toplevel` are centered within screen by default unless `x` or `y` attributes are specified, in which case, they are honored instead.
|
590
|
+
|
583
591
|
#### Text Defaults
|
584
592
|
|
585
593
|
`text` widget has these defaults:
|
@@ -618,7 +626,25 @@ More details can be found in the [Hello, Computed!](#hello-computed) sample belo
|
|
618
626
|
|
619
627
|
## Data-Binding
|
620
628
|
|
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).
|
629
|
+
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).
|
630
|
+
|
631
|
+
To summarize the data-binding API:
|
632
|
+
- `view_property <=> [model, attribute, *read_or_write_options]`: Bidirectional (two-way) data-binding to Model attribute accessor
|
633
|
+
- `view_property <= [model, attribute, *read_only_options]`: Unidirectional (one-way) data-binding to Model attribute reader
|
634
|
+
|
635
|
+
Data-bound model attribute can be:
|
636
|
+
- **Direct:** `Symbol` representing attribute reader/writer (e.g. `[person, :name`])
|
637
|
+
- **Nested:** `String` representing nested attribute path (e.g. `[company, 'address.street']`). That results in "nested data-binding"
|
638
|
+
- **Indexed:** `String` containing array attribute index (e.g. `[customer, 'addresses[0].street']`). That results in "indexed data-binding"
|
639
|
+
|
640
|
+
Data-binding options include:
|
641
|
+
- `before_read {|value| ...}`: performs an operation before reading data from Model to update View.
|
642
|
+
- `on_read {|value| ...}`: converts value read from Model to update the View.
|
643
|
+
- `after_read {|converted_value| ...}`: performs an operation after read from Model to update View.
|
644
|
+
- `before_write {|value| ...}`: performs an operation before writing data to Model from View.
|
645
|
+
- `on_write {|value| ...}`: converts value read from View to update the Model.
|
646
|
+
- `after_write {|converted_value| ...}`: performs an operation after writing to Model from View.
|
647
|
+
- `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
648
|
|
623
649
|
### Label Data-Binding
|
624
650
|
|
@@ -3234,7 +3260,7 @@ root { |r|
|
|
3234
3260
|
anchor 'center'
|
3235
3261
|
}
|
3236
3262
|
|
3237
|
-
|
3263
|
+
menu_bar {
|
3238
3264
|
# Mac-specific application menu (right next to the Apple menu)
|
3239
3265
|
if OS.mac?
|
3240
3266
|
menu(:application) {
|
@@ -3359,16 +3385,24 @@ root { |r|
|
|
3359
3385
|
menu_item(:radiobutton, label: image_name.capitalize) {
|
3360
3386
|
selection image_name == 'usa'
|
3361
3387
|
image File.expand_path("images/#{image_name}.png", __dir__)
|
3388
|
+
|
3389
|
+
on('command') do
|
3390
|
+
message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
|
3391
|
+
end
|
3362
3392
|
}
|
3363
3393
|
end
|
3364
3394
|
}
|
3365
3395
|
|
3366
|
-
menu(label: 'Country', underline:
|
3396
|
+
menu(label: 'Country', underline: 0) {
|
3367
3397
|
['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
|
3368
3398
|
menu_item(:radiobutton, label: image_name.capitalize) {
|
3369
3399
|
selection image_name == 'usa'
|
3370
3400
|
image File.expand_path("images/#{image_name}.png", __dir__)
|
3371
3401
|
compound 'left'
|
3402
|
+
|
3403
|
+
on('command') do
|
3404
|
+
message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
|
3405
|
+
end
|
3372
3406
|
}
|
3373
3407
|
end
|
3374
3408
|
}
|
@@ -3521,6 +3555,8 @@ root { |r|
|
|
3521
3555
|
anchor 'center'
|
3522
3556
|
}
|
3523
3557
|
|
3558
|
+
# Contextual Menu is bound to mouse right-click (and CTRL-click on Mac) by default
|
3559
|
+
# (Read Comment Below for Alternative)
|
3524
3560
|
menu {
|
3525
3561
|
menu(label: 'Edit', underline: 0) {
|
3526
3562
|
menu_item(label: 'Cut', underline: 2) {
|
@@ -3574,6 +3610,10 @@ root { |r|
|
|
3574
3610
|
menu_item(:radiobutton, label: image_name.capitalize) {
|
3575
3611
|
selection image_name == 'usa'
|
3576
3612
|
image File.expand_path("images/#{image_name}.png", __dir__)
|
3613
|
+
|
3614
|
+
on('command') do
|
3615
|
+
message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
|
3616
|
+
end
|
3577
3617
|
}
|
3578
3618
|
end
|
3579
3619
|
}
|
@@ -3584,10 +3624,14 @@ root { |r|
|
|
3584
3624
|
selection image_name == 'usa'
|
3585
3625
|
image File.expand_path("images/#{image_name}.png", __dir__)
|
3586
3626
|
compound 'left'
|
3627
|
+
|
3628
|
+
on('command') do
|
3629
|
+
message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
|
3630
|
+
end
|
3587
3631
|
}
|
3588
3632
|
end
|
3589
3633
|
}
|
3590
|
-
|
3634
|
+
|
3591
3635
|
menu(label: 'Format', underline: 3) {
|
3592
3636
|
menu(label: 'Background Color', underline: 0) {
|
3593
3637
|
COLORS.each { |color_style|
|
@@ -3637,6 +3681,32 @@ root { |r|
|
|
3637
3681
|
}
|
3638
3682
|
}
|
3639
3683
|
}
|
3684
|
+
|
3685
|
+
# You can replace `menu {` code with `menu(bind: false) {` if you want to bind manually,
|
3686
|
+
# which can be useful if you want to show menu at a specific location based on conditional logic.
|
3687
|
+
#
|
3688
|
+
# You can also repurpose a `menu_bar` as a contextual menu by declaring `@menu = menu_bar {` and
|
3689
|
+
# binding to mouse right-click.
|
3690
|
+
#
|
3691
|
+
# Example:
|
3692
|
+
#
|
3693
|
+
# @menu = menu(bind: false) {
|
3694
|
+
# menu(label: 'File', underline: 0) {
|
3695
|
+
# menu_item(label: 'Exit')
|
3696
|
+
# }
|
3697
|
+
# }
|
3698
|
+
# if OS.mac?
|
3699
|
+
# on('2') do |event|
|
3700
|
+
# @menu.popup(event.x_root, event.y_root)
|
3701
|
+
# end
|
3702
|
+
# on('Control-1') do |event|
|
3703
|
+
# @menu.popup(event.x_root, event.y_root)
|
3704
|
+
# end
|
3705
|
+
# else
|
3706
|
+
# on('3') do |event|
|
3707
|
+
# @menu.popup(event.x_root, event.y_root)
|
3708
|
+
# end
|
3709
|
+
# end
|
3640
3710
|
}.open
|
3641
3711
|
```
|
3642
3712
|
|
@@ -3682,10 +3752,10 @@ https://github.com/cryptopunksnotdead/cryptopunks-gui
|
|
3682
3752
|
|
3683
3753
|
Generate an icon of overlapping circles derived from a hash.
|
3684
3754
|
|
3685
|
-
https://gitlab.com/fjc/circule
|
3686
|
-
|
3687
3755
|
[Demo Video](https://gitlab.com/fjc/circule/-/raw/master/circule-demo.mp4)
|
3688
3756
|
|
3757
|
+
https://gitlab.com/fjc/circule
|
3758
|
+
|
3689
3759
|
## Process
|
3690
3760
|
|
3691
3761
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
@@ -3693,6 +3763,7 @@ https://gitlab.com/fjc/circule
|
|
3693
3763
|
## Resources
|
3694
3764
|
|
3695
3765
|
- [Tk Tutorial](https://tkdocs.com/tutorial/index.html)
|
3766
|
+
- [Official Tk Command Reference](https://tcl.tk/man/tcl8.6/TkCmd/contents.htm)
|
3696
3767
|
- [Code Master Blog](https://andymaleh.blogspot.com/search/label/Tk)
|
3697
3768
|
|
3698
3769
|
## Help
|
@@ -3730,7 +3801,7 @@ These features have been planned or suggested. You might see them in a future ve
|
|
3730
3801
|
|
3731
3802
|
[MIT](LICENSE.txt)
|
3732
3803
|
|
3733
|
-
Copyright (c) 2020-
|
3804
|
+
Copyright (c) 2020-2022 - Andy Maleh.
|
3734
3805
|
|
3735
3806
|
--
|
3736
3807
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.53
|
data/bin/girb
CHANGED
data/bin/girb_runner.rb
CHANGED
data/glimmer-dsl-tk.gemspec
CHANGED
Binary file
|
data/lib/glimmer/dsl/tk/dsl.rb
CHANGED
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Tk
|
3
24
|
DragAndDropEvent = Struct.new(:source, :target, :tooltip, :x_root, :y_root, :data, :drop_accepted) do
|
data/lib/glimmer/tk/lbl_proxy.rb
CHANGED