ffi-tk 2009.11.29 → 2009.12.14
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +20 -0
- data/MANIFEST +1 -0
- data/example/tkgo.rb +269 -0
- data/ffi-tk.gemspec +3 -3
- data/lib/ffi-tk/widget/canvas.rb +14 -14
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
[0ec1768 | 2009-12-05 16:50:39 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
2
|
+
|
3
|
+
* Gnugo defaults to 19 size
|
4
|
+
|
5
|
+
[95e450e | 2009-12-05 12:30:24 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
6
|
+
|
7
|
+
* Add license and some options
|
8
|
+
|
9
|
+
[01bc732 | 2009-12-05 07:10:23 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
10
|
+
|
11
|
+
* Fix some stuff of Canvas
|
12
|
+
|
13
|
+
[709119c | 2009-11-28 15:17:42 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
14
|
+
|
15
|
+
* Make gemspec and related files
|
16
|
+
|
17
|
+
[a03ce1d | 2009-11-28 10:05:07 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
18
|
+
|
19
|
+
* Fix Treeview#delete and add Treeview#clear
|
20
|
+
|
1
21
|
[294fdaf | 2009-11-23 08:13:47 UTC] Julian Langschaedel <meta.rb@gmail.com>
|
2
22
|
|
3
23
|
* Fix Listbox#value
|
data/MANIFEST
CHANGED
data/example/tkgo.rb
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
# Copyright (c) 2009 Michael Fellinger <m.fellinger@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
16
|
+
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
# tkgo.rb is an extended implementation of the goco frontend for GNU Go.
|
22
|
+
# goco can be found at http://stud4.tuwien.ac.at/~e0225855/
|
23
|
+
#
|
24
|
+
# TkGo contains many bugfixes and is written in Ruby.
|
25
|
+
# It shows some basics of Tk::Canvas usage.
|
26
|
+
|
27
|
+
require 'ffi-tk'
|
28
|
+
require 'optparse'
|
29
|
+
require 'open3'
|
30
|
+
|
31
|
+
class TkGo
|
32
|
+
attr_accessor(:linedist, :frame, :goban, :passb, :scoreb, :undob, :boardsize,
|
33
|
+
:sin, :sout, :serr, :status)
|
34
|
+
|
35
|
+
def initialize(options)
|
36
|
+
index = options.index('--boardsize')
|
37
|
+
@boardsize = index ? options[index + 1] : 19
|
38
|
+
@linedist = 28
|
39
|
+
@black_history = []
|
40
|
+
@white_history = []
|
41
|
+
|
42
|
+
cmd = "gnugo --mode gtp #{options.join(' ')}"
|
43
|
+
|
44
|
+
Open3.popen3 cmd do |sin, sout, serr|
|
45
|
+
@sin, @sout, @serr = sin, sout, serr
|
46
|
+
setup_widgets
|
47
|
+
Tk.mainloop
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def setup_widgets
|
52
|
+
Tk::Tile.set_theme 'clam'
|
53
|
+
|
54
|
+
@frame = Tk::Tile::Frame.new
|
55
|
+
@passb = Tk::Tile::Button.new(frame, text: 'Pass'){ clicked_field('pass') }
|
56
|
+
@scoreb = Tk::Tile::Button.new(frame, text: 'Score'){ score }
|
57
|
+
@undob = Tk::Tile::Button.new(frame, text: 'Undo'){
|
58
|
+
2.times{
|
59
|
+
sin.puts("undo")
|
60
|
+
read_pipe
|
61
|
+
}
|
62
|
+
@white_history.pop
|
63
|
+
@black_history.pop
|
64
|
+
draw_pieces
|
65
|
+
}
|
66
|
+
@status = Tk::Tile::Label.new
|
67
|
+
passb.pack(padx: 5, pady: 5, side: :left)
|
68
|
+
scoreb.pack(padx: 5, pady: 5, side: :left)
|
69
|
+
undob.pack(padx: 5, pady: 5, side: :left)
|
70
|
+
status.pack(side: :bottom, expand: true, fill: :both)
|
71
|
+
|
72
|
+
Tk.root.wm_title = 'GO considered'
|
73
|
+
Tk.root.bind('<Destroy>'){
|
74
|
+
sin.puts("exit")
|
75
|
+
exit
|
76
|
+
}
|
77
|
+
|
78
|
+
gobansize = linedist * (boardsize + 1)
|
79
|
+
@goban = Tk::Canvas.new(
|
80
|
+
Tk.root,
|
81
|
+
height: gobansize,
|
82
|
+
width: gobansize,
|
83
|
+
background: '#eebb77')
|
84
|
+
goban.pack(expand: true)
|
85
|
+
frame.pack(expand: true)
|
86
|
+
draw_board(goban)
|
87
|
+
end
|
88
|
+
|
89
|
+
# NOTE: there is no I
|
90
|
+
def x_to_letter(x)
|
91
|
+
%w[A B C D E F G H J K L M N O P Q R S T][x]
|
92
|
+
end
|
93
|
+
|
94
|
+
def read_pipe
|
95
|
+
reply = sout.gets.strip.split
|
96
|
+
ignore = sout.gets
|
97
|
+
reply
|
98
|
+
end
|
99
|
+
|
100
|
+
def draw_pieces
|
101
|
+
sin.puts("list_stones black")
|
102
|
+
blacks = read_pipe
|
103
|
+
blacks.shift
|
104
|
+
|
105
|
+
sin.puts("list_stones white")
|
106
|
+
whites = read_pipe
|
107
|
+
whites.shift
|
108
|
+
|
109
|
+
goban.delete(:piece, :marker)
|
110
|
+
|
111
|
+
blacks.each{|name| draw_piece(name, :black) }
|
112
|
+
whites.each{|name| draw_piece(name, :white) }
|
113
|
+
|
114
|
+
draw_markers(blacks.any?, whites.any?)
|
115
|
+
end
|
116
|
+
|
117
|
+
def draw_piece(name, color)
|
118
|
+
cs = goban.coords(name)
|
119
|
+
return if cs.empty?
|
120
|
+
|
121
|
+
goban.create_oval(*cs, tags: [:piece], fill: color)
|
122
|
+
outline = color == :white ? :black : :white
|
123
|
+
end
|
124
|
+
|
125
|
+
def draw_markers(blacks, whites)
|
126
|
+
last_white = @white_history.reject{|name| name =~ /pass/i }.last
|
127
|
+
draw_marker(last_white, :black) if whites && last_white
|
128
|
+
|
129
|
+
last_black = @black_history.reject{|name| name =~ /pass/i }.last
|
130
|
+
draw_marker(last_black, :white) if blacks && last_black
|
131
|
+
end
|
132
|
+
|
133
|
+
def draw_marker(name, color)
|
134
|
+
p draw_marker: [name, color]
|
135
|
+
x1, y1, x2, y2 = goban.coords(name)
|
136
|
+
margin = linedist / 4
|
137
|
+
cs = (x1 + margin), (y1 + margin), (x2 - margin), (y2 - margin)
|
138
|
+
goban.create_rectangle(*cs, tags: [:marker], outline: color)
|
139
|
+
end
|
140
|
+
|
141
|
+
def clicked_field(name)
|
142
|
+
@black_history << name
|
143
|
+
sin.puts("play black #{name}")
|
144
|
+
reply = read_pipe
|
145
|
+
|
146
|
+
return if reply[0] == '?'
|
147
|
+
|
148
|
+
sin.puts("genmove white")
|
149
|
+
pos = read_pipe.last
|
150
|
+
@white_history << pos
|
151
|
+
status.value = "White: #{pos}"
|
152
|
+
|
153
|
+
draw_pieces
|
154
|
+
rescue => ex
|
155
|
+
puts "#{ex.class}: #{ex}", *ex.backtrace
|
156
|
+
nil
|
157
|
+
end
|
158
|
+
|
159
|
+
def score
|
160
|
+
sin.puts("final_score")
|
161
|
+
reply = read_pipe.last
|
162
|
+
status.value = reply
|
163
|
+
end
|
164
|
+
|
165
|
+
def draw_board(board)
|
166
|
+
max = boardsize * linedist
|
167
|
+
|
168
|
+
1.upto(boardsize) do |i|
|
169
|
+
start = linedist * i
|
170
|
+
board.create_line(linedist, start, max, start)
|
171
|
+
board.create_line(start, linedist, start, max)
|
172
|
+
end
|
173
|
+
|
174
|
+
(0...boardsize).each do |i|
|
175
|
+
(0...boardsize).each do |j|
|
176
|
+
x1 = ((linedist * i) + (linedist / 2)) - 2
|
177
|
+
y1 = ((linedist * j) + (linedist / 2)) - 2
|
178
|
+
x2 = (x1 + linedist) - 2
|
179
|
+
y2 = (y1 + linedist) - 2
|
180
|
+
|
181
|
+
fieldname = [x_to_letter(i), j + 1].join
|
182
|
+
# color = '#' << Array.new(3){ rand(255).to_s(16).rjust(2, '0') }.join
|
183
|
+
color = nil
|
184
|
+
board.create_rectangle(
|
185
|
+
x1, y1, x2, y2, tags: [fieldname], outline: nil, fill: color)
|
186
|
+
board.bind(fieldname, '<1>'){ clicked_field(fieldname) }
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
options = []
|
193
|
+
|
194
|
+
op = OptionParser.new{|o|
|
195
|
+
o.separator "\nMain Options:"
|
196
|
+
o.on('--level <amount>', Integer, 'strength (default 10)'){|amount|
|
197
|
+
options << '--level' << amount }
|
198
|
+
o.on('--never-resign', 'Forbid GNU Go to resign'){
|
199
|
+
options << '--never-resign' }
|
200
|
+
o.on('--resign-allowed', 'Allow resignation (default)'){
|
201
|
+
options << '--resign-allowed' }
|
202
|
+
o.on('-l', '--infile <file>', 'Load name sgf file'){|file|
|
203
|
+
options << '--infile' << file }
|
204
|
+
o.on('-L', '--until <move>', 'Stop loading just before move is played. <move>
|
205
|
+
can be the move number or location (eg L10).'){|move|
|
206
|
+
options << '--until' << move }
|
207
|
+
o.on('-o', '--outfile <file>', 'Write sgf output to file'){|file|
|
208
|
+
options << '--outfile' << file }
|
209
|
+
o.on('--printsgf <file>', 'Write position as a diagram to file (use with -l)'){|file|
|
210
|
+
options << '--printsgf' << file }
|
211
|
+
|
212
|
+
o.separator "\nGame Options:"
|
213
|
+
o.on('--boardsize <num>', Integer, 'Set the board size to use (1--19)'){|num|
|
214
|
+
options << '--boardsize' << num }
|
215
|
+
o.on('--color <color>', "Choose your color ('black' or 'white')"){|color|
|
216
|
+
options << '--color' << color }
|
217
|
+
o.on('--handicap <num>', Integer, 'Set the number of handicap stones (0--9)'){|num|
|
218
|
+
options << '--handicap' << num }
|
219
|
+
o.on('--komi <num>', Integer, 'Set the komi'){|num|
|
220
|
+
options << '--komi' << num }
|
221
|
+
o.on('--clock <sec>', 'Initialize the timer.'){|sec|
|
222
|
+
options << '--clock' << sec }
|
223
|
+
o.on('--byo-time <sec>', 'Initialize the byo-yomi timer.'){|sec|
|
224
|
+
options << '--byo-time' << sec }
|
225
|
+
o.on('--byo-period <stones>', 'Initialize the byo-yomi period.'){|stones|
|
226
|
+
options << '--byo-period' << stones }
|
227
|
+
|
228
|
+
o.on('--japanese-rules', '(default)'){
|
229
|
+
options << '---japanese-rules' }
|
230
|
+
o.on('--chinese-rules'){
|
231
|
+
options << '--chinese-rules' }
|
232
|
+
o.on('--forbid-suicide', 'Forbid suicide. (default)'){
|
233
|
+
options << '--forbid-suicide' }
|
234
|
+
o.on('--allow-suicide', 'Allow suicide except single-stone suicide.'){
|
235
|
+
options << '--allow-suicide' }
|
236
|
+
o.on('--allow-all-suicide', 'Allow all suicide moves.'){
|
237
|
+
options << '--allow-all-suicide' }
|
238
|
+
o.on('--simple-ko', 'Forbid simple ko recapture. (default)'){
|
239
|
+
options << '--simple-ko' }
|
240
|
+
o.on('--no-ko', 'Allow any ko recapture.'){
|
241
|
+
options << '--no-ko' }
|
242
|
+
o.on('--positional-superko', 'Positional superko restrictions.'){
|
243
|
+
options << '--positional-superko' }
|
244
|
+
o.on('--situational-superko', 'Situational superko restrictions.'){
|
245
|
+
options << '--situational-superko' }
|
246
|
+
|
247
|
+
o.on('--play-out-aftermath'){
|
248
|
+
options << '--play-out-aftermath' }
|
249
|
+
o.on('--capture-all-dead'){
|
250
|
+
options << '--capture-all-dead' }
|
251
|
+
|
252
|
+
o.on('--min-level <amount>', 'minimum level for adjustment schemes'){|amount|
|
253
|
+
options << '--min-level' << amount }
|
254
|
+
o.on('--max-level <amount>', 'maximum level for adjustment schemes'){|amount|
|
255
|
+
options << '--max-level' << amount }
|
256
|
+
o.on('--autolevel', 'adapt gnugo level during game to respect
|
257
|
+
the time specified by --clock <sec>.'){
|
258
|
+
options << '--autolevel' }
|
259
|
+
|
260
|
+
|
261
|
+
o.on('-h', '--help'){
|
262
|
+
puts o
|
263
|
+
exit
|
264
|
+
}
|
265
|
+
}
|
266
|
+
|
267
|
+
op.parse!
|
268
|
+
|
269
|
+
TkGo.new(options)
|
data/ffi-tk.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ffi-tk}
|
5
|
-
s.version = "2009.
|
5
|
+
s.version = "2009.12.14"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-12-14}
|
10
10
|
s.description = %q{Pure Ruby FFI wrapper for the Tk GUI toolkit.}
|
11
11
|
s.email = %q{m.fellinger@gmail.com}
|
12
|
-
s.files = ["CHANGELOG", "MANIFEST", "README.md", "Rakefile", "TODO.md", "bin/rwish", "doc/MIT_LICENSE", "doc/TCL_LICENSE", "example/choose_color.rb", "example/choose_directory.rb", "example/dialog.rb", "example/hello.rb", "example/message_box.rb", "example/option_menu.rb", "example/popup.rb", "example/set_palette.rb", "example/text.rb", "example/tile/kroc_demo_small.rb", "example/tile/kroc_rb_demo.rb", "example/tile/notebook.rb", "example/tile/theme_hello.rb", "example/tile/treeview.rb", "example/various.rb", "example/wait.rb", "ffi-tk.gemspec", "lib/ffi-tk.rb", "lib/ffi-tk/command.rb", "lib/ffi-tk/command/after.rb", "lib/ffi-tk/command/bell.rb", "lib/ffi-tk/command/bind.rb", "lib/ffi-tk/command/bindtags.rb", "lib/ffi-tk/command/cget.rb", "lib/ffi-tk/command/choose_color.rb", "lib/ffi-tk/command/choose_directory.rb", "lib/ffi-tk/command/clipboard.rb", "lib/ffi-tk/command/configure.rb", "lib/ffi-tk/command/destroy.rb", "lib/ffi-tk/command/dialog.rb", "lib/ffi-tk/command/event.rb", "lib/ffi-tk/command/focus.rb", "lib/ffi-tk/command/font.rb", "lib/ffi-tk/command/get_open_file.rb", "lib/ffi-tk/command/get_save_file.rb", "lib/ffi-tk/command/grab.rb", "lib/ffi-tk/command/grid.rb", "lib/ffi-tk/command/image.rb", "lib/ffi-tk/command/lower.rb", "lib/ffi-tk/command/message_box.rb", "lib/ffi-tk/command/option_menu.rb", "lib/ffi-tk/command/pack.rb", "lib/ffi-tk/command/place.rb", "lib/ffi-tk/command/popup.rb", "lib/ffi-tk/command/raise.rb", "lib/ffi-tk/command/scrollable.rb", "lib/ffi-tk/command/selection.rb", "lib/ffi-tk/command/set_palette.rb", "lib/ffi-tk/command/tk_cmd.rb", "lib/ffi-tk/command/vars.rb", "lib/ffi-tk/command/wait.rb", "lib/ffi-tk/command/winfo.rb", "lib/ffi-tk/command/wm.rb", "lib/ffi-tk/core_extensions.rb", "lib/ffi-tk/event/data.rb", "lib/ffi-tk/event/handler.rb", "lib/ffi-tk/ffi/tcl.rb", "lib/ffi-tk/ffi/tcl/cmd_proc.rb", "lib/ffi-tk/ffi/tcl/eval_result.rb", "lib/ffi-tk/ffi/tcl/interp.rb", "lib/ffi-tk/ffi/tcl/obj.rb", "lib/ffi-tk/ffi/tcl/time.rb", "lib/ffi-tk/ffi/tk.rb", "lib/ffi-tk/geometry.rb", "lib/ffi-tk/thread_sender.rb", "lib/ffi-tk/tk.rb", "lib/ffi-tk/variable.rb", "lib/ffi-tk/widget.rb", "lib/ffi-tk/widget/button.rb", "lib/ffi-tk/widget/canvas.rb", "lib/ffi-tk/widget/canvas/arc.rb", "lib/ffi-tk/widget/canvas/bitmap.rb", "lib/ffi-tk/widget/canvas/image.rb", "lib/ffi-tk/widget/canvas/item.rb", "lib/ffi-tk/widget/canvas/line.rb", "lib/ffi-tk/widget/canvas/oval.rb", "lib/ffi-tk/widget/canvas/polygon.rb", "lib/ffi-tk/widget/canvas/rectangle.rb", "lib/ffi-tk/widget/canvas/text.rb", "lib/ffi-tk/widget/canvas/window.rb", "lib/ffi-tk/widget/checkbutton.rb", "lib/ffi-tk/widget/entry.rb", "lib/ffi-tk/widget/frame.rb", "lib/ffi-tk/widget/label.rb", "lib/ffi-tk/widget/labelframe.rb", "lib/ffi-tk/widget/listbox.rb", "lib/ffi-tk/widget/menu.rb", "lib/ffi-tk/widget/menubutton.rb", "lib/ffi-tk/widget/message.rb", "lib/ffi-tk/widget/panedwindow.rb", "lib/ffi-tk/widget/radiobutton.rb", "lib/ffi-tk/widget/root.rb", "lib/ffi-tk/widget/scale.rb", "lib/ffi-tk/widget/scrollbar.rb", "lib/ffi-tk/widget/spinbox.rb", "lib/ffi-tk/widget/text.rb", "lib/ffi-tk/widget/text/peer.rb", "lib/ffi-tk/widget/tile.rb", "lib/ffi-tk/widget/tile/button.rb", "lib/ffi-tk/widget/tile/checkbutton.rb", "lib/ffi-tk/widget/tile/combobox.rb", "lib/ffi-tk/widget/tile/entry.rb", "lib/ffi-tk/widget/tile/frame.rb", "lib/ffi-tk/widget/tile/label.rb", "lib/ffi-tk/widget/tile/labelframe.rb", "lib/ffi-tk/widget/tile/menubutton.rb", "lib/ffi-tk/widget/tile/notebook.rb", "lib/ffi-tk/widget/tile/panedwindow.rb", "lib/ffi-tk/widget/tile/progressbar.rb", "lib/ffi-tk/widget/tile/radiobutton.rb", "lib/ffi-tk/widget/tile/scale.rb", "lib/ffi-tk/widget/tile/scrollbar.rb", "lib/ffi-tk/widget/tile/separator.rb", "lib/ffi-tk/widget/tile/sizegrip.rb", "lib/ffi-tk/widget/tile/style.rb", "lib/ffi-tk/widget/tile/treeview.rb", "lib/ffi-tk/widget/toplevel.rb", "spec/ffi-tk/command/bindtags.rb", "spec/ffi-tk/command/clipboard.rb", "spec/ffi-tk/command/font.rb", "spec/ffi-tk/command/grid.rb", "spec/ffi-tk/command/image.rb", "spec/ffi-tk/command/pack.rb", "spec/ffi-tk/command/place.rb", "spec/ffi-tk/command/selection.rb", "spec/ffi-tk/command/vars.rb", "spec/ffi-tk/command/winfo.rb", "spec/ffi-tk/command/wm.rb", "spec/ffi-tk/event.rb", "spec/ffi-tk/tile/button.rb", "spec/ffi-tk/tile/checkbutton.rb", "spec/ffi-tk/tile/combobox.rb", "spec/ffi-tk/tile/entry.rb", "spec/ffi-tk/tile/frame.rb", "spec/ffi-tk/tile/label.rb", "spec/ffi-tk/tile/labelframe.rb", "spec/ffi-tk/tile/menubutton.rb", "spec/ffi-tk/tile/notebook.rb", "spec/ffi-tk/tile/panedwindow.rb", "spec/ffi-tk/tile/progressbar.rb", "spec/ffi-tk/tile/radiobutton.rb", "spec/ffi-tk/tile/scale.rb", "spec/ffi-tk/tile/scrollbar.rb", "spec/ffi-tk/tile/separator.rb", "spec/ffi-tk/tile/sizegrip.rb", "spec/ffi-tk/tile/style.rb", "spec/ffi-tk/tile/treeview.rb", "spec/ffi-tk/variable.rb", "spec/ffi-tk/widget/button.rb", "spec/ffi-tk/widget/canvas.rb", "spec/ffi-tk/widget/checkbutton.rb", "spec/ffi-tk/widget/entry.rb", "spec/ffi-tk/widget/frame.rb", "spec/ffi-tk/widget/label.rb", "spec/ffi-tk/widget/labelframe.rb", "spec/ffi-tk/widget/listbox.rb", "spec/ffi-tk/widget/menu.rb", "spec/ffi-tk/widget/menubutton.rb", "spec/ffi-tk/widget/message.rb", "spec/ffi-tk/widget/panedwindow.rb", "spec/ffi-tk/widget/radiobutton.rb", "spec/ffi-tk/widget/root.rb", "spec/ffi-tk/widget/scale.rb", "spec/ffi-tk/widget/scrollbar.rb", "spec/ffi-tk/widget/spinbox.rb", "spec/ffi-tk/widget/text.rb", "spec/ffi-tk/widget/toplevel.rb", "spec/helper.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/ycov.rake"]
|
12
|
+
s.files = ["CHANGELOG", "MANIFEST", "README.md", "Rakefile", "TODO.md", "bin/rwish", "doc/MIT_LICENSE", "doc/TCL_LICENSE", "example/choose_color.rb", "example/choose_directory.rb", "example/dialog.rb", "example/hello.rb", "example/message_box.rb", "example/option_menu.rb", "example/popup.rb", "example/set_palette.rb", "example/text.rb", "example/tile/kroc_demo_small.rb", "example/tile/kroc_rb_demo.rb", "example/tile/notebook.rb", "example/tile/theme_hello.rb", "example/tile/treeview.rb", "example/tkgo.rb", "example/various.rb", "example/wait.rb", "ffi-tk.gemspec", "lib/ffi-tk.rb", "lib/ffi-tk/command.rb", "lib/ffi-tk/command/after.rb", "lib/ffi-tk/command/bell.rb", "lib/ffi-tk/command/bind.rb", "lib/ffi-tk/command/bindtags.rb", "lib/ffi-tk/command/cget.rb", "lib/ffi-tk/command/choose_color.rb", "lib/ffi-tk/command/choose_directory.rb", "lib/ffi-tk/command/clipboard.rb", "lib/ffi-tk/command/configure.rb", "lib/ffi-tk/command/destroy.rb", "lib/ffi-tk/command/dialog.rb", "lib/ffi-tk/command/event.rb", "lib/ffi-tk/command/focus.rb", "lib/ffi-tk/command/font.rb", "lib/ffi-tk/command/get_open_file.rb", "lib/ffi-tk/command/get_save_file.rb", "lib/ffi-tk/command/grab.rb", "lib/ffi-tk/command/grid.rb", "lib/ffi-tk/command/image.rb", "lib/ffi-tk/command/lower.rb", "lib/ffi-tk/command/message_box.rb", "lib/ffi-tk/command/option_menu.rb", "lib/ffi-tk/command/pack.rb", "lib/ffi-tk/command/place.rb", "lib/ffi-tk/command/popup.rb", "lib/ffi-tk/command/raise.rb", "lib/ffi-tk/command/scrollable.rb", "lib/ffi-tk/command/selection.rb", "lib/ffi-tk/command/set_palette.rb", "lib/ffi-tk/command/tk_cmd.rb", "lib/ffi-tk/command/vars.rb", "lib/ffi-tk/command/wait.rb", "lib/ffi-tk/command/winfo.rb", "lib/ffi-tk/command/wm.rb", "lib/ffi-tk/core_extensions.rb", "lib/ffi-tk/event/data.rb", "lib/ffi-tk/event/handler.rb", "lib/ffi-tk/ffi/tcl.rb", "lib/ffi-tk/ffi/tcl/cmd_proc.rb", "lib/ffi-tk/ffi/tcl/eval_result.rb", "lib/ffi-tk/ffi/tcl/interp.rb", "lib/ffi-tk/ffi/tcl/obj.rb", "lib/ffi-tk/ffi/tcl/time.rb", "lib/ffi-tk/ffi/tk.rb", "lib/ffi-tk/geometry.rb", "lib/ffi-tk/thread_sender.rb", "lib/ffi-tk/tk.rb", "lib/ffi-tk/variable.rb", "lib/ffi-tk/widget.rb", "lib/ffi-tk/widget/button.rb", "lib/ffi-tk/widget/canvas.rb", "lib/ffi-tk/widget/canvas/arc.rb", "lib/ffi-tk/widget/canvas/bitmap.rb", "lib/ffi-tk/widget/canvas/image.rb", "lib/ffi-tk/widget/canvas/item.rb", "lib/ffi-tk/widget/canvas/line.rb", "lib/ffi-tk/widget/canvas/oval.rb", "lib/ffi-tk/widget/canvas/polygon.rb", "lib/ffi-tk/widget/canvas/rectangle.rb", "lib/ffi-tk/widget/canvas/text.rb", "lib/ffi-tk/widget/canvas/window.rb", "lib/ffi-tk/widget/checkbutton.rb", "lib/ffi-tk/widget/entry.rb", "lib/ffi-tk/widget/frame.rb", "lib/ffi-tk/widget/label.rb", "lib/ffi-tk/widget/labelframe.rb", "lib/ffi-tk/widget/listbox.rb", "lib/ffi-tk/widget/menu.rb", "lib/ffi-tk/widget/menubutton.rb", "lib/ffi-tk/widget/message.rb", "lib/ffi-tk/widget/panedwindow.rb", "lib/ffi-tk/widget/radiobutton.rb", "lib/ffi-tk/widget/root.rb", "lib/ffi-tk/widget/scale.rb", "lib/ffi-tk/widget/scrollbar.rb", "lib/ffi-tk/widget/spinbox.rb", "lib/ffi-tk/widget/text.rb", "lib/ffi-tk/widget/text/peer.rb", "lib/ffi-tk/widget/tile.rb", "lib/ffi-tk/widget/tile/button.rb", "lib/ffi-tk/widget/tile/checkbutton.rb", "lib/ffi-tk/widget/tile/combobox.rb", "lib/ffi-tk/widget/tile/entry.rb", "lib/ffi-tk/widget/tile/frame.rb", "lib/ffi-tk/widget/tile/label.rb", "lib/ffi-tk/widget/tile/labelframe.rb", "lib/ffi-tk/widget/tile/menubutton.rb", "lib/ffi-tk/widget/tile/notebook.rb", "lib/ffi-tk/widget/tile/panedwindow.rb", "lib/ffi-tk/widget/tile/progressbar.rb", "lib/ffi-tk/widget/tile/radiobutton.rb", "lib/ffi-tk/widget/tile/scale.rb", "lib/ffi-tk/widget/tile/scrollbar.rb", "lib/ffi-tk/widget/tile/separator.rb", "lib/ffi-tk/widget/tile/sizegrip.rb", "lib/ffi-tk/widget/tile/style.rb", "lib/ffi-tk/widget/tile/treeview.rb", "lib/ffi-tk/widget/toplevel.rb", "spec/ffi-tk/command/bindtags.rb", "spec/ffi-tk/command/clipboard.rb", "spec/ffi-tk/command/font.rb", "spec/ffi-tk/command/grid.rb", "spec/ffi-tk/command/image.rb", "spec/ffi-tk/command/pack.rb", "spec/ffi-tk/command/place.rb", "spec/ffi-tk/command/selection.rb", "spec/ffi-tk/command/vars.rb", "spec/ffi-tk/command/winfo.rb", "spec/ffi-tk/command/wm.rb", "spec/ffi-tk/event.rb", "spec/ffi-tk/tile/button.rb", "spec/ffi-tk/tile/checkbutton.rb", "spec/ffi-tk/tile/combobox.rb", "spec/ffi-tk/tile/entry.rb", "spec/ffi-tk/tile/frame.rb", "spec/ffi-tk/tile/label.rb", "spec/ffi-tk/tile/labelframe.rb", "spec/ffi-tk/tile/menubutton.rb", "spec/ffi-tk/tile/notebook.rb", "spec/ffi-tk/tile/panedwindow.rb", "spec/ffi-tk/tile/progressbar.rb", "spec/ffi-tk/tile/radiobutton.rb", "spec/ffi-tk/tile/scale.rb", "spec/ffi-tk/tile/scrollbar.rb", "spec/ffi-tk/tile/separator.rb", "spec/ffi-tk/tile/sizegrip.rb", "spec/ffi-tk/tile/style.rb", "spec/ffi-tk/tile/treeview.rb", "spec/ffi-tk/variable.rb", "spec/ffi-tk/widget/button.rb", "spec/ffi-tk/widget/canvas.rb", "spec/ffi-tk/widget/checkbutton.rb", "spec/ffi-tk/widget/entry.rb", "spec/ffi-tk/widget/frame.rb", "spec/ffi-tk/widget/label.rb", "spec/ffi-tk/widget/labelframe.rb", "spec/ffi-tk/widget/listbox.rb", "spec/ffi-tk/widget/menu.rb", "spec/ffi-tk/widget/menubutton.rb", "spec/ffi-tk/widget/message.rb", "spec/ffi-tk/widget/panedwindow.rb", "spec/ffi-tk/widget/radiobutton.rb", "spec/ffi-tk/widget/root.rb", "spec/ffi-tk/widget/scale.rb", "spec/ffi-tk/widget/scrollbar.rb", "spec/ffi-tk/widget/spinbox.rb", "spec/ffi-tk/widget/text.rb", "spec/ffi-tk/widget/toplevel.rb", "spec/helper.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/ycov.rake"]
|
13
13
|
s.homepage = %q{http://github.com/manveru/ffi-tk}
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.rubygems_version = %q{1.3.5}
|
data/lib/ffi-tk/widget/canvas.rb
CHANGED
@@ -169,9 +169,9 @@ module Tk
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
-
name = "#{tag_or_id}
|
172
|
+
name = "#{tag_or_id}".scan(/\w+/).join('_')
|
173
173
|
@events ||= {}
|
174
|
-
unregister_event(name)
|
174
|
+
# unregister_event(name)
|
175
175
|
|
176
176
|
Event::Handler.register_custom(script) do |id|
|
177
177
|
code = "%s bind %s %s { ::RubyFFI::event %d '' %s }"
|
@@ -329,28 +329,28 @@ module Tk
|
|
329
329
|
execute(:find, tag, :above, tag_or_id)
|
330
330
|
end
|
331
331
|
|
332
|
-
def find_all
|
333
|
-
execute(:find,
|
332
|
+
def find_all
|
333
|
+
execute(:find, :all)
|
334
334
|
end
|
335
335
|
|
336
|
-
def find_below(
|
337
|
-
execute(:find,
|
336
|
+
def find_below(tag_or_id)
|
337
|
+
execute(:find, :below, tag_or_id)
|
338
338
|
end
|
339
339
|
|
340
|
-
def find_closest(
|
341
|
-
execute(:find,
|
340
|
+
def find_closest(x, y, halo = None, start = None)
|
341
|
+
execute(:find, :closest, x, y, halo, start)
|
342
342
|
end
|
343
343
|
|
344
|
-
def find_enclosed(
|
345
|
-
execute(:find,
|
344
|
+
def find_enclosed(x1, y1, x2, y2)
|
345
|
+
execute(:find, :enclosed, x1, y1, x2, y2)
|
346
346
|
end
|
347
347
|
|
348
|
-
def find_overlapping(
|
349
|
-
execute(:find,
|
348
|
+
def find_overlapping(x1, y1, x2, y2)
|
349
|
+
execute(:find, :overlapping, x1, y1, x2, y2)
|
350
350
|
end
|
351
351
|
|
352
|
-
def find_withtag(
|
353
|
-
execute(:find,
|
352
|
+
def find_withtag(tag_or_id)
|
353
|
+
execute(:find, :withtag, tag_or_id)
|
354
354
|
end
|
355
355
|
|
356
356
|
# Set the keyboard focus for the canvas widget to the item given by
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-tk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2009.
|
4
|
+
version: 2009.12.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael 'manveru' Fellinger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-14 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- example/tile/notebook.rb
|
64
64
|
- example/tile/theme_hello.rb
|
65
65
|
- example/tile/treeview.rb
|
66
|
+
- example/tkgo.rb
|
66
67
|
- example/various.rb
|
67
68
|
- example/wait.rb
|
68
69
|
- ffi-tk.gemspec
|