From a1e21c66aedc89b90364b26aac455721fb9b1b0a Mon Sep 17 00:00:00 2001 From: Lawrence Hudson Date: Mon, 12 Dec 2016 12:23:19 +0000 Subject: [PATCH] [#406] how Boxes view on creating new document --- CHANGELOG.md | 1 + inselect/gui/main_window.py | 3 +++ inselect/tests/gui/test_active_view.py | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4bae23..580d3b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ This is an overview of major changes. Refer to the git repository for a full log Version 0.1.35 ------------- +- #406 Show Boxes view on creating new document - #405 Remove qtpy - #401 Support new pyzbar and pylibdmtx - #397 Couple of problems with keyboard shortcuts box diff --git a/inselect/gui/main_window.py b/inselect/gui/main_window.py index f439b61..711ae68 100644 --- a/inselect/gui/main_window.py +++ b/inselect/gui/main_window.py @@ -723,6 +723,9 @@ def empty_document(self, checked=False): self.setWindowFilePath(None) self.info_widget.set_document(None) + # Show view tab + self.show_tab(index=0) + self.sync_ui() def closeEvent(self, event): diff --git a/inselect/tests/gui/test_active_view.py b/inselect/tests/gui/test_active_view.py index 1d01a0e..3e026b5 100644 --- a/inselect/tests/gui/test_active_view.py +++ b/inselect/tests/gui/test_active_view.py @@ -1,8 +1,13 @@ import unittest +from pathlib import Path + from .gui_test import GUITest +TESTDATA = Path(__file__).parent.parent / 'test_data' + + class TestActiveView(GUITest): """Basic tests of the MainWindow's active view. """ @@ -20,7 +25,7 @@ def test_select_view(self): def test_select_next_tab(self): "Next tab is selected" - self.window.show_tab(0) + self.window.show_tab(index=0) self.window.next_previous_tab(next=True) self.assertEqual(1, self.window.views.currentIndex()) @@ -36,5 +41,13 @@ def test_select_next_tab(self): self.assertEqual(0, self.window.views.currentIndex()) + def test_close(self): + "User closes document and Inselect shows Boxes tab" + self.window.open_file(path=TESTDATA.joinpath('shapes.inselect')) + self.window.show_tab(index=1) + self.window.close() + self.assertEqual(0, self.window.views.currentIndex()) + + if __name__ == '__main__': unittest.main()