Skip to content

Commit 8017aca

Browse files
committed
Remove unwanted whitespace
1 parent 288cee3 commit 8017aca

19 files changed

+203
-233
lines changed

mal_gui/AssociationTableView.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def __init__(self, parent=None):
1010
self.mainWindow = parent
1111

1212
self.tableAssociationView = QTableView(self)
13-
1413
self.associationInfoModel = QStandardItemModel()
1514

1615
#headers for the columns
@@ -40,5 +39,3 @@ def __init__(self, parent=None):
4039

4140
def getAssociationInfo(self):
4241
return self.associationInfo
43-
44-

mal_gui/ConnectionDialog.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class ConnectionDialog(QDialog):
1414
def filterItems(self, text):
1515
pass
16-
16+
1717
def OkButtonClicked(self):
1818
pass
1919

@@ -25,7 +25,7 @@ def __init__(self, startItem, endItem,langGraph, lcs,model,parent=None):
2525
self.langGraph = langGraph
2626
self.lcs = lcs
2727
self.model = model
28-
28+
2929
self.setWindowTitle("Select Association Type")
3030
self.setMinimumWidth(300)
3131

@@ -121,7 +121,7 @@ def __init__(self, startItem, endItem,langGraph, lcs,model,parent=None):
121121

122122
# Select the first item by default
123123
self.associationListWidget.setCurrentRow(0)
124-
124+
125125
def filterItems(self, text):
126126
for i in range(self.associationListWidget.count()):
127127
item = self.associationListWidget.item(i)
@@ -132,7 +132,7 @@ def OkButtonClicked(self):
132132
if selectedItem:
133133
selectedAssociationText = selectedItem.text()
134134
# QMessageBox.information(self, "Selected Item", f"You selected: {selectedAssociationText}")
135-
135+
136136
(assoc, leftAsset, rightAsset) = self._str_to_assoc[selectedAssociationText]
137137
# TODO: Create association based on its full name instead in order
138138
# to avoid conflicts when multiple associations with the same name
@@ -144,7 +144,7 @@ def OkButtonClicked(self):
144144
selectedItem.association = association
145145
# self.model.add_association(association)
146146
self.accept()
147-
147+
148148
class EntrypointConnectionDialog(ConnectionDialog):
149149
def __init__(self, attackerItem, assetItem, langGraph, lcs, model, parent=None):
150150
super().__init__(parent)
@@ -193,7 +193,6 @@ def __init__(self, attackerItem, assetItem, langGraph, lcs, model, parent=None):
193193
self.layout.addWidget(self.filterEdit)
194194
self.layout.addWidget(self.attackStepListWidget)
195195

196-
197196
buttonLayout = QHBoxLayout()
198197
self.okButton = QPushButton("OK")
199198
self.okButton.clicked.connect(self.OkButtonClicked)

mal_gui/ConnectionItem.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ def createLabel(self, text):
1313

1414
def updatePath(self):
1515
pass
16-
16+
1717
def removeLabels(self):
1818
pass
19-
19+
2020
def restoreLabels(self):
2121
pass
22-
23-
22+
23+
2424
class AssociationConnectionItem(IConnectionItem):
2525
def __init__(
2626
self,
@@ -31,23 +31,23 @@ def __init__(
3131
parent = None
3232
):
3333
super().__init__(parent)
34-
34+
3535
pen = QPen(QColor(0, 255, 0), 2) # Green color with 2-pixel thickness
3636
self.setPen(pen)
37-
37+
3838
self.setZValue(0) # Ensure connection items are behind rect items
39-
39+
4040
self.showAssociationFlag = False
41-
41+
4242
self.startItem = startItem
4343
self.endItem = endItem
4444
self.scene = scene
45-
45+
4646
self.startItem.addConnection(self)
4747
self.endItem.addConnection(self)
48-
48+
4949
if self.startItem.assetType != 'Attacker' and self.endItem.assetType != 'Attacker':
50-
50+
5151
self.associationDetails = selectedAssociationText.split("-->")
5252
assocLeftField = self.associationDetails[0]
5353
assocMiddleName = self.associationDetails[1]
@@ -58,9 +58,9 @@ def __init__(
5858
self.labelAssocLeftField = self.createLabel(assocLeftField.split(".")[1])
5959
self.labelAssocMiddleName = self.createLabel(assocMiddleName)
6060
self.labelAssocRightField = self.createLabel(assocRightField.split(".")[1])
61-
61+
6262
else:
63-
63+
6464
#Need to check who is attacker and get the name of target and attackStep Name
6565
# Assumption is Both are not 'Attacker'
6666
if self.startItem.assetType == 'Attacker':
@@ -69,15 +69,15 @@ def __init__(
6969
else:
7070
attacker = self.endItem.attackerAttachment
7171
target = str(self.startItem.assetName)
72-
72+
7373
#selectedAssociationText is representing 'AttackStep' name
7474
attacker.entry_points.append(target + ' -> ' + selectedAssociationText)
7575
self.labelAssocLeftField = self.createLabel("")
7676
self.labelAssocMiddleName = self.createLabel(selectedAssociationText)
7777
self.labelAssocRightField = self.createLabel("")
78-
79-
80-
78+
79+
80+
8181
self.updatePath()
8282

8383
def createLabel(self, text):
@@ -104,7 +104,7 @@ def updatePath(self):
104104
self.startPos = self.startItem.sceneBoundingRect().center()
105105
self.endPos = self.endItem.sceneBoundingRect().center()
106106
self.setLine(QLineF(self.startPos, self.endPos))
107-
107+
108108
labelAssocLeftFieldPos = self.line().pointAt(0.2)
109109
self.labelAssocLeftField.setPos(labelAssocLeftFieldPos - QPointF(self.labelAssocLeftField.boundingRect().width() / 2, self.labelAssocLeftField.boundingRect().height() / 2))
110110

@@ -113,9 +113,9 @@ def updatePath(self):
113113

114114
labelAssocRightFieldPos = self.line().pointAt(0.8)
115115
self.labelAssocRightField.setPos(labelAssocRightFieldPos - QPointF(self.labelAssocRightField.boundingRect().width() / 2, self.labelAssocRightField.boundingRect().height() / 2))
116-
116+
117117
# print("isAssociationVisibilityChecked = "+ str(self.isAssociationVisibilityChecked))
118-
118+
119119
self.labelAssocLeftField.setVisible(self.scene.getShowAssociationCheckBoxStatus())
120120
self.labelAssocRightField.setVisible(self.scene.getShowAssociationCheckBoxStatus())
121121

@@ -125,24 +125,24 @@ def calculateOffset(self, rect, label_pos, angle):
125125
"""
126126
offset_distance = 10 # Distance to move the label outside the rectangle
127127
offset = QPointF()
128-
128+
129129
if angle < 90 or angle > 270:
130130
offset.setX(rect.width() / 2 + offset_distance)
131131
else:
132132
offset.setX(-(rect.width() / 2 + offset_distance))
133-
133+
134134
if angle < 180:
135135
offset.setY(rect.height() / 2 + offset_distance)
136136
else:
137137
offset.setY(-(rect.height() / 2 + offset_distance))
138-
138+
139139
return offset
140-
140+
141141
def removeLabels(self):
142142
self.scene.removeItem(self.labelAssocLeftField)
143143
self.scene.removeItem(self.labelAssocMiddleName)
144144
self.scene.removeItem(self.labelAssocRightField)
145-
145+
146146
def restoreLabels(self):
147147
self.scene.addItem(self.labelAssocLeftField)
148148
self.scene.addItem(self.labelAssocMiddleName)
@@ -151,7 +151,6 @@ def restoreLabels(self):
151151
def delete(self):
152152
self.removeLabels()
153153
self.scene.removeItem(self)
154-
155154

156155

157156
class EntrypointConnectionItem(IConnectionItem):
@@ -193,8 +192,8 @@ def createLabel(self, text):
193192
labelGroup = self.scene.createItemGroup([labelBackground, label])
194193
labelGroup.setZValue(1) # Ensure labels are above the line
195194

196-
return labelGroup
197-
195+
return labelGroup
196+
198197
def updatePath(self):
199198
"""
200199
Draws a straight line from the start to end items and updates label positions.

0 commit comments

Comments
 (0)