Exemplo n.º 1
0
    def load_ui(self):
        loader = QUiLoader()
        path = os.path.join(os.path.dirname(__file__), "form.ui")
        ui_file = QFile(path)
        ui_file.open(QFile.ReadOnly)
        self.ui = loader.load(ui_file, self)
        ui_file.close()

        #        self.chartView = QtCharts.QChartView()
        #        self.chartView.setMinimumWidth(450)
        #        self.graphicsView = self.ui.findChild(QGraphicsView, "graphicsView")

        # graphics
        self.tab_summary = self.ui.findChild(QWidget, "tab_summary")

        #        QtDataVisualization.QAbstract3DGraph

        self.scatter3d = QtDataVisualization.Q3DScatter()
        self.container = QWidget.createWindowContainer(self.scatter3d)
        self.container.setMinimumWidth(450)

        self.scatterProxy = QtDataVisualization.QScatterDataProxy()
        self.scatterSeries = QtDataVisualization.QScatter3DSeries(
            self.scatterProxy)

        self.scatter3d.axisX().setTitle("x")
        self.scatter3d.axisY().setTitle("y")
        self.scatter3d.axisZ().setTitle("z")

        self.scatter3d.addSeries(self.scatterSeries)

        self.find_widgets()
Exemplo n.º 2
0
 def __init__(self, data=None, path=None):
     self.scatter_graph = QtDataVisualization.Q3DScatter()
     self.scatter_graph.activeTheme().setType(
         QtDataVisualization.Q3DTheme.ThemeEbony)
     self.scatter_graph.setShadowQuality(
         QtDataVisualization.QAbstract3DGraph.ShadowQualitySoftHigh)
     self.scatter_graph.scene().activeCamera().setCameraPreset(
         QtDataVisualization.Q3DCamera.CameraPresetNone)
     # self.scatter_graph.scene().activeCamera().setXRotation(180)
     # self.scatter_graph.scene().activeCamera().setYRotation(100)
     self.proxy = QtDataVisualization.QScatterDataProxy()
     self.series = QtDataVisualization.QScatter3DSeries(self.proxy)
     self.series.setItemLabelFormat(
         '@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel')
     self.series.setMeshSmooth(True)
     self.scatter_graph.addSeries(self.series)
     self.scatter_graph.axisX().setTitle('X')
     self.scatter_graph.axisY().setTitle('Y')
     self.scatter_graph.axisZ().setTitle('Z')
     self.scatter_graph.axisX().setReversed(True)
     self.scatter_graph.axisY().setReversed(True)
     self.scatter_graph.axisZ().setReversed(True)
     if path is not None:
         data = np.load(path)
     if data is not None:
         self.refresh(data)
Exemplo n.º 3
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.setWindowTitle("Molecular dynamics visualization")
        self.scatter = QtDataVisualization.Q3DScatter()
        self.container = QWidget.createWindowContainer(self.scatter)
        self.scatter.setAspectRatio(1.0)
        self.scatter.setHorizontalAspectRatio(1.0)

        # Setting of plot limits
        self.scatter.axisX().setRange(0.0, 1.0)
        self.scatter.axisY().setRange(0.0, 1.0)
        self.scatter.axisZ().setRange(0.0, 1.0)

        if (not self.scatter.hasContext()):
            msgBox = QMessageBox()
            msgBox.setText("Couldn't initialze the OpenGL context.")
            msgBox.exec()
            sys.exit(-1)

        screenSize = self.scatter.screen().size()
        self.container.setMinimumSize(
            QSize(screenSize.width() / 2.0,
                  screenSize.height() / 1.5))
        self.container.setMaximumSize(screenSize)
        self.container.setSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
        self.container.setFocusPolicy(Qt.StrongFocus)

        self.setCentralWidget(self.container)

        self.menu = self.menuBar()
        self.file_menu = self.menu.addMenu("File")

        self.open_action = QAction("Open file", self)
        self.open_action.setShortcut("Ctrl+O")
        self.quit_action = QAction("Quit", self)
        self.quit_action.setShortcut("Ctrl+Q")

        self.file_menu.addAction(self.open_action)
        self.open_action.triggered.connect(self.openFileDialog)
        self.file_menu.addAction(self.quit_action)
        self.quit_action.triggered.connect(self.exit_app)