Skip to content

Basic prototype with support for selecting chip and simulating a test #2

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions frontend-prototype/frontend-prototype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import tkinter as tk
import os
from time import sleep

def get_files(path):
files = []
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
if file.endswith(".txt"):
files.append(file.replace(".txt", ""))
return files

def start_test():
to_test = clicked.get()
print(f"Testing {to_test}")
label_test_status.config(text=f"Starting test of {to_test}")
label_test_status.config(text=f"Test of {to_test} complete")
f = open("../test_results" + os.sep + "test_results_" + to_test + ".txt", "w")
f.write("Test results for " + to_test + "\n")
f.close()


# Create the main window
root = tk.Tk()
root.title("Frontend Prototype")

root.geometry("400x400")

def show():
label.config(text= clicked.get())

options = get_files("../test_chips")

clicked = tk.StringVar()
clicked.set(options[0])

# Create a dropdown menu
drop = tk.OptionMenu(root, clicked, *options)
drop.pack()

button = tk.Button(root, text="Select", command=show).pack()

# Create a label widget
label = tk.Label(root, text="Select a circuit to test")
label.pack()

# Button to start test
button_test = tk.Button(root, text="Start Test", command=start_test)
button_test.pack()

label_test_status = tk.Label(root, text="Click 'Start Test' to begin testing")
label_test_status.pack()

# Run the application
root.mainloop()
Empty file added test_chips/2inputAND.txt
Empty file.
Empty file added test_chips/2inputNAND.txt
Empty file.
Empty file added test_chips/2inputNOR.txt
Empty file.
Empty file added test_chips/hexconverter.txt
Empty file.
1 change: 1 addition & 0 deletions test_results/test_results_hexconverter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test results for hexconverter