38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/glimmer/dsl/tk/built_in_dialog_expression.rb', line 38
def interpret(parent, keyword, *args, &block)
if args.first.is_a?(Hash)
options = args.first.symbolize_keys
options[:initialcolor] = options.delete(:initial_color) if options.keys.include?(:initial_color)
options[:filetypes] = options.delete(:file_types) if options.keys.include?(:file_types)
options[:filetypes] = options[:filetypes].map { |key, value| "{#{key}} {#{value}}" } if options[:filetypes].is_a?(Hash)
options[:parent] = options[:parent].tk if options[:parent].is_a?(Glimmer::Tk::RootProxy)
args[0] = options
end
keyword = "get_#{keyword}" if keyword.start_with?('open') || keyword.start_with?('save') || keyword.start_with?('multiple')
if keyword == 'choose_font'
TkFont::Fontchooser.configure(:font => args, :command => block)
TkFont::Fontchooser.show
else
::Tk.send(keyword.camelcase, *args)
end
end
|