mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bug fix ( tested with Ruby/Tk widget demo )
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
37b2487c70
commit
7544bfc130
6 changed files with 25 additions and 15 deletions
|
@ -191,6 +191,7 @@ module TkComm
|
||||||
conf
|
conf
|
||||||
end
|
end
|
||||||
private :hash_kv
|
private :hash_kv
|
||||||
|
module_function :hash_kv
|
||||||
|
|
||||||
def array2tk_list(ary)
|
def array2tk_list(ary)
|
||||||
ary.collect{|e|
|
ary.collect{|e|
|
||||||
|
@ -205,6 +206,7 @@ module TkComm
|
||||||
}.join(" ")
|
}.join(" ")
|
||||||
end
|
end
|
||||||
private :array2tk_list
|
private :array2tk_list
|
||||||
|
module_function :array2tk_list
|
||||||
|
|
||||||
def bool(val)
|
def bool(val)
|
||||||
case val
|
case val
|
||||||
|
@ -307,15 +309,16 @@ module TkComm
|
||||||
|
|
||||||
def _curr_cmd_id
|
def _curr_cmd_id
|
||||||
#id = format("c%.4d", Tk_IDs[0])
|
#id = format("c%.4d", Tk_IDs[0])
|
||||||
id = "c" + Tk_IDs[0]
|
id = "c" + TkComm::Tk_IDs[0]
|
||||||
end
|
end
|
||||||
def _next_cmd_id
|
def _next_cmd_id
|
||||||
id = _curr_cmd_id
|
id = _curr_cmd_id
|
||||||
#Tk_IDs[0] += 1
|
#Tk_IDs[0] += 1
|
||||||
Tk_IDs[0].succ!
|
TkComm::Tk_IDs[0].succ!
|
||||||
id
|
id
|
||||||
end
|
end
|
||||||
private :_curr_cmd_id, :_next_cmd_id
|
private :_curr_cmd_id, :_next_cmd_id
|
||||||
|
module_function :_curr_cmd_id, :_next_cmd_id
|
||||||
|
|
||||||
def install_cmd(cmd)
|
def install_cmd(cmd)
|
||||||
return '' if cmd == ''
|
return '' if cmd == ''
|
||||||
|
@ -332,6 +335,7 @@ module TkComm
|
||||||
TkCore::INTERP.tk_cmd_tbl.delete(id)
|
TkCore::INTERP.tk_cmd_tbl.delete(id)
|
||||||
end
|
end
|
||||||
private :install_cmd, :uninstall_cmd
|
private :install_cmd, :uninstall_cmd
|
||||||
|
module_function :install_cmd
|
||||||
|
|
||||||
def install_win(ppath,name=nil)
|
def install_win(ppath,name=nil)
|
||||||
if !name or name == ''
|
if !name or name == ''
|
||||||
|
@ -1213,8 +1217,8 @@ module Tk
|
||||||
if bar
|
if bar
|
||||||
@xscrollbar = bar
|
@xscrollbar = bar
|
||||||
@xscrollbar.orient 'horizontal'
|
@xscrollbar.orient 'horizontal'
|
||||||
self.xscrollcommand {|arg| @xscrollbar.set(*arg)}
|
self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
|
||||||
@xscrollbar.command {|arg| self.xview(*arg)}
|
@xscrollbar.command {|*arg| self.xview(*arg)}
|
||||||
end
|
end
|
||||||
@xscrollbar
|
@xscrollbar
|
||||||
end
|
end
|
||||||
|
@ -1222,8 +1226,8 @@ module Tk
|
||||||
if bar
|
if bar
|
||||||
@yscrollbar = bar
|
@yscrollbar = bar
|
||||||
@yscrollbar.orient 'vertical'
|
@yscrollbar.orient 'vertical'
|
||||||
self.yscrollcommand {|arg| @yscrollbar.set(*arg)}
|
self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
|
||||||
@yscrollbar.command {|arg| self.yview(*arg)}
|
@yscrollbar.command {|*arg| self.yview(*arg)}
|
||||||
end
|
end
|
||||||
@yscrollbar
|
@yscrollbar
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,6 +74,7 @@ class TkDialog2 < TkWindow
|
||||||
@title = keys['title'] if keys.key? 'title'
|
@title = keys['title'] if keys.key? 'title'
|
||||||
@message = keys['message'] if keys.key? 'message'
|
@message = keys['message'] if keys.key? 'message'
|
||||||
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
|
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
|
||||||
|
@bitmap = '{}' if @bitmap == nil || @bitmap == ""
|
||||||
@default_button = keys['default'] if keys.key? 'default'
|
@default_button = keys['default'] if keys.key? 'default'
|
||||||
@buttons = keys['buttons'] if keys.key? 'buttons'
|
@buttons = keys['buttons'] if keys.key? 'buttons'
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def init_instance_variable
|
def init_instance_variable
|
||||||
@cmdtbl = {}
|
@cmdtbl = []
|
||||||
@tags = {}
|
@tags = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ if ARGV.length == 0
|
||||||
if ENV['MAIL']
|
if ENV['MAIL']
|
||||||
$spool = ENV['MAIL']
|
$spool = ENV['MAIL']
|
||||||
else
|
else
|
||||||
$spool = '/usr/spool/mail/' + ENV['USER']
|
$spool = '/var/spool/mail/' + ENV['USER']
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
$spool = ARGV[0]
|
$spool = ARGV[0]
|
||||||
|
@ -70,7 +70,13 @@ end
|
||||||
|
|
||||||
require "tkscrollbox"
|
require "tkscrollbox"
|
||||||
|
|
||||||
|
my_appname = Tk.appname('tkbiff')
|
||||||
$top = TkRoot.new
|
$top = TkRoot.new
|
||||||
|
if ((TkWinfo.interps($top) - [my_appname]).find{|ip| ip =~ /^tkbiff/})
|
||||||
|
STDERR.print("Probably other 'tkbiff's are running. Bye.\n")
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
$top.withdraw
|
$top.withdraw
|
||||||
$list = TkScrollbox.new($top) {
|
$list = TkScrollbox.new($top) {
|
||||||
relief 'raised'
|
relief 'raised'
|
||||||
|
@ -136,12 +142,12 @@ def pop_up
|
||||||
$list.see 'end'
|
$list.see 'end'
|
||||||
end
|
end
|
||||||
$top.deiconify
|
$top.deiconify
|
||||||
Tk.after 2000, proc{$top.withdraw}
|
Tk.after 2000, proc{$top.iconify}
|
||||||
end
|
end
|
||||||
|
|
||||||
$list.insert 'end', "You have no mail."
|
$list.insert 'end', "You have no mail."
|
||||||
check
|
check
|
||||||
Tk.after 2000, proc{$top.withdraw}
|
Tk.after 2000, proc{$top.iconify}
|
||||||
begin
|
begin
|
||||||
Tk.mainloop
|
Tk.mainloop
|
||||||
rescue
|
rescue
|
||||||
|
|
|
@ -54,7 +54,6 @@ bot.pack
|
||||||
root.pack('side'=>'top', 'fill'=>'both', 'expand'=>'yes')
|
root.pack('side'=>'top', 'fill'=>'both', 'expand'=>'yes')
|
||||||
|
|
||||||
def quit(button)
|
def quit(button)
|
||||||
print "aaa\n"
|
|
||||||
print "You pressed the \"#{button}\" button; bye-bye!\n"
|
print "You pressed the \"#{button}\" button; bye-bye!\n"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,9 +54,9 @@ if ARGV.length == 0
|
||||||
if ENV['MAIL']
|
if ENV['MAIL']
|
||||||
ARGV[0] = ENV['MAIL']
|
ARGV[0] = ENV['MAIL']
|
||||||
elsif ENV['USER']
|
elsif ENV['USER']
|
||||||
ARGV[0] = '/usr/spool/mail/' + ENV['USER']
|
ARGV[0] = '/var/spool/mail/' + ENV['USER']
|
||||||
elsif ENV['LOGNAME']
|
elsif ENV['LOGNAME']
|
||||||
ARGV[0] = '/usr/spool/mail/' + ENV['LOGNAME']
|
ARGV[0] = '/var/spool/mail/' + ENV['LOGNAME']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ require "tk"
|
||||||
list = scroll = nil
|
list = scroll = nil
|
||||||
TkFrame.new{|f|
|
TkFrame.new{|f|
|
||||||
list = TkListbox.new(f) {
|
list = TkListbox.new(f) {
|
||||||
yscroll proc{|idx|
|
yscroll proc{|*idx|
|
||||||
scroll.set *idx
|
scroll.set *idx
|
||||||
}
|
}
|
||||||
relief 'raised'
|
relief 'raised'
|
||||||
|
@ -94,7 +94,7 @@ root.bind "space", proc{exit}
|
||||||
|
|
||||||
$outcount = 0;
|
$outcount = 0;
|
||||||
for file in ARGV
|
for file in ARGV
|
||||||
next if File.exist?(file)
|
next unless File.exist?(file)
|
||||||
atime = File.atime(file)
|
atime = File.atime(file)
|
||||||
mtime = File.mtime(file)
|
mtime = File.mtime(file)
|
||||||
f = open(file, "r")
|
f = open(file, "r")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue