• 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

22.73
/trnsysGUI/segmentDialog.py
1
import PyQt5.QtWidgets as _qtw
1✔
2

3
import pytrnsys.utils.result as _res
1✔
4

5
import trnsysGUI.connection.connectionBase as _cb
1✔
6
import trnsysGUI.warningsAndErrors as _werrors
1✔
7
import trnsysGUI.names.rename as _rename
1✔
8

9

10
class SegmentDialog(_qtw.QDialog):
1✔
11
    def __init__(
1✔
12
        self,
13
        connection: _cb.ConnectionBase,
14
        renameHelper: _rename.RenameHelper,
15
    ) -> None:
16
        super().__init__()
×
17
        self._connection = connection
×
18
        self._renameHelper = renameHelper
×
19

20
        nameLabel = _qtw.QLabel("Name:")
×
21
        self._lineEdit = _qtw.QLineEdit(self._connection.displayName)
×
22

23
        okButton = _qtw.QPushButton("OK")
×
24
        cancelButton = _qtw.QPushButton("Cancel")
×
25

26
        buttonLayout = _qtw.QHBoxLayout()
×
27
        buttonLayout.addStretch()
×
28
        buttonLayout.addWidget(okButton)
×
29
        buttonLayout.addWidget(cancelButton)
×
30
        layout = _qtw.QGridLayout()
×
31
        layout.addWidget(nameLabel, 0, 0)
×
32
        layout.addWidget(self._lineEdit, 0, 1)
×
33
        layout.addLayout(buttonLayout, 1, 0, 2, 0)
×
34
        self.setLayout(layout)
×
35

36
        okButton.clicked.connect(self._acceptedEdit)
×
37
        cancelButton.clicked.connect(self._cancel)
×
38
        self.setWindowTitle("Change connection name")
×
39

40
    def _acceptedEdit(self) -> None:
1✔
41
        newName = self._lineEdit.text()
×
42
        currentName = self._connection.displayName
×
43

44
        checkDdckFolder = False
×
NEW
45
        result = self._renameHelper.canRename(
×
46
            currentName, newName, checkDdckFolder
47
        )
48
        if _res.isError(result):
×
49
            errorMessage = _res.error(result)
×
50
            _werrors.showMessageBox(errorMessage.message)
×
51
            return
×
52

53
        self._applyNameChange(newName)
×
54
        self._renameHelper.rename(currentName, newName)
×
55
        self.close()
×
56

57
    def _applyNameChange(self, newName: str) -> None:
1✔
58
        self._connection.setDisplayName(newName)
×
59
        for segment in self._connection.segments:
×
60
            segment.setToolTip(newName)
×
61

62
    def _cancel(self) -> None:
1✔
63
        self.close()
×
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