#    DataViewer visualization package
#    Copyright (C) 1997 Randy Paffenroth and Thomas Stone
#
#    This library is free software; you can redistribute it and/or
#    modify it under the terms of the GNU Library General Public
#    License as published by the Free Software Foundation; either
#    version 2 of the License, or (at your option) any later version.
#
#    This library is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    Library General Public License for more details.
#
#    You should have received a copy of the GNU Library General Public
#    License along with this library; if not, write to the Free
#    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#    MA 02111-1307, USA
import tkFileDialog
import Tkinter
import Pmw
import math
import string

from geom_window import GeomWindow

class ViewMoto(GeomWindow):
    def __init__(self,parent=None,cnf={},**kw):
	apply(GeomWindow.__init__,(self,parent),kw)
	self.geom.set_problem("view_moto")
        self.var={}

    def UserWidgets(self):
        #redraw with current filename
        button = Tkinter.Button(self.UserTop,text="Draw",
                                command=lambda obj=self:obj.Draw())
        button.pack()
        
        some_frame=Tkinter.Frame(self.UserTop)
        some_frame.pack()
        
	#Control widget for the geometry complexity
	self.var["geom_comp"] = Tkinter.IntVar()
	self.var["geom_comp"].set(7)
	slider1 = Tkinter.Scale(some_frame,width=15,length=200)
	slider1["from"] = 1
	slider1["to"] = 9
	slider1["variable"] = self.var["geom_comp"]
	slider1["label"] = "Geom Complexity"
	slider1["orient"] = "horizontal"
	slider1["tickinterval"] = 1
	slider1["relief"] = "raised"
	slider1.pack(side="left",padx="2m")

	#Control widget for the light complexity
	self.var["light_comp"] = Tkinter.IntVar()
	self.var["light_comp"].set(7)
	slider2 = Tkinter.Scale(some_frame,width=15,length=200)
	slider2["from"] = 1
	slider2["to"] = 9
	slider2["variable"] = self.var["light_comp"]
	slider2["label"] = "Light Complexity"
	slider2["orient"] = "horizontal"
	slider2["tickinterval"] = 1
	slider2.pack(side="left")
	slider2["relief"] = "raised"
	slider2.pack(side="left",padx="2m")

    def update_data(self,event):
	self.data = self.entry_contents.get()
    
    def Draw(self):
        data_str="%d %d" %(self.var["geom_comp"].get(),
                           self.var["light_comp"].get())
        self.geom.set_problem("view_moto")
        self.geom.file(data_str)

if __name__ == '__main__' : ViewMoto().mainloop()
