Esempio n. 1
0
 def updateGMS(self, plot):
     if plot.graphics_method:
         gm = plot.graphics_method.name
         if gm[:2] == '__':
             gm_prefix = vcs.graphicsmethodtype(plot.graphics_method)
             gm_prefix = self.fixInvalidVariables(gm_prefix)
             if gm_prefix not in self.gm_count.keys():
                 self.gm_count[gm_prefix] = 1
             else:
                 self.gm_count[gm_prefix] += 1
             gm = "{0}_{1}".format(gm_prefix, self.gm_count[gm_prefix])
         else:
             gm = self.fixInvalidVariables(gm)
         if gm == 'default':
             "{0}_default".format(vcs.graphicsmethodtype(plot.graphics_method))
         self.shell_vars[plot]['gm'] = gm
         self.kernel.shell.push({gm: plot.graphics_method})
Esempio n. 2
0
 def updateGMS(self, plot):
     if plot.graphics_method:
         gm = plot.graphics_method.name
         if gm[:2] == '__':
             gm_prefix = vcs.graphicsmethodtype(plot.graphics_method)
             gm_prefix = self.fixInvalidVariables(gm_prefix)
             if gm_prefix not in self.gm_count.keys():
                 self.gm_count[gm_prefix] = 1
             else:
                 self.gm_count[gm_prefix] += 1
             gm = "{0}_{1}".format(gm_prefix, self.gm_count[gm_prefix])
         else:
             gm = self.fixInvalidVariables(gm)
         if gm == 'default':
             "{0}_default".format(
                 vcs.graphicsmethodtype(plot.graphics_method))
         self.shell_vars[plot]['gm'] = gm
         self.kernel.shell.push({gm: plot.graphics_method})
Esempio n. 3
0
    def plot(self):
        if self.variables is None:
            raise ValueError("No variables specified")
        if self.graphics_method is None:
            raise ValueError("No graphics method specified")
        # Check if gm supports templates
        if self.template is None:
            raise ValueError("No template specified")

        if self.dp is not None:
            if self.dp.name not in self.canvas.display_names:
                self.dp = vcs.elements["display"][self.canvas.display_names[
                    self.dp_ind]]
            # Set the slabs appropriately
            self.dp.array[0] = self.variables[0]
            self.dp.array[1] = self.variables[1]

            # Update the template
            self.dp._template_origin = self.template.name

            # Update the graphics method
            self.dp.g_name = self.graphics_method.name
            self.dp.g_type = vcs.graphicsmethodtype(self.graphics_method)

            ind = self.canvas.display_names.index(self.dp.name)

            # Update the canvas
            self.canvas.update()

            self.dp = vcs.elements["display"][self.canvas.display_names[ind]]

        else:
            args = []
            for var in self.variables:
                if var is not None:
                    args.append(var)
            args.append(self.template.name)
            args.append(vcs.graphicsmethodtype(self.graphics_method))
            args.append(self.graphics_method.name)
            self.dp = self.canvas.plot(*args, ratio="autot")
            self.dp_ind = self.canvas.display_names.index(self.dp.name)
Esempio n. 4
0
    def plot(self):
        if self.variables is None:
            raise ValueError("No variables specified")
        if self.graphics_method is None:
            raise ValueError("No graphics method specified")
        # Check if gm supports templates
        if self.template is None:
            raise ValueError("No template specified")

        if self.dp is not None:
            if self.dp.name not in self.canvas.display_names:
                self.dp = vcs.elements["display"][self.canvas.display_names[self.dp_ind]]
            # Set the slabs appropriately
            self.dp.array[0] = self.variables[0]
            self.dp.array[1] = self.variables[1]

            # Update the template
            self.dp._template_origin = self.template.name

            # Update the graphics method
            self.dp.g_name = self.graphics_method.name
            self.dp.g_type = vcs.graphicsmethodtype(self.graphics_method)

            ind = self.canvas.display_names.index(self.dp.name)

            # Update the canvas
            self.canvas.update()

            self.dp = vcs.elements["display"][self.canvas.display_names[ind]]

        else:
            args = []
            for var in self.variables:
                if var is not None:
                    args.append(var)
            args.append(self.template.name)
            args.append(vcs.graphicsmethodtype(self.graphics_method))
            args.append(self.graphics_method.name)
            self.dp = self.canvas.plot(*args, ratio="autot")
            self.dp_ind = self.canvas.display_names.index(self.dp.name)
Esempio n. 5
0
    def plot(self):
        if self.variables is None:
            raise ValueError("No variables specified")

        if self.dp is not None:
            # Set the slabs appropriately
            self.dp.array[0] = self.variables[0]
            self.dp.array[1] = self.variables[1]

            # Update the template
            self.dp._template_origin = self.template.name

            # Update the graphics method
            self.dp.g_name = self.graphics_method.name
            self.dp.g_type = vcs.graphicsmethodtype(self.graphics_method)

            # Update the canvas
            self.canvas.update()

        else:
            args = []
            for var in self.variables:
                if var is not None:
                    args.append(var)
            if self.template is not None:
                args.append(self.template.name)
            else:
                args.append("default")
            if self.graphics_method is not None:
                args.append(vcs.graphicsmethodtype(self.graphics_method))
                args.append(self.graphics_method.name)
            self.dp = self.canvas.plot(*args)
            if self.template is None:
                self._template = vcs.gettemplate(self.dp._template_origin)
            if self.graphics_method is None:
                self._gm = vcs.getgraphicsmethod(self.dp.g_type,
                                                 self.dp.g_name)
Esempio n. 6
0
    def plot(self):
        if self.variables is None:
            raise ValueError("No variables specified")

        if self.dp is not None:
            # Set the slabs appropriately
            self.dp.array[0] = self.variables[0]
            self.dp.array[1] = self.variables[1]

            # Update the template
            self.dp._template_origin = self.template.name

            # Update the graphics method
            self.dp.g_name = self.graphics_method.name
            self.dp.g_type = vcs.graphicsmethodtype(self.graphics_method)

            # Update the canvas
            self.canvas.update()

        else:
            args = []
            for var in self.variables:
                if var is not None:
                    args.append(var)
            if self.template is not None:
                args.append(self.template.name)
            else:
                args.append("default")
            if self.graphics_method is not None:
                args.append(vcs.graphicsmethodtype(self.graphics_method))
                args.append(self.graphics_method.name)
            self.dp = self.canvas.plot(*args)
            if self.template is None:
                self._template = vcs.gettemplate(self.dp._template_origin)
            if self.graphics_method is None:
                self._gm = vcs.getgraphicsmethod(self.dp.g_type, self.dp.g_name)
Esempio n. 7
0
    def name(self):
        if self.can_plot() is False:
            return "(Untitled)"

        vars = []
        for v in self._vars:
            if v is None:
                continue
            try:
                vars.append(v.long_name)
            except AttributeError:
                try:
                    vars.append(v.title)
                except AttributeError:
                    vars.append(v.id)

        gm_type = vcs.graphicsmethodtype(self._gm)
        vars = " x ".join(vars)
        return "%s (%s)" % (vars, gm_type)
Esempio n. 8
0
    def name(self):
        if self.can_plot() is False:
            return "(Untitled)"

        vars = []
        for v in self._vars:
            if v is None:
                continue
            try:
                vars.append(v.long_name)
            except AttributeError:
                try:
                    vars.append(v.title)
                except AttributeError:
                    vars.append(v.id)

        gm_type = vcs.graphicsmethodtype(self._gm)
        vars = " x ".join(vars)
        return "%s (%s)" % (vars, gm_type)
Esempio n. 9
0
 def selectPlot(self, plot):
     plotIndex = self.plot_combo.currentIndex()
     if 0 <= plotIndex < self.plots.rowCount():
         self.plot_combo.setEnabled(True)
         self.current_plot = plot
         # Set the variable combos to the correct indices
         for ind, var in enumerate(plot.variables):
             block = self.var_combos[ind].blockSignals(True)
             if var is None:
                 self.var_combos[ind].setEnabled(False)
                 self.var_combos[ind].setCurrentIndex(-1)
             else:
                 self.var_combos[ind].setEnabled(True)
                 self.var_combos[ind].setCurrentIndex(self.var_combos[ind].findText(var.id))
             self.var_combos[ind].blockSignals(block)
         gm = plot.graphics_method
         block = self.gm_instance_combo.blockSignals(True)
         self.gm_type_combo.setCurrentIndex(self.gm_type_combo.findText(vcs.graphicsmethodtype(gm)))
         try:
             self.gm_instance_combo.setCurrentIndex(self.gm_instance_combo.findText(gm.name))
         except:
             pass
         self.gm_instance_combo.blockSignals(block)
         self.gm_instance_combo.setEnabled(True)
         self.gm_type_combo.setEnabled(True)
         self.template_combo.setEnabled(True)
         block = self.template_combo.blockSignals(True)
         self.template_combo.setCurrentIndex(self.template_combo.findText(plot.template.name))
         self.template_combo.blockSignals(block)
         if self.gm_type_combo.currentText() == "boxfill":
             self.edit_gm_button.setEnabled(True)
         else:
             self.edit_gm_button.setEnabled(False)
     else:
         self.plot_combo.setEnabled(False)
         self.gm_type_combo.setEnabled(False)
         self.gm_instance_combo.setEnabled(False)
         self.template_combo.setEnabled(False)
         self.edit_gm_button.setEnabled(False)
         for v in self.var_combos:
             v.setEnabled(False)
Esempio n. 10
0
def diff_gm(gm):
    base = vcs.getgraphicsmethod(vcs.graphicsmethodtype(gm), "default")
    return diff(gm, base)
Esempio n. 11
0
 def replace(self, index, gm):
     self.gms[vcs.graphicsmethodtype(gm)][index.row()] = gm
     self.dataChanged.emit(index, index)
Esempio n. 12
0
 def add_gm(self, gm):
     parent_row = self.gm_types.index(vcs.graphicsmethodtype(gm))
     self.insertRows(self.rowCount(), 1, [gm], self.index(parent_row, 0))
Esempio n. 13
0
 def replace(self, index, gm):
     self.gms[vcs.graphicsmethodtype(gm)][index.row()] = gm
     self.dataChanged.emit(index, index)
Esempio n. 14
0
 def add_gm(self, gm):
     parent_row = self.gm_types.index(vcs.graphicsmethodtype(gm))
     self.insertRows(self.rowCount(), 1, [gm], self.index(parent_row, 0))
Esempio n. 15
0
def diff_gm(gm):
    base = vcs.getgraphicsmethod(vcs.graphicsmethodtype(gm), "default")
    return diff(gm, base)