diff --git a/opencodeblocks/graphics/pyeditor/__init__.py b/opencodeblocks/graphics/pyeditor/__init__.py new file mode 100644 index 00000000..9275d0ae --- /dev/null +++ b/opencodeblocks/graphics/pyeditor/__init__.py @@ -0,0 +1,3 @@ +""" Module for the Python Editor. """ + +from opencodeblocks.graphics.pyeditor.pyeditor import PythonEditor, POINT_SIZE diff --git a/opencodeblocks/graphics/editor_history.py b/opencodeblocks/graphics/pyeditor/history.py similarity index 100% rename from opencodeblocks/graphics/editor_history.py rename to opencodeblocks/graphics/pyeditor/history.py diff --git a/opencodeblocks/graphics/pyeditor.py b/opencodeblocks/graphics/pyeditor/pyeditor.py similarity index 98% rename from opencodeblocks/graphics/pyeditor.py rename to opencodeblocks/graphics/pyeditor/pyeditor.py index f13aabbf..7d34c28d 100644 --- a/opencodeblocks/graphics/pyeditor.py +++ b/opencodeblocks/graphics/pyeditor/pyeditor.py @@ -15,7 +15,7 @@ QWheelEvent, ) from PyQt5.Qsci import QsciScintilla, QsciLexerPython -from opencodeblocks.graphics.editor_history import EditorHistory +from opencodeblocks.graphics.pyeditor.history import EditorHistory from opencodeblocks.graphics.theme_manager import theme_manager from opencodeblocks.blocks.block import OCBBlock diff --git a/opencodeblocks/scene/scene_history.py b/opencodeblocks/scene/history.py similarity index 100% rename from opencodeblocks/scene/scene_history.py rename to opencodeblocks/scene/history.py diff --git a/opencodeblocks/scene/scene.py b/opencodeblocks/scene/scene.py index dd804029..d00d641c 100644 --- a/opencodeblocks/scene/scene.py +++ b/opencodeblocks/scene/scene.py @@ -18,7 +18,7 @@ from opencodeblocks.blocks.block import OCBBlock from opencodeblocks.graphics.edge import OCBEdge from opencodeblocks.scene.clipboard import SceneClipboard -from opencodeblocks.scene.scene_history import SceneHistory +from opencodeblocks.scene.history import SceneHistory from opencodeblocks.scene.from_ipynb_conversion import ipynb_to_ipyg from opencodeblocks.scene.to_ipynb_conversion import ipyg_to_ipynb diff --git a/tests/unit/scene/test_history.py b/tests/unit/scene/test_history.py index 5650aef0..30fe0964 100644 --- a/tests/unit/scene/test_history.py +++ b/tests/unit/scene/test_history.py @@ -7,7 +7,7 @@ from pytest_mock import MockerFixture import pytest_check as check -from opencodeblocks.scene.scene_history import SceneHistory +from opencodeblocks.scene.history import SceneHistory class TestUndo: @@ -23,7 +23,7 @@ def setup(self, mocker: MockerFixture): def test_undo(self, mocker: MockerFixture): """should allow for undo without breaking the history stack.""" - mocker.patch("opencodeblocks.scene.scene_history.SceneHistory.restore") + mocker.patch("opencodeblocks.scene.history.SceneHistory.restore") check.equal(self.history.history_stack, ["A", "B", "C", "D"]) check.equal(self.history.history_stack[self.history.current], "D") @@ -36,7 +36,7 @@ def test_undo(self, mocker: MockerFixture): def test_undo_nostack(self, mocker: MockerFixture): """should allow to undo without any change if the history stack is empty.""" - mocker.patch("opencodeblocks.scene.scene_history.SceneHistory.restore") + mocker.patch("opencodeblocks.scene.history.SceneHistory.restore") self.history.history_stack = [] self.history.current = -1 @@ -49,7 +49,7 @@ def test_undo_nostack(self, mocker: MockerFixture): def test_undo_end_of_stack(self, mocker: MockerFixture): """should allow to undo without any change if at the end of the history stack.""" - mocker.patch("opencodeblocks.scene.scene_history.SceneHistory.restore") + mocker.patch("opencodeblocks.scene.history.SceneHistory.restore") self.history.current = 0 check.equal(self.history.history_stack, ["A", "B", "C", "D"]) @@ -75,7 +75,7 @@ def setup(self, mocker: MockerFixture): def test_redo(self, mocker: MockerFixture): """should allow for redo without changing the history stack.""" - mocker.patch("opencodeblocks.scene.scene_history.SceneHistory.restore") + mocker.patch("opencodeblocks.scene.history.SceneHistory.restore") check.equal(self.history.history_stack, ["A", "B", "C", "D"]) check.equal(self.history.history_stack[self.history.current], "B") @@ -88,7 +88,7 @@ def test_redo(self, mocker: MockerFixture): def test_redo_nostack(self, mocker: MockerFixture): """should allow to redo without any change if the history stack is empty.""" - mocker.patch("opencodeblocks.scene.scene_history.SceneHistory.restore") + mocker.patch("opencodeblocks.scene.history.SceneHistory.restore") self.history.history_stack = [] self.history.current = -1 @@ -101,7 +101,7 @@ def test_redo_nostack(self, mocker: MockerFixture): def test_redo_end_of_stack(self, mocker: MockerFixture): """should allow to redo without any change if at the beggining of the history stack.""" - mocker.patch("opencodeblocks.scene.scene_history.SceneHistory.restore") + mocker.patch("opencodeblocks.scene.history.SceneHistory.restore") self.history.current = 3 check.equal(self.history.history_stack, ["A", "B", "C", "D"])