コード例 #1
0
 def loadWidget( self, pipeline):
     from PyQt4 import QtGui
     aliases = pipeline.aliases
     widget = QtGui.QWidget()
     layout = QtGui.QVBoxLayout()
     hidden_aliases = self.plot.computeHiddenAliases()
     for name, (type, oId, parentType, parentId, mId) in aliases.iteritems():
         if name not in hidden_aliases:
             p = pipeline.db_get_object(type, oId)
             if p.identifier == '':
                 idn = 'edu.utah.sci.vistrails.basic'
             else:
                 idn = p.identifier
             reg = get_module_registry()
             p_module = reg.get_module_by_name(idn, p.type, p.namespace)
             if p_module is not None:
                 widget_type = get_widget_class(p_module)
             else:
                 widget_type = StandardConstantWidget
             p_widget = widget_type(p, None)
             a_layout = QtGui.QHBoxLayout()
             label = QtGui.QLabel(name)
             a_layout.addWidget(label)
             a_layout.addWidget(p_widget)
             
             layout.addLayout(a_layout)
             self.alias_widgets[name] = p_widget
             
     widget.setLayout(layout)
     return widget
コード例 #2
0
 def loadWidget(self):
     from PyQt4 import QtGui
     aliases = self.workflow.aliases
     widget = QtGui.QWidget()
     layout = QtGui.QVBoxLayout()
     hidden_aliases = self.computeHiddenAliases()
     for name, (type, oId, parentType, parentId, mId) in aliases.iteritems():
         if name not in hidden_aliases:
             p = self.workflow.db_get_object(type, oId)
             if p.identifier == '':
                 idn = 'edu.utah.sci.vistrails.basic'
             else:
                 idn = p.identifier
             reg = get_module_registry()
             p_module = reg.get_module_by_name(idn, p.type, p.namespace)
             if p_module is not None:
                 widget_type = get_widget_class(p_module)
             else:
                 widget_type = StandardConstantWidget
             p_widget = widget_type(p, None)
             a_layout = QtGui.QHBoxLayout()
             label = QtGui.QLabel(name)
             a_layout.addWidget(label)
             a_layout.addWidget(p_widget)
             
             layout.addLayout(a_layout)
             self.alias_widgets[name] = p_widget
             
     widget.setLayout(layout)
     self._widget = widget
コード例 #3
0
    def __init__(self, param, parent=None):
        """ QParameterQuery(param: ModuleParam) -> QParameterQuery
        Construct the widget layout
        
        """
        QtGui.QWidget.__init__(self, parent)
        self.value = param.strValue
        self.type = param.type

        layout = QtGui.QHBoxLayout()
        layout.setSpacing(0)
        layout.setMargin(0)
        self.setLayout(layout)

        self.label = QtGui.QLabel('')
        layout.addWidget(self.label)

        self.selector = QParameterQuerySelector(self.type)
        layout.addWidget(self.selector)

        reg = get_module_registry()
        constant_class = reg.get_module_by_name(param.identifier, param.type,
                                                param.namespace)
        widget_type = get_widget_class(constant_class)
        self.editor = widget_type(param)
        layout.addWidget(self.editor)

        self.connect(self.selector.operationActionGroup,
                     QtCore.SIGNAL('triggered(QAction*)'),
                     self.operationChanged)
        if self.type == 'String':
            self.connect(self.selector.caseActionGroup,
                         QtCore.SIGNAL('triggered(QAction*)'),
                         self.caseChanged)
        self.selector.initAction(param.queryMethod)
コード例 #4
0
ファイル: mashups_widgets.py プロジェクト: painter1/vistrails
 def createAliasWidget(self, val=None, parent=None):
     if self.vtparam.identifier == '':
         idn = 'edu.utah.sci.vistrails.basic'
     else:
         idn = self.vtparam.identifier
     reg = get_module_registry()
     p_module = reg.get_module_by_name(idn, self.vtparam.type,
                                       self.vtparam.namespace)
     widget_type = get_widget_class(p_module)
     if val:
         self.vtparam.strValue = val
     return widget_type(self.vtparam, parent)
コード例 #5
0
 def createAliasWidget(self, val=None, parent=None):
     if self.vtparam.identifier == '':
         idn = 'edu.utah.sci.vistrails.basic'
     else:
         idn = self.vtparam.identifier
     reg = get_module_registry()
     p_module = reg.get_module_by_name(idn, self.vtparam.type, 
                                       self.vtparam.namespace)
     widget_type = get_widget_class(p_module)
     if val:
         self.vtparam.strValue = val
     return widget_type(self.vtparam, parent)
コード例 #6
0
ファイル: alias_inspector.py プロジェクト: painter1/vistrails
 def createAliasWidget(alias, controller, parent=None):
     v = controller.vtController.vistrail
     p = v.db_get_object(alias.component.vttype, alias.component.vtid)
     if p.identifier == '':
         idn = 'edu.utah.sci.vistrails.basic'
     else:
         idn = p.identifier
     reg = get_module_registry()
     p_module = reg.get_module_by_name(idn, p.type, p.namespace)
     widget_type = get_widget_class(p_module)
     p.strValue = alias.component.val
     return widget_type(p, parent)
コード例 #7
0
    def updateFunction(self, function, port_spec):
        """ updateFunction(function: ModuleFunction,
                           port_spec: PortSpec) -> None
        Auto create widgets to describes the function 'function'
        
        """
        reg = module_registry.get_module_registry()
        self.function = function
        self.widgets = []
        self.labels = []

        ps_labels = None
        if port_spec is not None:
            ps_labels = port_spec.labels
        for pIndex in xrange(len(function.params)):
            p = function.params[pIndex]
            # FIXME: Find the source of this problem instead
            # of working around it here.
            if p.identifier == '':
                idn = 'edu.utah.sci.vistrails.basic'
            else:
                idn = p.identifier

            p_module = None
            try:
                p_module = reg.get_module_by_name(idn,
                                                  p.type,
                                                  p.namespace)
            except module_registry.ModuleRegistryException:
                debug.critical("HIT ModuleRegistryException in DROPBOX")
                pass
            widget_type = get_widget_class(p_module)
            ps_label = ''
            if ps_labels is not None and len(ps_labels) > pIndex:
                ps_label = str(ps_labels[pIndex])
            label = QHoverAliasLabel(p.alias, p.type, ps_label)

            constant_widget = widget_type(p, self)
            self.widgets.append(constant_widget)
            self.labels.append(label)
            self.layout().addWidget(label, pIndex, 0)
            self.layout().addWidget(constant_widget, pIndex, 1)
            # Ugly hack to add browse button to methods that look like
            # they have to do with files
            if('file' in function.name.lower() and p.type == 'String'):
                browseButton = FileChooserToolButton(self, constant_widget)
                self.layout().addWidget(browseButton, pIndex, 2)
コード例 #8
0
ファイル: method_dropbox.py プロジェクト: painter1/vistrails
    def updateFunction(self, function, port_spec):
        """ updateFunction(function: ModuleFunction,
                           port_spec: PortSpec) -> None
        Auto create widgets to describes the function 'function'
        
        """
        reg = module_registry.get_module_registry()
        self.function = function
        self.widgets = []
        self.labels = []

        ps_labels = None
        if port_spec is not None:
            ps_labels = port_spec.labels
        for pIndex in xrange(len(function.params)):
            p = function.params[pIndex]
            # FIXME: Find the source of this problem instead
            # of working around it here.
            if p.identifier == '':
                idn = 'edu.utah.sci.vistrails.basic'
            else:
                idn = p.identifier

            p_module = None
            try:
                p_module = reg.get_module_by_name(idn, p.type, p.namespace)
            except module_registry.ModuleRegistryException:
                debug.critical("HIT ModuleRegistryException in DROPBOX")
                pass
            widget_type = get_widget_class(p_module)
            ps_label = ''
            if ps_labels is not None and len(ps_labels) > pIndex:
                ps_label = str(ps_labels[pIndex])
            label = QHoverAliasLabel(p.alias, p.type, ps_label)

            constant_widget = widget_type(p, self)
            self.widgets.append(constant_widget)
            self.labels.append(label)
            self.layout().addWidget(label, pIndex, 0)
            self.layout().addWidget(constant_widget, pIndex, 1)
            # Ugly hack to add browse button to methods that look like
            # they have to do with files
            if ('file' in function.name.lower() and p.type == 'String'):
                browseButton = FileChooserToolButton(self, constant_widget)
                self.layout().addWidget(browseButton, pIndex, 2)
コード例 #9
0
 def __init__(self, descriptor, var_strValue="", parent=None):
     """ QVariableInputForm(descriptor: ModuleDescriptor, var_strValue: str, parent: QWidget) -> QVariableInputForm
     Initialize with a vertical layout
     
     """
     QtGui.QGroupBox.__init__(self, parent)
     self.setLayout(QtGui.QGridLayout())
     self.layout().setMargin(5)
     self.layout().setSpacing(5)
     self.setFocusPolicy(QtCore.Qt.ClickFocus)
     self.setSizePolicy(QtGui.QSizePolicy.Preferred,
                        QtGui.QSizePolicy.Fixed)
     self.palette().setColor(QtGui.QPalette.Window,
                             CurrentTheme.METHOD_SELECT_COLOR)
     # Create widget for editing variable
     p = ModuleParam(type=descriptor.name, identifier=descriptor.identifier, namespace=descriptor.namespace)
     p.strValue = var_strValue
     widget_type = get_widget_class(descriptor.module)
     self.widget = widget_type(p, self)
     self.label = QDragVariableLabel(p.type)
     self.layout().addWidget(self.label, 0, 0)
     self.layout().addWidget(self.widget, 0, 1)
     self.updateMethod()
コード例 #10
0
    def __init__(self, param, parent=None):
        """ QParameterQuery(param: ModuleParam) -> QParameterQuery
        Construct the widget layout
        
        """
        QtGui.QWidget.__init__(self, parent)
        self.value = param.strValue
        self.type = param.type
        
        layout = QtGui.QHBoxLayout()
        layout.setSpacing(0)
        layout.setMargin(0)
        self.setLayout(layout)
        
        self.label = QtGui.QLabel('')
        layout.addWidget(self.label)
        
        self.selector = QParameterQuerySelector(self.type)
        layout.addWidget(self.selector)        

        reg = get_module_registry()
        constant_class = reg.get_module_by_name(param.identifier,
                                                param.type,
                                                param.namespace)
        widget_type = get_widget_class(constant_class)
        self.editor = widget_type(param)
        layout.addWidget(self.editor)

        self.connect(self.selector.operationActionGroup,
                     QtCore.SIGNAL('triggered(QAction*)'),
                     self.operationChanged)
        if self.type =='String':            
            self.connect(self.selector.caseActionGroup,
                         QtCore.SIGNAL('triggered(QAction*)'),
                         self.caseChanged)
        self.selector.initAction(param.queryMethod)