From 2697c924a96f6926fcc878ae8ce9750670ec0007 Mon Sep 17 00:00:00 2001 From: nagai Date: Fri, 11 Apr 2008 01:23:38 +0000 Subject: * ext/tk/lib/tkextlib/tile.rb: __define_LoadImages_proc_for_compatibility__! do nothing when the Tcl command exists. * ext/tk/lib/tkextlib/tile/style.rb: __define_wrapper_proc_for_compatibility__! do nothing when the Tcl command exists. * ext/tk/sample/tkextlib/tile/demo.rb: don't create 'step' theme if it already exists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/tkextlib/tile.rb | 5 ++++- ext/tk/lib/tkextlib/tile/style.rb | 7 +++++-- ext/tk/sample/tkextlib/tile/demo.rb | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'ext/tk') diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 02473d57a1..76d22812ac 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -133,7 +133,10 @@ module Tk ns_list.each{|ns| cmd = "#{ns}::#{proc_name}" unless Tk.info(:commands, cmd).empty? - fail RuntimeError, "can't define '#{cmd}' command (already exist)" + #fail RuntimeError, "can't define '#{cmd}' command (already exist)" + + # do nothing !!! + warn "Warning: can't define '#{cmd}' command (already exist)" if $DEBUG end TkNamespace.eval(ns){ TkCore::INTERP.add_tk_procs(proc_name, 'imgdir {patterns {*.gif}}', diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb index bf8acb34b0..56a7f35180 100644 --- a/ext/tk/lib/tkextlib/tile/style.rb +++ b/ext/tk/lib/tkextlib/tile/style.rb @@ -34,8 +34,11 @@ class << Tk::Tile::Style if Tk::Tile::TILE_SPEC_VERSION_ID < 7 def __define_wrapper_proc_for_compatibility__! unless Tk.info(:commands, '::ttk::style').empty? - fail RuntimeError, - "can't define ':ttk::style' command (already exist)" + # fail RuntimeError, + # "can't define '::ttk::style' command (already exist)" + + # do nothing !!! + warn "Warning: can't define '::ttk::style' command (already exist)" if $DEBUG end TkCore::INTERP.add_tk_procs('::ttk::style', 'args', <<-'EOS') if [string equal [lrange $args 0 1] {element create}] { diff --git a/ext/tk/sample/tkextlib/tile/demo.rb b/ext/tk/sample/tkextlib/tile/demo.rb index 1a9c029701..633a072460 100644 --- a/ext/tk/sample/tkextlib/tile/demo.rb +++ b/ext/tk/sample/tkextlib/tile/demo.rb @@ -24,7 +24,9 @@ end Tk::Tile.__define_LoadImages_proc_for_compatibility__! Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! -Tk::Tile::Style.theme_create('step') +unless Tk::Tile::Style.theme_names.include?('step') + Tk::Tile::Style.theme_create('step') +end Tk.load_tclscript(File.join(demodir, 'toolbutton.tcl')) Tk.load_tclscript(File.join(demodir, 'repeater.tcl')) -- cgit v1.2.3