• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SPF-OST / pytrnsys_gui / 11662562960

29 Oct 2024 03:09PM UTC coverage: 67.508% (-0.08%) from 67.591%
11662562960

push

github

web-flow
Merge pull request #564 from SPF-OST/560-black-change-line-length-to-pep8-standard-of-79-and-check-ci-reaction

changed line length in black to 79

1054 of 1475 new or added lines in 174 files covered. (71.46%)

150 existing lines in 74 files now uncovered.

10399 of 15404 relevant lines covered (67.51%)

0.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.62
/trnsysGUI/connection/deleteSinglePipeConnectionCommand.py
1
from __future__ import annotations
1✔
2

3
import dataclasses as _dc
1✔
4
import typing as _tp
1✔
5

6
import PyQt5.QtWidgets as _qtw
1✔
7

8
import pytrnsys.utils.result as _res
1✔
9
import trnsysGUI.connection.singlePipeConnection as _spc  # pylint: disable=cyclic-import
1✔
10
import trnsysGUI.connection.undo as _cundo
1✔
11
import trnsysGUI.hydraulicLoops.merge as _hlmerge  # pylint: disable=cyclic-import
1✔
12
import trnsysGUI.hydraulicLoops.model as _hlmodel
1✔
13
import trnsysGUI.hydraulicLoops.split as _hlsplit  # pylint: disable=cyclic-import
1✔
14
import trnsysGUI.names.undo as _un
1✔
15

16

17
@_dc.dataclass
1✔
18
class HydraulicLoopsData:
1✔
19
    hydraulicLoops: _hlmodel.HydraulicLoops
1✔
20
    fluids: _tp.Sequence[_hlmodel.Fluid]
1✔
21
    defaultFluid: _hlmodel.Fluid
1✔
22

23

24
class DeleteSinglePipeConnectionCommand(
1✔
25
    _qtw.QUndoCommand
26
):  # pylint: disable=too-many-instance-attributes
27
    def __init__(
1✔
28
        self,
29
        connection: _spc.SinglePipeConnection,
30
        undoNamingHelper: _un.UndoNamingHelper,
31
        hydraulicLoopsData: HydraulicLoopsData,
32
        graphicsScene: _qtw.QGraphicsScene,
33
        parentCommand: _tp.Optional[_qtw.QUndoCommand],
34
    ):
35
        super().__init__("Delete single pipe connection", parentCommand)
×
36

37
        self._connection = connection
×
38
        self._undoNamingHelper = undoNamingHelper
×
39
        self._hydraulicLoopsData = hydraulicLoopsData
×
40
        self._graphicsScene = graphicsScene
×
41
        self._splitSummary: _tp.Optional[_hlsplit.SplitSummary] = None
×
42

43
    def redo(self) -> None:
1✔
44
        assert self._connection
×
45

NEW
46
        splitLoopsSummary = (
×
47
            self._splitSummary.after if self._splitSummary else None
48
        )  # pylint: disable=no-member
49

50
        cancellable = _hlsplit.split(
×
51
            self._connection,
52
            self._hydraulicLoopsData.hydraulicLoops,
53
            self._hydraulicLoopsData.fluids,
54
            splitLoopsSummary,
55
        )
56
        if cancellable == "cancelled":
×
57
            self.setObsolete(True)
×
58
            return
×
59
        self._splitSummary = cancellable
×
60

61
        self._graphicsScene.removeItem(self._connection)
×
62
        self._connection.deleteConnection()
×
NEW
63
        self._undoNamingHelper.removeNameForDelete(
×
64
            self._connection.displayName
65
        )
66

67
    def undo(self) -> None:
1✔
NEW
68
        mergedLoopSummary = (
×
69
            self._splitSummary.before if self._splitSummary else None
70
        )  # pylint: disable=no-member
71

72
        cancellable = _hlmerge.merge(
×
73
            self._connection,
74
            self._hydraulicLoopsData.hydraulicLoops,
75
            self._hydraulicLoopsData.fluids,
76
            self._hydraulicLoopsData.defaultFluid,
77
            mergedLoopSummary,
78
        )
79
        assert cancellable != "cancelled" and not _res.isError(cancellable)
×
80

81
        _cundo.setDisplayNameForReAdd(self._connection, self._undoNamingHelper)
×
82
        _cundo.reAddConnection(self._connection)
×
83
        self._graphicsScene.addItem(self._connection)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc