def __init__(self, parent=None): super(LineSelectorView, self).__init__(parent) self.list = QtWidgets.QVBoxLayout() self.total = Checkbox("Plot Total") self.prompt = Checkbox("Plot Prompt") self.delayed = Checkbox("Plot Delayed") self.line_checkboxes = [self.total, self.prompt, self.delayed] for line_type in self.line_checkboxes: self.list.addWidget(line_type) self.setLayout(self.list)
def _setup_checkbox(self, name, checked): checkbox = Checkbox(name) checkbox.setChecked(checked) checkbox.on_checkbox_unchecked(self._remove_value_from_new_data) checkbox.on_checkbox_checked(self._add_value_to_new_data) self.list.addWidget(checkbox) return checkbox
def __init__(self, parent=None): super(PeaksView, self).__init__(parent) self.list = QtWidgets.QVBoxLayout() self.major = Checkbox("Major Peaks") self.minor = Checkbox("Minor Peaks") self.gamma = Checkbox("Gamma Peaks") self.electron = Checkbox("Electron Peaks") self.peak_checkboxes = [self.major, self.minor, self.gamma, self.electron] for peak_type in self.peak_checkboxes: self.list.addWidget(peak_type) self.setLayout(self.list)
def __init__(self, parent=None): super(DetectorsView, self).__init__(parent) self.list = QtGui.QVBoxLayout() self.GE1 = Checkbox("GE1") self.GE2 = Checkbox("GE2") self.GE3 = Checkbox("GE3") self.GE4 = Checkbox("GE4") self.list.addWidget(QtGui.QLabel("Detectors")) for detector in [self.GE1, self.GE2, self.GE3, self.GE4]: self.list.addWidget(detector) self.setLayout(self.list)
def test_remove_value_from_new_data_does_not_raise_KeyError_if_type_not_in_new_data( self): checkbox = Checkbox('type: value') try: self.view._remove_value_from_new_data(checkbox) except KeyError: raise AssertionError
def _setup_checkbox(self, name, checked): checkbox = Checkbox(name) checkbox.setChecked(checked) checkbox.on_checkbox_unchecked(self._remove_value_from_new_data) checkbox.on_checkbox_checked(self._add_value_to_new_data) self.list.addWidget(checkbox) return checkbox
def __init__(self, parent=None): super(DetectorsView, self).__init__(parent) self.list = QtWidgets.QVBoxLayout() self.widgets = OrderedDict() labels = ["GE1", "GE2", "GE3", "GE4"] for label in labels: self.widgets[label] = Checkbox(label) self.list.addWidget(QtWidgets.QLabel("Detectors")) for detector in self.widgets.keys(): self.list.addWidget(self.widgets[detector]) self.setLayout(self.list)
def test_remove_value_from_new_data_raises_KeyError_is_type_not_in_new_data( self): checkbox = Checkbox('type: value') self.assertRaises(KeyError, self.view._remove_value_from_new_data, checkbox)
def test_remove_value_from_new_data_removes_existing_key_from_new_data( self): self.view.new_data['type'] = 'value' checkbox = Checkbox('type: value') self.view._remove_value_from_new_data(checkbox) self.assertIs('type' in self.view.new_data.keys(), False)
def test_add_value_to_new_data(self): self.new_data = {} checkbox = Checkbox('type: value') self.view._add_value_to_new_data(checkbox) self.assertIs('type' in self.view.new_data.keys(), True)