def __init__(self, param, parent=None): """__init__(param: core.vistrail.module_param.ModuleParam, parent: QWidget) Initializes the line edit with contents """ dictkey = param._namespace typedict = vistrails.packages.webServices.webServicesmodulesDict[dictkey] w = param._namespace.replace('|Types','') dictkey = w + "." + param._type obj = typedict[dictkey] self.enumerationlist = obj.ports[0][0] QtGui.QComboBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) QtGui.QComboBox.clear(self) listqt = [] for element in self.enumerationlist: listqt.append(element) QtGui.QComboBox.addItems(self, listqt) foundindex = self.findText(param.strValue) if not foundindex == -1: self.setCurrentIndex(foundindex) else: self.setCurrentIndex(0) param.strValue = self.enumerationlist[self.currentIndex()] self.connect(self, QtCore.SIGNAL('activated(int)'), self.change_state)
def __init__(self, param, parent=None): QtGui.QWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) if not param.strValue: self._tf = copy.copy(default_tf) else: self._tf = TransferFunction.parse(param.strValue) self._scene = TransferFunctionScene(self._tf, self) layout = QtGui.QVBoxLayout() self.setLayout(layout) self._view = TransferFunctionView(self) self._view.setScene(self._scene) self._view.setMinimumSize(200,200) self._view.setMaximumHeight(280) self._view.show() self._view.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self._view.setMatrix(QtGui.QMatrix(1, 0, 0, -1, 0, 0)) self.setMinimumSize(260,240) caption = QtGui.QLabel("Double-click on the line to add a point") font = QtGui.QFont('Arial', 11) font.setItalic(True) caption.setFont(font) layout.addWidget(self._view) layout.addWidget(caption)
def __init__(self, param, parent=None): """__init__(param: core.vistrail.module_param.ModuleParam, parent: QWidget) """ contents = param.strValue contentType = param.type QtGui.QComboBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) # want to look up in registry based on parameter type self._silent = False self.addItem('') for val in self.param_values: self.addItem(val) curIdx = self.findText(contents) if curIdx != -1: self.setCurrentIndex(curIdx) self._contentType = contentType self.connect(self, QtCore.SIGNAL('currentIndexChanged(int)'), self.indexChanged)
def __init__(self, param, parent=None): """__init__(param: core.vistrail.module_param.ModuleParam, parent: QWidget) Initializes the line edit with contents """ dictkey = param._namespace typedict = vistrails.packages.webServices.webServicesmodulesDict[ dictkey] w = param._namespace.replace('|Types', '') dictkey = w + "." + param._type obj = typedict[dictkey] self.enumerationlist = obj.ports[0][0] QtGui.QComboBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) QtGui.QComboBox.clear(self) listqt = [] for element in self.enumerationlist: listqt.append(element) QtGui.QComboBox.addItems(self, listqt) foundindex = self.findText(param.strValue) if not foundindex == -1: self.setCurrentIndex(foundindex) else: self.setCurrentIndex(0) param.strValue = self.enumerationlist[self.currentIndex()] self.connect(self, QtCore.SIGNAL('activated(int)'), self.change_state)
def __init__(self, param, parent=None): QtGui.QSpinBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) assert param.type == 'Integer' assert param.identifier == get_vistrails_basic_pkg_id() self.connect(self, QtCore.SIGNAL('valueChanged(int)'), self.change_val) self.setContents(param.strValue)
def __init__(self, param, parent=None): QtGui.QDoubleSpinBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) assert param.type == "Float" assert param.identifier == get_vistrails_basic_pkg_id() self.connect(self, QtCore.SIGNAL("valueChanged(double)"), self.change_val) self.setContents(param.strValue)
def __init__(self, param, parent=None): QtGui.QSpinBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) assert param.type == 'Integer' assert param.identifier == get_vistrails_basic_pkg_id() self.connect(self, QtCore.SIGNAL('valueChanged(int)'), self.change_val) self.setContents(param.strValue)
def __init__(self, param, parent=None): self.param = param self.strValue = param.strValue contentsType = param.type QtGui.QWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) layout = QtGui.QHBoxLayout() # FIXME Use a greyed QLineEdit? # layout.addWidget(QtGui.QLabel("File Info:")) button = QtGui.QPushButton("Configure") button.setMaximumWidth(100) self.connect(button, QtCore.SIGNAL('clicked()'), self.run_dialog) layout.addWidget(button) layout.setMargin(5) layout.setSpacing(5) self.setLayout(layout)
def __init__(self, param, parent=None): QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent) ConstantWidgetMixin.__init__(self, param.strValue) assert param.type in['Integer', 'Float'] self.sliderType = int if param.type == 'Integer' else float assert param.identifier == get_vistrails_basic_pkg_id() self.connect(self, QtCore.SIGNAL('valueChanged(int)'),self.change_val) QtGui.QSlider.setSingleStep(self, 1) QtGui.QSlider.setPageStep(self, 5) self.floatMinVal = 0.0 self.floatMaxVal = 1.0 self.floatStepSize = 1 self.numSteps = 1 self.setContents(param.strValue) self.setTickPosition(QtGui.QSlider.TicksAbove)
def __init__(self, param, parent=None): QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent) ConstantWidgetMixin.__init__(self, param.strValue) assert param.type in ['Integer', 'Float'] self.sliderType = int if param.type == 'Integer' else float assert param.identifier == get_vistrails_basic_pkg_id() self.connect(self, QtCore.SIGNAL('valueChanged(int)'), self.change_val) QtGui.QSlider.setSingleStep(self, 1) QtGui.QSlider.setPageStep(self, 5) self.floatMinVal = 0.0 self.floatMaxVal = 1.0 self.floatStepSize = 1 self.numSteps = 1 self.setContents(param.strValue) self.setTickPosition(QtGui.QSlider.TicksAbove)
def __init__(self, param, parent=None): self.param = param self.strValue = param.strValue contentsType = param.type QtGui.QWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) layout = QtGui.QHBoxLayout() # FIXME Use a greyed QLineEdit? # layout.addWidget(QtGui.QLabel("File Info:")) button = QtGui.QPushButton("Configure") button.setMaximumWidth(100) self.connect(button, QtCore.SIGNAL('clicked()'), self.run_dialog) layout.addWidget(button) layout.setMargin(5) layout.setSpacing(5) self.setLayout(layout)
def __init__(self, param, available_tree, parent=None): """__init__(param: vistrails.core.vistrail.module_param.ModuleParam, parent: QWidget) Initialize the line edit with its contents. Content type is limited to 'int', 'float', and 'string' """ PredictorListWidget.__init__(self, param.strValue, available_tree, parent) ConstantWidgetMixin.__init__(self, param.strValue) contents = param.strValue contentType = param.type # need to deserialize contents and set tree widget accordingly # self.setText(contents) self._contentType = contentType
def __init__(self, param, parent=None): QtGui.QGraphicsWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) self.setAcceptHoverEvents(True) if not param.strValue: self._tf = copy.copy(default_tf) else: self._tf = TransferFunction.parse(param.strValue) self._tf_items = [] poly = TransferFunctionPolygon(self) poly.setup() self._tf_poly = poly self.create_tf_items(self._tf) self._tf_poly.setup() #current scale self._sx = 1.0 self._sy = 1.0 # Add outlines line_color = QtGui.QColor(200, 200, 200) pen = QtGui.QPen(line_color) ps = [ QtCore.QPointF(0.0, 0.0), QtCore.QPointF(GLOBAL_SCALE, 0.0), QtCore.QPointF(GLOBAL_SCALE, GLOBAL_SCALE), QtCore.QPointF(0.0, GLOBAL_SCALE) ] polygon = QtGui.QGraphicsPolygonItem(QtGui.QPolygonF(ps), self) polygon.setPen(pen) for i in xrange(51): u = GLOBAL_SCALE * float(i) / 50.0 line = QtGui.QGraphicsLineItem( QtCore.QLineF(u, 0.0, u, GLOBAL_SCALE), self) line.setPen(pen) line = QtGui.QGraphicsLineItem( QtCore.QLineF(0.0, u, GLOBAL_SCALE, u), self) line.setPen(pen) self.setGeometry(self.boundingRect()) # restore y axis inversion self.setTransform(QtGui.QTransform(1, 0, 0, -1, 0, GLOBAL_SCALE)) self.setTransformOriginPoint(0, GLOBAL_SCALE) self.reset_transfer_function(self._tf)
def __init__(self, param, parent=None): QtGui.QGraphicsWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) self.setAcceptHoverEvents(True) if not param.strValue: self._tf = copy.copy(default_tf) else: self._tf = TransferFunction.parse(param.strValue) self._tf_items = [] poly = TransferFunctionPolygon(self) poly.setup() self._tf_poly = poly self.create_tf_items(self._tf) self._tf_poly.setup() #current scale self._sx = 1.0 self._sy = 1.0 # Add outlines line_color = QtGui.QColor(200, 200, 200) pen = QtGui.QPen(line_color) ps = [QtCore.QPointF(0.0, 0.0), QtCore.QPointF(GLOBAL_SCALE, 0.0), QtCore.QPointF(GLOBAL_SCALE, GLOBAL_SCALE), QtCore.QPointF(0.0, GLOBAL_SCALE)] polygon = QtGui.QGraphicsPolygonItem(QtGui.QPolygonF(ps), self) polygon.setPen(pen) for i in xrange(51): u = GLOBAL_SCALE * float(i) / 50.0 line = QtGui.QGraphicsLineItem(QtCore.QLineF(u, 0.0, u, GLOBAL_SCALE), self) line.setPen(pen) line = QtGui.QGraphicsLineItem(QtCore.QLineF(0.0, u, GLOBAL_SCALE, u), self) line.setPen(pen) self.setGeometry(self.boundingRect()) # restore y axis inversion self.setTransform(QtGui.QTransform(1, 0, 0, -1, 0, GLOBAL_SCALE)) self.setTransformOriginPoint(0, GLOBAL_SCALE) self.reset_transfer_function(self._tf)
def __init__(self, param, parent=None): """__init__(param: core.vistrail.module_param.ModuleParam, parent: QWidget) """ contents = param.strValue contentType = param.type QtGui.QComboBox.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) # want to look up in registry based on parameter type self._silent = False self.addItem('') for val in self.param_values: self.addItem(val) curIdx = self.findText(contents) if curIdx != -1: self.setCurrentIndex(curIdx) self._contentType = contentType self.connect(self, QtCore.SIGNAL('currentIndexChanged(int)'), self.indexChanged)