ruby-changes:4572
From: ko1@a...
Date: Fri, 18 Apr 2008 08:06:59 +0900 (JST)
Subject: [ruby-changes:4572] nagai - Ruby:r16066 (ruby_1_8): * ext/tk/lib/tk.rb, ext/tk/lib/tk/scrollbar.rb, ext/tk/lib/tk/scale.rb:
nagai 2008-04-18 08:06:33 +0900 (Fri, 18 Apr 2008) New Revision: 16066 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ext/tk/lib/tk/scale.rb branches/ruby_1_8/ext/tk/lib/tk/scrollbar.rb branches/ruby_1_8/ext/tk/lib/tk.rb branches/ruby_1_8/ext/tk/lib/tkextlib/blt/ted.rb branches/ruby_1_8/ext/tk/lib/tkextlib/blt/unix_dnd.rb branches/ruby_1_8/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb branches/ruby_1_8/ext/tk/lib/tkextlib/version.rb Log: * ext/tk/lib/tk.rb, ext/tk/lib/tk/scrollbar.rb, ext/tk/lib/tk/scale.rb: improve unknonw-option check when create a widget. * ext/tk/lib/tkextlib/blt/unix_dnd.rb, ext/tk/lib/tkextlib/blt/ted.rb, ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix on 'cget'. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/scale.rb?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/blt/unix_dnd.rb?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/blt/ted.rb?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/version.rb?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/scrollbar.rb?r1=16066&r2=16065&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk.rb?r1=16066&r2=16065&diff_format=u Index: ruby_1_8/ext/tk/lib/tk.rb =================================================================== --- ruby_1_8/ext/tk/lib/tk.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tk.rb (revision 16066) @@ -4799,8 +4799,15 @@ tk_call_without_enc(cmd, @path) keys = __check_available_configure_options(keys) unless keys.empty? - tk_call_without_enc('destroy', @path) - tk_call_without_enc(cmd, @path, *hash_kv(keys, true)) + begin + tk_call_without_enc('destroy', @path) + rescue + # cannot destroy + configure(keys) + else + # re-create widget + tk_call_without_enc(cmd, @path, *hash_kv(keys, true)) + end end end end @@ -5341,7 +5348,7 @@ #Tk.freeze module Tk - RELEASE_DATE = '2008-04-15'.freeze + RELEASE_DATE = '2008-04-18'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' Index: ruby_1_8/ext/tk/lib/tkextlib/blt/unix_dnd.rb =================================================================== --- ruby_1_8/ext/tk/lib/tkextlib/blt/unix_dnd.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tkextlib/blt/unix_dnd.rb (revision 16066) @@ -34,7 +34,7 @@ private :itemconfiginfo, :current_itemconfiginfo def cget(win, option) - itemconfigure(['cget', win], slot, value) + itemcget(['cget', win], option) end def configure(win, slot, value=None) itemconfigure(['configure', win], slot, value) @@ -46,8 +46,8 @@ current_itemconfiginfo(['configure', win], slot) end - def tokwn_cget(win, option) - itemconfigure(['token', 'cget', win], slot, value) + def token_cget(win, option) + itemcget(['token', 'cget', win], option) end def token_configure(win, slot, value=None) itemconfigure(['token', 'configure', win], slot, value) Index: ruby_1_8/ext/tk/lib/tkextlib/blt/ted.rb =================================================================== --- ruby_1_8/ext/tk/lib/tkextlib/blt/ted.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tkextlib/blt/ted.rb (revision 16066) @@ -34,7 +34,7 @@ private :itemconfiginfo, :current_itemconfiginfo def cget(master, option) - itemconfigure(master, slot, value) + itemcget(master, option) end def configure(master, slot, value=None) itemconfigure(master, slot, value) Index: ruby_1_8/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb =================================================================== --- ruby_1_8/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb (revision 16066) @@ -518,7 +518,8 @@ def notify_cget(win, pattern, option) pattern = "<#{pattern}>" - itemconfigure(['notify', [win, pattern]], option) + # "notify" doesn't have cget subcommand. + current_itemconfiginfo(['notify', [win, pattern]])[option.to_s] end def notify_configure(win, pattern, slot, value=None) pattern = "<#{pattern}>" @@ -528,7 +529,10 @@ pattern = "<#{pattern}>" itemconfiginfo(['notify', [win, pattern]], slot) end - alias current_notify_configinfo notify_configinfo + def current_notify_configinfo(tagOrId, slot=nil) + pattern = "<#{pattern}>" + current_itemconfiginfo(['notify', [win, pattern]], slot) + end def style_cget(tagOrId, option) itemcget(['style', tagOrId], option) Index: ruby_1_8/ext/tk/lib/tkextlib/version.rb =================================================================== --- ruby_1_8/ext/tk/lib/tkextlib/version.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tkextlib/version.rb (revision 16066) @@ -2,5 +2,5 @@ # release date of tkextlib # module Tk - Tkextlib_RELEASE_DATE = '2008-04-14'.freeze + Tkextlib_RELEASE_DATE = '2008-04-18'.freeze end Index: ruby_1_8/ext/tk/lib/tk/scrollbar.rb =================================================================== --- ruby_1_8/ext/tk/lib/tk/scrollbar.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tk/scrollbar.rb (revision 16066) @@ -31,9 +31,16 @@ tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? - tk_call_without_enc('destroy', @path) - tk_call_without_enc(self.class::TkCommandNames[0], @path, - *hash_kv(keys, true)) + begin + tk_call_without_enc('destroy', @path) + rescue + # cannot destroy + configure(keys) + else + # re-create widget + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + end end end end Index: ruby_1_8/ext/tk/lib/tk/scale.rb =================================================================== --- ruby_1_8/ext/tk/lib/tk/scale.rb (revision 16065) +++ ruby_1_8/ext/tk/lib/tk/scale.rb (revision 16066) @@ -26,9 +26,16 @@ tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? - tk_call_without_enc('destroy', @path) - tk_call_without_enc(self.class::TkCommandNames[0], @path, - *hash_kv(keys, true)) + begin + tk_call_without_enc('destroy', @path) + rescue + # cannot destroy + configure(keys) + else + # re-create widget + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + end end end end Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 16065) +++ ruby_1_8/ChangeLog (revision 16066) @@ -1,3 +1,11 @@ +Fri Apr 18 07:56:18 2008 Hidetoshi NAGAI <nagai@a...> + + * ext/tk/lib/tk.rb, ext/tk/lib/tk/scrollbar.rb, ext/tk/lib/tk/scale.rb: + improve unknonw-option check when create a widget. + + * ext/tk/lib/tkextlib/blt/unix_dnd.rb, ext/tk/lib/tkextlib/blt/ted.rb, + ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix on 'cget'. + Thu Apr 17 22:03:52 2008 akira yamada <akira@a...> * lib/uri/ftp.rb, lib/uri/generic.rb, test/uri/test_common.rb, -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/