Sha256: 90ab24816de808cb5ca01b65ffc722c2594dc16e94cf1f14a4c520f39e22c976
Contents?: true
Size: 520 Bytes
Versions: 1
Compression:
Stored size: 520 Bytes
Contents
require 'gtk3' module Mireru class Widget def self.create(file) case File.extname(file) when /\A\.(png|jpe?g|gif)\z/i image = Gtk::Image.new image.file = file widget = image when /\A\.(txt|rb)\z/i buffer = Gtk::TextBuffer.new buffer.text = File.open(file).read text = Gtk::TextView.new(buffer) text.editable = false widget = text else raise "coding error: uncheck file type." end widget end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mireru-0.0.6 | lib/mireru/widget.rb |