diff --git a/fluents/navigator.py b/fluents/navigator.py
index 4e44951..10c1a7a 100644
--- a/fluents/navigator.py
+++ b/fluents/navigator.py
@@ -9,8 +9,6 @@ import scipy
class NavigatorView (gtk.TreeView):
def __init__(self):
-# self.project = project
-# self.app = app
if main.project:
self.data_tree = main.project.data_tree
else:
@@ -26,13 +24,12 @@ class NavigatorView (gtk.TreeView):
# Selection Mode
self.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
-# self.get_selection().set_select_function(self.is_selectable)
self.get_selection().connect('changed',self.selection_changed_handler)
self._previous_selection = []
# Setting up TextRenderers etc
- # self.connect('cursor_changed', self.cursor_changed_handler)
- self.connect('row_activated', self.row_activated_handler)
+ self.connect('row_activated', self.on_row_activated)
+ self.connect('cursor_changed', self.on_cursor_changed)
# Activate context menu
self.menu = NavigatorMenu(self)
@@ -56,7 +53,6 @@ class NavigatorView (gtk.TreeView):
self.connect("drag-data-get",self.slot_drag_data)
logger.log('debug', 'Initializing navigator window.')
-
# sets data for drag event.
def slot_drag_data(self, treeview, context, selection, target_id, etime):
@@ -66,10 +62,9 @@ class NavigatorView (gtk.TreeView):
self.data_tree.drag_data_get(paths[0], selection)
def add_project(self, project):
-# self.project = project
self.data_tree = project.data_tree
self.set_model(project.data_tree)
- self.data_tree.connect('row-changed',self.row_changed_handler)
+ self.data_tree.connect('row-changed',self.on_row_changed)
# selection changed, setting current_data ojbects
def selection_changed_handler(self, selection):
@@ -80,6 +75,7 @@ class NavigatorView (gtk.TreeView):
tmp = self._previous_selection
self._previous_selection = paths
+
# set timestamp on newly selected objects
[self.data_tree.set_value(self.data_tree.get_iter(path), 6, time.time())
for path in paths if path not in tmp]
@@ -100,7 +96,7 @@ class NavigatorView (gtk.TreeView):
# TreeView changed. Set correct focus and colours
- def row_changed_handler(self, treestore, pos, iter):
+ def on_row_changed(self, treestore, pos, iter):
obj = treestore.get_value(iter,2)
type_= treestore.get_value(iter,1)
@@ -112,23 +108,7 @@ class NavigatorView (gtk.TreeView):
self.set_cursor(pos)
self.grab_focus()
- def display_data_info(self, data):
- dims = zip(data.get_dim_name(), data.shape)
-
- dim_text = ", ".join(["%s (%d)" % dim for dim in dims])
-
- text = """Data: %s
-
-Dimensions: %s""" % (data.get_name(), dim_text)
-
- d = gtk.MessageDialog(flags=(gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
- buttons=gtk.BUTTONS_OK)
- d.set_markup(text)
- d.set_default_response(gtk.BUTTONS_OK)
- d.run()
- d.destroy()
-
- def row_activated_handler(self, widget, path, column):
+ def on_row_activated(self, widget, path, column):
tree_iter = self.data_tree.get_iter(path)
obj = self.data_tree.get_value(tree_iter, 2)
@@ -136,7 +116,7 @@ class NavigatorView (gtk.TreeView):
logger.log('debug', 'Activating plot')
main.application.change_plot(obj)
elif isinstance(obj, dataset.Dataset):
- self.display_data_info(obj)
+ pass
elif obj == None:
children = []
i = self.data_tree.iter_children(tree_iter)
@@ -148,7 +128,7 @@ class NavigatorView (gtk.TreeView):
main.application.change_plots(children)
else:
t = type(obj)
- logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t)
+ logger.log('notice', 'Activated datatype was %s. Don\'t know what to do.' % t)
def popup_menu(self, *rest):
self.menu.popup(None, None, None, 0, 0)
@@ -171,6 +151,17 @@ class NavigatorView (gtk.TreeView):
if event.button == 3:
self.menu.popup(None, None, None, event.button, event.time)
+ def on_cursor_changed(self, widget):
+ path = widget.get_cursor()[0]
+ tree_iter = self.data_tree.get_iter(path)
+ obj = self.data_tree.get_value(tree_iter, 2)
+ if isinstance(obj, dataset.Dataset):
+ dims = zip(obj.get_dim_name(), obj.shape)
+ dim_text = ", ".join(["%s (%d)" % dim for dim in dims])
+ else:
+ dim_text = ""
+ main.application['appbar1'].push(dim_text)
+
class NavigatorMenu(gtk.Menu):
def __init__(self, navigator):