<commit_before>"""
Objects that can be manipulated by the model editor GUI.

Originally written by <NAME>.
$Id$
"""
__version__='$Revision$'

# JABALERT: Please try to eliminate import *
from Tkinter import *
import Pmw
import math

from parametersframe import ParametersFrame

class EditorObject :
    """
    Anything that can be added and manipulated in an EditorCanvas. Every EditorCanvas
    has a corresponding Topo object associated with it. An instance of this class can 
    have the focus.
    """
    FROM = 0
    TO = 1

    # constructor
    def __init__(self, name, canvas) :
	self.canvas = canvas # retains a reference to the canvas
	self.name = name # set the name of the sheet
	self.focus = False # this does not have the focus

    def draw(self) :
	# draw the object at the current x, y position
	pass

    def showProperties(self) :
	# show parameters frame for object
	paramWindow = Toplevel()
	Label(paramWindow, text = self.name).pack(side = TOP)
	self.paramFrame = ParametersFrame(paramWindow)
	self.buttonPanel = Frame(paramWindow)
	self.buttonPanel.pack(side = BOTTOM)
        #JABHACKALERT: We also need an OK button that applies and then closes the window
	updateButton = Button(self.buttonPanel, text = 'Apply', command = self.updateParameters)
	updateButton.pack(side = LEFT)

    def updateParameters(self) :
	self.paramFrame.set_obj_params()

    def setFocus(self, focus) : # set focus
	self.focus = focus

    def move(self) :
	# update position of object and redraw
	pass

    def remove(self) :
	# remove this object from the canvas and deal with relevant 
	# Topographica objects.
	pass    

    def inBounds(self, x, y) : 
	# return true, if x,y lies within this gui object's boundary
	pass

####################################################################


class EditorNode(EditorObject) :
    """
    An EditorNode is used to cover any topographica node, presently this can only be a sheet.
    It is a sub class of EditorObject and supplies the methods required by any node to be used<commit_msg>Ok button added to objects properties window. Updates and closes.<commit_after>"""
Objects that can be manipulated by the model editor GUI.

Originally written by <NAME>.
$Id$
"""
__version__='$Revision$'

# JABALERT: Please try to eliminate import *
from Tkinter import *
import Pmw
import math

from parametersframe import ParametersFrame

class EditorObject :
    """
    Anything that can be added and manipulated in an EditorCanvas. Every EditorCanvas
    has a corresponding Topo object associated with it. An instance of this class can 
    have the focus.
    """
    FROM = 0
    TO = 1

    # constructor
    def __init__(self, name, canvas) :
	self.canvas = canvas # retains a reference to the canvas
	self.name = name # set the name of the sheet
	self.focus = False # this does not have the focus

    def draw(self) :
	# draw the object at the current x, y position
	pass

    def showProperties(self) :
	# show parameters frame for object
	paramWindow = Toplevel()
	Label(paramWindow, text = self.name).pack(side = TOP)
	self.paramFrame = ParametersFrame(paramWindow)
	self.buttonPanel = Frame(paramWindow)
	self.buttonPanel.pack(side = BOTTOM)
	updateButton = Button(self.buttonPanel, text = 'Apply', command = self.updateParameters)
	okayButton = Button(self.buttonPanel, text = 'Ok', command = lambda : self.okParameters(paramWindow))
	updateButton.pack(side = LEFT)
	okayButton.pack(side = RIGHT)

    def updateParameters(self) :
	self.paramFrame.set_obj_params()

    def okParameters(self, paramWindow) :
	self.updateParameters()
	paramWindow.destroy()

    def setFocus(self, focus) : # set focus
	self.focus = focus

    def move(self) :
	# update position of object and redraw
	pass

    def remove(self) :
	# remove this object from the canvas and deal with relevant 
	# Topographica objects.
	pass    

    def inBounds(self, x, y) : 
	# return true, if x,y lies within this gui object's boundary
	pass

####################################################################


class EditorNode(EditorObject) :
    """
    An EditorNode is used to cover any topographica node, presently this can only be a sheet.
    It is a sub class of EditorObject and supplies the methods required by any node to be used
{'fraction_non_alphanumeric': 0.10533707865168539, 'fraction_numerical': 0.0009363295880149813, 'mean_word_length': 3.833710407239819, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '940956', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1180, 'n_words': 480}