diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-31 05:55:35 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-31 05:55:35 +0000 |
commit | 78711606b3c5e3eec4906ccc9992d7bf72cfe14e (patch) | |
tree | a3d2cb2412f0a24f94bf7a5742e353b32866b816 /ext | |
parent | 0a57886cca5ebc2743ba15ba7d1299e7a04174ec (diff) | |
download | ruby-78711606b3c5e3eec4906ccc9992d7bf72cfe14e.tar.gz |
* sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename
only [ruby-dev:25970]
* sample/tkextlib/treectrl/demo.rb: add check for existence of
'backgroundimage' option.
* sample/tkextlib/treectrl/bitmaps.rb: ditto.
* sample/tkextlib/treectrl/outlook-newgroup.rb: lack of '%I'
event callback argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/tk/ChangeLog.tkextlib | 13 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb | 2 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/bitmaps.rb | 3 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/demo.rb | 47 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb | 8 |
5 files changed, 63 insertions, 10 deletions
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib index 34954ebaa2..39d3f57926 100644 --- a/ext/tk/ChangeLog.tkextlib +++ b/ext/tk/ChangeLog.tkextlib @@ -1,5 +1,18 @@ 2005-03-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> + * sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename + only [ruby-dev:25970] + + * sample/tkextlib/treectrl/demo.rb: add check for existence of + 'backgroundimage' option. + + * sample/tkextlib/treectrl/bitmaps.rb: ditto. + + * sample/tkextlib/treectrl/outlook-newgroup.rb: lack of '%I' + event callback argument. + +2005-03-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> + * sample/tkextlib/iwidgets/sample/hierarchy.rb: fail to treat Japanese (i18n?) filenames. diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb index 9e44176696..ddb08d8b78 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb @@ -6,7 +6,7 @@ def get_files(file) dir = (file.empty?)? ENV['HOME'] : TkComm._fromUTF8(file) Dir.chdir(dir) rescue return '' Dir['*'].sort.collect{|f| - TkCore::INTERP._merge_tklist(TkComm._toUTF8(File.join(dir, f))) + [TkComm._toUTF8(File.join(dir, f)), TkComm._toUTF8(f)] } end diff --git a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb index c621e61fdc..5ada13bc60 100644 --- a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb +++ b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb @@ -2,7 +2,8 @@ # Demo: Bitmaps # def demoBitmaps(t) - if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + #if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + if @has_bgimg t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false, :backgroundimage=>@images['sky']) diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb index 92742e583c..acb5fcc192 100644 --- a/ext/tk/sample/tkextlib/treectrl/demo.rb +++ b/ext/tk/sample/tkextlib/treectrl/demo.rb @@ -42,6 +42,20 @@ class TkTreeCtrl_demo make_source_window() make_menubar() make_main_window() + + if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + begin + @tree2[:backgroundimage] + @has_bgimg = true + rescue + @has_bgimg = false + end + else + @has_bgimg = false + end + + #################### + make_list_popup() make_header_popup() @@ -328,7 +342,8 @@ class TkTreeCtrl_demo [ 'Expand', [], nil, '', {:menu_config=>{:tearoff=>false}} ] ] - if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + # if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + if @has_bgimg menuspec << \ [ 'Background Image', [ @@ -528,7 +543,8 @@ class TkTreeCtrl_demo [:data, :display, :enable].each{|k| @popup[:debug][k].value = w.debug_cget(k) } - if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + # if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + if @has_bgimg @popup[:bgimg].value = @images.key(w[:backgroundimage]) end @popup[:bgmode].value = w[:backgroundmode] @@ -667,6 +683,8 @@ class TkTreeCtrl_demo master = self + has_bgimg = @has_bgimg + scriptDir = @ScriptDir thisPlatform = @thisPlatform @@ -687,6 +705,8 @@ class TkTreeCtrl_demo @demo_scripts.instance_eval{ @master = master + @has_bgimg = has_bgimg + @display_styles_in_item = proc_disp_styles_in_item @Priv = TkVarAccess.new('::TreeCtrl::Priv') @@ -712,7 +732,25 @@ class TkTreeCtrl_demo private :_get_binding def load_demo(file) - eval(IO.readlines(file).join, _get_binding()) + puts "load \"#{file}\"" if $DEBUG + begin + eval(IO.readlines(file).join, _get_binding()) + rescue Exception => e + bt = e.backtrace + + if bt[0] =~ /^([^:]+):(\d+):/ + errline = $2.to_i + else + raise e + end + + if bt[1] =~ /^([^:]+):(\d+):/ + bt.unshift("#{file}:#{errline - $2.to_i + 1}") + raise e + else + raise e + end + end end def init_pics(*args) @@ -1063,7 +1101,8 @@ class TkTreeCtrl_demo end # Restore some happy defaults to the demo list - if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + # if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0) + if @has_bgimg @tree2.configure(:orient=>:vertical, :wrap=>'', :xscrollincrement=>0, :yscrollincrement=>0, :itemheight=>0, :showheader=>true, diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb index 41b7fbb868..26fb84a765 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb @@ -387,7 +387,7 @@ def demoOutlookNewsgroup2(t) }, '%T') t.notify_bind(t, 'Expand-after', - proc{|w| + proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read2 -> read t.item_style_map(i, 'subject', 'read', @@ -400,10 +400,10 @@ def demoOutlookNewsgroup2(t) t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) end - }, '%T') + }, '%T %I') t.notify_bind(t, 'Collapse-after', - proc{|w| + proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read -> read2 t.item_style_map(i, 'subject', 'read2', @@ -416,7 +416,7 @@ def demoOutlookNewsgroup2(t) t.item_style_map(i, 'size', 'unread.w', ['text.read', 'text.unread']) end - }, '%T') + }, '%T %I') (1...(msgCnt)).each{|i| if rand(2) == 0 |