Example #1
0
    def __init__(self, current_runs, instrument, current_workspaces, fit_to_raw, context, parent_widget=None):
        super(QtWidgets.QDialog, self).__init__(parent=parent_widget)
        self.setupUi(self)
        self.current_runs = current_runs
        self.current_workspaces = current_workspaces
        self.instrument = instrument
        self.context = context
        self.rebin = not fit_to_raw

        self.groups_and_pairs = 'All'
        self.runs = 'All'

        self.select_button.clicked.connect(self.accept)
        self.cancel_button.clicked.connect(self.reject)

        self.list_selector_widget = ListSelectorView(self)
        self.list_selector_layout.addWidget(self.list_selector_widget, 0, 1, 4, 1)
        self.list_selector_layout.setContentsMargins(0, 0, 0, 0)
        self.list_selector_presenter = ListSelectorPresenter(self.list_selector_widget, self.get_workspace_list())
        self.update_list()
        self.list_selector_presenter.update_view_from_model()

        self.group_pair_line_edit.editingFinished.connect(self.handle_group_pair_selection_changed)
        self.run_line_edit.editingFinished.connect(self.handle_run_edit_changed)
        self.phase_quad_checkbox.stateChanged.connect(self.handle_phase_quad_changed)
Example #2
0
def _create_empty_list_selector(parent, col_zero_width):
    """
    Create a ListSelector around the given parent
    and return the presenter

    :param parent: The parent widget for the selector
    :param col_zero_width: The width of the first column
    :return: A new presenter that controls the widget
    """
    presenter = ListSelectorPresenter(ListSelectorView(parent), {})
    return presenter
Example #3
0
    def __init__(self,
                 current_runs,
                 instrument,
                 current_workspaces,
                 fit_to_raw,
                 plot_type,
                 context,
                 parent_widget=None):
        super(QtWidgets.QDialog, self).__init__(parent=parent_widget)
        self.setupUi(self)
        self.current_runs = current_runs
        self.current_workspaces = current_workspaces
        self.instrument = instrument
        self.context = context
        self.rebin = not fit_to_raw

        self.groups_and_pairs = 'All'
        self.runs = 'All'

        self.select_button.clicked.connect(self.accept)
        self.cancel_button.clicked.connect(self.reject)

        self.list_selector_widget = ListSelectorView(self)
        self.list_selector_layout.addWidget(self.list_selector_widget, 0, 1, 4,
                                            1)
        self.list_selector_layout.setContentsMargins(0, 0, 0, 0)
        self.list_selector_presenter = ListSelectorPresenter(
            self.list_selector_widget, self.get_workspace_list())
        self.update_list()
        self.list_selector_presenter.update_view_from_model()

        self.group_pair_line_edit.editingFinished.connect(
            self.handle_group_pair_selection_changed)
        self.run_line_edit.editingFinished.connect(
            self.handle_run_edit_changed)
        self.phase_quad_checkbox.stateChanged.connect(
            self.handle_phase_quad_changed)

        self.time_domain_combo.addItem(frequency_domain +
                                       FREQUENCY_EXTENSIONS["MOD"])
        self.time_domain_combo.addItem(frequency_domain +
                                       FREQUENCY_EXTENSIONS["MAXENT"])
        self.time_domain_combo.addItem(frequency_domain +
                                       FREQUENCY_EXTENSIONS["RE"])
        self.time_domain_combo.addItem(frequency_domain +
                                       FREQUENCY_EXTENSIONS["IM"])

        self.time_domain_combo.currentIndexChanged.connect(self.time_or_freq)
        if self.context._frequency_context:
            index = self.time_domain_combo.findText(plot_type)
            if index == -1:
                index = 0
            self.time_domain_combo.setEnabled(True)
            self.time_domain_combo.setCurrentIndex(index)
Example #4
0
class TestListSelectorView(GuiTest):
    def setUp(self):
        self.view = ListSelectorView()

    def test_add_items_adds_correct_number_of_items_to_table_view(self):
        item_list = [('property_one', True, True),
                     ('property_two', False, False)]

        self.view.addItems(item_list)

        self.assertEqual(self.view.item_table_widget.rowCount(), 2)
        self.assertEqual(
            self.view.item_table_widget.item(0, 0).text(), item_list[0][0])
        self.assertEqual(
            self.view.item_table_widget.item(1, 0).text(), item_list[1][0])
        self.assertEqual(
            self.view.item_table_widget.item(1, 1).checkState(),
            QtCore.Qt.Unchecked)
        self.assertEqual(
            self.view.item_table_widget.item(0, 1).checkState(),
            QtCore.Qt.Checked)
        self.assertEqual(
            self.view.item_table_widget.item(0, 1).checkState(),
            QtCore.Qt.Checked)
        self.assertEqual(
            self.view.item_table_widget.item(1, 1).checkState(),
            QtCore.Qt.Unchecked)

    def test_that_clear_removes_all_items(self):
        item_list = [('property_one', True, True),
                     ('property_two', False, False)]

        self.view.addItems(item_list)
        self.view.clearItems()

        self.assertEqual(self.view.item_table_widget.rowCount(), 0)
Example #5
0
 def setUp(self):
     self.view = ListSelectorView()