Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tk library and sample change. #295

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion ext/tk/lib/tk/canvas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ def tagid(tag)

# create a canvas item without creating a TkcItem object
def create(type, *args)
type = TkcItem.type2class(type.to_s) unless type.kind_of?(TkcItem)
if TkcItem.type2class(type.to_s)
type = TkcItem.type2class(type.to_s)
elsif type.kind_of?(Class) and type.ancestors.member?(TkcItem)
else
raise "type must a TkcItem class, or a string in CItemTypeToClass"
end
type.create(self, *args)
end

Expand Down
2 changes: 1 addition & 1 deletion ext/tk/sample/demos-en/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
end
}

7. Resize the window. This widget has been configured with the "setGrid"
8. Resize the window. This widget has been configured with the "setGrid"
option on, so that if you resize the window it will always resize to an
even number of characters high and wide. Also, if you make the window
narrow you can see that long lines automatically wrap around onto
Expand Down
2 changes: 1 addition & 1 deletion ext/tk/sample/demos-en/tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def populate_tree(tree, node)
path = tree.get(node, :fullpath)
tree.delete(tree.children(node))
Dir.glob("#{path}/*").sort.each{|f|
type = File.ftype(f)
type = File.ftype(f) rescue nil
id = tree.insert(node, :end,
:text=>File.basename(f), :values=>[f, type]).id
if type == 'directory'
Expand Down
6 changes: 3 additions & 3 deletions ext/tk/sample/demos-en/widget
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def eval_samplecode(code, file=nil)
end
}
}
Tk.update
Tk.update rescue nil
end

# invoke --
Expand All @@ -699,7 +699,7 @@ def invoke(txt, idx)

cursor = txt.cget('cursor')
txt.cursor('watch')
Tk.update
Tk.update rescue nil
# eval(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, _null_binding)
# Tk.update
eval_samplecode(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, tag[5..-1] + '.rb')
Expand Down Expand Up @@ -1058,7 +1058,7 @@ if ARGV[0] == '-n'
no_launcher = true if ARGV.size > 0
else
# show the root widget to make it lower then demo windows
Tk.update
Tk.update rescue nil
end
ARGV.each{|cmd|
if cmd =~ /(.*).rb/
Expand Down