def getDefaultPlot(self): args = str(self.defaultPlot.currentText()).split('_-_') if len(args) == 2: return get_plot_manager().new_plot(args[0], args[1]) elif len(args) == 3: return get_plot_manager().new_plot(args[0], args[1], args[2]) else: return None
def getDefaultPlot(self): args = str(self.defaultPlot.currentText()).split('_-_') if len(args) == 2: return get_plot_manager().new_plot(args[0], args[1]) elif len(args) == 3: return get_plot_manager().new_plot(args[0], args[1], args[2]) else: return None
def load_pipeline_in_location(pipeline, controller, sheetName, row, col, plot_type, cell): #for now this helper will change the location in place #based on the alias dictionary from core.uvcdat.plotmanager import get_plot_manager controller.change_selected_version(cell.current_parent_version) plot_obj = get_plot_manager().get_plot_by_vistrail_version(plot_type, controller.vistrail, controller.current_version) plot_obj.current_parent_version = cell.current_parent_version plot_obj.current_controller = controller cell.plots = [plot_obj] #FIXME: this will always spread the cells in the same row for j in range(plot_obj.cellnum): if plot_obj.cells[j].row_name and plot_obj.cells[j].col_name: pipeline.set_alias_str_value(plot_obj.cells[j].row_name, str(row+1)) pipeline.set_alias_str_value(plot_obj.cells[j].col_name, str(col+1+j)) elif plot_obj.cells[j].address_name: pipeline.set_alias_str_value(plot_obj.cells[j].address_name, "%s%s"%(chr(ord('A') + col+j), row+1)) #this will update the variables for i in range(plot_obj.varnum): cell.add_variable(pipeline.get_alias_str_value(plot_obj.vars[i]))
def load_pipeline_in_location(pipeline, controller, sheetName, row, col, plot_type, cell): #for now this helper will change the location in place #based on the alias dictionary from core.uvcdat.plotmanager import get_plot_manager controller.change_selected_version(cell.current_parent_version) plot_obj = get_plot_manager().get_plot_by_vistrail_version( plot_type, controller.vistrail, controller.current_version) plot_obj.current_parent_version = cell.current_parent_version plot_obj.current_controller = controller cell.plots = [plot_obj] #FIXME: this will always spread the cells in the same row for j in range(plot_obj.cellnum): if plot_obj.cells[j].row_name and plot_obj.cells[j].col_name: pipeline.set_alias_str_value(plot_obj.cells[j].row_name, str(row + 1)) pipeline.set_alias_str_value(plot_obj.cells[j].col_name, str(col + 1 + j)) elif plot_obj.cells[j].address_name: pipeline.set_alias_str_value( plot_obj.cells[j].address_name, "%s%s" % (chr(ord('A') + col + j), row + 1)) #this will update the variables for i in range(plot_obj.varnum): cell.add_variable(pipeline.get_alias_str_value(plot_obj.vars[i]))
def create_plot_objs_from_pipeline(pipeline, plot_type): plot_objs = [] helper = MatplotlibPipelineHelper # get to from cell? for plot_module in helper.find_plot_modules(pipeline): plot_objs.append(get_plot_manager().get_plot('Matplotlib', plot_module.name[3:])) return plot_objs
def create_plot_objs_from_pipeline(pipeline, plot_type): plot_objs = [] helper = MatplotlibPipelineHelper # get to from cell? for plot_module in helper.find_plot_modules(pipeline): plot_objs.append(get_plot_manager().get_plot( 'Matplotlib', plot_module.name[3:])) return plot_objs
def copy_pipeline_to_other_location(pipeline, controller, sheetName, row, col, plot_type, cell): #for now this helper will copy the workflow and change the location #based on the alias dictionary from core.uvcdat.plotmanager import get_plot_manager pip_str = core.db.io.serialize(pipeline) controller.change_selected_version(cell.current_parent_version) modules = controller.paste_modules_and_connections(pip_str, (0.0,0.0)) cell.current_parent_version = controller.current_version pipeline = controller.current_pipeline plot_obj = get_plot_manager().get_plot_by_vistrail_version(plot_type, controller.vistrail, controller.current_version) plot_obj.current_parent_version = cell.current_parent_version plot_obj.current_controller = controller cell.plots = [plot_obj] aliases = {} for a in pipeline.aliases: aliases[a] = pipeline.get_alias_str_value(a) if (plot_obj.serializedConfigAlias and plot_obj.serializedConfigAlias in aliases): plot_obj.unserializeAliases(aliases) #FIXME: this will always spread the cells in the same row for j in range(plot_obj.cellnum): if plot_obj.cells[j].row_name and plot_obj.cells[j].col_name: aliases[plot_obj.cells[j].row_name] = str(row+1) aliases[plot_obj.cells[j].col_name] = str(col+1+j) elif plot_obj.cells[j].address_name: aliases[plot_obj.cells[j].address_name] = "%s%s"%(chr(ord('A') + col+j), row+1) actions = plot_obj.applyChanges(aliases) #this will update the variables for i in range(plot_obj.varnum): cell.add_variable(aliases[plot_obj.vars[i]]) #get the most recent action that is not None if len(actions) > 0: action = actions.pop() while action == None and len(actions) > 0: action = actions.pop() if action is not None: cell.current_parent_version = action.id return action return None
def copy_pipeline_to_other_location(pipeline, controller, sheetName, row, col, plot_type, cell): #for now this helper will copy the workflow and change the location #based on the alias dictionary from core.uvcdat.plotmanager import get_plot_manager pip_str = core.db.io.serialize(pipeline) controller.change_selected_version(cell.current_parent_version) modules = controller.paste_modules_and_connections(pip_str, (0.0, 0.0)) cell.current_parent_version = controller.current_version pipeline = controller.current_pipeline plot_obj = get_plot_manager().get_plot_by_vistrail_version( plot_type, controller.vistrail, controller.current_version) plot_obj.current_parent_version = cell.current_parent_version plot_obj.current_controller = controller cell.plots = [plot_obj] aliases = {} for a in pipeline.aliases: aliases[a] = pipeline.get_alias_str_value(a) if (plot_obj.serializedConfigAlias and plot_obj.serializedConfigAlias in aliases): plot_obj.unserializeAliases(aliases) #FIXME: this will always spread the cells in the same row for j in range(plot_obj.cellnum): if plot_obj.cells[j].row_name and plot_obj.cells[j].col_name: aliases[plot_obj.cells[j].row_name] = str(row + 1) aliases[plot_obj.cells[j].col_name] = str(col + 1 + j) elif plot_obj.cells[j].address_name: aliases[plot_obj.cells[j].address_name] = "%s%s" % ( chr(ord('A') + col + j), row + 1) actions = plot_obj.applyChanges(aliases) #this will update the variables for i in range(plot_obj.varnum): cell.add_variable(aliases[plot_obj.vars[i]]) #get the most recent action that is not None if len(actions) > 0: action = actions.pop() while action == None and len(actions) > 0: action = actions.pop() if action is not None: cell.current_parent_version = action.id return action return None
def get_plot_by_vistrail_version(plot_type, vistrail, version): from core.uvcdat.plotmanager import get_plot_manager plots = get_plot_manager()._plot_list[plot_type] vistrail_a = vistrail version_a = version if vistrail_a is None or version_a <= 0: return None pipeline = vistrail.getPipeline(version) for pl in plots.itervalues(): vistrail_b = pl.plot_vistrail version_b = pl.workflow_version if vistrail_b is not None and version_b > 0: if (MatplotlibPipelineHelper.are_workflows_compatible( vistrail_a, vistrail_b, version_a, version_b) and len(pipeline.aliases) == len(pl.workflow.aliases)): return pl return None
def get_plot_by_vistrail_version(plot_type, vistrail, version): from core.uvcdat.plotmanager import get_plot_manager plots = get_plot_manager()._plot_list[plot_type] vistrail_a = vistrail version_a = version if vistrail_a is None or version_a <=0: return None pipeline = vistrail.getPipeline(version) for pl in plots.itervalues(): vistrail_b = pl.plot_vistrail version_b = pl.workflow_version if vistrail_b is not None and version_b > 0: if (MatplotlibPipelineHelper.are_workflows_compatible(vistrail_a, vistrail_b, version_a, version_b) and len(pipeline.aliases) == len(pl.workflow.aliases)): return pl return None
def setupDefaultPlotOptions(self): plotOptions = ["None"] currentIndex = 0 i = 1 plotList = get_plot_manager()._plot_list for package in plotList: for plot in plotList[package]: if type(plotList[package][plot]) is dict: for method in plotList[package][plot]: item = "%s_-_%s_-_%s" % (package, plot, method) plotOptions.append(item) if item == customizeUVCDAT.defaultPlot: currentIndex = i i+=1 else: item = "%s_-_%s" % (package, plot) plotOptions.append(item) if item == customizeUVCDAT.defaultPlot: currentIndex = i i+=1 self.defaultPlot.addItems(plotOptions) self.defaultPlot.setCurrentIndex(currentIndex)
def setupDefaultPlotOptions(self): plotOptions = ["None"] currentIndex = 0 i = 1 plotList = get_plot_manager()._plot_list for package in plotList: for plot in plotList[package]: if type(plotList[package][plot]) is dict: for method in plotList[package][plot]: item = "%s_-_%s_-_%s" % (package, plot, method) plotOptions.append(item) if item == customizeUVCDAT.defaultPlot: currentIndex = i i += 1 else: item = "%s_-_%s" % (package, plot) plotOptions.append(item) if item == customizeUVCDAT.defaultPlot: currentIndex = i i += 1 self.defaultPlot.addItems(plotOptions) self.defaultPlot.setCurrentIndex(currentIndex)
def remove_plot(self, plot): try: get_plot_manager().remove_plot_instance(plot) self.plots.remove(plot) except ValueError, err: print >> sys.stderr, " -- Error Removing plot (probably removing the plot more then once from the same list)-- "
def remove_plot(self, plot): try: get_plot_manager().remove_plot_instance(plot) self.plots.remove(plot) except ValueError, err: print>>sys.stderr, " -- Error Removing plot (probably removing the plot more then once from the same list)-- "