ffi-tk 2010.08.23 → 2018.02.20
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 +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +371 -0
- data/AUTHORS +4 -2
- data/CHANGELOG +302 -262
- data/Gemfile +10 -0
- data/Gemfile.lock +45 -0
- data/MANIFEST +6 -6
- data/README.md +1 -1
- data/Rakefile +12 -11
- data/bin/rwish +6 -5
- data/example/choose_color.rb +5 -4
- data/example/choose_directory.rb +5 -4
- data/example/dialog.rb +9 -8
- data/example/hello.rb +2 -1
- data/example/message_box.rb +8 -5
- data/example/option_menu.rb +4 -3
- data/example/popup.rb +4 -3
- data/example/set_palette.rb +5 -4
- data/example/text.rb +30 -30
- data/example/tile/kroc_demo_small.rb +51 -55
- data/example/tile/kroc_rb_demo.rb +74 -83
- data/example/tile/notebook.rb +6 -9
- data/example/tile/theme_hello.rb +6 -8
- data/example/tile/themes.rb +4 -2
- data/example/tile/treeview.rb +16 -14
- data/example/tkgo.rb +120 -88
- data/example/various.rb +8 -7
- data/example/wait.rb +3 -2
- data/ffi-tk.gemspec +21 -20
- data/gemset.nix +134 -0
- data/lib/ffi-tk.rb +10 -11
- data/lib/ffi-tk/command.rb +3 -2
- data/lib/ffi-tk/command/after.rb +8 -7
- data/lib/ffi-tk/command/bell.rb +2 -1
- data/lib/ffi-tk/command/bind.rb +1 -0
- data/lib/ffi-tk/command/bindtags.rb +1 -0
- data/lib/ffi-tk/command/cget.rb +31 -24
- data/lib/ffi-tk/command/choose_color.rb +2 -1
- data/lib/ffi-tk/command/choose_directory.rb +2 -1
- data/lib/ffi-tk/command/clipboard.rb +6 -5
- data/lib/ffi-tk/command/configure.rb +23 -21
- data/lib/ffi-tk/command/destroy.rb +2 -1
- data/lib/ffi-tk/command/dialog.rb +4 -3
- data/lib/ffi-tk/command/event.rb +1 -0
- data/lib/ffi-tk/command/focus.rb +2 -1
- data/lib/ffi-tk/command/font.rb +12 -9
- data/lib/ffi-tk/command/get_open_file.rb +1 -0
- data/lib/ffi-tk/command/get_save_file.rb +1 -0
- data/lib/ffi-tk/command/grab.rb +2 -1
- data/lib/ffi-tk/command/grid.rb +7 -6
- data/lib/ffi-tk/command/image.rb +5 -4
- data/lib/ffi-tk/command/lower.rb +1 -0
- data/lib/ffi-tk/command/message_box.rb +2 -1
- data/lib/ffi-tk/command/option_menu.rb +3 -2
- data/lib/ffi-tk/command/pack.rb +5 -4
- data/lib/ffi-tk/command/place.rb +5 -4
- data/lib/ffi-tk/command/popup.rb +2 -1
- data/lib/ffi-tk/command/raise.rb +1 -0
- data/lib/ffi-tk/command/scrollable.rb +7 -10
- data/lib/ffi-tk/command/selection.rb +4 -3
- data/lib/ffi-tk/command/set_palette.rb +2 -1
- data/lib/ffi-tk/command/tk_cmd.rb +1 -0
- data/lib/ffi-tk/command/vars.rb +2 -1
- data/lib/ffi-tk/command/wait.rb +2 -1
- data/lib/ffi-tk/command/winfo.rb +9 -8
- data/lib/ffi-tk/command/wm.rb +11 -10
- data/lib/ffi-tk/core_extensions.rb +5 -4
- data/lib/ffi-tk/event/data.rb +32 -31
- data/lib/ffi-tk/event/handler.rb +4 -3
- data/lib/ffi-tk/ffi/tcl.rb +42 -31
- data/lib/ffi-tk/ffi/tcl/cmd_proc.rb +2 -1
- data/lib/ffi-tk/ffi/tcl/eval_result.rb +47 -8
- data/lib/ffi-tk/ffi/tcl/interp.rb +7 -4
- data/lib/ffi-tk/ffi/tcl/obj.rb +7 -32
- data/lib/ffi-tk/ffi/tcl/time.rb +2 -1
- data/lib/ffi-tk/ffi/tk.rb +8 -7
- data/lib/ffi-tk/geometry.rb +20 -17
- data/lib/ffi-tk/thread_sender.rb +1 -0
- data/lib/ffi-tk/tk.rb +23 -23
- data/lib/ffi-tk/variable.rb +25 -3
- data/lib/ffi-tk/version.rb +1 -1
- data/lib/ffi-tk/widget.rb +2 -1
- data/lib/ffi-tk/widget/button.rb +4 -1
- data/lib/ffi-tk/widget/canvas.rb +18 -15
- data/lib/ffi-tk/widget/canvas/arc.rb +2 -1
- data/lib/ffi-tk/widget/canvas/bitmap.rb +2 -1
- data/lib/ffi-tk/widget/canvas/image.rb +2 -1
- data/lib/ffi-tk/widget/canvas/item.rb +4 -4
- data/lib/ffi-tk/widget/canvas/line.rb +2 -1
- data/lib/ffi-tk/widget/canvas/oval.rb +2 -1
- data/lib/ffi-tk/widget/canvas/polygon.rb +2 -1
- data/lib/ffi-tk/widget/canvas/rectangle.rb +2 -1
- data/lib/ffi-tk/widget/canvas/text.rb +2 -1
- data/lib/ffi-tk/widget/canvas/window.rb +2 -1
- data/lib/ffi-tk/widget/checkbutton.rb +4 -1
- data/lib/ffi-tk/widget/entry.rb +4 -1
- data/lib/ffi-tk/widget/frame.rb +4 -1
- data/lib/ffi-tk/widget/label.rb +4 -1
- data/lib/ffi-tk/widget/labelframe.rb +4 -1
- data/lib/ffi-tk/widget/listbox.rb +5 -2
- data/lib/ffi-tk/widget/menu.rb +4 -1
- data/lib/ffi-tk/widget/menubutton.rb +4 -1
- data/lib/ffi-tk/widget/message.rb +4 -1
- data/lib/ffi-tk/widget/panedwindow.rb +5 -2
- data/lib/ffi-tk/widget/radiobutton.rb +4 -1
- data/lib/ffi-tk/widget/root.rb +1 -0
- data/lib/ffi-tk/widget/scale.rb +4 -1
- data/lib/ffi-tk/widget/scrollbar.rb +4 -1
- data/lib/ffi-tk/widget/spinbox.rb +4 -1
- data/lib/ffi-tk/widget/text.rb +20 -16
- data/lib/ffi-tk/widget/text/peer.rb +1 -0
- data/lib/ffi-tk/widget/tile.rb +2 -1
- data/lib/ffi-tk/widget/tile/button.rb +4 -1
- data/lib/ffi-tk/widget/tile/checkbutton.rb +4 -1
- data/lib/ffi-tk/widget/tile/combobox.rb +5 -2
- data/lib/ffi-tk/widget/tile/entry.rb +4 -1
- data/lib/ffi-tk/widget/tile/frame.rb +4 -1
- data/lib/ffi-tk/widget/tile/label.rb +4 -2
- data/lib/ffi-tk/widget/tile/labelframe.rb +4 -1
- data/lib/ffi-tk/widget/tile/menubutton.rb +4 -1
- data/lib/ffi-tk/widget/tile/notebook.rb +4 -1
- data/lib/ffi-tk/widget/tile/panedwindow.rb +4 -1
- data/lib/ffi-tk/widget/tile/progressbar.rb +4 -2
- data/lib/ffi-tk/widget/tile/radiobutton.rb +4 -1
- data/lib/ffi-tk/widget/tile/scale.rb +4 -1
- data/lib/ffi-tk/widget/tile/scrollbar.rb +7 -4
- data/lib/ffi-tk/widget/tile/separator.rb +4 -1
- data/lib/ffi-tk/widget/tile/sizegrip.rb +4 -1
- data/lib/ffi-tk/widget/tile/style.rb +16 -17
- data/lib/ffi-tk/widget/tile/treeview.rb +11 -5
- data/lib/ffi-tk/widget/toplevel.rb +4 -1
- data/shell.nix +19 -0
- data/spec/ffi-tk/command/bind.rb +5 -4
- data/spec/ffi-tk/command/bindtags.rb +2 -1
- data/spec/ffi-tk/command/clipboard.rb +4 -3
- data/spec/ffi-tk/command/font.rb +20 -19
- data/spec/ffi-tk/command/image.rb +13 -5
- data/spec/ffi-tk/command/pack.rb +3 -2
- data/spec/ffi-tk/command/place.rb +4 -3
- data/spec/ffi-tk/command/selection.rb +2 -1
- data/spec/ffi-tk/command/vars.rb +3 -2
- data/spec/ffi-tk/command/winfo.rb +10 -10
- data/spec/ffi-tk/command/wm.rb +23 -22
- data/spec/ffi-tk/event.rb +23 -21
- data/spec/ffi-tk/tile/button.rb +8 -8
- data/spec/ffi-tk/tile/checkbutton.rb +1 -1
- data/spec/ffi-tk/tile/combobox.rb +11 -12
- data/spec/ffi-tk/tile/entry.rb +18 -19
- data/spec/ffi-tk/tile/frame.rb +13 -13
- data/spec/ffi-tk/tile/label.rb +2 -2
- data/spec/ffi-tk/tile/labelframe.rb +1 -1
- data/spec/ffi-tk/tile/menubutton.rb +1 -1
- data/spec/ffi-tk/tile/notebook.rb +22 -20
- data/spec/ffi-tk/tile/panedwindow.rb +1 -1
- data/spec/ffi-tk/tile/progressbar.rb +1 -1
- data/spec/ffi-tk/tile/radiobutton.rb +1 -1
- data/spec/ffi-tk/tile/scale.rb +1 -1
- data/spec/ffi-tk/tile/scrollbar.rb +1 -16
- data/spec/ffi-tk/tile/separator.rb +2 -2
- data/spec/ffi-tk/tile/sizegrip.rb +1 -1
- data/spec/ffi-tk/tile/style.rb +63 -65
- data/spec/ffi-tk/tile/treeview.rb +11 -10
- data/spec/ffi-tk/variable.rb +5 -4
- data/spec/ffi-tk/widget/button.rb +3 -2
- data/spec/ffi-tk/widget/canvas.rb +59 -58
- data/spec/ffi-tk/widget/checkbutton.rb +6 -5
- data/spec/ffi-tk/widget/entry.rb +112 -103
- data/spec/ffi-tk/widget/frame.rb +2 -1
- data/spec/ffi-tk/widget/label.rb +2 -1
- data/spec/ffi-tk/widget/labelframe.rb +1 -0
- data/spec/ffi-tk/widget/listbox.rb +5 -4
- data/spec/ffi-tk/widget/menu.rb +3 -2
- data/spec/ffi-tk/widget/menubutton.rb +1 -0
- data/spec/ffi-tk/widget/message.rb +1 -0
- data/spec/ffi-tk/widget/panedwindow.rb +1 -0
- data/spec/ffi-tk/widget/radiobutton.rb +1 -0
- data/spec/ffi-tk/widget/root.rb +2 -1
- data/spec/ffi-tk/widget/scale.rb +1 -0
- data/spec/ffi-tk/widget/scrollbar.rb +1 -0
- data/spec/ffi-tk/widget/spinbox.rb +1 -0
- data/spec/ffi-tk/widget/text.rb +63 -54
- data/spec/ffi-tk/widget/toplevel.rb +1 -0
- data/spec/helper.rb +3 -1
- data/tasks/authors.rake +3 -2
- data/tasks/bacon.rake +13 -11
- data/tasks/changelog.rake +1 -0
- data/tasks/gem.rake +13 -11
- data/tasks/manifest.rake +2 -1
- data/tasks/release.rake +11 -32
- data/tasks/reversion.rake +2 -1
- metadata +52 -75
- data/spec/ffi-tk/command/grid.rb +0 -6
- data/tasks/gem_setup.rake +0 -113
- data/tasks/grancher.rake +0 -12
- data/tasks/rcov.rake +0 -17
- data/tasks/setup.rake +0 -12
- data/tasks/ycov.rake +0 -84
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
module_function
|
3
4
|
|
@@ -18,7 +19,7 @@ module Tk
|
|
18
19
|
# dialog, to the left of the text.
|
19
20
|
# If this is nil then no bitmap is displayed in the dialog.
|
20
21
|
#
|
21
|
-
# @param default [nil
|
22
|
+
# @param default [nil Integer]
|
22
23
|
# If this is an integer greater than or equal to zero, then it gives the
|
23
24
|
# index of the button that is to be the default button for the dialog (0 for
|
24
25
|
# the leftmost button, and so on).
|
@@ -48,7 +49,7 @@ module Tk
|
|
48
49
|
# 'questhead', 0, 'Yes', 'No', "I'm not sure")
|
49
50
|
def dialog(window, title, text, bitmap, default, *answers)
|
50
51
|
answer = Tk.execute(:tk_dialog,
|
51
|
-
|
52
|
+
window, title, text, bitmap, default, *answers).to_i
|
52
53
|
return answer unless answer == -1
|
53
54
|
end
|
54
|
-
end
|
55
|
+
end
|
data/lib/ffi-tk/command/event.rb
CHANGED
data/lib/ffi-tk/command/focus.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# Utility methods for managing the input focus.
|
3
4
|
module Focus
|
@@ -17,7 +18,7 @@ module Tk
|
|
17
18
|
when :lastfor
|
18
19
|
Tk.execute('focus', '-lastfor', window).to_s
|
19
20
|
else
|
20
|
-
raise ArgumentError,
|
21
|
+
raise ArgumentError, 'option must be one of: None, :displayof, :force, :lastfor'
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
data/lib/ffi-tk/command/font.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# Create and inspect fonts.
|
3
4
|
# The font command provides several facilities for dealing with fonts, such as
|
@@ -8,8 +9,8 @@ module Tk
|
|
8
9
|
string_or_hash =~ /^(.*)\s+(\d+)?$/
|
9
10
|
|
10
11
|
params = {}
|
11
|
-
params[:family] =
|
12
|
-
params[:size] =
|
12
|
+
params[:family] = Regexp.last_match(1).to_s
|
13
|
+
params[:size] = Regexp.last_match(2).to_i if Regexp.last_match(2)
|
13
14
|
|
14
15
|
@font = Font.create(params)
|
15
16
|
elsif string_or_hash.respond_to?(:to_hash)
|
@@ -47,8 +48,8 @@ module Tk
|
|
47
48
|
underline: :boolean,
|
48
49
|
overstrike: :boolean,
|
49
50
|
weight: :symbol,
|
50
|
-
slant: :symbol
|
51
|
-
}
|
51
|
+
slant: :symbol
|
52
|
+
}.freeze
|
52
53
|
|
53
54
|
def self.execute(command, *args)
|
54
55
|
Tk.execute(:font, command, *args)
|
@@ -74,9 +75,9 @@ module Tk
|
|
74
75
|
char = options.fetch(:char, None)
|
75
76
|
|
76
77
|
args = []
|
77
|
-
args <<
|
78
|
+
args << '-displayof' << window unless window == None
|
78
79
|
args << option.to_tcl_option unless option == None
|
79
|
-
args <<
|
80
|
+
args << '--' << char.to_tcl unless char == None
|
80
81
|
|
81
82
|
array = execute(:actual, font, *args)
|
82
83
|
array.tcl_options_to_hash(FONT_CONFIGURE_HINTS)
|
@@ -84,16 +85,18 @@ module Tk
|
|
84
85
|
|
85
86
|
def self.configure(fontname, argument = None)
|
86
87
|
Configure.common(
|
87
|
-
self, [:configure, fontname], argument, FONT_CONFIGURE_HINTS
|
88
|
+
self, [:configure, fontname], argument, FONT_CONFIGURE_HINTS
|
89
|
+
)
|
88
90
|
end
|
89
91
|
|
90
92
|
def self.create(fontname, options = None)
|
91
93
|
if fontname.respond_to?(:to_tcl_options)
|
92
|
-
|
94
|
+
options = fontname
|
95
|
+
fontname = None
|
93
96
|
options = options.to_tcl_options
|
94
97
|
end
|
95
98
|
|
96
|
-
execute(:create, fontname, options)
|
99
|
+
execute(:create, fontname, options)&.to_str
|
97
100
|
end
|
98
101
|
|
99
102
|
def self.delete(*fontnames)
|
data/lib/ffi-tk/command/grab.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# Confine pointer and keyboard events to a window sub-tree
|
3
4
|
#
|
@@ -61,7 +62,7 @@ module Tk
|
|
61
62
|
# a given display at once.
|
62
63
|
module Grab
|
63
64
|
# @see Grab.global
|
64
|
-
def grab_global(
|
65
|
+
def grab_global(_window)
|
65
66
|
Grab.globa(self)
|
66
67
|
end
|
67
68
|
|
data/lib/ffi-tk/command/grid.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# Geometry manager that arranges widgets in a grid
|
3
4
|
#
|
@@ -37,7 +38,7 @@ module Tk
|
|
37
38
|
# Bbox.bbox('.', 0, 0) # top left cell
|
38
39
|
# Bbox.bbox('.', 1, 1) # cell in second column and row
|
39
40
|
# Bbox.bbox('.', 0, 0, 1, 1) # cells from top left to second col/row
|
40
|
-
def self.bbox(master,
|
41
|
+
def self.bbox(master, _col1 = None, row1 = None, _col2 = None, row2 = None)
|
41
42
|
bbox = Tk.execute('grid', 'bbox', master, column1, row1, column2, row2)
|
42
43
|
bbox.map(&:to_i)
|
43
44
|
end
|
@@ -80,7 +81,7 @@ module Tk
|
|
80
81
|
# The characters -, x and ^, can be specified instead of a window name to
|
81
82
|
# alter the default location of a slave.
|
82
83
|
def self.configure(*arguments)
|
83
|
-
options, slaves = arguments.partition{|arg| arg.respond_to?(:to_tcl_options?) }
|
84
|
+
options, slaves = arguments.partition { |arg| arg.respond_to?(:to_tcl_options?) }
|
84
85
|
options = options.first
|
85
86
|
Tk.execute('grid', 'configure', *slaves, options.to_tcl_options?)
|
86
87
|
end
|
@@ -104,12 +105,12 @@ module Tk
|
|
104
105
|
hash = {}
|
105
106
|
|
106
107
|
info.scan(/(?:-(\w+))\s+([^-][\S]*)/) do
|
107
|
-
key =
|
108
|
+
key = Regexp.last_match(1).to_sym
|
108
109
|
case key
|
109
110
|
when :column, :row, :columnspan, :rowspan, :ipadx, :ipady, :padx, :pady
|
110
|
-
hash[key] = Integer(
|
111
|
+
hash[key] = Integer(Regexp.last_match(2))
|
111
112
|
else
|
112
|
-
hash[key] =
|
113
|
+
hash[key] = Regexp.last_match(2).to_str
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
@@ -187,7 +188,7 @@ module Tk
|
|
187
188
|
# returned, most recently manages first.
|
188
189
|
# Option can be either -row or -column which causes only the slaves in the
|
189
190
|
# row (or column) specified by value to be returned.
|
190
|
-
def self.slaves(
|
191
|
+
def self.slaves(_master, _options = {})
|
191
192
|
Tk.execute('grid', 'slaves')
|
192
193
|
end
|
193
194
|
|
data/lib/ffi-tk/command/image.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
module Image
|
3
4
|
module_function
|
@@ -29,9 +30,9 @@ module Tk
|
|
29
30
|
if None == name
|
30
31
|
Tk.execute(:image, :create, type)
|
31
32
|
elsif None == options && name.respond_to?(:to_hash)
|
32
|
-
Tk.execute(:image, :create, name.to_tcl_options)
|
33
|
+
Tk.execute(:image, :create, type, name.to_tcl_options)
|
33
34
|
elsif None != name && None != options
|
34
|
-
Tk.exeucte(:image, :create, name, options.to_tcl_options)
|
35
|
+
Tk.exeucte(:image, :create, type, name, options.to_tcl_options)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -73,7 +74,7 @@ module Tk
|
|
73
74
|
# of the values that may be supplied for the type argument to image
|
74
75
|
# create).
|
75
76
|
def types
|
76
|
-
Tk.execute(:image, :types).to_sym
|
77
|
+
Tk.execute(:image, :types).to_a(&:to_sym)
|
77
78
|
end
|
78
79
|
end
|
79
|
-
end
|
80
|
+
end
|
data/lib/ffi-tk/command/lower.rb
CHANGED
data/lib/ffi-tk/command/pack.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# Geometry manager that packs around edges of cavity
|
3
4
|
#
|
@@ -33,7 +34,7 @@ module Tk
|
|
33
34
|
def self.info(slave)
|
34
35
|
info = Tk.execute('pack', 'info', slave)
|
35
36
|
|
36
|
-
array = info.
|
37
|
+
array = info.map do |key, value|
|
37
38
|
case key = key[1..-1].to_sym
|
38
39
|
when :expand
|
39
40
|
[key, Tk.boolean(value)]
|
@@ -44,9 +45,9 @@ module Tk
|
|
44
45
|
when :after, :anchor, :before, :in
|
45
46
|
[key, value]
|
46
47
|
else
|
47
|
-
raise
|
48
|
+
raise 'Unknown info pair: %p => %p' % [key, value]
|
48
49
|
end
|
49
|
-
|
50
|
+
end
|
50
51
|
|
51
52
|
Hash[array]
|
52
53
|
end
|
@@ -96,4 +97,4 @@ module Tk
|
|
96
97
|
Pack.slaves(self)
|
97
98
|
end
|
98
99
|
end
|
99
|
-
end
|
100
|
+
end
|
data/lib/ffi-tk/command/place.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# Geometry manager for fixed or rubber-sheet placement
|
3
4
|
#
|
@@ -17,7 +18,7 @@ module Tk
|
|
17
18
|
# +window+'s geometry is managed.
|
18
19
|
# Option may have any of the values accepted by [Place.configure].
|
19
20
|
def self.place(window, options = {})
|
20
|
-
args = options.map{|k,v| ["-#{k}", v] }.flatten
|
21
|
+
args = options.map { |k, v| ["-#{k}", v] }.flatten
|
21
22
|
Tk.execute_only('place', window, *args)
|
22
23
|
end
|
23
24
|
|
@@ -42,7 +43,7 @@ module Tk
|
|
42
43
|
def self.info(window)
|
43
44
|
info = Tk.execute('place', 'info', window).to_s
|
44
45
|
|
45
|
-
array = info.split.each_slice(2).map
|
46
|
+
array = info.split.each_slice(2).map do |key, value|
|
46
47
|
case key = key[1..-1].to_sym
|
47
48
|
when :anchor, :in
|
48
49
|
[key, value]
|
@@ -53,9 +54,9 @@ module Tk
|
|
53
54
|
when :relheight, :relwidth, :relx, :rely
|
54
55
|
[key, value.to_f]
|
55
56
|
else
|
56
|
-
raise
|
57
|
+
raise 'Unknown info pair: %p => %p' % [key, value]
|
57
58
|
end
|
58
|
-
|
59
|
+
end
|
59
60
|
|
60
61
|
Hash[array]
|
61
62
|
end
|
data/lib/ffi-tk/command/popup.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# This procedure posts a menu at a given position on the screen and configures
|
3
4
|
# Tk so that the menu and its cascaded children can be traversed with the
|
@@ -11,4 +12,4 @@ module Tk
|
|
11
12
|
def self.popup(menu, x, y, entry = None)
|
12
13
|
Tk.execute_only(:tk_popup, menu, x, y, entry)
|
13
14
|
end
|
14
|
-
end
|
15
|
+
end
|
data/lib/ffi-tk/command/raise.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
module Scrollable
|
3
|
-
|
4
4
|
# Returns a list containing two elements.
|
5
5
|
# Each element is a real fraction between 0 and 1; together they describe
|
6
6
|
# the portion of the document's horizontal span that is visible in the
|
@@ -69,7 +69,6 @@ module Tk
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
|
73
72
|
# Adjusts the view in the window so that the pixel given by fraction
|
74
73
|
# appears at the top of the top line of the window.
|
75
74
|
# Fraction is a fraction between 0 and 1; 0 indicates the first pixel of
|
@@ -124,8 +123,8 @@ module Tk
|
|
124
123
|
@yscrollbar = sbar
|
125
124
|
@yscrollbar.orient :vertical
|
126
125
|
|
127
|
-
|
128
|
-
@yscrollbar.command {|
|
126
|
+
yscrollcommand { |*arg| @yscrollbar.set(*arg); true }
|
127
|
+
@yscrollbar.command { |_action, fraction| yview_moveto(fraction) }
|
129
128
|
@yscrollbar
|
130
129
|
end
|
131
130
|
|
@@ -133,19 +132,17 @@ module Tk
|
|
133
132
|
@xscrollbar = sbar
|
134
133
|
@xscrollbar.orient :horizontal
|
135
134
|
|
136
|
-
|
137
|
-
@xscrollbar.command {|
|
135
|
+
xscrollcommand { |*arg| @xscrollbar.set(*arg); true }
|
136
|
+
@xscrollbar.command { |_action, fraction| xview_moveto(fraction) }
|
138
137
|
@xscrollbar
|
139
138
|
end
|
140
139
|
|
141
140
|
def xscrollcommand(&block)
|
142
|
-
configure(:
|
141
|
+
configure(xscrollcommand: block) if block
|
143
142
|
end
|
144
143
|
|
145
144
|
def yscrollcommand(&block)
|
146
|
-
configure(:
|
145
|
+
configure(yscrollcommand: block) if block
|
147
146
|
end
|
148
|
-
|
149
147
|
end
|
150
148
|
end
|
151
|
-
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
# This command provides a Tcl interface to the X selection mechanism and
|
3
4
|
# implements the full selection functionality described in the X Inter-Client
|
@@ -7,11 +8,11 @@ module Tk
|
|
7
8
|
# clipboard command may also be used.
|
8
9
|
module Selection
|
9
10
|
def selection_clear(options = {})
|
10
|
-
Selection.clear({displayof: self}.merge(options))
|
11
|
+
Selection.clear({ displayof: self }.merge(options))
|
11
12
|
end
|
12
13
|
|
13
14
|
def selection_get(options = {})
|
14
|
-
Selection.get({displayof: self}.merge(options))
|
15
|
+
Selection.get({ displayof: self }.merge(options))
|
15
16
|
end
|
16
17
|
|
17
18
|
def selection_handle(options = {}, &command)
|
@@ -120,7 +121,7 @@ module Tk
|
|
120
121
|
|
121
122
|
if cmd = (options[:command] || command)
|
122
123
|
command = register_command(:selection_own, &cmd)
|
123
|
-
Tk.execute(:selection, :own, {command: command}.merge(options).to_tcl_options)
|
124
|
+
Tk.execute(:selection, :own, { command: command }.merge(options).to_tcl_options)
|
124
125
|
else
|
125
126
|
Tk.execute(:selection, :own, options.to_tcl_options)
|
126
127
|
end
|
data/lib/ffi-tk/command/vars.rb
CHANGED
data/lib/ffi-tk/command/wait.rb
CHANGED
data/lib/ffi-tk/command/winfo.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Tk
|
2
3
|
module Winfo
|
3
4
|
# @see Winfo.atom
|
@@ -324,7 +325,7 @@ module Tk
|
|
324
325
|
if None == window
|
325
326
|
Tk.execute(:winfo, :containing, root_x, root_y).to_s?
|
326
327
|
else
|
327
|
-
Tk.execute(:winfo, :containing, '-displayof', window, root_x, root_y)
|
328
|
+
Tk.execute(:winfo, :containing, '-displayof', window, root_x, root_y)
|
328
329
|
end
|
329
330
|
end
|
330
331
|
|
@@ -401,7 +402,7 @@ module Tk
|
|
401
402
|
# If the geometry manager is a widget, such as canvases or text, the name
|
402
403
|
# is the widget's class command, such as canvas.
|
403
404
|
def manager(window)
|
404
|
-
Tk.execute(:winfo, :manager, window)
|
405
|
+
Tk.execute(:winfo, :manager, window)
|
405
406
|
end
|
406
407
|
|
407
408
|
# Returns window's name (i.e. its name within its parent, as opposed to its
|
@@ -414,7 +415,7 @@ module Tk
|
|
414
415
|
# Returns the path name of +window+'s parent, or nil if +window+ is the main
|
415
416
|
# window of the application.
|
416
417
|
def parent(window)
|
417
|
-
Tk.execute(:winfo, :parent, window)
|
418
|
+
Tk.execute(:winfo, :parent, window)
|
418
419
|
end
|
419
420
|
|
420
421
|
# Returns the path name of the window whose X identifier is +id+.
|
@@ -491,7 +492,7 @@ module Tk
|
|
491
492
|
# in the window given by window.
|
492
493
|
# Color may be specified in any of the forms acceptable for a color option.
|
493
494
|
def rgb(window, color)
|
494
|
-
Tk.execute(:winfo, :rgb, window, color).
|
495
|
+
Tk.execute(:winfo, :rgb, window, color).split.map(&:to_i)
|
495
496
|
end
|
496
497
|
|
497
498
|
# Returns a decimal string giving the x-coordinate, in the root window of
|
@@ -602,16 +603,16 @@ module Tk
|
|
602
603
|
def visualsavailable(window, includeids = None)
|
603
604
|
if None == includeids
|
604
605
|
list = Tk.execute(:winfo, :visualsavailable, window).to_a
|
605
|
-
list.uniq.map
|
606
|
+
list.uniq.map do |string|
|
606
607
|
klass, depth = string.split
|
607
608
|
[klass, depth.to_i]
|
608
|
-
|
609
|
+
end
|
609
610
|
else
|
610
611
|
list = Tk.execute(:winfo, :visualsavailable, window, :includeids).to_a
|
611
|
-
list.uniq.map
|
612
|
+
list.uniq.map do |string|
|
612
613
|
klass, depth, id = string.split
|
613
614
|
[klass, depth.to_i, id]
|
614
|
-
|
615
|
+
end
|
615
616
|
end
|
616
617
|
end
|
617
618
|
|