예제 #1
0
def main():
    import sys
    from pathlib import Path
    app = QtWidgets.QApplication(sys.argv)

    from pymodaq.dashboard import DashBoard

    win = QtWidgets.QMainWindow()
    area = DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)
    win.setWindowTitle('PyMoDAQ Dashboard')

    dash = DashBoard(area)
    file = Path(get_set_preset_path()).joinpath(
        f"{config('presets', 'default_preset_for_scan')}.xml")
    if file.exists():
        dash.set_preset_mode(file)
        dash.load_scan_module()

    mainwindow = QtWidgets.QMainWindow()
    dockarea = DockArea()
    mainwindow.setCentralWidget(dockarea)

    prog = NonLinearScanner(dockarea)

    QtWidgets.QApplication.processEvents()
    prog.positions_signal.connect(
        dash.scan_module.scanner.update_tabular_positions)

    mainwindow.show()
    sys.exit(app.exec_())
예제 #2
0
def main():
    import sys
    app = QtWidgets.QApplication(sys.argv)
    dockarea = DockArea()
    prog = StepsSequencer(dockarea)
    prog.positions_signal.connect(print_positions)
    dockarea.show()
    sys.exit(app.exec_())
예제 #3
0
def main():
    from pymodaq.dashboard import DashBoard
    from pathlib import Path
    from pymodaq.daq_utils.gui_utils.dock import DockArea

    config = Config()
    app = QtWidgets.QApplication(sys.argv)
    if config('style', 'darkstyle'):
        import qdarkstyle
        app.setStyleSheet(qdarkstyle.load_stylesheet())

    win = QtWidgets.QMainWindow()
    area = DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)
    win.setWindowTitle('PyMoDAQ Dashboard')

    # win.setVisible(False)
    prog = DashBoard(area)
    file = Path(get_set_preset_path()).joinpath(
        f"{config('presets', 'default_preset_for_logger')}.xml")
    if file.exists():
        prog.set_preset_mode(file)
        prog.load_log_module()
    else:
        msgBox = QtWidgets.QMessageBox()
        msgBox.setText(
            f"The default file specified in the configuration file does not exists!\n"
            f"{file}\n"
            f"Impossible to load the Logger Module")
        msgBox.setStandardButtons(msgBox.Ok)
        ret = msgBox.exec()

    sys.exit(app.exec_())
예제 #4
0
파일: utils.py 프로젝트: CEMES-CNRS/PyMoDAQ
def main(xmlfile):
    from pymodaq.dashboard import DashBoard
    from pymodaq.daq_utils.config import get_set_preset_path
    from pymodaq.daq_utils import gui_utils as gutils
    from pathlib import Path
    from qtpy import QtWidgets
    from pymodaq.pid.pid_controller import DAQ_PID

    import sys
    app = QtWidgets.QApplication(sys.argv)
    win = QtWidgets.QMainWindow()
    area = DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)
    win.setWindowTitle('PyMoDAQ Dashboard')

    dashboard = DashBoard(area)
    file = Path(get_set_preset_path()).joinpath(xmlfile)
    if file.exists():
        dashboard.set_preset_mode(file)
        # prog.load_scan_module()
        pid_area = DockArea()
        pid_window = QtWidgets.QMainWindow()
        pid_window.setCentralWidget(pid_area)

        prog = DAQ_PID(pid_area)
        pid_window.show()
        pid_window.setWindowTitle('PidController')
        prog.set_module_manager(dashboard.detector_modules,
                                dashboard.actuators_modules)
        QtWidgets.QApplication.processEvents()

    else:
        msgBox = QtWidgets.QMessageBox()
        msgBox.setText(
            f"The default file specified in the configuration file does not exists!\n"
            f"{file}\n"
            f"Impossible to load the DAQ_PID Module")
        msgBox.setStandardButtons(msgBox.Ok)
        ret = msgBox.exec()

    sys.exit(app.exec_())
예제 #5
0
def main():
    import sys
    app = QtWidgets.QApplication(sys.argv)
    mainwindow = QtWidgets.QMainWindow()
    dockarea = DockArea()
    mainwindow.setCentralWidget(dockarea)

    prog = CustomAppExample(dockarea)

    mainwindow.show()
    sys.exit(app.exec_())
예제 #6
0
    def __init__(self, dockarea: DockArea, dashboard=None):
        QObject.__init__(self)
        ActionManager.__init__(self)
        ParameterManager.__init__(self)
        QLocale.setDefault(QLocale(QLocale.English, QLocale.UnitedStates))

        if not isinstance(dockarea, DockArea):
            raise Exception('no valid parent container, expected a DockArea')

        self.dockarea = dockarea
        self.mainwindow = dockarea.parent()
        self.dashboard = dashboard

        self.docks = dict([])
        self.statusbar = None
        self._toolbar = QtWidgets.QToolBar()

        if self.mainwindow is not None:
            self.mainwindow.addToolBar(self._toolbar)
            self.statusbar = self.mainwindow.statusBar()

        self.set_toolbar(self._toolbar)
예제 #7
0
    def __init__(self, parent=None):
        
        super(ViewerND, self).__init__()


        if parent is None:
            area = DockArea()
            area.show()
            self.area = area
        elif isinstance(parent, DockArea):
            self.area = parent
        elif isinstance(parent, QtWidgets.QWidget):
            area = DockArea()
            self.area = area
            parent.setLayout(QtWidgets.QVBoxLayout())
            parent.layout().addWidget(area)

        self.wait_time = 2000
        self.viewer_type = 'DataND'  # ☺by default but coul dbe used for 3D visualization
        self.distribution = 'uniform'
        self.nav_axes_viewers = []
        self.nav_axes_dicts = []

        self.x_axis = dict(data=None, label='', units='')
        self.y_axis = dict(data=None, label='', units='')

        self.data_buffer = []  # convenience list to store 0D data to be displayed
        self.datas = None
        self.datas_settings = None
        # set default data shape case
        self.data_axes = None
        # self.set_nav_axes(3)
        self.ui = QObject()  # the user interface
        self.set_GUI()
        self.setup_spread_UI()
        self.title = ""
        self.data_to_export = OrderedDict(name=self.title, data0D=OrderedDict(), data1D=OrderedDict(),
                                          data2D=OrderedDict(),
                                          dataND=OrderedDict())
예제 #8
0
                if len(self.datas.axes_manager.signal_shape) == 0:  # means 0D data, plot on 1D viewer
                    self.data_buffer.extend(data)
                    self.ui.viewer1D.show_data([self.data_buffer])

                elif len(self.datas.axes_manager.signal_shape) == 1:  # means 1D data, plot on 1D viewer
                    self.ui.viewer1D.remove_plots()
                    self.ui.viewer1D.x_axis = self.x_axis
                    self.ui.viewer1D.show_data([data])

                elif len(self.datas.axes_manager.signal_shape) == 2:  # means 2D data, plot on 2D viewer
                    self.ui.viewer2D.x_axis = self.x_axis
                    self.ui.viewer2D.y_axis = self.y_axis
                    self.ui.viewer2D.setImage(data)
            except Exception as e:
                logger.exception(str(e))
                self.update_status(utils.getLineInfo() + str(e), wait_time=self.wait_time, log='log')


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    area = DockArea()
    prog = ViewerND(area)
    prog.settings.child(('set_data_4D')).show(True)
    prog.settings.child(('set_data_3D')).show(True)
    prog.settings.child(('set_data_2D')).show(True)
    prog.settings.child(('set_data_1D')).show(True)
    prog.signal_axes_selection()
    area.show()
    sys.exit(app.exec_())