Added icons to navigator

This commit is contained in:
Arnar Flatberg 2006-08-30 10:27:45 +00:00
parent 1b9aff1c5a
commit fc21c58ab3
9 changed files with 32 additions and 15 deletions

BIN
icons/category_dataset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

BIN
icons/dataset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

BIN
icons/folder_grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

BIN
icons/graph_dataset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

BIN
icons/line_plot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

View File

@ -18,6 +18,7 @@ from system import project, workflow, dataset, logger, plots, navigator, dialogs
PROGRAM_NAME = 'fluents'
VERSION = '0.1.0'
DATADIR = os.path.dirname(sys.modules['system'].__file__)
ICONDIR = os.path.join(DATADIR,"..","icons")
GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade')
class FluentApp:

View File

@ -18,6 +18,7 @@ class NavigatorView (gtk.TreeView):
# various properties
self.set_headers_visible(False)
self.get_hadjustment().set_value(0)
# Selection Mode
self.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
self.get_selection().set_select_function(self.is_selectable)
@ -29,10 +30,12 @@ class NavigatorView (gtk.TreeView):
self.connect('row_activated', self.row_activated_handler)
self.textrenderer = textrenderer = gtk.CellRendererText()
textrenderer.set_property('foreground_set',True)
pixbufrenderer = gtk.CellRendererPixbuf()
self.object_col = gtk.TreeViewColumn('Object')
self.object_col.pack_start(pixbufrenderer,expand=False)
self.object_col.pack_start(textrenderer,expand=False)
self.object_col.set_attributes(textrenderer, cell_background=3, foreground=4, text=0)
self.object_col.set_attributes(pixbufrenderer, pixbuf=5)
self.append_column(self.object_col)
# send events to plots / itself
@ -75,10 +78,10 @@ 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),5,time.time()) for path in paths if path not in tmp]
[self.data_tree.set_value(self.data_tree.get_iter(path),6,time.time()) for path in paths if path not in tmp]
objs = [self.data_tree.get_iter(path) for path in paths]
objs = [(self.data_tree.get_value(iter,5), self.data_tree.get_value(iter,2)) for iter in objs]
objs = [(self.data_tree.get_value(iter,6), self.data_tree.get_value(iter,2)) for iter in objs]
objs.sort()
objs = [obj for timestamp, obj in objs]
# order dataset

View File

@ -558,7 +558,7 @@ has no color and size options."""
#remove old selection
if self._selection_line:
self.ax.lines.remove(self._selection_line)
self._selection_line, = self.ax.plot(xdata_new,ydata_new,marker='o',markersize=self.ms,linestyle=None)
self._selection_line, = self.ax.plot(xdata_new,ydata_new,marker='o',markersize=self.ms,linestyle=None,markerfacecolor='r')
self._toolbar.forward() #update data lims before draw
self.canvas.draw()
@ -578,7 +578,7 @@ has no color and size options."""
self.xaxis_data = dataset_1._array[:,x_index]
self.yaxis_data = dataset_2._array[:,y_index]
ax.scatter(self.xaxis_data,self.yaxis_data,s=s,c=c,faceted=False,edgecolor='k')
ax.scatter(self.xaxis_data,self.yaxis_data,s=s,c=c,faceted=False,edgecolor='k',alpha=.6,cmap = cm.Set1)
ax.set_title(self.get_title())
#ax.set_xlabel("%s - %s" % (sel_dim, id_1))
#ax.set_ylabel("%s - %s" % (sel_dim, id_2))

View File

@ -1,7 +1,8 @@
import os
import scipy
import gobject
import gtk
import fluents
import logger
from system import dataset, plots
@ -9,7 +10,8 @@ class Project:
def __init__(self,name="Testing"):
self.data_tree = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_PYOBJECT, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_DOUBLE)
gobject.TYPE_STRING, gobject.TYPE_OBJECT,
gobject.TYPE_DOUBLE)
self.name = name
self.dim_names = []
@ -69,26 +71,36 @@ class Project:
has finished and returns its output."""
parent_iter = self.get_data_iter(parents)
it = self.data_tree_insert(parent_iter, fun, None, "grey","black")
icon_fname = os.path.join(fluents.ICONDIR,"folder_grey.png")
icon = gtk.gdk.pixbuf_new_from_file(icon_fname)
it = self.data_tree_insert(parent_iter, fun, None, None,"black",icon)
for d in data:
if isinstance(d, dataset.GraphDataset):
self.add_dataset(d)
self.data_tree_insert(it, d.get_name(), d, "LightPink", "black")
icon_fname = os.path.join(fluents.ICONDIR,"graph_dataset.png")
icon = gtk.gdk.pixbuf_new_from_file(icon_fname)
self.data_tree_insert(it, d.get_name(), d, None, "black",icon)
elif isinstance(d,dataset.CategoryDataset):
icon_fname = os.path.join(fluents.ICONDIR,"category_dataset.png")
icon = gtk.gdk.pixbuf_new_from_file(icon_fname)
self.add_dataset(d)
self.data_tree_insert(it, d.get_name(), d, "LightSalmon", "black")
self.data_tree_insert(it, d.get_name(), d, None, "black",icon)
elif isinstance(d, dataset.Dataset):
icon_fname = os.path.join(fluents.ICONDIR,"dataset.png")
icon = gtk.gdk.pixbuf_new_from_file(icon_fname)
self.add_dataset(d)
self.data_tree_insert(it, d.get_name(), d, "LightSkyBlue", "black")
self.data_tree_insert(it, d.get_name(), d, None, "black",icon)
elif isinstance(d, plots.Plot):
self.data_tree_insert(it, d.get_title(), d, "PaleGreen", "black")
icon_fname = os.path.join(fluents.ICONDIR,"line_plot.png")
icon = gtk.gdk.pixbuf_new_from_file(icon_fname)
self.data_tree_insert(it, d.get_title(), d, None, "black",icon)
d.set_selection_listener(self.set_selection)
self._selection_observers.append(d)
elif isinstance(d, dataset.Selection):
self.add_selection(d)
def data_tree_insert(self, parent, text, data, bgcolour,fontcolour,selected = 0):
def data_tree_insert(self, parent, text, data, bgcolour,fontcolour,icon,selected = 0):
tree = self.data_tree
it = tree.append(parent)
tree.set_value(it, 0, text)
@ -96,7 +108,8 @@ class Project:
tree.set_value(it, 2, data)
tree.set_value(it, 3, bgcolour)
tree.set_value(it, 4, fontcolour)
tree.set_value(it, 5, selected)
tree.set_value(it, 5, icon)
tree.set_value(it, 6, selected)
return it
def add_dataset(self, dataset):