Ejemplo n.º 1
0
    def get_pipeline(self):
        vistraildata = VistrailManager(self._controller)
        if vistraildata is None:
            return None

        if self.widget() is not None:
            # Get pipeline info from VisTrails
            pipelineInfo = self.cellInfo.tab.getCellPipelineInfo(
                self.cellInfo.row, self.cellInfo.column)
            version = pipelineInfo[0]['version']
            return vistraildata.get_pipeline(version,
                                             infer_for_cell=self.cellInfo)
        else:
            # Get pipeline info from DAT: we might be building something here
            return vistraildata.get_pipeline(self.cellInfo)
Ejemplo n.º 2
0
    def show_advanced_config(self):
        # Get the pipeline info for the cell
        vistraildata = VistrailManager(self._cell._controller)
        pipeline = vistraildata.get_pipeline(self._cell.cellInfo)

        self._cell._set_overlay(pipeline.recipe.plot.configWidget)
        self._cell._overlay.setup(self._cell, pipeline.recipe.plot)
Ejemplo n.º 3
0
    def show_advanced_config(self):
        # Get the pipeline info for the cell
        vistraildata = VistrailManager(self._cell._controller)
        pipeline = vistraildata.get_pipeline(self._cell.cellInfo)

        self._cell._set_overlay(pipeline.recipe.plot.configWidget)
        self._cell._overlay.setup(self._cell, pipeline.recipe.plot)
Ejemplo n.º 4
0
def _color_version_nodes(node, action, tag, description):
    pipelineInfo = None
    if action is not None and VistrailManager.initialized:
        vistraildata = VistrailManager()
        # Warning: the first scene might get created before the
        # VistrailManager gets the 'controller_changed' signal, thus
        # VistrailManager() might be None
        if vistraildata is not None:
            pipelineInfo = vistraildata.get_pipeline(action.id)

    if tag == 'dat-vars':
        # Variable root
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        return dict(
            VERSION_USER_BRUSH=brush,
            VERSION_OTHER_BRUSH=brush,
            VERSION_LABEL_COLOR=QtGui.QColor(255, 255, 255),
            VERSION_SHAPE='rectangle')
    elif tag is not None and tag.startswith('dat-var-'):
        # Variables
        return dict(
            VERSION_USER_BRUSH=QtGui.QBrush(QtGui.QColor(27, 27, 75)),
            VERSION_OTHER_BRUSH=QtGui.QBrush(QtGui.QColor(72, 50, 25)),
            VERSION_LABEL_COLOR=QtGui.QColor(255, 255, 255),
            VERSION_SHAPE='rectangle')
    elif pipelineInfo is not None:
        return dict(
            VERSION_USER_BRUSH=QtGui.QBrush(QtGui.QColor(171, 169, 214)),
            VERSION_OTHER_BRUSH=QtGui.QBrush(QtGui.QColor(219, 198, 179)))
    else:
        return dict()
Ejemplo n.º 5
0
Archivo: vt_hooks.py Proyecto: rbax/DAT
def _color_version_nodes(node, action, tag, description):
    pipelineInfo = None
    if action is not None and VistrailManager.initialized:
        vistraildata = VistrailManager()
        # Warning: the first scene might get created before the
        # VistrailManager gets the 'controller_changed' signal, thus
        # VistrailManager() might be None
        if vistraildata is not None:
            pipelineInfo = vistraildata.get_pipeline(action.id)

    if tag == 'dat-vars':
        # Variable root
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        return dict(VERSION_USER_BRUSH=brush,
                    VERSION_OTHER_BRUSH=brush,
                    VERSION_LABEL_COLOR=QtGui.QColor(255, 255, 255),
                    VERSION_SHAPE='rectangle')
    elif tag is not None and tag.startswith('dat-var-'):
        # Variables
        return dict(VERSION_USER_BRUSH=QtGui.QBrush(QtGui.QColor(27, 27, 75)),
                    VERSION_OTHER_BRUSH=QtGui.QBrush(QtGui.QColor(72, 50, 25)),
                    VERSION_LABEL_COLOR=QtGui.QColor(255, 255, 255),
                    VERSION_SHAPE='rectangle')
    elif pipelineInfo is not None:
        return dict(
            VERSION_USER_BRUSH=QtGui.QBrush(QtGui.QColor(171, 169, 214)),
            VERSION_OTHER_BRUSH=QtGui.QBrush(QtGui.QColor(219, 198, 179)))
    else:
        return dict()
Ejemplo n.º 6
0
 def resetClicked(self):
     mngr = VistrailManager(self.cell._controller)
     pipeline = mngr.get_pipeline(self.cell.cellInfo)
     if pipeline.version != self.cell._controller.current_version:
         self.cell._controller.change_selected_version(pipeline.version)
         currentTabIndex = self.tabWidget.currentIndex()
         self.setup(self.cell, self.plot)
         self.tabWidget.setCurrentIndex(currentTabIndex)
Ejemplo n.º 7
0
    def applyClicked(self):
        self.okClicked()

        # Bring this overlay back up
        self.cell._set_overlay(DefaultPlotConfigOverlay)
        mngr = VistrailManager(self.cell._controller)
        pipeline = mngr.get_pipeline(self.cell.cellInfo)
        self.cell._overlay.setup(self.cell, pipeline.recipe.plot)
Ejemplo n.º 8
0
 def okClicked(self):
     mngr = VistrailManager(self.cell._controller)
     pipeline = mngr.get_pipeline(self.cell.cellInfo)
     if pipeline.version != self.cell._controller.current_version:
         new_pipeline = PipelineInformation(
             self.cell._controller.current_version,
             pipeline.recipe,
             pipeline.conn_map,
             pipeline.port_map)
         mngr.created_pipeline(self.cell.cellInfo, new_pipeline)
         self.cell.update_pipeline(True)
     else:
         self.cell._set_overlay(None)
Ejemplo n.º 9
0
def _get_custom_version_panels(controller, version):
    _ = translate("recipe_version_panel")

    if not VistrailManager.initialized:
        return []
    vistraildata = VistrailManager(controller)
    if vistraildata is None:
        return []
    pipelineInfo = vistraildata.get_pipeline(version)
    if pipelineInfo is None:
        return []

    monospace = QtGui.QFont('Monospace')
    monospace.setStyleHint(QtGui.QFont.TypeWriter)

    recipe = pipelineInfo.recipe
    recipe_widget = QtGui.QGroupBox(_("DAT recipe"))
    recipe_widget.setSizePolicy(
        recipe_widget.sizePolicy().horizontalPolicy(),
        QtGui.QSizePolicy.Fixed)
    layout = QtGui.QVBoxLayout()

    line = QtGui.QHBoxLayout()
    line.addWidget(QtGui.QLabel(_("Plot:")))
    plot_label = QtGui.QLabel("%s" % recipe.plot.name)
    plot_label.setFont(monospace)
    line.addWidget(plot_label)
    layout.addLayout(line)

    layout.addWidget(QtGui.QLabel(_("Variables:")))
    variable_list = QtGui.QTextEdit()
    color = variable_list.textColor()
    variable_list.setEnabled(False)
    variable_list.setTextColor(color)
    variable_list.setFont(monospace)
    variable_list.setLineWrapMode(QtGui.QTextEdit.NoWrap)
    variable_list.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
    text = []
    for p_values in recipe.parameters.itervalues():
        for value in p_values:
            if value.type == RecipeParameterValue.VARIABLE:
                text.append(value.variable.name)
    text = '\n'.join(text)
    variable_list.setPlainText(text)
    variable_list.setFixedHeight(
        variable_list.document().size().height())
    layout.addWidget(variable_list)

    recipe_widget.setLayout(layout)
    return [(-1, recipe_widget)]
Ejemplo n.º 10
0
    def setup(self, cell, plot):
        self.cell = cell
        self.plot = plot

        # Get pipeline of the cell
        mngr = VistrailManager(cell._controller)
        pipelineInfo = mngr.get_pipeline(cell.cellInfo)

        # Clear old tabs
        self.tabWidget.clear()

        # Get all of the plot modules in the pipeline
        plot_modules = get_plot_modules(
            pipelineInfo,
            cell._controller.current_pipeline)

        registry = get_module_registry()
        getter = registry.get_configuration_widget
        for module in plot_modules:
            widgetType = None
            widget = None

            # Try to get custom config widget for the module
            try:
                widgetType = \
                    getter(module.package, module.name, module.namespace)
            except ModuleRegistryException:
                pass

            if widgetType:
                # Use custom widget
                widget = widgetType(module, cell._controller)
                self.connect(widget, QtCore.SIGNAL("doneConfigure"),
                             self.configureDone)
                self.connect(widget, QtCore.SIGNAL("stateChanged"),
                             self.stateChanged)
            else:
                # Use PortsList widget, only if module has ports
                widget = DATPortsList(self)
                widget.update_module(module)
                if len(widget.port_spec_items) > 0:
                    widget.set_controller(cell._controller)
                else:
                    widget = None

            # Add widget in new tab
            if widget:
                self.tabWidget.addTab(widget, module.name)
Ejemplo n.º 11
0
Archivo: vt_hooks.py Proyecto: rbax/DAT
def _get_custom_version_panels(controller, version):
    _ = translate("recipe_version_panel")

    if not VistrailManager.initialized:
        return []
    vistraildata = VistrailManager(controller)
    if vistraildata is None:
        return []
    pipelineInfo = vistraildata.get_pipeline(version)
    if pipelineInfo is None:
        return []

    monospace = QtGui.QFont('Monospace')
    monospace.setStyleHint(QtGui.QFont.TypeWriter)

    recipe = pipelineInfo.recipe
    recipe_widget = QtGui.QGroupBox(_("DAT recipe"))
    recipe_widget.setSizePolicy(recipe_widget.sizePolicy().horizontalPolicy(),
                                QtGui.QSizePolicy.Fixed)
    layout = QtGui.QVBoxLayout()

    line = QtGui.QHBoxLayout()
    line.addWidget(QtGui.QLabel(_("Plot:")))
    plot_label = QtGui.QLabel("%s" % recipe.plot.name)
    plot_label.setFont(monospace)
    line.addWidget(plot_label)
    layout.addLayout(line)

    layout.addWidget(QtGui.QLabel(_("Variables:")))
    variable_list = QtGui.QTextEdit()
    color = variable_list.textColor()
    variable_list.setEnabled(False)
    variable_list.setTextColor(color)
    variable_list.setFont(monospace)
    variable_list.setLineWrapMode(QtGui.QTextEdit.NoWrap)
    variable_list.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
    text = []
    for p_values in recipe.parameters.itervalues():
        for value in p_values:
            if value.type == RecipeParameterValue.VARIABLE:
                text.append(value.variable.name)
    text = '\n'.join(text)
    variable_list.setPlainText(text)
    variable_list.setFixedHeight(variable_list.document().size().height())
    layout.addWidget(variable_list)

    recipe_widget.setLayout(layout)
    return [(-1, recipe_widget)]