~strainanalyser/strainanalyser/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/python

import gtk

from util import *
from datahandling import *
from graphing import *


class StrainAnalyserDatasetDiffUI(AbstractUI):

	def __init__(self):
		super(StrainAnalyserDatasetDiffUI, self).__init__("datasetdiff.xml", "datasetdiffwindow")

		self.datasetcollection = StrainAnalyserDatasetCollection()

		# initialise dataset list model-view-controller stuff
		widget = self.get_object("datasetlist")
		cols = [

				("Name", 0),
			]
		for (title, columnId) in cols:
			column = gtk.TreeViewColumn(title, gtk.CellRendererText(), text=columnId)
			column.set_resizable(True)
			column.set_sort_column_id(columnId)
			column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
			column.set_expand(True)
			widget.append_column(column)
		widget.set_model(self.datasetcollection)

		# fix other widgets whose defaults are not picked up from Glade correctly
		self.get_object("noisefilt_order").set_value(5)
		self.get_object("noisefilt_kernel").set_value(51)

		# TODO: graph faff
		#self.datagraph = StrainAnalyserDataGraph(
		#		widget_add_cb=self.get_object("graphcontainer").add,
		#		set_temperature_offset_cb=self.set_temperature_offset,
		#		set_range_cb=self.set_range,
		#		avg_dataset_strain=self.avg_strain_dataset,
		#		avg_dataset_temperature=self.avg_temperature_dataset
		#	)


	# Signal handlers

	def on_datasetdiffwindow_destroy(self, widget):
		gtk.main_quit()

	def on_open_dataset_clicked(self, widget):
		# TODO
		self.datagraph.redraw()

	def on_new_dataset_clicked(self, widget):
		# TODO
		pass

	def on_edit_dataset_clicked(self, widget):
		# TODO
		pass

	def on_remove_dataset_clicked(self, widget):
		datasetlist = self.get_object("datasetlist")
		cursor = datasetlist.get_cursor()[0]
		if cursor:
			index = cursor[0]
			self.datasetcollection.remove_file(index)
			self.datagraph.redraw()

	def on_noisefilt_order_slider_value_changed(self, widget):
		# TODO
		#self.datagraph.redraw()
		pass

	def on_noisefilt_order_kernel_value_changed(self, widget):
		# TODO
		#self.datagraph.redraw()
		pass


if __name__ == "__main__":
	ui = StrainAnalyserDatasetDiffUI()
	ui.show()
	gtk.main()