#!/usr/local/bin/ruby1.9.1
##
# @file latexitGUI.rb
# @author Mitch Richling <http://www.mitchr.me>
# @Copyright Copyright 2011 by Mitch Richling. All rights reserved.
# @Revision $Revision$
# @SCMdate $Date$
# @brief GUI for latexit.rb@EOL
# @Keywords
# @Std Ruby 1.9.1
require 'tk'
require 'open3'
root = TkRoot.new { title "LaTeX!" }
texIn = TkText.new(root) do
width 80
height 5
borderwidth 1
font TkFont.new('times 12 bold')
pack("side" => "top", "padx"=> "5", "pady"=> "5")
end
texOut = TkText.new(root) do
width 80
height 20
borderwidth 1
font TkFont.new('times 12 bold')
pack("side" => "bottom", "padx"=> "5", "pady"=> "5")
end
texBut = TkButton.new(root) do
text "Run LaTeX"
borderwidth 5
underline 0
state "normal"
cursor "watch"
font TkFont.new('times 20 bold')
foreground "red"
activebackground "blue"
relief "groove"
command (proc {
texOut.state("normal")
texOut.clear()
stdout_and_stderr_str, status = Open3.capture2("latexit.rb", :stdin_data=>texIn.value)
texOut.insert('end', stdout_and_stderr_str)
texOut.state("disabled")
})
pack("side" => "top", "padx"=> "50", "pady"=> "10")
end
Tk.mainloop
Generated by GNU Enscript 1.6.5.2.