def build_index_view(model, ui_file): # could potentially also just put it in the right place?? view = load_ui(ui_file) # create the a table view and model view.table.setModel(model) # can probably set these in view view.table.setSelectionBehavior(QAbstractItemView.SelectRows) view.table.setEditTriggers(QAbstractItemView.NoEditTriggers) def stop_run(): model.stop_run(view.table.selectionModel().selectedRows()) view.newButton.clicked.connect(model.create_new_run) view.stopButton.clicked.connect(stop_run) def set_action(action): job_idx = view.table.currentIndex() if action > 0: model.run_action(action, view.table.selectionModel().selectedRows()) view.actionComboBox.setCurrentIndex(0) view.actionComboBox.currentIndexChanged.connect(set_action) # TODO - also need to set up view here return view
def test_ui_loads(self, MockQFile, MockUiLoader): window = load_ui('list_view.ui') self.assertEqual(window, MockUiLoader.load())