Changed the name of the current Project class to ProjectView, to make room for a new
non-GUI project class.
This commit is contained in:
parent
21133af8f7
commit
b5d2e8e181
|
@ -3,7 +3,7 @@
|
||||||
from getopt import getopt
|
from getopt import getopt
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from laydi import laydi, project, workflow, main
|
from laydi import laydi, projectview, workflow, main
|
||||||
#import workflows
|
#import workflows
|
||||||
from laydi import cfgparse
|
from laydi import cfgparse
|
||||||
import optparse
|
import optparse
|
||||||
|
@ -113,9 +113,9 @@ if __name__ == '__main__':
|
||||||
app = laydi.LaydiApp()
|
app = laydi.LaydiApp()
|
||||||
|
|
||||||
main.set_application(app)
|
main.set_application(app)
|
||||||
main.set_project(project.Project())
|
main.set_projectview(projectview.ProjectView())
|
||||||
|
|
||||||
app.set_project(main.project)
|
app.set_projectview(main.projectview)
|
||||||
app.show()
|
app.show()
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import gtk
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import gobject
|
import gobject
|
||||||
import logger, project, workflow
|
import logger, projectview, workflow
|
||||||
|
|
||||||
DATADIR = os.path.dirname(sys.modules['laydi'].__file__)
|
DATADIR = os.path.dirname(sys.modules['laydi'].__file__)
|
||||||
GLADEFILENAME = os.path.join(DATADIR, 'laydi.glade')
|
GLADEFILENAME = os.path.join(DATADIR, 'laydi.glade')
|
||||||
|
@ -62,11 +62,11 @@ class CreateProjectDruid(gtk.Window):
|
||||||
def finish(self, *rest):
|
def finish(self, *rest):
|
||||||
tree, it = self['workflow_list'].get_selection().get_selected()
|
tree, it = self['workflow_list'].get_selection().get_selected()
|
||||||
wf_class = self.workflows.get_value(it, 1)
|
wf_class = self.workflows.get_value(it, 1)
|
||||||
proj = project.Project()
|
proj = projectview.ProjectView()
|
||||||
main.set_workflow(wf_class())
|
main.set_workflow(wf_class())
|
||||||
# self.app.set_workflow(wf(self.app))
|
# self.app.set_workflow(wf(self.app))
|
||||||
# self.app.set_project(proj)
|
# self.app.set_project(proj)
|
||||||
main.set_project(proj)
|
main.set_projectview(proj)
|
||||||
self.hide()
|
self.hide()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import gnome
|
||||||
import gnome.ui
|
import gnome.ui
|
||||||
import scipy
|
import scipy
|
||||||
import pango
|
import pango
|
||||||
import project, workflow, dataset, view, navigator, dialogs, selections, plots, main
|
import projectview, workflow, dataset, view, navigator, dialogs, selections, plots, main
|
||||||
from logger import logger, LogView
|
from logger import logger, LogView
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,7 +160,6 @@ class ViewFrameToolButton (gtk.ToolItem):
|
||||||
class LaydiApp:
|
class LaydiApp:
|
||||||
|
|
||||||
def __init__(self): # Application variables
|
def __init__(self): # Application variables
|
||||||
# self.project = None
|
|
||||||
self.current_data = None
|
self.current_data = None
|
||||||
self._last_view = None
|
self._last_view = None
|
||||||
self._plot_toolbar = None
|
self._plot_toolbar = None
|
||||||
|
@ -227,11 +226,11 @@ class LaydiApp:
|
||||||
tb = ViewFrameToolButton()
|
tb = ViewFrameToolButton()
|
||||||
self['toolbar'].add(tb)
|
self['toolbar'].add(tb)
|
||||||
|
|
||||||
def set_project(self, proj):
|
def set_projectview(self, proj):
|
||||||
logger.notice('Welcome to your new project. Grasp That Data!')
|
logger.notice('Welcome to your new project. Grasp That Data!')
|
||||||
self.navigator_view.add_project(proj)
|
self.navigator_view.add_projectview(proj)
|
||||||
self.dimlist_crt.set_project(proj)
|
self.dimlist_crt.set_projectview(proj)
|
||||||
self.sellist_crt.set_project(proj)
|
self.sellist_crt.set_projectview(proj)
|
||||||
|
|
||||||
def set_workflow(self, workflow):
|
def set_workflow(self, workflow):
|
||||||
main.workflow = workflow
|
main.workflow = workflow
|
||||||
|
@ -244,7 +243,7 @@ class LaydiApp:
|
||||||
"""Sets the plot in the currently active ViewFrame. If the plot is
|
"""Sets the plot in the currently active ViewFrame. If the plot is
|
||||||
already shown in another ViewFrame it will be moved from there."""
|
already shown in another ViewFrame it will be moved from there."""
|
||||||
# Set current selection in the plot before showing it.
|
# Set current selection in the plot before showing it.
|
||||||
plot.selection_changed(None, main.project.get_selection())
|
plot.selection_changed(None, main.projectview.get_selection())
|
||||||
|
|
||||||
self['main_view'].insert_view(plot)
|
self['main_view'].insert_view(plot)
|
||||||
self._update_toolbar(plot)
|
self._update_toolbar(plot)
|
||||||
|
|
|
@ -21,8 +21,8 @@ navigator = None
|
||||||
#: The current application
|
#: The current application
|
||||||
application = None
|
application = None
|
||||||
|
|
||||||
#: The current project
|
#: The current projectview
|
||||||
project = None
|
projectview = None
|
||||||
|
|
||||||
#: The current workflow
|
#: The current workflow
|
||||||
workflow = None
|
workflow = None
|
||||||
|
@ -84,9 +84,9 @@ def set_application(app):
|
||||||
application = app
|
application = app
|
||||||
notify_observers('application')
|
notify_observers('application')
|
||||||
|
|
||||||
def set_project(p):
|
def set_projectview(p):
|
||||||
global project
|
global projectview
|
||||||
project = p
|
projectview = p
|
||||||
notify_observers('project')
|
notify_observers('project')
|
||||||
|
|
||||||
def set_workflow(wf):
|
def set_workflow(wf):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import plots
|
||||||
import time
|
import time
|
||||||
import laydi
|
import laydi
|
||||||
from logger import logger
|
from logger import logger
|
||||||
import dataset, plots, project, workflow, main
|
import dataset, plots, projectview, workflow, main
|
||||||
import scipy
|
import scipy
|
||||||
|
|
||||||
class NavigatorView (gtk.TreeView):
|
class NavigatorView (gtk.TreeView):
|
||||||
|
@ -15,8 +15,8 @@ class NavigatorView (gtk.TreeView):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if main.project:
|
if main.projectview:
|
||||||
self.data_tree = main.project.data_tree
|
self.data_tree = main.projectview.data_tree
|
||||||
else:
|
else:
|
||||||
self.data_tree = None
|
self.data_tree = None
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@ class NavigatorView (gtk.TreeView):
|
||||||
if paths:
|
if paths:
|
||||||
self.data_tree.drag_data_get(paths[0], selection)
|
self.data_tree.drag_data_get(paths[0], selection)
|
||||||
|
|
||||||
def add_project(self, project):
|
def add_projectview(self, projectview):
|
||||||
"""Dependency injection."""
|
"""Dependency injection."""
|
||||||
self.data_tree = project.data_tree
|
self.data_tree = projectview.data_tree
|
||||||
self.set_model(project.data_tree)
|
self.set_model(projectview.data_tree)
|
||||||
self.data_tree.connect('row-changed',self.on_row_changed)
|
self.data_tree.connect('row-changed',self.on_row_changed)
|
||||||
|
|
||||||
def on_selection_changed(self, selection):
|
def on_selection_changed(self, selection):
|
||||||
|
@ -97,10 +97,10 @@ class NavigatorView (gtk.TreeView):
|
||||||
|
|
||||||
if objs and isinstance(objs[0], dataset.Dataset):
|
if objs and isinstance(objs[0], dataset.Dataset):
|
||||||
logger.debug('Selecting dataset')
|
logger.debug('Selecting dataset')
|
||||||
main.project.current_data = objs
|
main.projectview.current_data = objs
|
||||||
else:
|
else:
|
||||||
logger.debug('Deselecting dataset')
|
logger.debug('Deselecting dataset')
|
||||||
main.project.current_data = []
|
main.projectview.current_data = []
|
||||||
|
|
||||||
def on_row_changed(self, treestore, pos, iter):
|
def on_row_changed(self, treestore, pos, iter):
|
||||||
"""Set correct focus and colours when rows have changed."""
|
"""Set correct focus and colours when rows have changed."""
|
||||||
|
@ -294,8 +294,8 @@ class NavigatorMenu(gtk.Menu):
|
||||||
else:
|
else:
|
||||||
icon = laydi.icon_factory.get("dataset")
|
icon = laydi.icon_factory.get("dataset")
|
||||||
|
|
||||||
main.project.add_dataset(ds)
|
main.projectview.add_dataset(ds)
|
||||||
main.project.data_tree_insert(None, ds.get_name(), ds, None, "black", icon)
|
main.projectview.data_tree_insert(None, ds.get_name(), ds, None, "black", icon)
|
||||||
|
|
||||||
def on_load_dataset(self, item, navigator):
|
def on_load_dataset(self, item, navigator):
|
||||||
# Set up file chooser.
|
# Set up file chooser.
|
||||||
|
@ -338,28 +338,28 @@ class NavigatorMenu(gtk.Menu):
|
||||||
iters = [tm.get_iter(r) for r in rows]
|
iters = [tm.get_iter(r) for r in rows]
|
||||||
iters.reverse()
|
iters.reverse()
|
||||||
for i in iters:
|
for i in iters:
|
||||||
main.project.delete_data(i)
|
main.projectview.delete_data(i)
|
||||||
# tm.remove(i)
|
# tm.remove(i)
|
||||||
|
|
||||||
def on_plot_image(self, item, navigator):
|
def on_plot_image(self, item, navigator):
|
||||||
plot = plots.ImagePlot(self.dataset, name='Image Plot')
|
plot = plots.ImagePlot(self.dataset, name='Image Plot')
|
||||||
icon = laydi.icon_factory.get("line_plot")
|
icon = laydi.icon_factory.get("line_plot")
|
||||||
main.project.data_tree_insert(self.tree_iter, 'Image Plot', plot, None, "black", icon)
|
main.projectview.data_tree_insert(self.tree_iter, 'Image Plot', plot, None, "black", icon)
|
||||||
# fixme: image plot selections are not well defined
|
# fixme: image plot selections are not well defined
|
||||||
#plot.set_selection_listener(project.set_selection)
|
#plot.set_selection_listener(projectview.set_selection)
|
||||||
#project._selection_observers.append(plot)
|
#projectview._selection_observers.append(plot)
|
||||||
|
|
||||||
def on_plot_hist(self, item, navigator):
|
def on_plot_hist(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
plot = plots.HistogramPlot(self.dataset, name='Histogram')
|
plot = plots.HistogramPlot(self.dataset, name='Histogram')
|
||||||
icon = laydi.icon_factory.get("line_plot")
|
icon = laydi.icon_factory.get("line_plot")
|
||||||
project.data_tree_insert(self.tree_iter, 'Histogram', plot, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Histogram', plot, None, "black", icon)
|
||||||
plot.set_selection_listener(project.set_selection)
|
plot.set_selection_listener(projectview.set_selection)
|
||||||
project._selection_observers.append(plot)
|
projectview._selection_observers.append(plot)
|
||||||
|
|
||||||
def on_plot_scatter(self, item, navigator):
|
def on_plot_scatter(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
datasets = main.project.current_data
|
datasets = main.projectview.current_data
|
||||||
ds_major = datasets[0]
|
ds_major = datasets[0]
|
||||||
dims_major = ds_major.get_dim_name()
|
dims_major = ds_major.get_dim_name()
|
||||||
ids_major = ds_major.get_identifiers(dims_major[1], sorted=True)
|
ids_major = ds_major.get_identifiers(dims_major[1], sorted=True)
|
||||||
|
@ -380,70 +380,70 @@ class NavigatorMenu(gtk.Menu):
|
||||||
name='Scatter (%s)' % ds_major.get_name())
|
name='Scatter (%s)' % ds_major.get_name())
|
||||||
plot.add_axes_spin_buttons(len(ids_major), 0, 1)
|
plot.add_axes_spin_buttons(len(ids_major), 0, 1)
|
||||||
icon = laydi.icon_factory.get("line_plot")
|
icon = laydi.icon_factory.get("line_plot")
|
||||||
project.data_tree_insert(self.tree_iter, 'Scatter', plot, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Scatter', plot, None, "black", icon)
|
||||||
plot.set_selection_listener(project.set_selection)
|
plot.set_selection_listener(projectview.set_selection)
|
||||||
project._selection_observers.append(plot)
|
projectview._selection_observers.append(plot)
|
||||||
|
|
||||||
def on_plot_line(self, item, navigator):
|
def on_plot_line(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
ds = self.dataset
|
ds = self.dataset
|
||||||
dims = ds.get_dim_name()
|
dims = ds.get_dim_name()
|
||||||
ids = ds.get_identifiers(dims[1])
|
ids = ds.get_identifiers(dims[1])
|
||||||
plot = plots.LineViewPlot(ds, name='Line (%s)' % ds.get_name())
|
plot = plots.LineViewPlot(ds, name='Line (%s)' % ds.get_name())
|
||||||
icon = laydi.icon_factory.get("line_plot")
|
icon = laydi.icon_factory.get("line_plot")
|
||||||
project.data_tree_insert(self.tree_iter, 'Line view', plot, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Line view', plot, None, "black", icon)
|
||||||
plot.set_selection_listener(project.set_selection)
|
plot.set_selection_listener(projectview.set_selection)
|
||||||
project._selection_observers.append(plot)
|
projectview._selection_observers.append(plot)
|
||||||
|
|
||||||
def on_plot_bar(self, item, navigator):
|
def on_plot_bar(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
ds = self.dataset
|
ds = self.dataset
|
||||||
dims = ds.get_dim_name()
|
dims = ds.get_dim_name()
|
||||||
ids = ds.get_identifiers(dims[1])
|
ids = ds.get_identifiers(dims[1])
|
||||||
plot = plots.BarPlot(ds, name='Bar (%s)' % ds.get_name())
|
plot = plots.BarPlot(ds, name='Bar (%s)' % ds.get_name())
|
||||||
icon = laydi.icon_factory.get("line_plot")
|
icon = laydi.icon_factory.get("line_plot")
|
||||||
project.data_tree_insert(self.tree_iter, 'Bar plot', plot, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Bar plot', plot, None, "black", icon)
|
||||||
plot.set_selection_listener(project.set_selection)
|
plot.set_selection_listener(projectview.set_selection)
|
||||||
project._selection_observers.append(plot)
|
projectview._selection_observers.append(plot)
|
||||||
|
|
||||||
def on_plot_box(self, item, navigator):
|
def on_plot_box(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
ds = self.dataset
|
ds = self.dataset
|
||||||
dims = ds.get_dim_name()
|
dims = ds.get_dim_name()
|
||||||
ids = ds.get_identifiers(dims[1])
|
ids = ds.get_identifiers(dims[1])
|
||||||
plot = plots.BoxPlot(ds, name='Box (%s)' % ds.get_name())
|
plot = plots.BoxPlot(ds, name='Box (%s)' % ds.get_name())
|
||||||
icon = laydi.icon_factory.get("line_plot")
|
icon = laydi.icon_factory.get("line_plot")
|
||||||
project.data_tree_insert(self.tree_iter, 'Box plot', plot, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Box plot', plot, None, "black", icon)
|
||||||
plot.set_selection_listener(project.set_selection)
|
plot.set_selection_listener(projectview.set_selection)
|
||||||
project._selection_observers.append(plot)
|
projectview._selection_observers.append(plot)
|
||||||
|
|
||||||
def on_transpose(self, item, navigator):
|
def on_transpose(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
ds = self.dataset.transpose()
|
ds = self.dataset.transpose()
|
||||||
ds._name = ds._name + ".T"
|
ds._name = ds._name + ".T"
|
||||||
icon = laydi.icon_factory.get(ds)
|
icon = laydi.icon_factory.get(ds)
|
||||||
project.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
||||||
|
|
||||||
def on_standardise_rows(self, item, navigator):
|
def on_standardise_rows(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
ds = self.dataset.copy()
|
ds = self.dataset.copy()
|
||||||
ds._name = self.dataset._name + ".rsc"
|
ds._name = self.dataset._name + ".rsc"
|
||||||
axis = 1
|
axis = 1
|
||||||
ds._array = ds.asarray()/scipy.expand_dims(ds.asarray().std(axis), axis)
|
ds._array = ds.asarray()/scipy.expand_dims(ds.asarray().std(axis), axis)
|
||||||
icon = laydi.icon_factory.get(ds)
|
icon = laydi.icon_factory.get(ds)
|
||||||
project.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
||||||
|
|
||||||
def on_standardise_cols(self, item, navigator):
|
def on_standardise_cols(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
ds = self.dataset.copy()
|
ds = self.dataset.copy()
|
||||||
ds._name = self.dataset._name + ".csc"
|
ds._name = self.dataset._name + ".csc"
|
||||||
axis = 0
|
axis = 0
|
||||||
ds._array = ds.asarray()/scipy.expand_dims(ds.asarray().std(axis), axis)
|
ds._array = ds.asarray()/scipy.expand_dims(ds.asarray().std(axis), axis)
|
||||||
icon = laydi.icon_factory.get(ds)
|
icon = laydi.icon_factory.get(ds)
|
||||||
project.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
||||||
|
|
||||||
def on_log(self, item, navigator):
|
def on_log(self, item, navigator):
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
try:
|
try:
|
||||||
if not scipy.all(self.dataset.asarray()>0):
|
if not scipy.all(self.dataset.asarray()>0):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
@ -455,7 +455,7 @@ class NavigatorMenu(gtk.Menu):
|
||||||
ds._array = scipy.log(ds.asarray())
|
ds._array = scipy.log(ds.asarray())
|
||||||
icon = laydi.icon_factory.get(ds)
|
icon = laydi.icon_factory.get(ds)
|
||||||
ds._name = ds._name + ".log"
|
ds._name = ds._name + ".log"
|
||||||
project.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, ds.get_name(), ds, None, "black", icon)
|
||||||
|
|
||||||
def on_split(self, item, navigator):
|
def on_split(self, item, navigator):
|
||||||
if self.dataset is None:
|
if self.dataset is None:
|
||||||
|
@ -464,13 +464,13 @@ class NavigatorMenu(gtk.Menu):
|
||||||
|
|
||||||
dim = self.dataset.get_dim_name(0)
|
dim = self.dataset.get_dim_name(0)
|
||||||
|
|
||||||
project = main.project
|
projectview = main.projectview
|
||||||
sel_ids = set(project.get_selection()[dim])
|
sel_ids = set(projectview.get_selection()[dim])
|
||||||
sel_ds = self.dataset.subdata(dim, sel_ids)
|
sel_ds = self.dataset.subdata(dim, sel_ids)
|
||||||
|
|
||||||
unsel_ids = set(self.dataset.get_identifiers(dim)) - set(sel_ids)
|
unsel_ids = set(self.dataset.get_identifiers(dim)) - set(sel_ids)
|
||||||
unsel_ds = self.dataset.subdata(dim, unsel_ids)
|
unsel_ds = self.dataset.subdata(dim, unsel_ids)
|
||||||
|
|
||||||
icon = laydi.icon_factory.get(self.dataset)
|
icon = laydi.icon_factory.get(self.dataset)
|
||||||
project.data_tree_insert(self.tree_iter, 'Selected', sel_ds, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Selected', sel_ds, None, "black", icon)
|
||||||
project.data_tree_insert(self.tree_iter, 'Unselected', unsel_ds, None, "black", icon)
|
projectview.data_tree_insert(self.tree_iter, 'Unselected', unsel_ds, None, "black", icon)
|
||||||
|
|
|
@ -268,7 +268,7 @@ class IdListController:
|
||||||
if paths==None: return
|
if paths==None: return
|
||||||
iters = [self._idstore.get_iter(p) for p in paths]
|
iters = [self._idstore.get_iter(p) for p in paths]
|
||||||
ids = [self._idstore.get_value(i, 0) for i in iters]
|
ids = [self._idstore.get_value(i, 0) for i in iters]
|
||||||
main.project.set_selection(self._dimension, ids)
|
main.projectview.set_selection(self._dimension, ids)
|
||||||
|
|
||||||
def _drag_data_received(self, widget, drag_context, x, y,
|
def _drag_data_received(self, widget, drag_context, x, y,
|
||||||
selection, info, timestamp):
|
selection, info, timestamp):
|
||||||
|
@ -331,9 +331,9 @@ class SelectionListController:
|
||||||
def activate(self):
|
def activate(self):
|
||||||
self._seltree.set_cursor((0,))
|
self._seltree.set_cursor((0,))
|
||||||
|
|
||||||
def set_project(self, project):
|
def set_projectview(self, projectview):
|
||||||
"""Dependency injection."""
|
"""Dependency injection."""
|
||||||
main.project.add_selection_observer(self)
|
main.projectview.add_selection_observer(self)
|
||||||
|
|
||||||
def set_dimlist_controller(self, dimlist_controller):
|
def set_dimlist_controller(self, dimlist_controller):
|
||||||
"""Dependency injection of the dimension list controller."""
|
"""Dependency injection of the dimension list controller."""
|
||||||
|
@ -381,7 +381,7 @@ class SelectionListController:
|
||||||
di = self._get_dataset_iter(dataset)
|
di = self._get_dataset_iter(dataset)
|
||||||
if not di:
|
if not di:
|
||||||
n_tot = dataset.shape[0]
|
n_tot = dataset.shape[0]
|
||||||
selection = main.project.get_selection().get(dim_name)
|
selection = main.projectview.get_selection().get(dim_name)
|
||||||
ds_idents = dataset.get_identifiers(dim_name)
|
ds_idents = dataset.get_identifiers(dim_name)
|
||||||
n_cs = len(selection.intersection(ds_idents))
|
n_cs = len(selection.intersection(ds_idents))
|
||||||
values = (dataset.get_name(), dataset, dim_name, n_cs, n_tot, 2)
|
values = (dataset.get_name(), dataset, dim_name, n_cs, n_tot, 2)
|
||||||
|
@ -452,7 +452,7 @@ class SelectionListController:
|
||||||
"""
|
"""
|
||||||
dim_name = dataset.get_dim_name(0)
|
dim_name = dataset.get_dim_name(0)
|
||||||
sel_store = self._sel_stores[dim_name]
|
sel_store = self._sel_stores[dim_name]
|
||||||
selection_obj = main.project.get_selection()
|
selection_obj = main.projectview.get_selection()
|
||||||
current_selection = selection_obj.get(dim_name)
|
current_selection = selection_obj.get(dim_name)
|
||||||
if current_selection==None: return
|
if current_selection==None: return
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ class SelectionListController:
|
||||||
else:
|
else:
|
||||||
seltree.expand_row(path, True)
|
seltree.expand_row(path, True)
|
||||||
elif isinstance(obj, dataset.Selection):
|
elif isinstance(obj, dataset.Selection):
|
||||||
main.project.set_selection(self._dimension,
|
main.projectview.set_selection(self._dimension,
|
||||||
obj[self._dimension])
|
obj[self._dimension])
|
||||||
|
|
||||||
def _on_button_pressed(self, widget, event):
|
def _on_button_pressed(self, widget, event):
|
||||||
|
@ -573,12 +573,11 @@ class DimListController:
|
||||||
##
|
##
|
||||||
## Public interface
|
## Public interface
|
||||||
##
|
##
|
||||||
def set_project(self, project):
|
def set_projectview(self, projectview):
|
||||||
"""Dependency injection."""
|
"""Dependency injection."""
|
||||||
# self.project = project
|
self.dim_names = projectview.dim_names
|
||||||
self.dim_names = project.dim_names
|
|
||||||
self.update_dims()
|
self.update_dims()
|
||||||
project.add_dataset_observer(self)
|
projectview.add_dataset_observer(self)
|
||||||
|
|
||||||
def get_dimension(self, dim):
|
def get_dimension(self, dim):
|
||||||
"""Returns the iterator to the dimension with the given name, or
|
"""Returns the iterator to the dimension with the given name, or
|
||||||
|
|
|
@ -427,7 +427,7 @@ class WorkflowMenu (gtk.Menu):
|
||||||
|
|
||||||
def run_function(function):
|
def run_function(function):
|
||||||
logger.log('debug', 'Starting function: %s' % function.name)
|
logger.log('debug', 'Starting function: %s' % function.name)
|
||||||
parent_data = main.project.current_data
|
parent_data = main.projectview.current_data
|
||||||
|
|
||||||
validation = function.validate_input()
|
validation = function.validate_input()
|
||||||
|
|
||||||
|
@ -464,12 +464,12 @@ def run_function(function):
|
||||||
if pass_selection:
|
if pass_selection:
|
||||||
# if the function has a 'selection' argument, we pass in
|
# if the function has a 'selection' argument, we pass in
|
||||||
# the selection
|
# the selection
|
||||||
new_data = function.run(selection=main.project.get_selection(), *data)
|
new_data = function.run(selection=main.projectview.get_selection(), *data)
|
||||||
else:
|
else:
|
||||||
new_data = function.run(*data)
|
new_data = function.run(*data)
|
||||||
|
|
||||||
if new_data != None:
|
if new_data != None:
|
||||||
main.project.add_data(parent_data, new_data, function.name)
|
main.projectview.add_data(parent_data, new_data, function.name)
|
||||||
|
|
||||||
logger.log('debug', 'Function ended: %s' % function.name)
|
logger.log('debug', 'Function ended: %s' % function.name)
|
||||||
|
|
||||||
|
|
Reference in New Issue