def add_template(self, template): for plot in self.plots: if plot.template is None: plot.template = template set_status_message("Added template %s to plot %s" % \ (template, plot.name)) return len(plot.variables) == plot.varnum set_status_message("Added %s to cell's template queue" % template) self.templateQ.append(template) return False
def add_plot(self, plot): self.plots.append(plot) #add template from queue if plot.template is None and len(self.templateQ) > 0: plot.template = self.templateQ.pop(0) #add vars from queue for i in range(plot.varnum - len(plot.variables)): if len(self.variableQ) > 0: varname = self.variableQ.pop(0) if plot.acceptsVariable(varname): plot.variables.append(varname) else: break if len(plot.variables) == plot.varnum: set_status_message("Plot %s" % plot.name) return True else: set_status_message("Added %s to cell's plot queue" % plot.name) return False
def add_variable(self, varname): self.defaultPlotVersion = None for plot in self.plots: if len(plot.variables) < plot.varnum: if plot.acceptsVariable(varname): plot.variables.append(varname) set_status_message("Added %s to plot %s" % (varname, plot.name)) return len(plot.variables) == plot.varnum else: set_status_message("Plot %s does not accept %s" % (plot.name, varname)) return False set_status_message("Added %s to cell's variable queue" % varname) self.variableQ.append(varname) return False