From 08018bedd8779bac4af4e2785b9582516936239b Mon Sep 17 00:00:00 2001 From: CopingWharf5 Date: Tue, 29 Oct 2024 16:39:42 -0400 Subject: [PATCH] Basic prototype with support for selecting chip and simulating a test --- frontend-prototype/frontend-prototype.py | 55 ++++++++++++++++++++++ test_chips/2inputAND.txt | 0 test_chips/2inputNAND.txt | 0 test_chips/2inputNOR.txt | 0 test_chips/hexconverter.txt | 0 test_results/test_results_hexconverter.txt | 1 + 6 files changed, 56 insertions(+) create mode 100644 frontend-prototype/frontend-prototype.py create mode 100644 test_chips/2inputAND.txt create mode 100644 test_chips/2inputNAND.txt create mode 100644 test_chips/2inputNOR.txt create mode 100644 test_chips/hexconverter.txt create mode 100644 test_results/test_results_hexconverter.txt diff --git a/frontend-prototype/frontend-prototype.py b/frontend-prototype/frontend-prototype.py new file mode 100644 index 0000000..d7a3db9 --- /dev/null +++ b/frontend-prototype/frontend-prototype.py @@ -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() \ No newline at end of file diff --git a/test_chips/2inputAND.txt b/test_chips/2inputAND.txt new file mode 100644 index 0000000..e69de29 diff --git a/test_chips/2inputNAND.txt b/test_chips/2inputNAND.txt new file mode 100644 index 0000000..e69de29 diff --git a/test_chips/2inputNOR.txt b/test_chips/2inputNOR.txt new file mode 100644 index 0000000..e69de29 diff --git a/test_chips/hexconverter.txt b/test_chips/hexconverter.txt new file mode 100644 index 0000000..e69de29 diff --git a/test_results/test_results_hexconverter.txt b/test_results/test_results_hexconverter.txt new file mode 100644 index 0000000..e8394d5 --- /dev/null +++ b/test_results/test_results_hexconverter.txt @@ -0,0 +1 @@ +Test results for hexconverter