Skip to content

Commit

Permalink
Basic prototype with support for selecting chip and simulating a test
Browse files Browse the repository at this point in the history
  • Loading branch information
CopingWharf5 authored and CopingWharf5 committed Oct 29, 2024
1 parent 03c8b6d commit 08018be
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
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

0 comments on commit 08018be

Please sign in to comment.