diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-07 07:10:44 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-07 07:10:44 +0000 |
commit | 865ff7fb4f11bbf1f0e139e16470727828f54e63 (patch) | |
tree | 09e2f00bbd85e05ba96774c32f6ee3b6f543ae64 /ext/tk/sample/tkoptdb-safeTk.rb | |
parent | a7357c196559f3181e359662d92cb06d7b18e3cb (diff) |
* tcltklib.c (lib_mainloop_core): fixed signal-trap bug
* multi-tk.rb, tk.rb, tkafter.rb, tkcanvas.rb, tkfont.rb, tktext.rb,
tkvirtevent.rb : Ruby/Tk works at $SAFE == 4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/tkoptdb-safeTk.rb')
-rw-r--r-- | ext/tk/sample/tkoptdb-safeTk.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ext/tk/sample/tkoptdb-safeTk.rb b/ext/tk/sample/tkoptdb-safeTk.rb index 169cd3c171..a5e394b230 100644 --- a/ext/tk/sample/tkoptdb-safeTk.rb +++ b/ext/tk/sample/tkoptdb-safeTk.rb @@ -5,6 +5,9 @@ require 'multi-tk' TkMessage.new(:text => <<EOM).pack This is a sample of the safe-Tk slave interpreter. \ On the slave interpreter, 'tkoptdb.rb' demo is running. +( Attention:: a safe-Tk interpreter can't read options \ +from a file. Options are given by the master interpreter \ +in this script. ) The window shown this message is a root widget of \ the default master interpreter. The other window \ is a toplevel widget of the master interpreter, and it \ @@ -12,7 +15,21 @@ has a container frame of the safe-Tk slave interpreter. \ You can delete the slave by the button on the toplevel widget. EOM +if ENV['LANG'] =~ /^ja/ + # read Japanese resource + ent = TkOptionDB.read_entries(File.expand_path('resource.ja', + File.dirname(__FILE__)), + 'euc-jp') +else + # read English resource + ent = TkOptionDB.read_entries(File.expand_path('resource.en', + File.dirname(__FILE__))) +end file = File.expand_path('tkoptdb.rb', File.dirname(__FILE__)) -MultiTkIp.new_safeTk{load file} +MultiTkIp.new_safeTk{ + ent.each{|pat, val| TkOptionDB.add(pat, val)} + load file +} +# Tk.mainloop is ignored on the slave-IP -# mainloop is started on 'tkoptdb.rb' +Tk.mainloop |