def _add_to_known_servers(self, ip):
        """Add IP address *ip* to irrad_control.server_ips. Sets default IP if wanted"""

        msg = 'Set {} as default server address?'.format(ip)
        reply = QtWidgets.QMessageBox.question(self, 'Add server IP', msg, QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)

        if reply == QtWidgets.QMessageBox.Yes:
            network_config['server']['default'] = ip

        network_config['server']['all'][ip] = 'none'

        # Open the network_config.yaml and overwrites it with current server_ips
        safe_yaml(path=make_path(config_path, 'network_config.yaml'), data=network_config)
    def _init_setup(self):

        # Label and widgets to set the output folder
        label_folder = QtWidgets.QLabel('Output folder:')
        edit_folder = QtWidgets.QLineEdit()
        edit_folder.setText(self.output_path)
        edit_folder.setReadOnly(True)
        btn_folder = QtWidgets.QPushButton(' Set folder')
        btn_folder.setIcon(btn_folder.style().standardIcon(QtWidgets.QStyle.SP_DirIcon))
        btn_folder.clicked.connect(self._get_output_folder)
        btn_folder.clicked.connect(lambda _: edit_folder.setText(self.output_path))
        btn_dump = QtWidgets.QPushButton(' Dump')
        btn_dump.setIcon(btn_dump.style().standardIcon(QtWidgets.QStyle.SP_TrashIcon))
        btn_dump.clicked.connect(lambda _: edit_folder.setText(make_path(tmp_dir)))

        # Add to layout
        self.add_widget(widget=[label_folder, edit_folder, btn_dump, btn_folder])

        # Label and widgets for output file
        label_out_file = QtWidgets.QLabel('Output file:')
        label_out_file.setToolTip('Name of output file containing raw and interpreted data. Cannot contain whitespaces!')
        edit_out_file = QtWidgets.QLineEdit()
        edit_out_file.setPlaceholderText('irradiation_{}'.format('_'.join(time.asctime().split())))
        edit_out_file.textEdited.connect(lambda t, e=edit_out_file: e.setText(t.replace(' ', '_')))  # Don't allow whitespaces

        # Add to layout
        self.add_widget(widget=[label_out_file, edit_out_file])

        # Label and combobox to set logging level
        label_logging = QtWidgets.QLabel('Logging level:')
        combo_logging = QtWidgets.QComboBox()
        combo_logging.addItems([log_levels[lvl] for lvl in sorted([n_lvl for n_lvl in log_levels if isinstance(n_lvl, int)])])
        combo_logging.setCurrentIndex(combo_logging.findText('INFO'))

        # Add to layout
        self.add_widget(widget=[label_logging, combo_logging])

        self.widgets['logging_combo'] = combo_logging
        self.widgets['folder_edit'] = edit_folder
        self.widgets['outfile_edit'] = edit_out_file
Example #3
0
from collections import namedtuple
from irrad_control.utils.tools import location, load_yaml, make_path

DAQ_BOARD_CONFIG = load_yaml(
    make_path(location(__file__), 'daq_board_config.yaml'))
RO_ELECTRONICS_CONFIG = load_yaml(
    make_path(location(__file__), 'ro_electronics_config.yaml'))
BEAM_MONITOR_CONFIG = load_yaml(
    make_path(location(__file__), 'beam_monitor_config.yaml'))

RO_DEVICES = namedtuple('ReadoutDevices', 'ReadoutElectronics DAQBoard')(
    ReadoutElectronics='ReadoutElectronics', DAQBoard='DAQBoard')

RO_TYPES = ("sem_left", "sem_right", "sem_up", "sem_down", "sem_sum", "cup",
            "blm", "ntc", "general_purpose")

RO_DEFAULTS = {
    'ch_names': ('Left', 'Right', 'Up', 'Down', 'Sum', 'BLM', 'NTC'),
    'ch_types':
    ("sem_left", "sem_right", "sem_up", "sem_down", "sem_sum", "blm", "ntc"),
    'ch_groups': ("sem", "sem", "sem", "sem", "sem", "ch12", "ntc")
}
Example #4
0
from irrad_control.utils.tools import location, load_yaml, make_path

DEVICES_CONFIG = load_yaml(make_path(location(__file__),
                                     'devices_config.yaml'))
Example #5
0
from irrad_control.utils.tools import location, load_yaml, make_path

RAD_MONITOR_CONFIG = load_yaml(make_path(location(__file__), 'rad_monitor_config.yaml'))