def __init__(self, parent=None):
        """Set up the ui."""
        uifile = _utils.get_ui_file(self)
        config = _configuration.ControlConfig()
        super().__init__(uifile, config, parent=parent)
        self.timer1 = _QTimer()
        self.timer1.timeout.connect(self.periodic_display_update)
        self.timer2 = _QTimer()
        self.timer2.timeout.connect(self.periodic_limit_switch_update)

        # create objects to use database functions
        #        self.access_measurement_data = _database.DatabaseCollection(
        #            database_name=self.database_name,
        #            collection_name=_measurement.MeasurementData.collection_name,
        #            mongo=self.mongo,
        #            server=self.server
        #        )
        self.access_block_data = _database.DatabaseCollection(
            database_name=self.database_name,
            collection_name=_measurement.BlockData.collection_name,
            mongo=self.mongo,
            server=self.server)
        self.access_hall_data = _database.DatabaseCollection(
            database_name=self.database_name,
            collection_name=_measurement.HallWaveformData.collection_name,
            mongo=self.mongo,
            server=self.server)
        self.access_scan_data = _database.DatabaseCollection(
            database_name=self.database_name,
            collection_name=_configuration.ScanConfig.collection_name,
            mongo=self.mongo,
            server=self.server)

        self.sb_names = []

        self.le_names = []

        self.te_names = []

        self.sbd_names = []

        self.cmb_names = []

        self.chb_names = []

        self.connect_signal_slots()
        self.load_last_db_entry()

        self.stop_sent = False
        self.current_encoder_position = 0.0
        self.encoder_measurement_index = -1

        #        self.measurement_data = _measurement.MeasurementData()

        # start periodic display update
        self.timer1.start(self._update_display_interval * 1000)
        # start periodic limit switch status update
        self.timer2.start(self._update_limit_switch_interval * 1000)
예제 #2
0
    def __init__(self, parent=None):
        """Set up the ui."""
        super().__init__(parent)
        uifile = _utils.get_ui_file(self)
        self.ui = _uic.loadUi(uifile, self)
        self.connect_signal_slots()
        self.stop = True
        self.stop_encoder_update = True
        self.timer = _QTimer()
        self.timer.timeout.connect(self.update_encoder_reading)

        self.configure_gui_visualization()
예제 #3
0
    def __init__(self, parent=None):
        """Set up the ui."""
        super().__init__(parent)

        # setup the ui
        uifile = _getUiFile(self)
        self.ui = _uic.loadUi(uifile, self)

        self.display = _display
        self.display_timer = _QTimer()

        self.thd_read_display = None
        self.test_thd = None

        # connect signals and slots
        self.connect_signals_slots()
예제 #4
0
    def __init__(self, parent=None):
        """Set up the ui."""
        super().__init__(parent)

        # setup the ui
        uifile = _get_ui_file(self)
        self.ui = _uic.loadUi(uifile, self)

        self.mdriver = _mdriver
        self.config = _config

        self.counter_timer = _QTimer()
        self.update_time = 20
        self.counts = 0.0  # current number of turns

        # connect signals and slots
        self.connect_signals_slots()
예제 #5
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle(_QCoreApplication.translate('', "Table and Plot"))
        self.resize(1230, 900)
        self.add_widgets()
        self.setFont(_font)

        # variables initialisation
        self.filename = None
        self._xvalues = []
        self._legend_items = []
        self._graphs = {}
        self._data_labels = (self._left_axis_1_data_labels +
                             self._right_axis_1_data_labels +
                             self._right_axis_2_data_labels)
        self._data_formats = (
            [self._left_axis_1_format] * len(self._left_axis_1_data_labels) +
            [self._right_axis_1_format] * len(self._right_axis_1_data_labels) +
            [self._right_axis_2_format] * len(self._right_axis_2_data_labels))
        self._readings = {}
        for i, label in enumerate(self._data_labels):
            self._readings[label] = []

        # create timer to monitor values
        self.timer = _QTimer(self)
        self.update_monitor_interval()
        self.timer.timeout.connect(lambda: self.read_value(monitor=True))

        # create table analysis dialog
        self.table_analysis_dialog = TableAnalysisDialog()

        # add legend to plot
        if self._show_legend:
            self.legend = _pyqtgraph.LegendItem(offset=(70, 30))
            self.legend.setParentItem(self.pw_plot.graphicsItem())
            self.legend.setAutoFillBackground(1)

        self.right_axis_1 = None
        self.right_axis_2 = None
        self.configure_plot()
        self.configure_table()
        self.connect_signal_slots()
예제 #6
0
    def __init__(self, parent=None):
        """Set up the ui."""
        super().__init__(parent)

        # setup the ui
        uifile = _get_ui_file(self)
        self.ui = _uic.loadUi(uifile, self)

        self.ui.la_connection_status.setText('OK')
        self.ui.la_connection_status.setStyleSheet('color: rgb(0, 0, 0)')

        self.mdriver = _mdriver
        self.mint = _mint
        self.config = _config
        self.meas = _meas
        self.stop = True
        self.update_timer = 500
        self.position_timer = _QTimer()
        self.list_config_files()

        # connect signals and slots
        self.connect_signal_slots()
    def __init__(self, parent=None):
        """Set up the ui."""
        super().__init__(parent)

        # setup the ui
        uifile = _utils.get_ui_file(self)
        self.ui = _uic.loadUi(uifile, self)
        self.assembly_data = _measurement.AssemblyData()

        self.timer1 = _QTimer()
        self.timer1.timeout.connect(self.periodic_update)

        # create object to use database function
        self.access_assembly_data = _database.DatabaseCollection(
            database_name=self.database_name,
            collection_name=_measurement.AssemblyData.collection_name,
            mongo=self.mongo,
            server=self.server)

        # properties
        self.assembly_id = -1
        self.cassette_name = ''
        self.list_position = 0
        self.block_count = 0
        self.block_list = []
        self.cassette_list = [
            _utils.CASSETTE_1_NAME, _utils.CASSETTE_2_NAME,
            _utils.CASSETTE_3_NAME, _utils.CASSETTE_4_NAME
        ]

        # stylesheets for buttons
        self.button_on_stylesheet = "background-color: rgb(0,255,0);"
        self.button_off_stylesheet = "background-color: rgb(232,232,232);"

        # create dictionary of images for LEDs
        self.led_images = {}
        self.led_images['green'] = _QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'green_light.png'))
        self.led_images['red'] = _QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'red_light.png'))

        # create dictionary of images for magnet orientations
        self.block_types = {}
        # suffix indicating image of block reversed
        self.PREFIX_REV = '-Rev'
        self.block_types[_utils.PREFIX_BLOCK_TYPE_1] = (_QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'Block-BA.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_2] = (_QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'Block-BB.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_3] = (_QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'Block-BC.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_4] = (_QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'Block-TA.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_5] = (_QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'Block-TB.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_6] = (_QPixmap(
            _os.path.join('deltabench', 'resources', 'img', 'Block-TC.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_1 +
                         self.PREFIX_REV] = (_QPixmap(
                             _os.path.join('deltabench', 'resources', 'img',
                                           'Block-BA-Rev.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_2 +
                         self.PREFIX_REV] = (_QPixmap(
                             _os.path.join('deltabench', 'resources', 'img',
                                           'Block-BB-Rev.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_3 +
                         self.PREFIX_REV] = (_QPixmap(
                             _os.path.join('deltabench', 'resources', 'img',
                                           'Block-BC-Rev.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_4 +
                         self.PREFIX_REV] = (_QPixmap(
                             _os.path.join('deltabench', 'resources', 'img',
                                           'Block-TA-Rev.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_5 +
                         self.PREFIX_REV] = (_QPixmap(
                             _os.path.join('deltabench', 'resources', 'img',
                                           'Block-TB-Rev.png')))
        self.block_types[_utils.PREFIX_BLOCK_TYPE_6 +
                         self.PREFIX_REV] = (_QPixmap(
                             _os.path.join('deltabench', 'resources', 'img',
                                           'Block-TC-Rev.png')))
        self.block_types['end'] = _QPixmap(
            _os.path.join('deltabench', 'resources', 'img',
                          'check-circle-outline.png'))
        self.block_types['none'] = _QPixmap()

        # initialize sheet name combo box with cassette names
        self.ui.cmb_sheet_name.addItems(self.cassette_list)

        # set push buttons background to off style
        self.set_all_motion_pbt_stylesheet(self.button_off_stylesheet)

        # clear GUI displayed data
        self.reset_all_display_data()

        # connect widgets to functions
        self.connect_signal_slots()

        # start periodic info update
        self.timer1.start(self._update_interval * 1000)