def on_remove_state_button_clicked(self):
		self.state_view.get_selection().selected_foreach(NewHMMDialog.remove_state)

	def remove_state(treemodel, path, iter):
		self.state_list.remove(path)

	def on_insert_emission_button_clicked(self):
		i = self.emission_list.append()
		self.emission_view.set_cursor(self.emission_list.get_path(i), self.emission_column, start_editing=True)
		#self.state_view.grab_focus()

	def on_emission_cell_edited(self, path, new_text):
		if len(new_text) == 0:
			self.emission_list.remove(self.emission_list.get_iter(path))
		else:
			self.emission_list.set(self.emission_list.get_iter(path), 0, new_text)

	def on_remove_emission_button_clicked(self):
		self.emission_view.get_selection().selected_foreach(NewHMMDialog.remove_emission)

	def remove_emission(treemodel, path, iter):
		self.emission_list.remove(path)

if __name__ == '__main__':
	mw = MainWindow()
	mw.show()
	d = NewHMMDialog(parent=mw)
	d.show()
	mw.main()
		text = text + '}\n'
		return text

	def set_hmm(self, hmm):
		self.set_dotcode(self.hmm_to_graph(hmm))

	def connect(self, name, cb):
		if name == 'hmm_clicked':
			self.cb_clicked = cb
		else:
			super(HMMDisplayWidget, self).connect(name, cb)


if __name__ == '__main__':
	from telehmmatic.hmm import HiddenMarkovModel
	from telehmmatic.ui.main_window import MainWindow

	window = MainWindow()
	display_widget = HMMDisplayWidget()
	window.vbox_main.pack_end(display_widget, True, True, 0)

	hmm = HiddenMarkovModel(['connected', 'disconnected'],
	                        ['received','lost'],
	                        [[0.99, 0.01], [0.02, 0.98]],
	                        [[0.9, 0.1], [0.05, 0.95]])
	display_widget.set_hmm(hmm)

	window.show_all()
	window.main()