Example #1
0
	def __init__(self, parent, coordinator=None):
		# Call the parent constructors
		super(TestCorpusDescriberWindow, self).__init__(parent, fill=True)

		# Initialize class variables
		self.coordinator = coordinator
		self.firmwareDict = dict() # firmware objects by key basename
		self.sectionDict = dict() # section objects by key bounds

		# Setup the window objects
		# First, the firmware list
		self.__firmwareList = Listbox(self,
				listChangeCallback=self._firmwareSelectionChangeCallback)
		self.__firmwareList.grid({"row": 0, "column": 0, "rowspan": 10,
				"sticky": "nswe"})

		# The buttons that manage the firmware list - in their own frame
		self.__firmwareButtonFrame = Frame(self)
		self.__firmwareButtonFrame.grid({"row": 10, "column": 0})

		self.__deleteFirmwareButton = Button(self.__firmwareButtonFrame,
				text="Delete", callback=self._deleteFirmwareButtonCallback)
		self.__deleteFirmwareButton.grid({"row": 0, "column": 0})

		self.__addFirmwareButton = Button(self.__firmwareButtonFrame,
				text="Add", callback=self._addFirmwareButtonCallback)
		self.__addFirmwareButton.grid({"row": 0, "column": 2})
		
		# Second, the section list
		self.__sectionList = Listbox(self,
				listChangeCallback=self._sectionSelectionChangeCallback)
		self.__sectionList.grid({"row": 0, "column": 1, "rowspan": 9,
				"sticky": "nsew"})

		# The buttons that manage the section list - in their own frame
		self.__sectionListButtonFrame = Frame(self)
		self.__sectionListButtonFrame.grid({"row": 9, "column": 1, "rowspan": 2})

		self.__sectionStartEntry = Entry(self.__sectionListButtonFrame, width=4)
		self.__sectionStartEntry.grid({"row": 0, "column": 0})
		self.__sectionEndEntry = Entry(self.__sectionListButtonFrame, width=4)
		self.__sectionEndEntry.grid({"row": 0, "column": 1})

		self.__addSection = Button(self.__sectionListButtonFrame, text="Add",
				callback=self._addSectionCallback)
		self.__addSection.grid({"row": 1, "column": 0})

		self.__deleteSection = Button(self.__sectionListButtonFrame,
				text="Delete", callback=self._deleteSectionCallback)
		self.__deleteSection.grid({"row": 1, "column": 1})

		# Lastly, the properties box
		# First the global config options, in their own frame
		self.__globalOptionsFrame = Frame(self, highlight=True)
		self.__globalOptionsFrame.grid({"row": 0, "column": 2, "rowspan": 4,
				"sticky": "nsew"})

		self.__globalSettingsLabel = Label(self.__globalOptionsFrame,
				text="Global Settings")
		self.__globalSettingsLabel.grid({"row": 0, "column":0, "columnspan": 3})

		self.__corpusNameLabel = Label(self.__globalOptionsFrame,
				text="Corpus Name:")
		self.__corpusNameLabel.grid({"row": 1, "column": 0})
		self.__corpusNameEntry = Entry(self.__globalOptionsFrame)
		self.__corpusNameEntry.grid({"row": 1, "column": 1, "columnspan": 2})

		self.__corpusDescriptionLabel = Label(self.__globalOptionsFrame,
				text="Description:")
		self.__corpusDescriptionLabel.grid({"row": 2, "column": 0})
		self.__corpusDescriptionEntry = Entry(self.__globalOptionsFrame)
		self.__corpusDescriptionEntry.grid({"row": 2, "column": 1, "columnspan": 2})

		# Next the firmware options in their own frame
		self.__firmwareOptionsFrame = Frame(self, highlight=True)
		self.__firmwareOptionsFrame.grid({"row": 4, "column": 2, "rowspan": 4, 
				"sticky": "nsew"})

		self.__firmwareSettingsLabel = Label(self.__firmwareOptionsFrame,
				text="Firmware Settings")
		self.__firmwareSettingsLabel.grid({"row": 0, "column":0, "columnspan": 3})

		self.__firmwareNameLabel = Label(self.__firmwareOptionsFrame,
				"Firmware Name:")
		self.__firmwareNameLabel.grid({"row": 1, "column": 0})
		self.__firmwareNameEntry = Entry(self.__firmwareOptionsFrame)
		self.__firmwareNameEntry.grid({"row": 1, "column": 1, "columnspan": 2})

		self.__firmwareFileNameLabel = Label(self.__firmwareOptionsFrame,
				text="Firmware File:")
		self.__firmwareFileNameLabel.grid({"row": 2, "column": 0})
		self.__firmwareFileNameEntry = Entry(self.__firmwareOptionsFrame)
		self.__firmwareFileNameEntry.grid({"row": 2, "column": 1, "columnspan": 2})

		# Next the section options in their own frame
		self.__sectionOptionsFrame = Frame(self, highlight=True)
		self.__sectionOptionsFrame.grid({"row": 8, "column": 2, "rowspan": 2,
				"sticky": "nsew"})

		self.__sectionSettingsLabel = Label(self.__sectionOptionsFrame,
				text="Section Settings")
		self.__sectionSettingsLabel.grid({"row": 0, "column":0, "columnspan": 3})

		self.__sectionFiletypeLabel = Label(self.__sectionOptionsFrame,
				"Section Filetype:")
		self.__sectionFiletypeLabel.grid({"row": 1, "column": 0})
		self.__sectionFiletypeEntry = Entry(self.__sectionOptionsFrame)
		self.__sectionFiletypeEntry.grid({"row": 1, "column": 1,
				"columnspan": 2})

		# Lastly the buttons that manage the config
		self.__globalButtonFrame = Frame(self)
		self.__globalButtonFrame.grid({"row": 10, "column": 2})

		self.__writeConfigButton = Button(self.__globalButtonFrame,
				text="Write Config", callback = self._writeConfigButtonCallback)
		self.__writeConfigButton.grid({"row": 0, "column": 0})