Esempio n. 1
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()
Esempio n. 2
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
 def createAliasWidget(self, val=None, parent=None):
     if self.vtparam.identifier == '':
         idn = get_vistrails_basic_pkg_id()
     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)
 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 = get_vistrails_basic_pkg_id()
     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)