glimmer-dsl-tk 0.0.38 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +311 -17
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/dsl/tk/block_attribute_expression.rb +6 -2
- data/lib/glimmer/dsl/tk/dsl.rb +1 -1
- data/lib/glimmer/tk/checkbutton_proxy.rb +0 -2
- data/lib/glimmer/tk/menu_item_proxy.rb +67 -9
- data/lib/glimmer/tk/menu_proxy.rb +48 -7
- data/lib/glimmer/tk/radiobutton_proxy.rb +0 -3
- data/lib/glimmer/tk/scrollbar_frame_proxy.rb +133 -0
- data/lib/glimmer/tk/widget_proxy.rb +36 -16
- data/lib/glimmer-dsl-tk.rb +12 -0
- data/samples/elaborate/meta_sample.rb +10 -0
- data/samples/hello/hello_button.rb +4 -4
- data/samples/hello/hello_checkbutton.rb +1 -1
- data/samples/hello/hello_menu_bar.rb +91 -14
- data/{lib/glimmer/tk/commandable.rb → samples/hello/hello_scrollbar.rb} +43 -19
- data/samples/hello/hello_scrollbar_frame.rb +77 -0
- data/samples/hello/hello_text.rb +10 -5
- data/samples/hello/hello_toplevel.rb +1 -1
- metadata +6 -5
- data/lib/glimmer/tk/button_proxy.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb49ce9e435d0313cdec33a81afec3ad4d7716ee6e8363004651417d3535704
|
4
|
+
data.tar.gz: 9ad46f88ace884c5d670d2449728369af8510b95e24c291a3bda7580cef65820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d58a0179466efe9991f53eefb23c6dd3749c386230d70722e0a6c3f24c85f2affc361e18c21d65b34b2cb37269dfb8c7ceff9953a1bc5059f1db971051b0c4c8
|
7
|
+
data.tar.gz: bad07c9519d483534306b04be7e4d110fe302c6dc3f03028d85aa5c85fcfe01437c0471d58b49e3db013abc99d6f55535d5aefacc4bdc651df50b30ecda467e0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.42
|
4
|
+
|
5
|
+
- Add vertical/horizontal scrollbars to Meta-Sample
|
6
|
+
- Keep only vertical scrollbar in Hello, Text!
|
7
|
+
- Fix issue with including bwidgets and iwidgets in Windows
|
8
|
+
- Fix Hello, Menu Bar! sample in Windows (by disabling Windows-special System menu, which does not seem to be working in Tk)
|
9
|
+
|
10
|
+
## 0.0.41
|
11
|
+
|
12
|
+
- Support `scrollbar_frame` Glimmer custom widget as a frame that automatically provides scrollbars when its content's size exceeds its size
|
13
|
+
- Support `scrollbar_frame` `xscrollbar` and `yscrollbar` attributes (to enable/disable via boolean or set to a custom externally instantiated scrollbar if needed)
|
14
|
+
- Hello, Scrollbar Frame!
|
15
|
+
|
16
|
+
## 0.0.40
|
17
|
+
|
18
|
+
- Hello, Scrollbar!
|
19
|
+
- Default to 'alt' Tk theme on Linux
|
20
|
+
- Added Windows/Linux accelerators to Hello, Menu Bar!
|
21
|
+
- Fix issue with extra junk character added to beginning of Hello, Checkbutton! by mistake
|
22
|
+
- Fix issue with Hello, Menu Bar! help menu item crashing in Linux (it is restricted to Mac only)
|
23
|
+
- Fix issue with Hello, Text! focus losing selection in Linux upon setting background/foreground/font/font-size
|
24
|
+
|
25
|
+
## 0.0.39
|
26
|
+
|
27
|
+
- Add Language and Language Name menus to Hello, Menu Bar! sample
|
28
|
+
- Update Hello, Button! sample to indicate compound option value on image text buttons
|
29
|
+
- Support Mac `menu_item(:about, label: ) { on('command') {} }`
|
30
|
+
- Support Mac `menu_item(:preferences) { on('command') {} }`
|
31
|
+
- Support Mac `menu_item(:help) { on('command') {} }`
|
32
|
+
- Support Mac `menu_item(:quit) { on('command') {} }`
|
33
|
+
- Support Mac/X11 `'Help'` menu
|
34
|
+
- Support Mac `'Window'` menu
|
35
|
+
- Support Windows `'System'` menu
|
36
|
+
|
37
|
+
|
3
38
|
## 0.0.38
|
4
39
|
|
5
40
|
- Hello, Menu Bar! sample
|
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.42
|
2
2
|
## MRI Ruby Desktop Development GUI Library
|
3
3
|
[](http://badge.fury.io/rb/glimmer-dsl-tk)
|
4
4
|
[](https://github.com/AndyObtiva/glimmer-dsl-tk/actions/workflows/ruby.yml)
|
@@ -121,6 +121,8 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
121
121
|
- [Hello, Drag and Drop!](#hello-drag-and-drop)
|
122
122
|
- [Hello, Built-in Dialog!](#hello-built-in-dialog)
|
123
123
|
- [Hello, Separator!](#hello-separator)
|
124
|
+
- [Hello, Scrollbar!](#hello-scrollbar)
|
125
|
+
- [Hello, Scrollbar Frame!](#hello-scrollbar-frame)
|
124
126
|
- [Hello, Menu Bar!](#hello-menu-bar)
|
125
127
|
- [Applications](#applications)
|
126
128
|
- [Glimmer Tk Calculator](#glimmer-tk-calculator)
|
@@ -156,6 +158,14 @@ For example, on Windows, you can follow the [instructions over here](https://tkd
|
|
156
158
|
- Setup environment variables TCL_LIBRARY=C:\ActiveTcl\lib\tcl8.6 & TK_LIBRARY=C:\ActiveTcl\lib\tk8.6
|
157
159
|
- Run: `gem install tk -v0.4.0`
|
158
160
|
|
161
|
+
For example, on Linux, you can:
|
162
|
+
- Download the ActiveTcl Linux package from [ActiveState.com](https://activestate.com)
|
163
|
+
- Extract the tar gz file using command `tar zxvf ActiveTcl-version-number.tar.gz`
|
164
|
+
- Run included install shell script `./ActiveTcl-version-number/install.sh`
|
165
|
+
- 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)
|
166
|
+
- Run: `rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl`
|
167
|
+
- Run: `gem install tk -v0.4.0`
|
168
|
+
|
159
169
|
Afterwards, if you open `irb`, you should be able to run `require 'tk'` successfully.
|
160
170
|
|
161
171
|
## Setup
|
@@ -171,7 +181,7 @@ gem install glimmer-dsl-tk
|
|
171
181
|
|
172
182
|
Add the following to `Gemfile`:
|
173
183
|
```
|
174
|
-
gem 'glimmer-dsl-tk', '
|
184
|
+
gem 'glimmer-dsl-tk', '0.0.42'
|
175
185
|
```
|
176
186
|
|
177
187
|
And, then run:
|
@@ -296,13 +306,17 @@ keyword(args) | attributes | event bindings & callbacks
|
|
296
306
|
`list` | `selectmode`, `selection` | None
|
297
307
|
`message_box(type: , message: , detail: , title: , icon: , default: , parent: )` | None | None
|
298
308
|
`menu(label: nil) (label is nil if nested under root/toplevel for menu bar)` | None | None
|
299
|
-
`menu_item(style = :command, label: , underline: )` (style also can be `:radiobutton`, `:checkbutton`,
|
309
|
+
`menu_item(style = :command, label: , underline: )` (style also can be `:radiobutton`, `:checkbutton`, `:separator`, `:about`, `:preferences`, `:quit`, `:help`) | `state`, `accelerator`, `selection` & `variable` (if `:radiobutton` or `:checkbutton`), `image`, `compound` | `command`
|
300
310
|
`notebook` | None | None
|
301
311
|
`radiobutton` | `text`, `variable` (Boolean), `image` (optional keyword args: `subsample`, `zoom`, `from`, `to`, `shrink`, `compositingrule`), `compound` (`'center', 'top', 'bottom', 'left', 'right'`), `value` (default: `text`) | `command {}`
|
302
312
|
`root` | `title`, `iconphoto`, `background`, `alpha`, `escapable`, `fullscreen?`, `topmost?`, `transparent?`, `stackorder`, `winfo_screendepth`, `winfo_screenvisual`, `winfo_screenwidth`, `winfo_screenheight`, `winfo_pixels('li')`, `winfo_screen`, `wm_maxsize`, `state` (`'normal', 'iconic', 'withdrawn', 'icon', 'zoomed'`) | `'DELETE_WINDOW'`, `'OPEN_WINDOW'`
|
313
|
+
`scrollbar` | `orient` | `command`
|
314
|
+
`scrollbar_frame` | `xscrollbar` (Boolean or scrollbar widget proxy), `yscrollbar` (Boolean or scrollbar widget proxy) | None
|
303
315
|
`separator` | `orient` (`'horizontal' (default) or 'vertical'`) | None
|
304
316
|
`toplevel` | `title`, `iconphoto`, `background`, `alpha`, `escapable`, `fullscreen?`, `topmost?`, `transparent?`, `stackorder`, `winfo_screendepth`, `winfo_screenvisual`, `winfo_screenwidth`, `winfo_screenheight`, `winfo_pixels('li')`, `winfo_screen`, `wm_maxsize`, `state` (`'normal', 'iconic', 'withdrawn', 'icon', 'zoomed'`) | `'DELETE_WINDOW'`
|
305
317
|
`text` | `value`, [many more attributes](https://tcl.tk/man/tcl8.6/TkCmd/text.htm#M116) | `'modified'`, `'selection'`, `'insert_mark_moved'` (alias: `'insert_mark_move', 'InsertMarkMove', 'InsertMarkMoved'`)
|
318
|
+
`x_scrollbar` | `orient` (`'horizontal'`) | `command`
|
319
|
+
`y_scrollbar` | `orient` (`'vertical'`) | `command`
|
306
320
|
|
307
321
|
Options for `get_open_file` and `get_multiple_open_file` include:
|
308
322
|
- `filetypes`: `Hash` of `'Group Name' => '.ext'` entries (e.g. `filetypes: {'PNG Images' => '.png'}`
|
@@ -422,8 +436,44 @@ Other useful built-in API methods:
|
|
422
436
|
- `text_edit_undo`
|
423
437
|
- `text_edit_redo`
|
424
438
|
|
439
|
+
If you would like to add scrollbars, you can set the `xscrollbar` and `yscrollbar` attributes.
|
440
|
+
|
441
|
+
Example of adding a vertical `scrollbar`:
|
442
|
+
|
443
|
+
```ruby
|
444
|
+
textarea_yscrollbar = y_scrollbar {
|
445
|
+
grid row:0, column:1
|
446
|
+
}
|
447
|
+
|
448
|
+
textarea = text {
|
449
|
+
grid row:0, column:0, column_weight: 0
|
450
|
+
wrap "word"
|
451
|
+
yscrollbar textarea_yscrollbar
|
452
|
+
}
|
453
|
+
```
|
454
|
+
|
455
|
+
Example of adding both a horizontal `scrollbar` and a vertical `scrollbar` (must disable `wrap "word"` for horizontal scrolling to work):
|
456
|
+
|
457
|
+
```ruby
|
458
|
+
textarea_xscrollbar = x_scrollbar {
|
459
|
+
grid row:1, column:0, column_span: 2, row_weight: 0
|
460
|
+
}
|
461
|
+
|
462
|
+
textarea_yscrollbar = y_scrollbar {
|
463
|
+
grid row:0, column:1
|
464
|
+
}
|
465
|
+
|
466
|
+
textarea = text {
|
467
|
+
grid row:0, column:0, column_weight: 0
|
468
|
+
xscrollbar textarea_xscrollbar
|
469
|
+
yscrollbar textarea_yscrollbar
|
470
|
+
}
|
471
|
+
```
|
472
|
+
|
425
473
|
Check out the [Hello, Text!](#hello-text) sample for a good demonstration of the `text` widget features.
|
426
474
|
|
475
|
+
Check out the [Hello, Scrollbar!](#hello-scrollbar) sample for a `text` demo with scrolling.
|
476
|
+
|
427
477
|
#### Drag and Drop API
|
428
478
|
|
429
479
|
Drag and drop works by simply designating a widget as a drag source with attribute `drag_source true`
|
@@ -2937,6 +2987,160 @@ Glimmer app:
|
|
2937
2987
|
|
2938
2988
|

|
2939
2989
|
|
2990
|
+
### Hello, Scrollbar!
|
2991
|
+
|
2992
|
+
Glimmer code (from [samples/hello/hello_scrollbar.rb](samples/hello/hello_scrollbar.rb)):
|
2993
|
+
|
2994
|
+
```ruby
|
2995
|
+
require 'glimmer-dsl-tk'
|
2996
|
+
|
2997
|
+
include Glimmer
|
2998
|
+
|
2999
|
+
root {
|
3000
|
+
title 'Hello, Scrollbar!'
|
3001
|
+
width 400
|
3002
|
+
height 500
|
3003
|
+
|
3004
|
+
notebook {
|
3005
|
+
grid sticky: 'nsew'
|
3006
|
+
|
3007
|
+
frame(text: 'Scrollable List') {
|
3008
|
+
@list = list {
|
3009
|
+
grid sticky: 'nsew', row: 0, column: 0, row_weight: 1, column_weight: 1
|
3010
|
+
items 40.times.map {|n| "Item #{n + 1} of a very long list" }
|
3011
|
+
}
|
3012
|
+
|
3013
|
+
@scrollbar = scrollbar {
|
3014
|
+
grid row: 0, column: 1
|
3015
|
+
# orient 'vertical' # default
|
3016
|
+
}
|
3017
|
+
@list.yscrollbar @scrollbar
|
3018
|
+
}
|
3019
|
+
|
3020
|
+
frame(text: 'Scrollable Text') {
|
3021
|
+
@text = text {
|
3022
|
+
grid sticky: 'nsew', row: 0, column: 0, row_weight: 1, column_weight: 1
|
3023
|
+
value ("This is a random sample of text that will repeat over and over and over"*2 + "\n")*40
|
3024
|
+
}
|
3025
|
+
|
3026
|
+
@yscrollbar = scrollbar {
|
3027
|
+
grid row: 0, column: 1
|
3028
|
+
# orient 'vertical' # default
|
3029
|
+
}
|
3030
|
+
@text.yscrollbar @yscrollbar
|
3031
|
+
|
3032
|
+
@xscrollbar = scrollbar {
|
3033
|
+
grid row: 1, column: 0, column_span: 2, row_weight: 0
|
3034
|
+
orient 'horizontal'
|
3035
|
+
}
|
3036
|
+
@text.xscrollbar @xscrollbar
|
3037
|
+
}
|
3038
|
+
}
|
3039
|
+
|
3040
|
+
}.open
|
3041
|
+
```
|
3042
|
+
|
3043
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3044
|
+
|
3045
|
+
```
|
3046
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scrollbar'"
|
3047
|
+
```
|
3048
|
+
|
3049
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3050
|
+
|
3051
|
+
```
|
3052
|
+
ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scrollbar.rb
|
3053
|
+
```
|
3054
|
+
|
3055
|
+
Glimmer app:
|
3056
|
+
|
3057
|
+

|
3058
|
+
|
3059
|
+

|
3060
|
+
|
3061
|
+
### Hello, Scrollbar Frame!
|
3062
|
+
|
3063
|
+
Glimmer code (from [samples/hello/hello_scrollbar_frame.rb](samples/hello/hello_scrollbar_frame.rb)):
|
3064
|
+
|
3065
|
+
```ruby
|
3066
|
+
require 'glimmer-dsl-tk'
|
3067
|
+
|
3068
|
+
include Glimmer
|
3069
|
+
|
3070
|
+
root {
|
3071
|
+
title 'Hello, Scrollbar Frame!'
|
3072
|
+
width 400
|
3073
|
+
height 400
|
3074
|
+
|
3075
|
+
notebook {
|
3076
|
+
grid sticky: 'nsew'
|
3077
|
+
|
3078
|
+
frame(text: 'X/Y Scroll') {
|
3079
|
+
scrollbar_frame {
|
3080
|
+
30.times do |row|
|
3081
|
+
10.times do |column|
|
3082
|
+
button {
|
3083
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
3084
|
+
text "Row #{row} | Column #{column}"
|
3085
|
+
}
|
3086
|
+
end
|
3087
|
+
end
|
3088
|
+
}
|
3089
|
+
}
|
3090
|
+
|
3091
|
+
frame(text: 'Y Scroll') {
|
3092
|
+
scrollbar_frame {
|
3093
|
+
xscrollbar false
|
3094
|
+
|
3095
|
+
30.times do |row|
|
3096
|
+
2.times do |column|
|
3097
|
+
button {
|
3098
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
3099
|
+
text "Row #{row} | Column #{column}"
|
3100
|
+
}
|
3101
|
+
end
|
3102
|
+
end
|
3103
|
+
}
|
3104
|
+
}
|
3105
|
+
|
3106
|
+
frame(text: 'X Scroll') {
|
3107
|
+
scrollbar_frame {
|
3108
|
+
yscrollbar false
|
3109
|
+
|
3110
|
+
13.times do |row|
|
3111
|
+
10.times do |column|
|
3112
|
+
button {
|
3113
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
3114
|
+
text "Row #{row} | Column #{column}"
|
3115
|
+
}
|
3116
|
+
end
|
3117
|
+
end
|
3118
|
+
}
|
3119
|
+
}
|
3120
|
+
}
|
3121
|
+
}.open
|
3122
|
+
```
|
3123
|
+
|
3124
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3125
|
+
|
3126
|
+
```
|
3127
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scrollbar_frame'"
|
3128
|
+
```
|
3129
|
+
|
3130
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3131
|
+
|
3132
|
+
```
|
3133
|
+
ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scrollbar_frame.rb
|
3134
|
+
```
|
3135
|
+
|
3136
|
+
Glimmer app:
|
3137
|
+
|
3138
|
+

|
3139
|
+
|
3140
|
+

|
3141
|
+
|
3142
|
+

|
3143
|
+
|
2940
3144
|
### Hello, Menu Bar!
|
2941
3145
|
|
2942
3146
|
Glimmer code (from [samples/hello/hello_menu_bar.rb](samples/hello/hello_menu_bar.rb)):
|
@@ -2961,51 +3165,92 @@ root { |r|
|
|
2961
3165
|
}
|
2962
3166
|
|
2963
3167
|
menu {
|
3168
|
+
# Mac-specific application menu (right next to the Apple menu)
|
3169
|
+
if OS.mac?
|
3170
|
+
menu(:application) {
|
3171
|
+
menu_item(:about, label: 'About My Application') {
|
3172
|
+
accelerator 'Command+A'
|
3173
|
+
|
3174
|
+
on('command') do
|
3175
|
+
message_box(parent: r, title: 'About', message: 'About my application.')
|
3176
|
+
end
|
3177
|
+
}
|
3178
|
+
|
3179
|
+
menu_item(:preferences) {
|
3180
|
+
on('command') do
|
3181
|
+
message_box(parent: r, title: 'Preferences', message: 'Preferences of my application.')
|
3182
|
+
end
|
3183
|
+
}
|
3184
|
+
|
3185
|
+
# If not defined, application simply quits upon selecting Quit menu item
|
3186
|
+
menu_item(:quit) {
|
3187
|
+
on('command') do
|
3188
|
+
message_box(parent: r, title: 'Quit', message: 'Quitting my application...')
|
3189
|
+
exit(0)
|
3190
|
+
end
|
3191
|
+
}
|
3192
|
+
}
|
3193
|
+
end
|
3194
|
+
|
3195
|
+
# Windows-specific system menu (to the top-left of the window frame)
|
3196
|
+
if OS.windows?
|
3197
|
+
menu(label: 'System')
|
3198
|
+
end
|
3199
|
+
|
2964
3200
|
menu(label: 'File', underline: 0) {
|
2965
3201
|
menu_item(label: 'New', underline: 0) {
|
2966
|
-
accelerator 'Command+N'
|
3202
|
+
accelerator OS.mac? ? 'Command+N' : 'Control+N'
|
2967
3203
|
|
2968
3204
|
on('command') do
|
2969
3205
|
message_box(parent: r, title: 'New', message: 'New file created.')
|
2970
3206
|
end
|
2971
3207
|
}
|
3208
|
+
|
2972
3209
|
menu_item(label: 'Open...', underline: 0) {
|
2973
|
-
accelerator 'Command+O'
|
3210
|
+
accelerator OS.mac? ? 'Command+O' : 'Control+O'
|
2974
3211
|
|
2975
3212
|
on('command') do
|
2976
3213
|
message_box(parent: r, title: 'Open', message: 'Opening File...')
|
2977
3214
|
end
|
2978
3215
|
}
|
3216
|
+
|
2979
3217
|
menu(label: 'Open Recent', underline: 5) {
|
2980
3218
|
menu_item(label: 'File 1') {
|
2981
3219
|
on('command') do
|
2982
3220
|
message_box(parent: r, title: 'File 1', message: 'File 1 Contents')
|
2983
3221
|
end
|
2984
3222
|
}
|
3223
|
+
|
2985
3224
|
menu_item(label: 'File 2') {
|
2986
3225
|
on('command') do
|
2987
3226
|
message_box(parent: r, title: 'File 2', message: 'File 2 Contents')
|
2988
3227
|
end
|
2989
3228
|
}
|
2990
3229
|
}
|
3230
|
+
|
2991
3231
|
menu_item(:separator)
|
3232
|
+
|
2992
3233
|
menu_item(label: 'Exit', underline: 1) {
|
2993
3234
|
on('command') do
|
2994
3235
|
exit(0)
|
2995
3236
|
end
|
2996
3237
|
}
|
2997
3238
|
}
|
3239
|
+
|
2998
3240
|
menu(label: 'Edit', underline: 0) {
|
2999
3241
|
menu_item(label: 'Cut', underline: 2) {
|
3000
|
-
accelerator 'Command+X'
|
3242
|
+
accelerator OS.mac? ? 'Command+X' : 'Control+X'
|
3001
3243
|
}
|
3244
|
+
|
3002
3245
|
menu_item(label: 'Copy', underline: 0) {
|
3003
|
-
accelerator 'Command+C'
|
3246
|
+
accelerator OS.mac? ? 'Command+C' : 'Control+C'
|
3004
3247
|
}
|
3248
|
+
|
3005
3249
|
menu_item(label: 'Paste', underline: 0) {
|
3006
|
-
accelerator 'Command+V'
|
3250
|
+
accelerator OS.mac? ? 'Command+V' : 'Control+V'
|
3007
3251
|
}
|
3008
3252
|
}
|
3253
|
+
|
3009
3254
|
menu(label: 'Options', underline: 0) {
|
3010
3255
|
menu_item(:checkbutton, label: 'Enabled', underline: 0) {
|
3011
3256
|
on('command') do
|
@@ -3013,7 +3258,8 @@ root { |r|
|
|
3013
3258
|
@select_multiple_menu.children.each { |menu_item| menu_item.state = menu_item.state == 'disabled' ? 'normal' : 'disabled' }
|
3014
3259
|
end
|
3015
3260
|
}
|
3016
|
-
|
3261
|
+
|
3262
|
+
@select_one_menu = menu(label: 'Select One', underline: 7) {
|
3017
3263
|
menu_item(:radiobutton, label: 'Option 1') {
|
3018
3264
|
state 'disabled'
|
3019
3265
|
}
|
@@ -3024,7 +3270,8 @@ root { |r|
|
|
3024
3270
|
state 'disabled'
|
3025
3271
|
}
|
3026
3272
|
}
|
3027
|
-
|
3273
|
+
|
3274
|
+
@select_multiple_menu = menu(label: 'Select Multiple', underline: 7) {
|
3028
3275
|
menu_item(:checkbutton, label: 'Option 4') {
|
3029
3276
|
state 'disabled'
|
3030
3277
|
}
|
@@ -3036,6 +3283,26 @@ root { |r|
|
|
3036
3283
|
}
|
3037
3284
|
}
|
3038
3285
|
}
|
3286
|
+
|
3287
|
+
menu(label: 'Language', underline: 3) {
|
3288
|
+
['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
|
3289
|
+
menu_item(:radiobutton, label: image_name.capitalize) {
|
3290
|
+
selection image_name == 'usa'
|
3291
|
+
image File.expand_path("images/#{image_name}.png", __dir__)
|
3292
|
+
}
|
3293
|
+
end
|
3294
|
+
}
|
3295
|
+
|
3296
|
+
menu(label: 'Country', underline: 3) {
|
3297
|
+
['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
|
3298
|
+
menu_item(:radiobutton, label: image_name.capitalize) {
|
3299
|
+
selection image_name == 'usa'
|
3300
|
+
image File.expand_path("images/#{image_name}.png", __dir__)
|
3301
|
+
compound 'left'
|
3302
|
+
}
|
3303
|
+
end
|
3304
|
+
}
|
3305
|
+
|
3039
3306
|
menu(label: 'Format', underline: 0) {
|
3040
3307
|
menu(label: 'Background Color', underline: 0) {
|
3041
3308
|
COLORS.each { |color_style|
|
@@ -3046,6 +3313,7 @@ root { |r|
|
|
3046
3313
|
}
|
3047
3314
|
}
|
3048
3315
|
}
|
3316
|
+
|
3049
3317
|
menu(label: 'Foreground Color', underline: 11) {
|
3050
3318
|
COLORS.each { |color_style|
|
3051
3319
|
menu_item(:radiobutton, label: color_style.to_s.split('_').map(&:capitalize).join(' ')) {
|
@@ -3056,46 +3324,64 @@ root { |r|
|
|
3056
3324
|
}
|
3057
3325
|
}
|
3058
3326
|
}
|
3327
|
+
|
3059
3328
|
menu(label: 'View', underline: 0) {
|
3060
3329
|
menu_item(:radiobutton, label: 'Small', underline: 0) {
|
3061
|
-
accelerator 'Command+S'
|
3330
|
+
accelerator OS.mac? ? 'Command+S' : 'Control+S'
|
3062
3331
|
|
3063
3332
|
on('command') do
|
3064
3333
|
@label.font = {size: 25}
|
3065
3334
|
end
|
3066
3335
|
}
|
3336
|
+
|
3067
3337
|
menu_item(:radiobutton, label: 'Medium', underline: 0) {
|
3068
|
-
accelerator 'Command+M'
|
3338
|
+
accelerator OS.mac? ? 'Command+M' : 'Control+M'
|
3069
3339
|
selection true
|
3070
3340
|
|
3071
3341
|
on('command') do
|
3072
3342
|
@label.font = {size: 50}
|
3073
3343
|
end
|
3074
3344
|
}
|
3345
|
+
|
3075
3346
|
menu_item(:radiobutton, label: 'Large', underline: 0) {
|
3076
|
-
accelerator 'Command+L'
|
3347
|
+
accelerator OS.mac? ? 'Command+L' : 'Control+L'
|
3077
3348
|
|
3078
3349
|
on('command') do
|
3079
3350
|
@label.font = {size: 75}
|
3080
3351
|
end
|
3081
3352
|
}
|
3082
3353
|
}
|
3354
|
+
|
3355
|
+
# Mac-specific window menu (containing zooming/resizing menu items)
|
3356
|
+
menu(label: 'Window', underline: 0) if OS.mac?
|
3357
|
+
|
3083
3358
|
menu(label: 'Help', underline: 0) {
|
3359
|
+
if OS.mac?
|
3360
|
+
menu_item(:help) {
|
3361
|
+
on('command') do
|
3362
|
+
message_box(parent: r, title: 'Help', message: 'Help for my application.')
|
3363
|
+
end
|
3364
|
+
}
|
3365
|
+
end
|
3366
|
+
|
3084
3367
|
menu_item(label: 'Manual', underline: 0) {
|
3085
|
-
accelerator 'Command+Shift+M'
|
3368
|
+
accelerator OS.mac? ? 'Command+Shift+M' : 'Control+U'
|
3086
3369
|
|
3087
3370
|
on('command') do
|
3088
3371
|
message_box(parent: r, title: 'Manual', message: 'Manual Contents')
|
3089
3372
|
end
|
3090
3373
|
}
|
3374
|
+
|
3091
3375
|
menu_item(label: 'Tutorial', underline: 0) {
|
3092
|
-
accelerator 'Command+Shift+T'
|
3376
|
+
accelerator OS.mac? ? 'Command+Shift+T' : 'Control+T'
|
3093
3377
|
|
3094
3378
|
on('command') do
|
3095
3379
|
message_box(parent: r, title: 'Tutorial', message: 'Tutorial Contents')
|
3096
3380
|
end
|
3097
3381
|
}
|
3382
|
+
|
3098
3383
|
menu_item(:separator)
|
3384
|
+
|
3099
3385
|
menu_item(label: 'Report an Issue...', underline: 0) {
|
3100
3386
|
on('command') do
|
3101
3387
|
message_box(parent: r, title: 'Report an Issue', message: 'Reporting an issue...')
|
@@ -3122,12 +3408,20 @@ Glimmer app:
|
|
3122
3408
|
|
3123
3409
|

|
3124
3410
|
|
3411
|
+

|
3412
|
+
|
3125
3413
|

|
3126
3414
|
|
3127
3415
|

|
3128
3416
|
|
3129
3417
|

|
3130
3418
|
|
3419
|
+

|
3420
|
+
|
3421
|
+

|
3422
|
+
|
3423
|
+

|
3424
|
+
|
3131
3425
|

|
3132
3426
|
|
3133
3427
|

|
@@ -3152,9 +3446,9 @@ https://github.com/ancorgs/y3network-ruby-ui
|
|
3152
3446
|
|
3153
3447
|
This is a Graphical User Interface for the famous [cryptopunks Ruby gem](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks).
|
3154
3448
|
|
3155
|
-
https://github.com/
|
3449
|
+
https://github.com/cryptopunksnotdead/cryptopunks-gui
|
3156
3450
|
|
3157
|
-

|
3158
3452
|
|
3159
3453
|
### Circule
|
3160
3454
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.42
|
data/glimmer-dsl-tk.gemspec
CHANGED
Binary file
|
@@ -28,11 +28,15 @@ module Glimmer
|
|
28
28
|
def can_interpret?(parent, keyword, *args, &block)
|
29
29
|
block_given? and
|
30
30
|
args.size == 0 and
|
31
|
-
parent.respond_to?("#{keyword}_block=")
|
31
|
+
(parent.respond_to?("#{keyword}_block=") || (parent.respond_to?(:tk) && parent.tk.respond_to?(keyword)))
|
32
32
|
end
|
33
33
|
|
34
34
|
def interpret(parent, keyword, *args, &block)
|
35
|
-
parent.
|
35
|
+
if parent.respond_to?("#{keyword}_block=")
|
36
|
+
parent.send("#{keyword}_block=", block)
|
37
|
+
else
|
38
|
+
parent.tk.send(keyword, block)
|
39
|
+
end
|
36
40
|
nil
|
37
41
|
end
|
38
42
|
end
|
data/lib/glimmer/dsl/tk/dsl.rb
CHANGED
@@ -20,7 +20,6 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/tk/widget_proxy'
|
23
|
-
require 'glimmer/tk/commandable'
|
24
23
|
require 'glimmer/tk/variable_owner'
|
25
24
|
|
26
25
|
module Glimmer
|
@@ -29,7 +28,6 @@ module Glimmer
|
|
29
28
|
#
|
30
29
|
# Follows the Proxy Design Pattern
|
31
30
|
class CheckbuttonProxy < WidgetProxy
|
32
|
-
include Commandable
|
33
31
|
include VariableOwner
|
34
32
|
end
|
35
33
|
end
|