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

Working on GUI

parent 35fa7654
No related branches found
No related tags found
No related merge requests found
......@@ -22,45 +22,59 @@ def openFile():
top = Toplevel()
top = Toplevel(guiRoot)
top.title("Parsed diagram")
top.geometry("1500x1500")
h = Scrollbar(top, orient="vertical")
h.pack()
top.geometry("500x500")
lab = Label(top, text="Threat components in the diagrams")
lab.config(font= ("Comic Sans MS", 25, "bold"))
lab.pack(pady=20)
lab.config(font= ("Helvetica", 20, "bold"))
lab.grid()
createThreats(diagram, top)
return diagram
def createThreats(diagram: Diagram, top):
rowIndex = 0
for threat in diagram.threats.values():
metrics, components = findMetrics(diagram, threat.componentID, "bowtie")
threatFrame = Frame(top)
threatFrame.pack()
threatFrame.grid(row=rowIndex)
rowIndex +=1
l1 = Label(threatFrame, text= f"ID: {threat.id} Description: {threat.threatSource}")
l1 = Label(threatFrame, text= f"Threat ID: {threat.id} \n Threat description: {threat.threatSource}")
l2 = Label(threatFrame, text= f"Associated vulnerability: {threat.vulnerability}")
l3 = Label(threatFrame, text= f"Observable metrics: {metrics}")
l4 = Label(threatFrame, text = f"Linked Components: {components}")
l1.config(font=("Comic Sans MS", 20))
l2.config(font=("Comic Sans MS", 15))
l3.config(font=("Comic Sans MS", 15))
l4.config(font=("Comic Sans MS", 15))
listofIndicators = Listbox(threatFrame, font="Helvetica")
index = 1
for metric in metrics:
listofIndicators.insert(index,metric)
index +=1
linkedComponents = Listbox(threatFrame, font="Helvetica")
index = 1
for component in components:
linkedComponents.insert(index, component)
index +=1
l3 = Label(threatFrame, text= f"Observable indicators: {metrics}")
l4 = Label(threatFrame, text = f"Linked Components: {components}")
l1.pack()
l2.pack()
l3.pack()
l4.pack()
l1.config(font=("Helvetica", 20, "bold"))
l2.config(font=("Helvetica", 15))
l3.config(font=("Helvetica", 15))
l4.config(font=("Helvetica", 15))
l1.grid(row = 4, column = 0)
l2.grid(row=6, column = 0)
listofIndicators.grid(row=4, column=10)
linkedComponents.grid(row = 4, column = 15)
......@@ -72,12 +86,12 @@ def findMetrics(diagram, id:int, typeOfObject:str):
if typeOfObject == "bowtie":
if id in metric.bowtieID:
relevantMetrics.append(metric.ID)
relevantMetrics.append(metric.name)
relatedComponents.append(metric.erID)
elif typeOfObject == "er":
if id in metric.erID:
relevantMetrics.append(metric.ID)
relevantMetrics.append(metric.name)
relatedComponents.append(metric.bowtieID)
return relevantMetrics, relatedComponents
......
......@@ -24,7 +24,6 @@ def parseDiagramFile(csvFile) -> component.Diagram:
metrics, dynamics = parseDynamic(df, metrics, dynamics)
metricsMatrix, metrics = matrix.parseTable(df, metrics, diagram) #Parse the table
return diagram
......
......@@ -268,7 +268,6 @@ class ERDynamic(DynamicComponent):
metric.erID.append(erID)
metricsDict[metricID] = metric # ! Adds the metric to the global metric list
def checkDuplicateMetrics(metricsDict: dict, metricID: str):
"""_summary_
Function will check if the diagrams metric dict contains a metric,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment