glimmer-dsl-tk 0.0.40 → 0.0.44
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/README.md +207 -60
- 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/list_proxy.rb +0 -3
- data/lib/glimmer/tk/menu_proxy.rb +3 -2
- data/lib/glimmer/tk/radiobutton_proxy.rb +0 -3
- data/lib/glimmer/tk/scrollbar_frame_proxy.rb +133 -0
- data/lib/glimmer/tk/text_proxy.rb +0 -3
- data/lib/glimmer/tk/widget_proxy.rb +31 -22
- data/lib/glimmer-dsl-tk.rb +4 -3
- data/lib/{glimmer/tk/scrollbar_proxy.rb → os.rb} +12 -7
- data/samples/elaborate/meta_sample.rb +10 -0
- data/samples/hello/hello_button.rb +3 -3
- data/samples/hello/hello_drag_and_drop.rb +96 -37
- data/samples/hello/hello_menu_bar.rb +3 -8
- data/samples/hello/hello_scrollbar.rb +1 -2
- data/samples/hello/hello_scrollbar_frame.rb +77 -0
- data/samples/hello/hello_text.rb +2 -7
- metadata +6 -27
- data/lib/glimmer/tk/button_proxy.rb +0 -34
- data/lib/glimmer/tk/commandable.rb +0 -42
- data/lib/glimmer/tk/scrollable.rb +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cb173f133301f49a6f4ddfc86578e450b563ff842b96274b6003b784b2e8acb
|
4
|
+
data.tar.gz: 810087c40f044768c6394a968b945fdc2e3c4c0d1eb8caac2b3421259c431d61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8842b20e509fd9c0f918953942665ac5a0609cbc91b0faf020c808e736890e1d2617abb579b384696711ecb0d40bf7ab82a5a0e669a1ff878bede9ed061c6abb
|
7
|
+
data.tar.gz: 983740e737d7e066f56411ddea5ab7ab607bf196579d519e41aea07bd4c5e8d24b2dcd178086a3d8f35aa8e6ae7b0b8995cb27e3846516887ad4908e07758847
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.44
|
4
|
+
|
5
|
+
- Fix issue with not being able to drop list into checkbox in Hello, Drag and Drop! by disabling functionality for list just like button
|
6
|
+
|
7
|
+
## 0.0.43
|
8
|
+
|
9
|
+
- Modified Hello, Drag and Drop! to include a list
|
10
|
+
- Removed the need to require `'glimmer/tk/drag_and_drop_extension'` to do drag and drop; it is automatically included in `require 'glimmer-dsl-tk'` now.
|
11
|
+
- Remove 'os' gem due to Tk having the capability to detect the OS it is on using `Tk.windowingsystem` (include Glimmer implementation of `OS` class having `OS.mac?`, `OS.windows?` and `OS.linux?`)
|
12
|
+
- Default to 'clam' Tk theme on Linux ('alt' looks a bit too classic with certain widgets)
|
13
|
+
|
14
|
+
## 0.0.42
|
15
|
+
|
16
|
+
- Add vertical/horizontal scrollbars to Meta-Sample
|
17
|
+
- Keep only vertical scrollbar in Hello, Text!
|
18
|
+
- Fix issue with including bwidgets and iwidgets in Windows (by removing from default requires, leaving to users to require manually when needed only and only systems that support them)
|
19
|
+
- Fix Hello, Menu Bar! sample in Windows (by disabling Windows-special System menu, which does not seem to be working in Tk)
|
20
|
+
|
21
|
+
## 0.0.41
|
22
|
+
|
23
|
+
- Support `scrollbar_frame` Glimmer custom widget as a frame that automatically provides scrollbars when its content's size exceeds its size
|
24
|
+
- Support `scrollbar_frame` `xscrollbar` and `yscrollbar` attributes (to enable/disable via boolean or set to a custom externally instantiated scrollbar if needed)
|
25
|
+
- Hello, Scrollbar Frame!
|
26
|
+
|
3
27
|
## 0.0.40
|
4
28
|
|
5
29
|
- Hello, Scrollbar!
|
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.44
|
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)
|
@@ -122,6 +122,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
122
122
|
- [Hello, Built-in Dialog!](#hello-built-in-dialog)
|
123
123
|
- [Hello, Separator!](#hello-separator)
|
124
124
|
- [Hello, Scrollbar!](#hello-scrollbar)
|
125
|
+
- [Hello, Scrollbar Frame!](#hello-scrollbar-frame)
|
125
126
|
- [Hello, Menu Bar!](#hello-menu-bar)
|
126
127
|
- [Applications](#applications)
|
127
128
|
- [Glimmer Tk Calculator](#glimmer-tk-calculator)
|
@@ -180,7 +181,7 @@ gem install glimmer-dsl-tk
|
|
180
181
|
|
181
182
|
Add the following to `Gemfile`:
|
182
183
|
```
|
183
|
-
gem 'glimmer-dsl-tk', '
|
184
|
+
gem 'glimmer-dsl-tk', '0.0.44'
|
184
185
|
```
|
185
186
|
|
186
187
|
And, then run:
|
@@ -310,11 +311,12 @@ keyword(args) | attributes | event bindings & callbacks
|
|
310
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 {}`
|
311
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'`
|
312
313
|
`scrollbar` | `orient` | `command`
|
313
|
-
`
|
314
|
-
`y_scrollbar` | `orient` (`'vertical'`) | `command`
|
314
|
+
`scrollbar_frame` | `xscrollbar` (Boolean or scrollbar widget proxy), `yscrollbar` (Boolean or scrollbar widget proxy) | None
|
315
315
|
`separator` | `orient` (`'horizontal' (default) or 'vertical'`) | None
|
316
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'`
|
317
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`
|
318
320
|
|
319
321
|
Options for `get_open_file` and `get_multiple_open_file` include:
|
320
322
|
- `filetypes`: `Hash` of `'Group Name' => '.ext'` entries (e.g. `filetypes: {'PNG Images' => '.png'}`
|
@@ -2681,27 +2683,31 @@ Glimmer app:
|
|
2681
2683
|
Glimmer code (from [samples/hello/hello_drag_and_drop.rb](samples/hello/hello_drag_and_drop.rb)):
|
2682
2684
|
|
2683
2685
|
```ruby
|
2684
|
-
require
|
2685
|
-
require "glimmer/tk/drag_and_drop_extension"
|
2686
|
+
require 'glimmer-dsl-tk'
|
2686
2687
|
|
2687
2688
|
include Glimmer
|
2688
2689
|
|
2689
2690
|
root {
|
2690
2691
|
title "Hello, Drag and Drop!"
|
2692
|
+
|
2691
2693
|
frame {
|
2692
2694
|
padding 5
|
2695
|
+
|
2693
2696
|
labelframe {
|
2694
2697
|
text "Drag sources"
|
2695
2698
|
padding 5
|
2699
|
+
|
2696
2700
|
label {
|
2697
|
-
text "Entry"
|
2698
2701
|
grid :row => 0, :column => 0
|
2702
|
+
text "Entry"
|
2699
2703
|
}
|
2704
|
+
|
2700
2705
|
entry {
|
2706
|
+
grid :row => 0, :column => 1, :pady => 5, :sticky => "e"
|
2701
2707
|
text "Drag entry text"
|
2702
2708
|
width 30
|
2703
|
-
|
2704
|
-
on_drag_start
|
2709
|
+
|
2710
|
+
on_drag_start do |event|
|
2705
2711
|
event.data = event.source.textvariable&.value
|
2706
2712
|
event.source.configure(:cursor => "hand2")
|
2707
2713
|
TkLabel.new(event.tooltip) {
|
@@ -2710,111 +2716,166 @@ root {
|
|
2710
2716
|
bitmap "warning"
|
2711
2717
|
compound "right"
|
2712
2718
|
}.pack
|
2713
|
-
|
2714
|
-
|
2719
|
+
end
|
2720
|
+
|
2721
|
+
on_drag_motion do |event|
|
2715
2722
|
if event.drop_accepted
|
2716
2723
|
event.source.configure(:cursor => "hand1")
|
2717
2724
|
else
|
2718
2725
|
event.source.configure(:cursor => "hand2")
|
2719
2726
|
end
|
2720
2727
|
event.tooltip.geometry("+#{event.x_root + 10}+#{event.y_root - 4}")
|
2721
|
-
|
2728
|
+
end
|
2722
2729
|
}
|
2730
|
+
|
2723
2731
|
label {
|
2724
|
-
text "Label"
|
2725
2732
|
grid :row => 1, :column => 0
|
2733
|
+
text "Label"
|
2726
2734
|
}
|
2735
|
+
|
2727
2736
|
label {
|
2737
|
+
grid :row => 1, :column => 1, :pady => 10, :sticky => "e"
|
2728
2738
|
text "Drag label text"
|
2729
2739
|
width 30
|
2730
|
-
grid :row => 1, :column => 1, :pady => 10, :sticky => "e"
|
2731
2740
|
drag_source true
|
2732
2741
|
}
|
2742
|
+
|
2733
2743
|
label {
|
2734
|
-
text "Combobox"
|
2735
2744
|
grid :row => 2, :column => 0
|
2745
|
+
text "Combobox"
|
2736
2746
|
}
|
2747
|
+
|
2737
2748
|
combobox {
|
2749
|
+
grid :row => 2, :column => 1, :pady => 5, :sticky => "e"
|
2738
2750
|
text "Spain"
|
2739
2751
|
values %w[USA Canada Mexico Columbia UK Australia Germany Italy Spain]
|
2740
2752
|
width 27
|
2741
|
-
|
2742
|
-
on_drag_start
|
2753
|
+
|
2754
|
+
on_drag_start do |event|
|
2743
2755
|
event.data = event.source.textvariable&.value
|
2744
|
-
|
2756
|
+
end
|
2745
2757
|
}
|
2758
|
+
|
2746
2759
|
label {
|
2747
|
-
text "Button"
|
2748
2760
|
grid :row => 3, :column => 0
|
2761
|
+
text 'List'
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
country_list = list {
|
2765
|
+
grid :row => 3, :column => 1, :pady => 5, :sticky => "e"
|
2766
|
+
selectmode 'browse'
|
2767
|
+
items %w[USA Canada Mexico]
|
2768
|
+
selection 'Canada'
|
2769
|
+
height 3
|
2770
|
+
|
2771
|
+
on_drag_start do |event|
|
2772
|
+
event.data = event.source.selection.to_a.first.text
|
2773
|
+
end
|
2749
2774
|
}
|
2775
|
+
|
2776
|
+
label {
|
2777
|
+
grid :row => 4, :column => 0
|
2778
|
+
text "Button"
|
2779
|
+
}
|
2780
|
+
|
2750
2781
|
button {
|
2782
|
+
grid :row => 4, :column => 1, :pady => 5, :sticky => "w"
|
2751
2783
|
text "Drag it"
|
2752
|
-
grid :row => 3, :column => 1, :pady => 5, :sticky => "w"
|
2753
2784
|
drag_source true
|
2754
2785
|
}
|
2755
2786
|
}
|
2756
2787
|
|
2757
2788
|
labelframe {
|
2758
|
-
text "Drop targets"
|
2759
2789
|
grid :sticky => "nsew", :pady => 15
|
2790
|
+
text "Drop targets"
|
2760
2791
|
padding 5
|
2792
|
+
|
2761
2793
|
label {
|
2762
|
-
text "Entry"
|
2763
2794
|
grid :row => 0, :column => 0
|
2795
|
+
text "Entry"
|
2764
2796
|
}
|
2797
|
+
|
2765
2798
|
entry {
|
2766
|
-
width 30
|
2767
2799
|
grid :row => 0, :column => 1, :pady => 5, :sticky => "e"
|
2800
|
+
width 30
|
2801
|
+
|
2768
2802
|
on_drop { |event|
|
2769
2803
|
event.target.textvariable.value = event.data
|
2770
2804
|
}
|
2771
2805
|
}
|
2806
|
+
|
2772
2807
|
label {
|
2773
|
-
text "Label"
|
2774
2808
|
grid :row => 1, :column => 0
|
2809
|
+
text "Label"
|
2775
2810
|
}
|
2811
|
+
|
2776
2812
|
label {
|
2777
|
-
width 30
|
2778
2813
|
grid :row => 1, :column => 1, :pady => 10, :sticky => "e"
|
2814
|
+
width 30
|
2779
2815
|
borderwidth 2
|
2780
2816
|
relief "solid"
|
2781
|
-
|
2817
|
+
|
2818
|
+
on_drop do |event|
|
2782
2819
|
event.target.textvariable.value = event.data
|
2783
|
-
|
2820
|
+
end
|
2784
2821
|
}
|
2822
|
+
|
2785
2823
|
label {
|
2786
|
-
text "Combobox"
|
2787
2824
|
grid :row => 2, :column => 0
|
2825
|
+
text "Combobox"
|
2788
2826
|
}
|
2827
|
+
|
2789
2828
|
combobox {
|
2790
|
-
width 27
|
2791
2829
|
grid :row => 2, :column => 1, :pady => 5, :sticky => "e"
|
2792
|
-
|
2830
|
+
width 27
|
2831
|
+
|
2832
|
+
on_drop do |event|
|
2793
2833
|
event.target.textvariable.value = event.data
|
2794
|
-
|
2834
|
+
end
|
2795
2835
|
}
|
2836
|
+
|
2796
2837
|
label {
|
2797
|
-
text "Button"
|
2798
2838
|
grid :row => 3, :column => 0
|
2839
|
+
text 'List'
|
2799
2840
|
}
|
2841
|
+
|
2842
|
+
list {
|
2843
|
+
grid :row => 3, :column => 1, :pady => 5, :sticky => "e"
|
2844
|
+
selectmode 'browse'
|
2845
|
+
height 3
|
2846
|
+
|
2847
|
+
on_drop do |event|
|
2848
|
+
event.target.insert('', 'end', :text => event.data)
|
2849
|
+
end
|
2850
|
+
}
|
2851
|
+
|
2852
|
+
label {
|
2853
|
+
grid :row => 4, :column => 0
|
2854
|
+
text "Button"
|
2855
|
+
}
|
2856
|
+
|
2800
2857
|
button {
|
2858
|
+
grid :row => 4, :column => 1, :pady => 5, :sticky => "w"
|
2801
2859
|
text "Drop here"
|
2802
|
-
|
2803
|
-
on_drop
|
2860
|
+
|
2861
|
+
on_drop do |event|
|
2804
2862
|
event.target.text = event.data
|
2805
|
-
|
2863
|
+
end
|
2806
2864
|
}
|
2865
|
+
|
2807
2866
|
label {
|
2867
|
+
grid :row => 5, :column => 0
|
2808
2868
|
text "Checkbutton"
|
2809
|
-
grid :row => 4, :column => 0
|
2810
2869
|
}
|
2870
|
+
|
2811
2871
|
checkbutton {
|
2872
|
+
grid :row => 5, :column => 1, :pady => 5, :sticky => "w"
|
2812
2873
|
text "Drop here to destroy a widget\n(except button)"
|
2813
|
-
|
2814
|
-
on_drop
|
2874
|
+
|
2875
|
+
on_drop do |event|
|
2815
2876
|
event.target.text = event.data
|
2816
2877
|
event.source.destroy unless event.source.is_a? Tk::Button
|
2817
|
-
|
2878
|
+
end
|
2818
2879
|
}
|
2819
2880
|
}
|
2820
2881
|
}
|
@@ -3000,7 +3061,7 @@ root {
|
|
3000
3061
|
height 500
|
3001
3062
|
|
3002
3063
|
notebook {
|
3003
|
-
grid sticky: 'nsew'
|
3064
|
+
grid sticky: 'nsew'
|
3004
3065
|
|
3005
3066
|
frame(text: 'Scrollable List') {
|
3006
3067
|
@list = list {
|
@@ -3056,6 +3117,89 @@ Glimmer app:
|
|
3056
3117
|
|
3057
3118
|
![glimmer dsl tk screenshot sample hello scrollbar](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-text.png)
|
3058
3119
|
|
3120
|
+
### Hello, Scrollbar Frame!
|
3121
|
+
|
3122
|
+
Glimmer code (from [samples/hello/hello_scrollbar_frame.rb](samples/hello/hello_scrollbar_frame.rb)):
|
3123
|
+
|
3124
|
+
```ruby
|
3125
|
+
require 'glimmer-dsl-tk'
|
3126
|
+
|
3127
|
+
include Glimmer
|
3128
|
+
|
3129
|
+
root {
|
3130
|
+
title 'Hello, Scrollbar Frame!'
|
3131
|
+
width 400
|
3132
|
+
height 400
|
3133
|
+
|
3134
|
+
notebook {
|
3135
|
+
grid sticky: 'nsew'
|
3136
|
+
|
3137
|
+
frame(text: 'X/Y Scroll') {
|
3138
|
+
scrollbar_frame {
|
3139
|
+
30.times do |row|
|
3140
|
+
10.times do |column|
|
3141
|
+
button {
|
3142
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
3143
|
+
text "Row #{row} | Column #{column}"
|
3144
|
+
}
|
3145
|
+
end
|
3146
|
+
end
|
3147
|
+
}
|
3148
|
+
}
|
3149
|
+
|
3150
|
+
frame(text: 'Y Scroll') {
|
3151
|
+
scrollbar_frame {
|
3152
|
+
xscrollbar false
|
3153
|
+
|
3154
|
+
30.times do |row|
|
3155
|
+
2.times do |column|
|
3156
|
+
button {
|
3157
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
3158
|
+
text "Row #{row} | Column #{column}"
|
3159
|
+
}
|
3160
|
+
end
|
3161
|
+
end
|
3162
|
+
}
|
3163
|
+
}
|
3164
|
+
|
3165
|
+
frame(text: 'X Scroll') {
|
3166
|
+
scrollbar_frame {
|
3167
|
+
yscrollbar false
|
3168
|
+
|
3169
|
+
13.times do |row|
|
3170
|
+
10.times do |column|
|
3171
|
+
button {
|
3172
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
3173
|
+
text "Row #{row} | Column #{column}"
|
3174
|
+
}
|
3175
|
+
end
|
3176
|
+
end
|
3177
|
+
}
|
3178
|
+
}
|
3179
|
+
}
|
3180
|
+
}.open
|
3181
|
+
```
|
3182
|
+
|
3183
|
+
Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3184
|
+
|
3185
|
+
```
|
3186
|
+
ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scrollbar_frame'"
|
3187
|
+
```
|
3188
|
+
|
3189
|
+
Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
|
3190
|
+
|
3191
|
+
```
|
3192
|
+
ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scrollbar_frame.rb
|
3193
|
+
```
|
3194
|
+
|
3195
|
+
Glimmer app:
|
3196
|
+
|
3197
|
+
![glimmer dsl tk screenshot sample hello scrollbar frame x y scroll](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-frame-x-y-scroll.png)
|
3198
|
+
|
3199
|
+
![glimmer dsl tk screenshot sample hello scrollbar frame y scroll](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-frame-y-scroll.png)
|
3200
|
+
|
3201
|
+
![glimmer dsl tk screenshot sample hello scrollbar frame x scroll](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-frame-x-scroll.png)
|
3202
|
+
|
3059
3203
|
### Hello, Menu Bar!
|
3060
3204
|
|
3061
3205
|
Glimmer code (from [samples/hello/hello_menu_bar.rb](samples/hello/hello_menu_bar.rb)):
|
@@ -3114,7 +3258,7 @@ root { |r|
|
|
3114
3258
|
|
3115
3259
|
menu(label: 'File', underline: 0) {
|
3116
3260
|
menu_item(label: 'New', underline: 0) {
|
3117
|
-
accelerator 'Command+N'
|
3261
|
+
accelerator OS.mac? ? 'Command+N' : 'Control+N'
|
3118
3262
|
|
3119
3263
|
on('command') do
|
3120
3264
|
message_box(parent: r, title: 'New', message: 'New file created.')
|
@@ -3122,7 +3266,7 @@ root { |r|
|
|
3122
3266
|
}
|
3123
3267
|
|
3124
3268
|
menu_item(label: 'Open...', underline: 0) {
|
3125
|
-
accelerator 'Command+O'
|
3269
|
+
accelerator OS.mac? ? 'Command+O' : 'Control+O'
|
3126
3270
|
|
3127
3271
|
on('command') do
|
3128
3272
|
message_box(parent: r, title: 'Open', message: 'Opening File...')
|
@@ -3154,15 +3298,15 @@ root { |r|
|
|
3154
3298
|
|
3155
3299
|
menu(label: 'Edit', underline: 0) {
|
3156
3300
|
menu_item(label: 'Cut', underline: 2) {
|
3157
|
-
accelerator 'Command+X'
|
3301
|
+
accelerator OS.mac? ? 'Command+X' : 'Control+X'
|
3158
3302
|
}
|
3159
3303
|
|
3160
3304
|
menu_item(label: 'Copy', underline: 0) {
|
3161
|
-
accelerator 'Command+C'
|
3305
|
+
accelerator OS.mac? ? 'Command+C' : 'Control+C'
|
3162
3306
|
}
|
3163
3307
|
|
3164
3308
|
menu_item(label: 'Paste', underline: 0) {
|
3165
|
-
accelerator 'Command+V'
|
3309
|
+
accelerator OS.mac? ? 'Command+V' : 'Control+V'
|
3166
3310
|
}
|
3167
3311
|
}
|
3168
3312
|
|
@@ -3174,7 +3318,7 @@ root { |r|
|
|
3174
3318
|
end
|
3175
3319
|
}
|
3176
3320
|
|
3177
|
-
@select_one_menu = menu(label: 'Select One', underline:
|
3321
|
+
@select_one_menu = menu(label: 'Select One', underline: 7) {
|
3178
3322
|
menu_item(:radiobutton, label: 'Option 1') {
|
3179
3323
|
state 'disabled'
|
3180
3324
|
}
|
@@ -3186,7 +3330,7 @@ root { |r|
|
|
3186
3330
|
}
|
3187
3331
|
}
|
3188
3332
|
|
3189
|
-
@select_multiple_menu = menu(label: 'Select Multiple', underline:
|
3333
|
+
@select_multiple_menu = menu(label: 'Select Multiple', underline: 7) {
|
3190
3334
|
menu_item(:checkbutton, label: 'Option 4') {
|
3191
3335
|
state 'disabled'
|
3192
3336
|
}
|
@@ -3208,7 +3352,7 @@ root { |r|
|
|
3208
3352
|
end
|
3209
3353
|
}
|
3210
3354
|
|
3211
|
-
menu(label: '
|
3355
|
+
menu(label: 'Country', underline: 3) {
|
3212
3356
|
['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
|
3213
3357
|
menu_item(:radiobutton, label: image_name.capitalize) {
|
3214
3358
|
selection image_name == 'usa'
|
@@ -3242,7 +3386,7 @@ root { |r|
|
|
3242
3386
|
|
3243
3387
|
menu(label: 'View', underline: 0) {
|
3244
3388
|
menu_item(:radiobutton, label: 'Small', underline: 0) {
|
3245
|
-
accelerator 'Command+S'
|
3389
|
+
accelerator OS.mac? ? 'Command+S' : 'Control+S'
|
3246
3390
|
|
3247
3391
|
on('command') do
|
3248
3392
|
@label.font = {size: 25}
|
@@ -3250,7 +3394,7 @@ root { |r|
|
|
3250
3394
|
}
|
3251
3395
|
|
3252
3396
|
menu_item(:radiobutton, label: 'Medium', underline: 0) {
|
3253
|
-
accelerator 'Command+M'
|
3397
|
+
accelerator OS.mac? ? 'Command+M' : 'Control+M'
|
3254
3398
|
selection true
|
3255
3399
|
|
3256
3400
|
on('command') do
|
@@ -3259,7 +3403,7 @@ root { |r|
|
|
3259
3403
|
}
|
3260
3404
|
|
3261
3405
|
menu_item(:radiobutton, label: 'Large', underline: 0) {
|
3262
|
-
accelerator 'Command+L'
|
3406
|
+
accelerator OS.mac? ? 'Command+L' : 'Control+L'
|
3263
3407
|
|
3264
3408
|
on('command') do
|
3265
3409
|
@label.font = {size: 75}
|
@@ -3267,17 +3411,20 @@ root { |r|
|
|
3267
3411
|
}
|
3268
3412
|
}
|
3269
3413
|
|
3270
|
-
menu(
|
3414
|
+
# Mac-specific window menu (containing zooming/resizing menu items)
|
3415
|
+
menu(label: 'Window', underline: 0) if OS.mac?
|
3271
3416
|
|
3272
3417
|
menu(label: 'Help', underline: 0) {
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3418
|
+
if OS.mac?
|
3419
|
+
menu_item(:help) {
|
3420
|
+
on('command') do
|
3421
|
+
message_box(parent: r, title: 'Help', message: 'Help for my application.')
|
3422
|
+
end
|
3423
|
+
}
|
3424
|
+
end
|
3278
3425
|
|
3279
3426
|
menu_item(label: 'Manual', underline: 0) {
|
3280
|
-
accelerator 'Command+Shift+M'
|
3427
|
+
accelerator OS.mac? ? 'Command+Shift+M' : 'Control+U'
|
3281
3428
|
|
3282
3429
|
on('command') do
|
3283
3430
|
message_box(parent: r, title: 'Manual', message: 'Manual Contents')
|
@@ -3285,7 +3432,7 @@ root { |r|
|
|
3285
3432
|
}
|
3286
3433
|
|
3287
3434
|
menu_item(label: 'Tutorial', underline: 0) {
|
3288
|
-
accelerator 'Command+Shift+T'
|
3435
|
+
accelerator OS.mac? ? 'Command+Shift+T' : 'Control+T'
|
3289
3436
|
|
3290
3437
|
on('command') do
|
3291
3438
|
message_box(parent: r, title: 'Tutorial', message: 'Tutorial Contents')
|
@@ -3356,7 +3503,7 @@ https://github.com/ancorgs/y3network-ruby-ui
|
|
3356
3503
|
|
3357
3504
|
### CryptoPunks GUI
|
3358
3505
|
|
3359
|
-
This is a Graphical User Interface for the [cryptopunks Ruby gem](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks).
|
3506
|
+
This is a Graphical User Interface for the famous [cryptopunks Ruby gem](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks).
|
3360
3507
|
|
3361
3508
|
https://github.com/cryptopunksnotdead/cryptopunks-gui
|
3362
3509
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.44
|
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
|
@@ -20,14 +20,11 @@
|
|
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/scrollable'
|
24
23
|
|
25
24
|
module Glimmer
|
26
25
|
module Tk
|
27
26
|
# Custom list widget implementation
|
28
27
|
class ListProxy < WidgetProxy
|
29
|
-
include Scrollable
|
30
|
-
|
31
28
|
def initialize(underscored_widget_name, parent_proxy, args)
|
32
29
|
super('treeview', parent_proxy, args)
|
33
30
|
@tk.show = 'tree'
|
@@ -71,8 +71,9 @@ module Glimmer
|
|
71
71
|
@tk = ::TkSysMenu_Help.new(@parent_proxy.tk)
|
72
72
|
elsif @parent_proxy.parent_proxy.is_a?(ToplevelProxy) && OS.mac? && window?
|
73
73
|
@tk = ::Tk::TkSysMenu_Window.new(@parent_proxy.tk)
|
74
|
-
|
75
|
-
|
74
|
+
# Windows system menu does not seem to work
|
75
|
+
# elsif @parent_proxy.parent_proxy.is_a?(ToplevelProxy) && OS.windows? && system?
|
76
|
+
# @tk = ::TkSysMenu_System.new(@parent_proxy.tk)
|
76
77
|
else
|
77
78
|
tk_widget_class = self.class.tk_widget_class_for(@keyword)
|
78
79
|
@tk = tk_widget_class.new(@parent_proxy.tk)
|
@@ -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
|
|
25
24
|
module Glimmer
|
26
25
|
module Tk
|
@@ -28,8 +27,6 @@ module Glimmer
|
|
28
27
|
#
|
29
28
|
# Follows the Proxy Design Pattern
|
30
29
|
class RadiobuttonProxy < WidgetProxy
|
31
|
-
include Commandable
|
32
|
-
|
33
30
|
def sibling_radio_buttons
|
34
31
|
@parent_proxy.children.select {|child| child.is_a?(RadiobuttonProxy) && child != self}
|
35
32
|
end
|