mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/lib/tkextlib/tktable/tktable.rb: fix bug on arguments for Proc object.
* ext/tk/sample/scrollframe.rb: forgot a Module definition. * ext/tk/extconf.rb: check unsupported version of tclConfig.sh/tkConfig.sh. It is because current Ruby/Tk doesn't support Tcl/Tk8.6. * ext/tk/extconf.rb: change search step of Tcl/Tk libraries. * ext/tk/lib/tk/namespace.rb: instance_exec() cannot accept a script string. * ext/tk/lib/tk/msgcat.rb: bug fix on treating encodings. Now, ext/tk/sample/tkmsgcat-load_rb*.rb will work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2fd4dec977
commit
b72256f91c
5 changed files with 59 additions and 33 deletions
|
@ -11,9 +11,17 @@ TkLib_Config['search_versions'] =
|
||||||
# %w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps
|
# %w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps
|
||||||
%w[8.5 8.4] # At present, Tcl/Tk8.6 is not supported.
|
%w[8.5 8.4] # At present, Tcl/Tk8.6 is not supported.
|
||||||
|
|
||||||
|
TkLib_Config['unsupported_versions'] =
|
||||||
|
%w[8.8 8.7 8.6] # At present, Tcl/Tk8.6 is not supported.
|
||||||
|
|
||||||
TkLib_Config['major_nums'] = '87'
|
TkLib_Config['major_nums'] = '87'
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
|
||||||
|
TkLib_Config['enable-shared'] = enable_config("shared")
|
||||||
|
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# use old extconf.rb ?
|
# use old extconf.rb ?
|
||||||
##############################################################
|
##############################################################
|
||||||
|
@ -543,13 +551,13 @@ end
|
||||||
|
|
||||||
def get_ext_list()
|
def get_ext_list()
|
||||||
exts = [CONFIG['DLEXT']]
|
exts = [CONFIG['DLEXT']]
|
||||||
exts.concat %w(dll lib) if is_win32?
|
exts.concat %w(dll) if is_win32?
|
||||||
exts.concat %w(bundle dylib) if is_macosx?
|
exts.concat %w(bundle dylib) if is_macosx?
|
||||||
|
|
||||||
if enable_config("shared") == false
|
if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false
|
||||||
[CONFIG['LIBEXT'], "a"].concat exts
|
exts.unshift "lib" if is_win32?
|
||||||
else
|
exts.unshift "a"
|
||||||
exts.concat [CONFIG['LIBEXT'], "a"]
|
exts.unshift CONFIG['LIBEXT']
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_win32?
|
if is_win32?
|
||||||
|
@ -786,10 +794,20 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
|
||||||
|
|
||||||
# parse tclConfig.sh/tkConfig.sh
|
# parse tclConfig.sh/tkConfig.sh
|
||||||
tclconf = (tclpath)? parse_tclConfig(tclpath): nil
|
tclconf = (tclpath)? parse_tclConfig(tclpath): nil
|
||||||
next if tclconf && tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
|
if tclconf
|
||||||
|
next if tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
|
||||||
|
next if TkLib_Config['unsupported_versions'].find{|ver|
|
||||||
|
ver == "#{tclconf['TCL_MAJOR_VERSION']}.#{tclconf['TCL_MINOR_VERSION']}"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
tkconf = (tkpath)? parse_tclConfig(tkpath): nil
|
tkconf = (tkpath)? parse_tclConfig(tkpath): nil
|
||||||
next if tkconf && tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
|
if tkconf
|
||||||
|
next if tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
|
||||||
|
next if TkLib_Config['unsupported_versions'].find{|ver|
|
||||||
|
ver == "#{tkconf['TK_MAJOR_VERSION']}.#{tkconf['TK_MINOR_VERSION']}"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
# nativethread check
|
# nativethread check
|
||||||
if !TkLib_Config["ruby_with_thread"]
|
if !TkLib_Config["ruby_with_thread"]
|
||||||
|
@ -1292,6 +1310,10 @@ end
|
||||||
def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
|
def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
|
||||||
tcl_opt_paths, tk_opt_paths)
|
tcl_opt_paths, tk_opt_paths)
|
||||||
st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
|
st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
|
||||||
|
if !st && TkLib_Config['enable-shared'] == nil
|
||||||
|
TkLib_Config['enable-shared'] = false
|
||||||
|
st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
|
||||||
|
end
|
||||||
unless st
|
unless st
|
||||||
puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
|
puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
|
||||||
return false
|
return false
|
||||||
|
@ -1304,6 +1326,10 @@ def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
|
||||||
end
|
end
|
||||||
|
|
||||||
st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
|
st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
|
||||||
|
if !st && TkLib_Config['enable-shared'] == nil
|
||||||
|
TkLib_Config['enable-shared'] = false
|
||||||
|
st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
|
||||||
|
end
|
||||||
unless st
|
unless st
|
||||||
puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
|
puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -125,6 +125,8 @@ class TkMsgCatalog < TkObject
|
||||||
|
|
||||||
when 2 # src and trans, or, trans_list and enc
|
when 2 # src and trans, or, trans_list and enc
|
||||||
if args[0].kind_of?(Array)
|
if args[0].kind_of?(Array)
|
||||||
|
# trans_list
|
||||||
|
self.set_translation_list(loc, *args)
|
||||||
else
|
else
|
||||||
#self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
|
#self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
|
||||||
self.set_translation(loc, *args)
|
self.set_translation(loc, *args)
|
||||||
|
@ -199,7 +201,11 @@ class TkMsgCatalog < TkObject
|
||||||
file = File.join(dir, loc + self::MSGCAT_EXT)
|
file = File.join(dir, loc + self::MSGCAT_EXT)
|
||||||
if File.readable?(file)
|
if File.readable?(file)
|
||||||
count += 1
|
count += 1
|
||||||
eval(open(file){|f| f.read})
|
if TkCore::WITH_ENCODING
|
||||||
|
eval(IO.read(file, :encoding=>"ASCII-8BIT"))
|
||||||
|
else
|
||||||
|
eval(IO.read(file))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
count
|
count
|
||||||
|
@ -215,7 +221,11 @@ class TkMsgCatalog < TkObject
|
||||||
file = File.join(dir, loc + @msgcat_ext)
|
file = File.join(dir, loc + @msgcat_ext)
|
||||||
if File.readable?(file)
|
if File.readable?(file)
|
||||||
count += 1
|
count += 1
|
||||||
@namespace.eval(open(file){|f| f.read})
|
if TkCore::WITH_ENCODING
|
||||||
|
@namespace.eval(IO.read(file, :encoding=>"ASCII-8BIT"))
|
||||||
|
else
|
||||||
|
@namespace.eval(IO.read(file))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
count
|
count
|
||||||
|
@ -229,30 +239,21 @@ class TkMsgCatalog < TkObject
|
||||||
def self.set_translation(locale, src_str, trans_str=None, enc='utf-8')
|
def self.set_translation(locale, src_str, trans_str=None, enc='utf-8')
|
||||||
if trans_str && trans_str != None
|
if trans_str && trans_str != None
|
||||||
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
|
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
|
||||||
Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
|
Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}"))
|
||||||
locale,
|
|
||||||
_get_eval_string(src_str, true),
|
|
||||||
trans_str))
|
|
||||||
else
|
else
|
||||||
Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
|
Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}"))
|
||||||
locale,
|
|
||||||
_get_eval_string(src_str, true)))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def set_translation(locale, src_str, trans_str=None, enc='utf-8')
|
def set_translation(locale, src_str, trans_str=None, enc='utf-8')
|
||||||
if trans_str && trans_str != None
|
if trans_str && trans_str != None
|
||||||
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
|
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
|
||||||
Tk.UTF8_String(@namespace.eval{
|
Tk.UTF8_String(@namespace.eval{
|
||||||
tk_call_without_enc('::msgcat::mcset',
|
ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}")
|
||||||
locale,
|
|
||||||
_get_eval_string(src_str, true),
|
|
||||||
trans_str)
|
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
Tk.UTF8_String(@namespace.eval{
|
Tk.UTF8_String(@namespace.eval{
|
||||||
tk_call_without_enc('::msgcat::mcset',
|
ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}")
|
||||||
locale,
|
})
|
||||||
_get_eval_string(src_str, true))})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -262,12 +263,13 @@ class TkMsgCatalog < TkObject
|
||||||
trans_list.each{|src, trans|
|
trans_list.each{|src, trans|
|
||||||
if trans && trans != None
|
if trans && trans != None
|
||||||
list << _get_eval_string(src, true)
|
list << _get_eval_string(src, true)
|
||||||
list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
|
list << Tk.UTF8_String(_toUTF8(trans, enc))
|
||||||
else
|
else
|
||||||
list << _get_eval_string(src, true) << ''
|
list << _get_eval_string(src, true) << ''
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
number(tk_call_without_enc('::msgcat::mcmset', locale, list))
|
#number(tk_call_without_enc('::msgcat::mcmset', locale, list))
|
||||||
|
number(ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}"))
|
||||||
end
|
end
|
||||||
def set_translation_list(locale, trans_list, enc='utf-8')
|
def set_translation_list(locale, trans_list, enc='utf-8')
|
||||||
# trans_list ::= [ [src, trans], [src, trans], ... ]
|
# trans_list ::= [ [src, trans], [src, trans], ... ]
|
||||||
|
@ -281,7 +283,8 @@ class TkMsgCatalog < TkObject
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
number(@namespace.eval{
|
number(@namespace.eval{
|
||||||
tk_call_without_enc('::msgcat::mcmset', locale, list)
|
#tk_call_without_enc('::msgcat::mcmset', locale, list)
|
||||||
|
ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}")
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -325,12 +325,7 @@ class TkNamespace < TkObject
|
||||||
def code(script = Proc.new)
|
def code(script = Proc.new)
|
||||||
if script.kind_of?(String)
|
if script.kind_of?(String)
|
||||||
cmd = proc{|*args|
|
cmd = proc{|*args|
|
||||||
if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
|
ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
|
||||||
obj = ScopeArgs.new(@fullname,*args)
|
|
||||||
ret = obj.instance_exec(obj, script)
|
|
||||||
else
|
|
||||||
ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
|
|
||||||
end
|
|
||||||
id = ret.object_id
|
id = ret.object_id
|
||||||
TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
|
TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
|
||||||
id
|
id
|
||||||
|
|
|
@ -70,7 +70,7 @@ module Tk::TkTable::ConfigMethod
|
||||||
private :__item_strval_optkeys
|
private :__item_strval_optkeys
|
||||||
|
|
||||||
def __item_val2ruby_optkeys(id) # { key=>method, ... }
|
def __item_val2ruby_optkeys(id) # { key=>method, ... }
|
||||||
super(id).update('window'=>proc{|v| window(v)})
|
super(id).update('window'=>proc{|k,v| window(v)})
|
||||||
end
|
end
|
||||||
private :__item_val2ruby_optkeys
|
private :__item_val2ruby_optkeys
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#
|
#
|
||||||
require 'tk'
|
require 'tk'
|
||||||
|
|
||||||
|
module Tk::RbWidget; end
|
||||||
|
|
||||||
class Tk::RbWidget::ScrollFrame < TkFrame
|
class Tk::RbWidget::ScrollFrame < TkFrame
|
||||||
include TkComposite
|
include TkComposite
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue