Removed need to provide plots with project/workflow on creation, is instead injected by project itself when added to it.
This commit is contained in:
@@ -161,15 +161,12 @@ class LargeView (gtk.Frame):
|
||||
|
||||
class Plot (gtk.Frame):
|
||||
|
||||
def __init__(self,project):
|
||||
def __init__(self):
|
||||
gtk.Frame.__init__(self)
|
||||
self.project = project
|
||||
self.mark_active(False)
|
||||
self.connect('button_press_event', self.on_button_press)
|
||||
self.sel_obj = None
|
||||
self.active = False
|
||||
if project!=None: #its not an Emptyview
|
||||
project.attach(self,'selection_update')
|
||||
|
||||
def on_button_press(self, *rest):
|
||||
# logger.log('debug', 'button pressed in plot')
|
||||
@@ -182,12 +179,16 @@ class Plot (gtk.Frame):
|
||||
self.set_shadow_type(gtk.SHADOW_OUT)
|
||||
self.active = active
|
||||
|
||||
def update(self,project,key):
|
||||
def update(self, key):
|
||||
pass
|
||||
|
||||
def set_project(self, project):
|
||||
self.project = project
|
||||
|
||||
|
||||
class EmptyView (Plot):
|
||||
def __init__(self):
|
||||
Plot.__init__(self,None)
|
||||
Plot.__init__(self)
|
||||
|
||||
label = gtk.Label('No view')
|
||||
ebox = gtk.EventBox()
|
||||
@@ -211,8 +212,8 @@ class EmptyView (Plot):
|
||||
|
||||
|
||||
class SinePlot(Plot):
|
||||
def __init__(self,project):
|
||||
Plot.__init__(self,project)
|
||||
def __init__(self):
|
||||
Plot.__init__(self)
|
||||
fig = Figure(figsize=(5,4), dpi=72)
|
||||
ax = fig.add_subplot(111)
|
||||
t = arange(0.0,3.0,0.01)
|
||||
@@ -224,9 +225,8 @@ class SinePlot(Plot):
|
||||
|
||||
|
||||
class ScatterPlot(Plot):
|
||||
def __init__(self,project,dataset,id_dim,sel_dim,id_1,id_2):
|
||||
Plot.__init__(self,project)
|
||||
self.project = project
|
||||
def __init__(self, dataset, id_dim, sel_dim, id_1, id_2):
|
||||
Plot.__init__(self)
|
||||
fig = Figure(figsize=(5,4), dpi=72)
|
||||
self.ax = ax = fig.add_subplot(111)
|
||||
self.current_dim = id_dim
|
||||
@@ -272,8 +272,8 @@ class ScatterPlot(Plot):
|
||||
ids = [id for id,ind in self.dataset[self.current_dim].items() if ind in index]
|
||||
self.project.set_selection(self.current_dim,ids)
|
||||
|
||||
def update(self,project,key):
|
||||
curr_sel = project.get_selection() # get selection object
|
||||
def update(self, key):
|
||||
curr_sel = self.project.get_selection() # get selection object
|
||||
ids = curr_sel[self.current_dim] # current identifiers
|
||||
|
||||
index = [ind for id,ind in self.dataset[self.current_dim].items() if id in ids] #conversion to index
|
||||
@@ -283,5 +283,3 @@ class ScatterPlot(Plot):
|
||||
self.ax.plot(self.xaxis_data,self.yaxis_data,'og')
|
||||
self.ax.plot(xdata_new,ydata_new,'or')
|
||||
self.canvas.draw()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user