e$B1J0fe(B@e$BCNG=!%6e9)Bg$G$9!%e(B
From: [email protected]
Subject: [ruby-dev:38750] Re: [1.8.7][1.9.1][tk] e$B<+A0<BAu$N3HD%e(B
widget e$B$r;H$$$?$$>l9ge(B
Date: Wed, 8 Jul 2009 19:57:43 +0900
Message-ID: [email protected]
e$B2!ED$G$9!#e(B
e$B$@$OC$K$J$C$F$$j$^$9!%e(B
e$B%?%$%H%k%P!<$Ne(B [X] e$B%%?%s$G$b=*N;$7$^$;$s!#e(B
C-c e$B$9$k$H2<5-$,=P$F$-$^$9!#e(B
$ ruby ext/tk/sample/tkcombobox.rb
/usr/local/lib/ruby/1.9.1/tk.rb:1363:in _invoke': Interrupt from /usr/local/lib/ruby/1.9.1/tk.rb:1363:in
module:TkCore’
from /usr/local/lib/ruby/1.9.1/tk.rb:1110:in <top (required)>' from ext/tk/sample/tkcombobox.rb:6:in
require’
from ext/tk/sample/tkcombobox.rb:6:in `’
e$B$!$%!%!%!%e(B
Ruby 1.9 e$B$GI,MW$K$J$ke(B Tcl e$B%$%s%?!<%W%j%?@lMQ%9%l%C%I$,e(B
e$BMn$A$A$c$C$F$$$k$s$G$7$g$&$M!%e(B
e$B0J2<$G$O$$$+$,$G$7$g$&$+!)e(B
— ext/tk/lib/tk.rb (revision 23988)
+++ ext/tk/lib/tk.rb (working copy)
@@ -15,7 +15,9 @@
class TclTkIp
backup original (without encoding) _eval and _invoke
alias _eval_without_enc _eval
@@ -113,17 +115,24 @@
gen_class_name = ruby_class_name
classname_def = ‘’
else # ruby_class == nil
m.const_defined?(tk_class)}
-
if Tk.const_defined?(tk_class)
-
mod.const_get(tk_class) # auto_load
-
ruby_class = WidgetClassNames[tk_class]
-
end
unless ruby_class
-
mods = TkExtlibAutoloadModule.find_all{|m|
m.const_defined?(tk_class)}
-
mods.each{|mod|
-
begin
-
mod.const_get(tk_class) # auto_load
-
break if (ruby_class = WidgetClassNames[tk_class])
-
rescue LoadError
-
# ignore load error
-
end
-
}
-
end
-
-
unless ruby_class
std_class = 'Tk' << tk_class
if Object.const_defined?(std_class)
Object.const_get(std_class) # auto_load
@@ -131,6 +140,14 @@
end
end
-
unless ruby_class
-
if Tk.const_defined?('TOPLEVEL_ALIASES') &&
-
Tk::TOPLEVEL_ALIASES.const_defined?(std_class)
-
Tk::TOPLEVEL_ALIASES.const_get(std_class) # auto_load
-
ruby_class = WidgetClassNames[tk_class]
-
end
-
end
-
if ruby_class
# found
ruby_class_name = ruby_class.name
@@ -613,11 +630,35 @@
val
end
end
- private :bool, :number, :string, :num_or_str
- private :list, :simplelist, :window, :procedure
- module_function :bool, :number, :num_or_str, :string
-
private :bool, :number, :num_or_str, :num_or_nil, :string
-
private :list, :simplelist, :window, :image_obj, :procedure
-
module_function :bool, :number, :num_or_str, :num_or_nil, :string
module_function :list, :simplelist, :window, :image_obj, :procedure
-
if (RUBY_VERSION.split(‘.’).map{|n| n.to_i} <=> [1,8,7]) < 0
-
def slice_ary(ary, size)
-
sliced = []
-
wk_ary = ary.dup
-
until wk_ary.size.zero?
-
sub_ary = []
-
size.times{ sub_ary << wk_ary.shift }
-
yield(sub_ary) if block_given?
-
sliced << sub_ary
-
end
-
(block_given?)? ary: sliced
-
end
-
else
-
def slice_ary(ary, size, &b)
-
if b
-
ary.each_slice(size, &b)
-
else
-
ary.each_slice(size).to_a
-
end
-
end
-
end
-
private :slice_ary
-
module_function :slice_ary
-
def subst(str, *opts)
opts := :nobackslashes | :nocommands | novariables
tk_call(‘subst’,
@@ -1130,30 +1171,42 @@
opts = ‘’
end
- if WITH_RUBY_VM ### check Ruby 1.9 !!!
-
# *** NEED TO FIX ***
-
ip = TclTkIp.new(name, opts)
-
if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' &&
-
(TclTkLib.get_version <=>
[8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0
main
on
-
# the main application thread.
-
RUN_EVENTLOOP_ON_MAIN_THREAD = true
-
INTERP = ip
-
else
-
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
-
RUN_EVENTLOOP_ON_MAIN_THREAD = false
-
end
-
if RUN_EVENTLOOP_ON_MAIN_THREAD
- unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
-
if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!!
-
# *** NEED TO FIX ***
-
ip = TclTkIp.new(name, opts)
-
if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' &&
-
(TclTkLib.get_version<=>[8,4,TclTkLib::RELEASE_TYPE::FINAL,6]) > 0
main
Tk.mainloop on
-
# the main application thread.
-
#
-
# *** ADD (2009/05/10) ***
-
# In some cases (I don't know the description of
conditions),
-
# TkAqua 8.4.7 has a same kind of hang-up trouble.
-
# So, if 8.4.7 or later, set RUN_EVENTLOOP_ON_MAIN_THREAD
to true.
following
-
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
-
RUN_EVENTLOOP_ON_MAIN_THREAD = false
-
end
-
if RUN_EVENTLOOP_ON_MAIN_THREAD
-
INTERP = ip
-
else
-
ip.delete
-
end
end
-
ip = nil
-
-
else # Ruby 1.8.x
RUN_EVENTLOOP_ON_MAIN_THREAD = false
end
end
@@ -1183,13 +1236,29 @@
#sleep
begin
-
begin
-
#TclTkLib.mainloop_abort_on_exception = false
-
#Thread.current[:status].value = TclTkLib.mainloop(true)
-
interp.mainloop_abort_on_exception = true
-
Thread.current[:status].value = interp.mainloop(true)
-
rescue SystemExit=>e
-
Thread.current[:status].value = e
-
rescue Exception=>e
-
Thread.current[:status].value = e
-
retry if interp.has_mainwindow?
-
ensure
-
INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast }
-
end
-
-
#Thread.current[:status].value = TclTkLib.mainloop(false)
-
Thread.current[:status].value = interp.mainloop(false)
-
ensure
dead.
handler
@@ -1321,7 +1390,8 @@
@add_tk_procs.delete_if{|elem|
elem.kind_of?(Array) && elem[0].to_s == name
}
-
#self._invoke('rename', name, '')
-
self.__invoke__('rename', name, '')
}
end
def INTERP.init_ip_internal
@@ -1704,11 +1774,14 @@
elsif TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
# if TclTkLib::WINDOWING_SYSTEM == ‘aqua’ &&
TkCore::INTERP._invoke_without_enc(‘tk’,‘windowingsystem’)==‘aqua’ &&
[8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0
thread only"
TkCore::INTERP._invoke_without_enc(‘tk’,‘windowingsystem’)==‘aqua’ &&
[8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0
thread only"
only"
end
TclTkLib.mainloop(check_root)
@@ -3028,7 +3101,7 @@
=begin
if ext_enc_obj == Tk::Encoding::UNKNOWN
@@ -3126,7 +3199,7 @@
#if ext_enc_name && ext_enc_name != tksys_enc_name
int_enc_name =
Tk::Encoding::ENCODING_TABLE.get_name(int_enc_obj)
if int_enc_name
@@ -3279,10 +3352,10 @@
TkFont.init_widget_font(pathname, *__confinfo_cmd)
else
fonts = {}
-
optkeys.each{|k|
-
k = k.to_s
-
pathname = [win, tag, k].join(';')
-
fonts[k] =
TkFont.used_on(pathname) ||
TkFont.init_widget_font(pathname, *__confinfo_cmd)
}
@@ -3407,7 +3480,7 @@
if fobj.kind_of?(TkFont)
if ltn.kind_of?(TkFont)
conf = {}
@@ -3467,7 +3540,7 @@
if fobj.kind_of?(TkFont)
if knj.kind_of?(TkFont)
conf = {}
@@ -3701,11 +3774,17 @@
val
end
- def cget_tkstring(option)
- opt = option.to_s
- fail ArgumentError, “Invalid option `#{option.inspect}'” if
opt.length == 0
- tk_call_without_enc(*(__cget_cmd << “-#{opt}”))
- end
- def __cget_core(slot)
orig_slot = slot
slot = slot.to_s
- if slot.length == 0
fail ArgumentError, “Invalid option `#{orig_slot.inspect}'”
end
@@ -4106,7 +4185,8 @@
else
# conf =
tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd <<
“-#{slot}”))))
<< “-#{slot}”)), 0, false, true)
<< “-#{slot}”)), 0, false, true)
<< “-#{slot}”)), 1, false, true)
end
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1…-1]
@@ -4296,8 +4376,8 @@
end
}
-
__methodcall_optkeys.each{|optkey, method|
-
ret << [optkey.to_s, '', '', '', self.__send__(method)]
-
__methodcall_optkeys.each{|optkey, m|
-
ret << [optkey.to_s, '', '', '', self.__send__(m)]
}
ret
@@ -4335,7 +4415,7 @@
if slot
slot = slot.to_s
== slot}
== slot}
if real_name
slot = real_name.to_s
end
@@ -4682,8 +4762,8 @@
end
}
-
__methodcall_optkeys.each{|optkey, method|
-
ret[optkey.to_s] = ['', '', '', self.__send__(method)]
-
__methodcall_optkeys.each{|optkey, m|
-
ret[optkey.to_s] = ['', '', '', self.__send__(m)]
}
ret
@@ -4721,18 +4801,18 @@
“there is a configure alias loop about ‘#{org_slot}’”
else
ret = {}
-
configinfo(slot).each{|key, cnf|
-
ret[key] = cnf[-1] if cnf.kind_of?(Array)
}
ret
end
@@ -4864,6 +4944,7 @@
include TkWinfo
extend TkBindCore
include Tk::Wm_for_General
-
include Tk::Busy
@@WIDGET_INSPECT_FULL = false
def TkWindow.widget_inspect_full?
@@ -5551,7 +5632,7 @@
#Tk.freeze
module Tk
- RELEASE_DATE = ‘2009-01-13’.freeze
-
RELEASE_DATE = ‘2009-07-08’.freeze
autoload :AUTO_PATH, ‘tk/variable’
autoload :TCL_PACKAGE_PATH, ‘tk/variable’