Skip to content

Commit

Permalink
WIP: project refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Jul 24, 2023
1 parent b0bb636 commit b35ebcb
Show file tree
Hide file tree
Showing 10 changed files with 901 additions and 23 deletions.
10 changes: 0 additions & 10 deletions spinetoolbox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,9 @@
import os
from pathlib import Path

# NOTE: All required Python package versions are in setup.cfg
LATEST_PROJECT_VERSION = 10

# For the Add/Update SpineOpt wizard
REQUIRED_SPINE_OPT_VERSION = "0.6.9"

# Invalid characters for directory names
# NOTE: "." is actually valid in a directory name but this is
# to prevent the user from creating directories like /..../
INVALID_CHARS = ["<", ">", ":", "\"", "/", "\\", "|", "?", "*", "."]
# Invalid characters for file names
INVALID_FILENAME_CHARS = ["<", ">", ":", "\"", "/", "\\", "|", "?", "*"]

# Paths to application, configuration file, default project and work dirs, and documentation index page
_frozen = getattr(sys, "frozen", False)
_path_to_executable = os.path.dirname(sys.executable if _frozen else __file__)
Expand Down
2 changes: 1 addition & 1 deletion spinetoolbox/headless.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from spine_engine.exception import EngineInitFailed
from spine_engine.load_project_items import load_item_specification_factories
from spine_engine.utils.serialization import deserialize_path
from spine_engine.project.project import LATEST_PROJECT_VERSION
from .project_item.logging_connection import HeadlessConnection
from .config import LATEST_PROJECT_VERSION
from .helpers import (
make_settings_dict_for_engine,
plugins_dirs,
Expand Down
3 changes: 0 additions & 3 deletions spinetoolbox/load_project_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
import importlib.util
import pkgutil
from spine_engine.project_item.project_item_info import ProjectItemInfo
from spine_engine import __version__ as curr_engine_version
from spinedb_api import __version__ as curr_db_api_version
from .version import __version__ as curr_toolbox_version
from .project_item.project_item_factory import ProjectItemFactory


Expand Down
16 changes: 9 additions & 7 deletions spinetoolbox/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
)
from spine_engine.utils.serialization import deserialize_path, serialize_path
from spine_engine.server.util.zip_handler import ZipHandler
from spine_engine.project.project import (
INVALID_CHARS,
LATEST_PROJECT_VERSION,
PROJECT_FILENAME,
PROJECT_LOCAL_DATA_DIR_NAME,
PROJECT_LOCAL_DATA_FILENAME,
SPECIFICATION_LOCAL_DATA_FILENAME,
PROJECT_ZIP_FILENAME,
)
from .server.engine_client import EngineClient
from .metaobject import MetaObject
from .helpers import (
Expand All @@ -50,14 +59,7 @@
)
from .project_upgrader import ProjectUpgrader
from .config import (
LATEST_PROJECT_VERSION,
PROJECT_FILENAME,
INVALID_CHARS,
PROJECT_LOCAL_DATA_DIR_NAME,
PROJECT_LOCAL_DATA_FILENAME,
FG_COLOR,
SPECIFICATION_LOCAL_DATA_FILENAME,
PROJECT_ZIP_FILENAME,
)
from .project_commands import SetProjectDescriptionCommand
from .spine_engine_worker import SpineEngineWorker
Expand Down
11 changes: 11 additions & 0 deletions spinetoolbox/project/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# This file is part of Spine Toolbox.
# Spine Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)
# any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details. You should have received a copy of the GNU Lesser General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################
"""This package contains adapters and wrappers that glue project into Spine Toolbox GUI."""
Loading

0 comments on commit b35ebcb

Please sign in to comment.