Skip to content

Commit

Permalink
Merge 0.8-dev to master (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen authored Apr 29, 2024
2 parents 6e11c29 + f6062b4 commit 8283d6e
Show file tree
Hide file tree
Showing 297 changed files with 7,993 additions and 6,258 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
os: [windows-latest, ubuntu-22.04]
python-version: [3.8, 3.9, "3.10", 3.11]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Version from Git tags
run: git describe --tags
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
Expand All @@ -43,6 +43,9 @@ jobs:
- name: List packages
run:
pip list
- name: Install coverage
run:
python -m pip install coverage[toml]
- name: Run tests
run: |
if [ "$RUNNER_OS" != "Windows" ]; then
Expand All @@ -51,4 +54,6 @@ jobs:
coverage run -m unittest discover --verbose
shell: bash
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions bin/append_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
license_text = [
"######################################################################################################################\n",
"# Copyright (C) 2017-2022 Spine project consortium\n",
"# Copyright Spine Items contributors\n",
"# This file is part of Spine Items.\n",
"# Spine Items is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General\n",
"# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)\n",
Expand Down
39 changes: 0 additions & 39 deletions bin/update_copyrights.py

This file was deleted.

6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
]
requires-python = ">=3.8.1, <3.12"
dependencies = [
"pyside6 >= 6.5.0, != 6.5.3",
"pyside6 >= 6.5.0, != 6.5.3, != 6.6.3",
"pyodbc >=4.0",
# v1.4 does not pass tests
"sqlalchemy >=1.3, <1.4",
Expand All @@ -27,9 +27,6 @@ dependencies = [
[project.urls]
Repository = "https://github.com/spine-tools/spine-items"

[project.optional-dependencies]
dev = ["coverage[toml]"]

[build-system]
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2", "wheel", "build"]
build-backend = "setuptools.build_meta"
Expand Down Expand Up @@ -58,5 +55,4 @@ ignore_errors = true

[tool.black]
line-length = 120
skip-string-normalization = true
exclude = '\.git|ui|resources_icons_rc.py'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e git+https://github.com/spine-tools/Spine-Database-API.git#egg=spinedb_api
-e git+https://github.com/spine-tools/spine-engine.git#egg=spine_engine
-e git+https://github.com/spine-tools/Spine-Toolbox.git#egg=spinetoolbox
-e .[dev]
-e .
57 changes: 53 additions & 4 deletions spine_items/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# Copyright Spine Items contributors
# This file is part of Spine Items.
# Spine Items 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)
Expand All @@ -9,9 +10,57 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################

"""
Spine items.
""" Spine items. """
from .version import __version__

"""

from .version import __version__
def _factories_and_executable_items():
from . import data_connection
from .data_connection.data_connection_factory import DataConnectionFactory
from . import data_store
from .data_store.data_store_factory import DataStoreFactory
from . import data_transformer
from .data_transformer.data_transformer_factory import DataTransformerFactory
from .data_transformer import specification_factory
from . import exporter
from .exporter.exporter_factory import ExporterFactory
from .exporter import specification_factory
from . import importer
from .importer.importer_factory import ImporterFactory
from .importer import specification_factory
from . import merger
from .merger.merger_factory import MergerFactory
from . import tool
from .tool.tool_factory import ToolFactory
from .tool import specification_factory
from . import view
from .view.view_factory import ViewFactory

modules = (data_connection, data_store, data_transformer, exporter, importer, merger, tool, view)
item_infos = tuple(module.item_info.ItemInfo for module in modules)
factories = (
DataConnectionFactory,
DataStoreFactory,
DataTransformerFactory,
ExporterFactory,
ImporterFactory,
MergerFactory,
ToolFactory,
ViewFactory,
)
factories = {info.item_type(): factory for info, factory in zip(item_infos, factories)}
executables = {module.item_info.ItemInfo.item_type(): module.executable_item.ExecutableItem for module in modules}
specification_item_submodules = (data_transformer, exporter, importer, tool)
specification_factories = {
module.item_info.ItemInfo.item_type(): module.specification_factory.SpecificationFactory
for module in specification_item_submodules
}
return (
factories.copy,
executables.copy,
specification_factories.copy,
)


item_factories, executable_items, item_specification_factories = _factories_and_executable_items()
del _factories_and_executable_items
7 changes: 2 additions & 5 deletions spine_items/animations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# Copyright Spine Items contributors
# This file is part of Spine Items.
# Spine Items 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)
Expand All @@ -9,11 +10,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################

"""
Animation class for importers and exporters.
"""

"""Animation class for importers and exporters."""
from PySide6.QtGui import QPainterPath, QFont, QFontMetrics
from PySide6.QtCore import Qt, Signal, Slot, QObject, QTimeLine, QRectF, QPointF, QLineF
from PySide6.QtWidgets import QGraphicsPathItem
Expand Down
81 changes: 49 additions & 32 deletions spine_items/commands.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# Copyright Spine Items contributors
# This file is part of Spine Items.
# Spine Items 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)
Expand All @@ -9,53 +10,59 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################

"""
Undo/redo commands that can be used by multiple project items.
"""
"""Undo/redo commands that can be used by multiple project items."""
from spinetoolbox.project_commands import SpineToolboxCommand


class UpdateCancelOnErrorCommand(SpineToolboxCommand):
def __init__(self, project_item, cancel_on_error):
def __init__(self, item_name, cancel_on_error, project):
"""Command to update Importer, Exporter, and Merger cancel on error setting.
Args:
project_item (ProjectItem): Item
item_name (str): Item's name
cancel_on_error (bool): New setting
project (SpineToolboxProject): project
"""
super().__init__()
self._project_item = project_item
self._item_name = item_name
self._redo_cancel_on_error = cancel_on_error
self._undo_cancel_on_error = not cancel_on_error
self.setText(f"change {project_item.name} cancel on error setting")
self._project = project
self.setText(f"change {item_name} cancel on error setting")

def redo(self):
self._project_item.set_cancel_on_error(self._redo_cancel_on_error)
item = self._project.get_item(self._item_name)
item.set_cancel_on_error(self._redo_cancel_on_error)

def undo(self):
self._project_item.set_cancel_on_error(self._undo_cancel_on_error)
item = self._project.get_item(self._item_name)
item.set_cancel_on_error(self._undo_cancel_on_error)


class UpdateOnConflictCommand(SpineToolboxCommand):
def __init__(self, project_item, on_conflict):
def __init__(self, item_name, on_conflict, project):
"""Command to update Importer and Merger 'on conflict' setting.
Args:
project_item (ProjectItem): Item
item_name (str): Item's name
on_conflict (str): New setting
project (SpineToolboxProject): project
"""
super().__init__()
self._project_item = project_item
self._item_name = item_name
self._redo_on_conflict = on_conflict
self._undo_on_conflict = self._project_item.on_conflict
self.setText(f"change {project_item.name} on conflict setting")
project_item = project.get_item(item_name)
self._undo_on_conflict = project_item.on_conflict
self._project = project
self.setText(f"change {item_name} on conflict setting")

def redo(self):
self._project_item.set_on_conflict(self._redo_on_conflict)
item = self._project.get_item(self._item_name)
item.set_on_conflict(self._redo_on_conflict)

def undo(self):
self._project_item.set_on_conflict(self._undo_on_conflict)
item = self._project.get_item(self._item_name)
item.set_on_conflict(self._undo_on_conflict)


class ChangeItemSelectionCommand(SpineToolboxCommand):
Expand All @@ -82,42 +89,52 @@ def undo(self):


class UpdateCmdLineArgsCommand(SpineToolboxCommand):
def __init__(self, item, cmd_line_args):
def __init__(self, item_name, cmd_line_args, project):
"""Command to update Tool command line args.
Args:
item (ProjectItemBase): the item
item_name (str): item's name
cmd_line_args (list): list of command line args
project (SpineToolboxProject): project
"""
super().__init__()
self.item = item
self.redo_cmd_line_args = cmd_line_args
self.undo_cmd_line_args = self.item.cmd_line_args
self.setText(f"change command line arguments of {item.name}")
self._item_name = item_name
self._redo_cmd_line_args = cmd_line_args
item = project.get_item(item_name)
self._undo_cmd_line_args = item.cmd_line_args
self._project = project
self.setText(f"change command line arguments of {item_name}")

def redo(self):
self.item.update_cmd_line_args(self.redo_cmd_line_args)
item = self._project.get_item(self._item_name)
item.update_cmd_line_args(self._redo_cmd_line_args)

def undo(self):
self.item.update_cmd_line_args(self.undo_cmd_line_args)
item = self._project.get_item(self._item_name)
item.update_cmd_line_args(self._undo_cmd_line_args)


class UpdateGroupIdCommand(SpineToolboxCommand):
def __init__(self, item, group_id):
def __init__(self, item_name, group_id, project):
"""Command to update item group identifier.
Args:
item (ProjectItemBase): the item
item_name (str): item's name
group_id (str): group identifier
project (SpineToolboxProject): project
"""
super().__init__()
self._item = item
self._item_name = item_name
self._redo_group_id = group_id
self._undo_group_id = self._item.group_id
self.setText(f"change group identifier of {item.name}")
item = project.get_item(item_name)
self._undo_group_id = item.group_id
self._project = project
self.setText(f"change group identifier of {item_name}")

def redo(self):
self._item.do_set_group_id(self._redo_group_id)
item = self._project.get_item(self._item_name)
item.do_set_group_id(self._redo_group_id)

def undo(self):
self._item.do_set_group_id(self._undo_group_id)
item = self._project.get_item(self._item_name)
item.do_set_group_id(self._undo_group_id)
6 changes: 2 additions & 4 deletions spine_items/data_connection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# Copyright Spine Items contributors
# This file is part of Spine Items.
# Spine Items 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)
Expand All @@ -9,7 +10,4 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################

"""
Data connection plugin.
"""
"""Data connection plugin."""
Loading

0 comments on commit 8283d6e

Please sign in to comment.