Skip to content
Snippets Groups Projects
Commit ad0afee6 authored by martiivGylden's avatar martiivGylden
Browse files

Integrated latex, finishing touches on 1.0 of parser, working on GUI

parent fb860905
No related branches found
No related tags found
No related merge requests found
......@@ -26,12 +26,12 @@ def openFile():
top.title("Parsed diagram")
top.geometry("500x500")
lab = Label(top, text="Threat components in the diagrams")
lab = Label(top, text="Metrics in the diagrams ranked by number of associated components")
lab.config(font= ("Helvetica", 20, "bold"))
lab.grid()
lab.grid()
createThreats(diagram, top)
createMetrics(diagram, top)
return diagram
def createThreats(diagram: Diagram, top):
......@@ -76,7 +76,45 @@ def createThreats(diagram: Diagram, top):
listofIndicators.grid(row=4, column=10)
linkedComponents.grid(row = 4, column = 15)
def createMetrics(diagram: Diagram, top):
metrics = diagram.metrics.values()
rowIndex = 0
associatedList = {} # Needed to keep track of the number of associated components per metric
for metric in metrics:
numberOfAssociates = len(metric.bowtieID)+len(metric.erID)
associatedList[metric.ID] = numberOfAssociates
rankedList = sorted(associatedList.items(), key=lambda x: x[1], reverse=True)
for i in rankedList:
amountOFComponents = i[1]
metricID = i[0]
metricName = diagram.metrics[metricID].name
metricValue = diagram.metrics[metricID].value
metricDate = diagram.metrics[metricID].date
metricFrame = Frame(top) # Frame for each metric, should cover 80% of the window and stack vertically
rowIndex +=1 # Increment the row index for the next frame
l1 = Label(metricFrame, text= f"Metric Name: {metricName} \n Metric value: {metricValue}") # First label = Metric id and description
l2 = Label(metricFrame, text = f"Number of associated components: {amountOFComponents}") # Second label = Number of associated components in both diagrams
l3 = Label (metricFrame, text = f"Last update: {metricDate}") # Third label = Last update of the metric
l1.config(font=("Helvetica", 15, "bold"))
l2.config(font=("Helvetica", 15))
l3.config(font=("Helvetica", 15))
l1.grid(row = 0, column = 0)
l2.grid(row=0, column = 10)
l3.grid(row=0, column = 15)
metricFrame.grid(row=rowIndex) # Grid the frame in the window
def findMetrics(diagram, id:int, typeOfObject:str):
relevantMetrics = []
......
This diff is collapsed.
......@@ -6,8 +6,7 @@ def main():
dynamicMetricsBowtie = [] # List of metrics for the bowtie model
dynamicMetricsArchitecture = [] # List of metrics for the architecture
#parse.parseDiagramFile('diagrams/Thesis Bow-Tie and architecture - Meta model-2.csv') # Parse the diagram
parse.parseDiagramFile('diagrams/TableTest2.csv') # Parse the diagram
diagram = parse.parseDiagramFile('diagrams/DiagramTest3.csv') # Parse the diagram
if __name__=="__main__":
......
......@@ -106,15 +106,13 @@ def fillMetricinfo(erID1: str,
print("Metric is not used in the diagram!!!")
return
if erID1 == "ID" or erID1 != None:
#TODO FML
if erID1 == "ID":
pass
else:
erID1 = erID1.split(",")
erID1 = [eval(i) for i in erID1] # Parse ERID list to int
for i in erID1:
print("TODO")
print(erID1)
if type(BowTieID1) == str:
if "," in BowTieID1: # If the amount of associated bowtie IDs is only one or none
......
65a4eb3a3df6f89c327e3425 @ 3fc3e312
Subproject commit 3fc3e312135dbd1a4adc2786b8baf7df96a8a574
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment