Exemple #1
0
    def __init__(self, *args):
        QWidget.__init__(self, *args)
        def createScene():
            # root
            rootEntity = QEntity()
            material = QPhongMaterial(rootEntity)
            material.setDiffuse(QColor(254, 254, 254));
            #data=QUrl(); 
            data=QUrl.fromLocalFile("C:/Users/LINX/Documents/cat.stl");
            # sphere
            print(data)
            sphereEntity = QEntity(rootEntity)
            sphereMesh = QMesh()
            sphereMesh.setSource(data)
            sphereTransform = QTransform()

            controller = OrbitTransformController(sphereTransform)
            controller.setTarget(sphereTransform)
            controller.setRadius(20)
            controller.setAxis(QVector3D(1, 0, 0)
            )

            sphereRotateTransformAnimation = QPropertyAnimation(sphereTransform)
            sphereRotateTransformAnimation.setTargetObject(controller)
            sphereRotateTransformAnimation.setPropertyName(b'angle')
            sphereRotateTransformAnimation.setStartValue(0)
            sphereRotateTransformAnimation.setEndValue(-10)
            #sphereRotateTransformAnimation.setDuration(10)
            #sphereRotateTransformAnimation.setLoopCount(-1)
            sphereRotateTransformAnimation.start()

            sphereEntity.addComponent(sphereMesh)
            sphereEntity.addComponent(sphereTransform)
            sphereEntity.addComponent(material)

            return rootEntity
        view = Qt3DWindow()

        scene = createScene()

        # camera
        camera = view.camera()
        camera.lens().setPerspectiveProjection(45.0, 16.0/9.0, 0.1, 1000)
        camera.setPosition(QVector3D(0, 0, 40))
        camera.setViewCenter(QVector3D(0, 0, 0))

        # for camera control
        camController = QOrbitCameraController(scene)
        camController.setLinearSpeed( 50.0 )
        camController.setLookSpeed( 180.0 )
        camController.setCamera(camera)

        view.setRootEntity(scene)
        view.show()
Exemple #2
0
    def __init__(self,
                 CurveNumber,
                 x_values,
                 y_values,
                 flags,
                 pen,
                 parent=None,
                 name=None):
        """ Initialises all the variables.  
        creates the main zoom plot
        connects the qt signals
    """

        QWidget.__init__(self, parent)
        self.setWindowTitle('Channel ' + str(CurveNumber))
        self._parent = parent
        self._d_zoomActive = self._d_zoom = False
        self._curve_number = CurveNumber
        self.curves = {}

        self._do_close = True  # enable closing by window manager
        self._do_pause = False  # pause mode is False at startup
        self._compare_max = False
        self._do_linear_scale = True  # linear Y axis scale by default
        self._do_fixed_scale = False  # auto scaling by default
        self._array_label = "Channel "

        #Create the plot for selected curve to zoom
        self._plotter = QwtImageDisplay(self)
        self._plotter.setZoomDisplay()

        self._zoom_plot_label = self._array_label + str(
            self._curve_number) + " Sequence (oldest to most recent)"

        self._max_crv = -1  # negative value used to indicate that this display
        self._min_crv = -1  # is not being used

        #####end of parameters set for the plot#######/

        # we seem to need a layout for PyQt
        box1 = QHBoxLayout(self)
        box1.addWidget(self._plotter)
        #   self.plotPrinter = plot_printer_qt5.plot_printer(self._plotter)

        self._plotter.winpaused.connect(self.Pausing)
        self._plotter.compare.connect(self.do_compare)
        #   self._plotter.do_print.connnect(self.plotPrinter.do_print)
        self._plotter.save_display.connect(self.handle_save_display)

        # insert flags ?
        self._plotter.initVellsContextMenu()
        self.update_plot(y_values, flags)
        self.show()
Exemple #3
0
 def __init__(self,
              array_shape=None,
              axis_label=None,
              axis_parms=None,
              num_axes=2,
              parent=None,
              name=""):
     QWidget.__init__(self, parent)
     # set default number of selectable axes to use 2-D QWT-based display
     self.selectable_axes = num_axes
     # create grid layout
     self.layout = QGridLayout(self)
     self.setWhatsThis(controller_instructions)
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.construct_selectors(array_shape, axis_label, axis_parms)
Exemple #4
0
    def __init__(self, *args):
        QWidget.__init__(self, *args)
        layout = QGridLayout(self)        
        # try to create a plot for SciPy arrays

        # make a curve and copy the data
        numpy_curve = QwtPlotCurve('y = lorentzian(x)')
        x = np.arange(0.0, 10.0, 0.01)
        y = lorentzian(x)
        numpy_curve.setData(x, y)
        # here, we know we can plot NumPy arrays
        numpy_plot = QwtPlot(self)
        numpy_plot.setTitle('numpy array')
        numpy_plot.setCanvasBackground(Qt.white)
        numpy_plot.plotLayout().setCanvasMargin(0)
        numpy_plot.plotLayout().setAlignCanvasToScales(True)
        # insert a curve and make it red
        numpy_curve.attach(numpy_plot)
        numpy_curve.setPen(QPen(Qt.red))
        layout.addWidget(numpy_plot, 0, 0)
        numpy_plot.replot()

        # create a plot widget for lists of Python floats
        list_plot = QwtPlot(self)
        list_plot.setTitle('Python list')
        list_plot.setCanvasBackground(Qt.white)
        list_plot.plotLayout().setCanvasMargin(0)
        list_plot.plotLayout().setAlignCanvasToScales(True)
        x = drange(0.0, 10.0, 0.01)
        y = [lorentzian(item) for item in x]
        # insert a curve, make it red and copy the lists
        list_curve = QwtPlotCurve('y = lorentzian(x)')
        list_curve.attach(list_plot)
        list_curve.setPen(QPen(Qt.red))
        list_curve.setData(x, y)
        layout.addWidget(list_plot, 0, 1)
        layout.addWidget(DataPlot(self),1,1)
        layout.addWidget(3dstl(self), 1, 0)
        list_plot.replot()
Exemple #5
0
    def __init__(self, *args):
        QWidget.__init__(self, *args)
        layout = QGridLayout(self)        
        # try to create a plot for SciPy arrays

        # make a curve and copy the data
        numpy_curve = QwtPlotCurve('y = lorentzian(x)')
        x = np.arange(0.0, 10.0, 0.01)
        y = lorentzian(x)
        numpy_curve.setData(x, y)
        # here, we know we can plot NumPy arrays
        numpy_plot = QwtPlot(self)
        numpy_plot.setTitle('numpy array')
        numpy_plot.setCanvasBackground(Qt.white)
        numpy_plot.plotLayout().setCanvasMargin(0)
        numpy_plot.plotLayout().setAlignCanvasToScales(True)
        # insert a curve and make it red
        numpy_curve.attach(numpy_plot)
        numpy_curve.setPen(QPen(Qt.red))
        layout.addWidget(numpy_plot, 0, 0)
        numpy_plot.replot()

        # create a plot widget for lists of Python floats
        list_plot = QwtPlot(self)
        list_plot.setTitle('Python list')
        list_plot.setCanvasBackground(Qt.white)
        list_plot.plotLayout().setCanvasMargin(0)
        list_plot.plotLayout().setAlignCanvasToScales(True)
        x = drange(0.0, 10.0, 0.01)
        y = [lorentzian(item) for item in x]
        # insert a curve, make it red and copy the lists
        list_curve = QwtPlotCurve('y = lorentzian(x)')
        list_curve.attach(list_plot)
        list_curve.setPen(QPen(Qt.red))
        list_curve.setData(x, y)
        layout.addWidget(list_plot, 0, 1)
        list_plot.replot()
Exemple #6
0
    def __init__(self, ax_number=1, axis_parms=None, parent=None, name=""):
        """ specify the layout of the spinbox and the slider """
        QWidget.__init__(self, parent)

        self.button = QPushButton(' ', self)
        self.ax_number = ax_number
        self.is_on = False
        self.axis_parms = axis_parms
        self.button_label = None

        self.spinbox = QSpinBox(self)
        self.spinbox.setMinimum(0)
        self.spinbox.setMaximum(99)
        self.spinbox.setWrapping(True)
        self.maxVal = 99

        self.slider = QSlider(Qt.Horizontal, self)
        self.slider.setTickPosition(QSlider.TicksBelow)
        self.slider.setTickInterval(10)
        self.slider.setRange(0, 99)
        self.maxVal = 99
        self.active = False

        self.label_info = QLabel(' ', self)

        self.resetValue()

        self.button.clicked.connect(self.emit_axis_number)
        self.slider.valueChanged.connect(self.update_slider)
        self.spinbox.valueChanged.connect(self.update_spinbox)

        self.layout = QGridLayout(self)
        self.layout.addWidget(self.label_info, 0, 0)
        self.layout.addWidget(self.button, 1, 0)
        self.layout.addWidget(self.spinbox, 0, 2)
        self.layout.addWidget(self.slider, 1, 2)
Exemple #7
0
    def __init__(self, parent=None, name="",horizontal=False,draw_scale=True,hide_slider=False, use_int=False, add_spacer=True):
#     QWidget.__init__(self, parent, name)
      QWidget.__init__(self, parent)

      self.menu_table = {
      'Adjust results buffer size': 301,
      'Display summary plot': 302,
      'X Axis': 303,
      'Y Axis': 304,
      'Z Axis': 305,
      'Show 2D Display': 306,
      'Update': 307,
      'Toggle ND Controller': 308,
      'Print to Postscript file': 309,
      'Align Camera': 310,
      'Reset Auto Scaling': 312,
      'Save Display in PNG Format': 313,
      }

      self.horizontal = horizontal
      self.hide_slider = hide_slider
      self.use_int = use_int
      self.add_spacer = add_spacer
      self.allow_emit = False
      self.allow_summary = False
      self.summary_request = True
      self.toggle_ND_Controller = 1
      self.toggle_scale_display = False
      self.draw_scale = draw_scale
      self.menu = None
      self.maxVal = 100
      self.minVal = 0
      self.scaler = 1
      self.label_info = QLabel('', self)
      self.string_info =  ' '
      self.offset_index = -1
      if self.horizontal or self.use_int:
        self.spinbox = QSpinBox(self)
      else:
        self.spinbox = QDoubleSpinBox(self)
        self.spinbox.setSingleStep(0.1)
      self.spinbox.setMinimum(self.minVal)
      self.spinbox.setMaximum(self.maxVal)

      if self.horizontal:
        self.slider = QSlider(Qt.Horizontal, self)
        if self.draw_scale:
          self.slider.setTickPosition(QSlider.TicksBelow)
          self.slider.setTickInterval(self.minVal)
        self.slider.setRange(self.minVal, self.maxVal)
        self.slider.valueChanged[int].connect(self.update_slider)
        self.spinbox.valueChanged[int].connect(self.update_spinbox)
      else:
         #print('creating standard vertical QSlider')
         self.slider = QSlider(Qt.Vertical, self)
         if not self.use_int:
           self.scaler = 10000000
         min = self.scaler * self.minVal
         max = self.scaler * self.maxVal
         if self.draw_scale:
           self.slider.setTickPosition(QSlider.TicksRight)
           step = int((max-min) /20)
           #print('slider step should me ', step)
           self.slider.setTickInterval(step)
         #print('slider min and max', min,max)
         self.slider.setRange(min, max)
         self.slider.valueChanged[int].connect(self.update_slider)

        # we may not want a slider - e.g. when selecion tab pages in collections plotter
      self.spinbox.setWrapping(True)
      #print('wrapping should be set')

      if self.hide_slider:
        self.slider.hide()

      if self.horizontal or self.use_int:
        self.spinbox.valueChanged[int].connect(self.update_spinbox)
      else:
        self.spinbox.valueChanged[float].connect(self.update_spinbox)

      if self.horizontal:
        self.label_info1 = QLabel('          ', self)
        self.layout = QHBoxLayout(self)
        if self.add_spacer:
          spacer = QSpacerItem(22,9,QSizePolicy.Expanding,QSizePolicy.Minimum)
          self.layout.addItem(spacer)
        self.layout.addWidget(self.label_info)
        self.layout.addWidget(self.spinbox)
        self.layout.addWidget(self.label_info1)
        self.layout.addWidget(self.slider)
        self.setValue()
      else:
        self.layout = QVBoxLayout(self)
        self.layout.addWidget(self.label_info)
        self.layout.addWidget(self.slider)
        self.layout.addWidget(self.spinbox)
        if self.add_spacer:
          spacer = QSpacerItem(9,22,QSizePolicy.Minimum,QSizePolicy.Expanding)
          self.layout.addItem(spacer)
        self.setValue(0,reset_auto=True)

# add on-line help
      self.setWhatsThis(results_range_help)
Exemple #8
0
 def __init__(self, orientation, *args):
     QWidget.__init__(self, *args)
     self.__orientation = orientation
     self.__light = QColor(Qt.white)
     self.__dark = QColor(Qt.black)
     self.setCursor(Qt.PointingHandCursor)
 def __init__(self, orientation, *args):
     QWidget.__init__(self, *args)
     self.__orientation = orientation
     self.__light = QColor(Qt.white)
     self.__dark = QColor(Qt.black)
     self.setCursor(Qt.PointingHandCursor)