예제 #1
0
 def setParameter(self, parameter):
     ParameterWidget.setParameter(self, parameter)
     self._txt_bias.setText(parameter.bias)
     self._txt_gain.setText(parameter.gain)
     self._txt_base_level.setText(parameter.base_level)
     self._txt_window.setText(parameter.window)
     self._cb_mode.setCurrentIndex(self._cb_mode.findText(parameter.mode))
예제 #2
0
 def setReadOnly(self, state):
     ParameterWidget.setReadOnly(self, state)
     self._txt_bias.setReadOnly(state)
     self._txt_gain.setReadOnly(state)
     self._txt_base_level.setReadOnly(state)
     self._txt_window.setReadOnly(state)
     self._cb_mode.setEnabled(not state)
예제 #3
0
    def __init__(self, clasz, parent=None):
        ParameterWidget.__init__(self, clasz, parent)

        name = clasz.TEMPLATE
        if clasz.CLASS is not None:
            name += ' (%s)' % clasz.CLASS
        self.setAccessibleName(name)
예제 #4
0
 def setReadOnly(self, state):
     ParameterWidget.setReadOnly(self, state)
     if state:
         trigger = QTableView.EditTrigger.NoEditTriggers
     else:
         trigger = QTableView.EditTrigger.AllEditTriggers
     self._table.setEditTriggers(trigger)
     self._toolbar.setEnabled(not state)
예제 #5
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
 def setReadOnly(self, state):
     ParameterWidget.setReadOnly(self, state)
     self._txt_title.setReadOnly(state)
     self._txt_author.setReadOnly(state)
     self._txt_owner.setReadOnly(state)
     self._txt_date.setReadOnly(state)
     self._txt_time.setReadOnly(state)
     self._txt_timezone.setReadOnly(state)
     self._txt_checksum.setReadOnly(state)
예제 #6
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
 def setParameter(self, header):
     ParameterWidget.setParameter(self, header)
     self._txt_title.setText(header.title)
     self._txt_author.setText(header.author)
     self._txt_owner.setText(header.owner)
     date = header.date
     if date is not None:
         self._txt_date.setDate(QDate(date.year, date.month, date.day))
     time = header.time
     if time is not None:
         self._txt_time.setTime(QTime(time.hour, time.minute, time.second))
     self._txt_timezone.setText(header.timezone)
     checksum = header.checksum
     if checksum is not None:
         self._txt_checksum.setText(checksum.value)
예제 #7
0
 def isReadOnly(self):
     return ParameterWidget.isReadOnly(self) and \
         self._txt_bias.isReadOnly() and \
         self._txt_gain.isReadOnly() and \
         self._txt_base_level.isReadOnly() and \
         self._txt_window.isReadOnly() and \
         not self._cb_mode.isEnabled()
예제 #8
0
    def _init_ui(self):
        # Widgets
        self._txt_bias = NumericalAttributeLineEdit(self.CLASS.bias)
        self._txt_gain = NumericalAttributeLineEdit(self.CLASS.gain)
        self._txt_base_level = NumericalAttributeLineEdit(self.CLASS.base_level)
        self._txt_window = NumericalAttributeLineEdit(self.CLASS.window)
        self._cb_mode = QComboBox()
        self._cb_mode.addItems([None] + list(_PHA_MODES))

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow('Bias', self._txt_bias)
        layout.addRow('Gain', self._txt_gain)
        layout.addRow('Base level', self._txt_base_level)
        layout.addRow('Window', self._txt_window)
        layout.addRow('Mode', self._cb_mode)

        # Signals
        self._txt_bias.textEdited.connect(self.edited)
        self._txt_gain.textEdited.connect(self.edited)
        self._txt_base_level.textEdited.connect(self.edited)
        self._txt_window.textEdited.connect(self.edited)
        self._cb_mode.currentIndexChanged.connect(self.edited)

        return layout
예제 #9
0
    def _init_ui(self):
        # Widgets
        self._combobox = QComboBox()
        self._stack = QStackedWidget()

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow(self._combobox)
        layout.addRow(self._stack)

        # Register classes
        self._widget_indexes = {}

        for entry_point in iter_entry_points('pyhmsa_gui.spec.condition.calibration'):
            widget_class = entry_point.load(require=False)
            widget = widget_class()
            self._combobox.addItem(widget.accessibleName().title())
            self._widget_indexes[widget.CLASS] = self._stack.addWidget(widget)
            widget.edited.connect(self.edited)

        # Signals
        self._combobox.currentIndexChanged.connect(self._on_combo_box)
        self._combobox.currentIndexChanged.connect(self.edited)

        return layout
예제 #10
0
    def _init_ui(self):
        # Widgets
        model = self._WindowModel()

        self._table = QTableView()
        self._table.setModel(model)
        self._table.setItemDelegate(self._WindowDelegate(self))
        self._table.horizontalHeader().setStretchLastSection(True)

        self._toolbar = QToolBar()
        action_add = self._toolbar.addAction(getIcon("list-add"), "Add layer")
        action_remove = self._toolbar.addAction(getIcon("list-remove"), "Remove layer")

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow(self._table)
        layout.addRow(self._toolbar)

        # Signals
        action_add.triggered.connect(self._on_add)
        action_remove.triggered.connect(self._on_remove)

        model.dataChanged.connect(self.edited)
        model.rowsInserted.connect(self.edited)
        model.rowsRemoved.connect(self.edited)

        return layout
예제 #11
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
    def _init_ui(self):
        # Widgets
        self._txt_title = TextAttributeLineEdit(attribute=self.CLASS.title)
        self._txt_author = TextAttributeLineEdit(attribute=self.CLASS.author)
        self._txt_owner = TextAttributeLineEdit(attribute=self.CLASS.owner)
        self._txt_date = QDateEdit()
        self._txt_date.setDisplayFormat('yyyy-MM-dd')
        self._txt_time = QTimeEdit()
        self._txt_time.setDisplayFormat('hh:mm:ss')
        self._txt_timezone = TextAttributeLineEdit(attribute=self.CLASS.timezone)
        self._txt_checksum = TextAttributeLineEdit(attribute=self.CLASS.checksum)
        self._txt_checksum.setReadOnly(True)

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow('Title', self._txt_title)
        layout.addRow('Author', self._txt_author)
        layout.addRow('Owner', self._txt_owner)
        layout.addRow('Date', self._txt_date)
        layout.addRow('Time', self._txt_time)
        layout.addRow('Timezone', self._txt_timezone)
        layout.addRow('Checksum', self._txt_checksum)

        # Signals
        self._txt_title.textEdited.connect(self.edited)
        self._txt_author.textEdited.connect(self.edited)
        self._txt_owner.textEdited.connect(self.edited)
        self._txt_date.dateChanged.connect(self.edited)
        self._txt_time.timeChanged.connect(self.edited)
        self._txt_timezone.textEdited.connect(self.edited)
        self._txt_checksum.textEdited.connect(self.edited)

        return layout
예제 #12
0
 def parameter(self, parameter=None):
     parameter = ParameterWidget.parameter(self, parameter)
     parameter.bias = self._txt_bias.text()
     parameter.gain = self._txt_gain.text()
     parameter.base_level = self._txt_base_level.text()
     parameter.window = self._txt_window.text()
     parameter.mode = self._cb_mode.currentText()
     return parameter
예제 #13
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
 def hasAcceptableInput(self):
     return ParameterWidget.hasAcceptableInput(self) and \
         self._txt_title.hasAcceptableInput() and \
         self._txt_author.hasAcceptableInput() and \
         self._txt_owner.hasAcceptableInput() and \
         self._txt_date.hasAcceptableInput() and \
         self._txt_time.hasAcceptableInput() and \
         self._txt_timezone.hasAcceptableInput() and \
         self._txt_checksum.hasAcceptableInput()
예제 #14
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
 def parameter(self, parameter=None):
     parameter = ParameterWidget.parameter(self, parameter)
     parameter.title = self._txt_title.text()
     parameter.author = self._txt_author.text()
     parameter.owner = self._txt_owner.text()
     parameter.date = self._txt_date.date().toString('yyyy-MM-dd')
     parameter.time = self._txt_time.time().toString('hh:mm:ss')
     parameter.timezone = self._txt_timezone.text()
     return parameter
예제 #15
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
 def isReadOnly(self):
     return ParameterWidget.isReadOnly(self) and \
         self._txt_title.isReadOnly() and \
         self._txt_author.isReadOnly() and \
         self._txt_owner.isReadOnly() and \
         self._txt_date.isReadOnly() and \
         self._txt_time.isReadOnly() and \
         self._txt_timezone.isReadOnly() and \
         self._txt_checksum.isReadOnly()
예제 #16
0
    def _init_ui(self):
        # Widgets
        self._table = QTableView()
        self._table.setModel(self._SpecimenPositionModel())
        self._table.setItemDelegate(self._SpecimenPositionDelegate(self))
        self._table.horizontalHeader().setStretchLastSection(True)

        self._toolbar = QToolBar()
        action_add = self._toolbar.addAction(getIcon("list-add"), "Add layer")
        action_remove = self._toolbar.addAction(getIcon("list-remove"), "Remove layer")

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow(self._table)
        layout.addRow(self._toolbar)

        # Signals
        action_add.triggered.connect(self._on_add)
        action_remove.triggered.connect(self._on_remove)

        return layout
예제 #17
0
 def __init__(self, parent=None):
     ParameterWidget.__init__(self, object, parent)
예제 #18
0
 def parameter(self, parameter=None):
     parameter = ParameterWidget.parameter(self, parameter)
     parameter.layers.clear()
     for layer in self._table.model().layers:
         parameter.append_layer(layer.material, layer.thickness) # copy
     return parameter
예제 #19
0
 def hasAcceptableInput(self):
     return ParameterWidget.hasAcceptableInput(self) and \
         self._stack.currentWidget().hasAcceptableInput()
예제 #20
0
 def isReadOnly(self):
     return ParameterWidget.isReadOnly(self) and \
         not self._combobox.isEnabled() and \
         self._stack.currentWidget().isReadOnly()
예제 #21
0
 def setReadOnly(self, state):
     ParameterWidget.setReadOnly(self, state)
     self._combobox.setEnabled(not state)
     self._stack.currentWidget().setReadOnly(state)
예제 #22
0
 def __init__(self, parent=None):
     ParameterWidget.__init__(self, PulseHeightAnalyser, parent)
예제 #23
0
 def __init__(self, parent=None):
     ParameterWidget.__init__(self, _Calibration, parent)
예제 #24
0
파일: header.py 프로젝트: pyhmsa/pyhmsa-gui
 def __init__(self, parent=None):
     ParameterWidget.__init__(self, Header, parent)
예제 #25
0
 def __init__(self, parent=None):
     ParameterWidget.__init__(self, Window, parent)
예제 #26
0
 def isReadOnly(self):
     return ParameterWidget.isReadOnly(self) and \
         self._table.editTriggers() == QTableView.EditTrigger.NoEditTriggers and \
         not self._toolbar.isEnabled()
예제 #27
0
 def hasAcceptableInput(self):
     return ParameterWidget.hasAcceptableInput(self) and \
         self._txt_bias.hasAcceptableInput() and \
         self._txt_gain.hasAcceptableInput() and \
         self._txt_base_level.hasAcceptableInput() and \
         self._txt_window.hasAcceptableInput()