2006-04-16 20:25:54 +02:00
|
|
|
|
|
|
|
import gtk
|
|
|
|
import gobject
|
|
|
|
import plots
|
|
|
|
import logger
|
2006-04-21 11:23:05 +02:00
|
|
|
import dataset
|
|
|
|
import project
|
2006-04-16 20:25:54 +02:00
|
|
|
|
|
|
|
class NavigatorView (gtk.TreeView):
|
2006-04-21 11:23:05 +02:00
|
|
|
def __init__(self, project, app):
|
|
|
|
self.project = project
|
|
|
|
self.data_tree = project.data_tree
|
2006-04-16 20:25:54 +02:00
|
|
|
self.app = app
|
2006-04-21 11:23:05 +02:00
|
|
|
|
|
|
|
gtk.TreeView.__init__(self, self.data_tree)
|
2006-04-16 20:25:54 +02:00
|
|
|
|
|
|
|
self.set_headers_visible(False)
|
|
|
|
self.connect('row-activated', self.row_activated_handler)
|
|
|
|
|
|
|
|
renderer = gtk.CellRendererText()
|
|
|
|
self.object_col = gtk.TreeViewColumn('Object', renderer, text=0)
|
|
|
|
self.append_column(self.object_col)
|
|
|
|
|
|
|
|
logger.log('debug', 'Initializing naviagor window')
|
|
|
|
|
|
|
|
def row_activated_handler(self, widget, path, column):
|
2006-04-21 11:23:05 +02:00
|
|
|
iter = self.data_tree.get_iter(path)
|
|
|
|
obj = self.data_tree.get_value(iter, 2)
|
|
|
|
if isinstance(obj, plots.Plot):
|
|
|
|
logger.log('debug', 'Activating plot')
|
|
|
|
self.app.change_plot(obj)
|
|
|
|
elif isinstance(obj, dataset.Dataset):
|
|
|
|
logger.log('debug', 'Selecting dataset')
|
|
|
|
self.project.set_current_data(obj)
|
|
|
|
else:
|
|
|
|
t = type(obj)
|
|
|
|
logger.log('debug', 'Datatype was %s. Don\'t know what to do.' % t)
|