Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SAM21004 committed Nov 5, 2024
1 parent 2a617e1 commit dc5c8ee
Showing 1 changed file with 165 additions and 0 deletions.
165 changes: 165 additions & 0 deletions SDPPython/tkex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import tkinter as tk
from tkinter import messagebox, ttk, filedialog
import webbrowser

devices = {
"Quadruple 2-input NAND gates": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/SN74HCT00",
},
"Quadruple 2-input NOR gates": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/SN74HCT02",
},
"Hex inverters": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/SN74HCT04",
},
"Quadruple 2-input AND gates": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/SN74HCT08",
},
"Quadruple 2-input OR gates": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/SN74HCT32",
},
"Dual J-K flip-flop with reset negative-edge trigger": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/CD74HC73",
},
"Dual D-type positive-edge triggered flip-flops": {
"pins": 14,
"datasheet": "https://www.ti.com/lit/gpn/sn74hct74",
},
"3-line to 8-line decoders/de-multiplexers": {
"pins": 16,
"datasheet": "https://www.ti.com/lit/gpn/sn54hct138",
},
"Dual 4-to-1-line selector/multiplexer": {
"pins": 16,
"datasheet": "https://www.ti.com/lit/gpn/CD54HC153",
},
"8-bit parallel-load shift registers": {
"pins": 16,
"datasheet": "https://www.ti.com/lit/gpn/SN74HC165",
},
"Octal buffers and line drivers with 3-state outputs": {
"pins": 20,
"datasheet": "https://www.ti.com/lit/gpn/sn74hct244",
},
"Octal bus transceivers with 3-state outputs": {
"pins": 20,
"datasheet": "https://www.ti.com/lit/gpn/sn74hct245",
},
"4-bit binary full adder with fast carry": {
"pins": 16,
"datasheet": "https://www.ti.com/lit/gpn/CD74HC283",
},
"Octal D-type flip-flop, 3-state positive-edge triggered": {
"pins": 20,
"datasheet": "https://www.ti.com/lit/gpn/sn74hct374",
},
"8-bit magnitude comparator": {
"pins": 20,
"datasheet": "https://www.ti.com/lit/gpn/CD74HC688",
},
}

# load the selected device's configuration
def load_device_config(event=None):
device_name = device_var.get()
if device_name in devices:
device_info = devices[device_name]
pin_count_label.config(text=f"Pin Count: {device_info['pins']} pins")
datasheet_button.config(state="normal")
else:
pin_count_label.config(text="Pin Count: -")
datasheet_button.config(state="disabled")

#open the datasheet link in a web browser
def open_datasheet():
device_name = device_var.get()
if device_name in devices:
webbrowser.open(devices[device_name]["datasheet"])

# start the test
def start_test():
device_name = device_var.get()
if device_name in devices:
messagebox.showinfo("Starting Test", f"Running test for {device_name}")
test_status_label.config(text="Status: Testing...", fg="blue")
# Placeholder for actual test logic
test_status_label.config(text="Status: Test Complete", fg="green")
test_results["device"] = device_name # Save the test result in test_results
test_results["status"] = "Test Complete"
else:
messagebox.showwarning("Warning", "Please select a device to begin the test.")

#save test results to a file
def save_report():
if "device" not in test_results or "status" not in test_results:
messagebox.showwarning("Warning", "No test results available to save.")
return

# Open a file dialog to save the test report
file_path = filedialog.asksaveasfilename(defaultextension=".txt", filetypes=[("Text Files", "*.txt")], title="Save Test Report")
if file_path:
with open(file_path, "w") as file:
file.write("Test Report\n")
file.write(f"Device: {test_results['device']}\n")
file.write(f"Pin Count: {devices[test_results['device']]['pins']} pins\n")
file.write(f"Test Status: {test_results['status']}\n")
messagebox.showinfo("Report Saved", f"Test report saved as {file_path}")

#exit the application
def exit_program():
root.destroy()

# Dictionary to store test results
test_results = {}

# Main window
root = tk.Tk()
root.title("IC Testing System")
root.geometry("350x300")

# Title label
title_label = tk.Label(root, text="IC Testing System", font=("Helvetica", 18, "bold"))
title_label.pack(pady=10)

# Frame for device selection and test start controls
selection_frame = tk.Frame(root, pady=10)
selection_frame.pack(fill="x", padx=20)

# Device type dropdown
device_var = tk.StringVar()
device_type_label = tk.Label(selection_frame, text="Select Device:", font=("Arial", 12))
device_type_label.grid(row=0, column=0, padx=5)

device_dropdown = ttk.Combobox(selection_frame, textvariable=device_var, font=("Arial", 12), state="readonly")
device_dropdown['values'] = list(devices.keys())
device_dropdown.grid(row=0, column=1, padx=5)
device_dropdown.bind("<<ComboboxSelected>>", load_device_config)

# Pin count label
pin_count_label = tk.Label(selection_frame, text="Pin Count: -", font=("Arial", 12))
pin_count_label.grid(row=1, column=0, columnspan=2, pady=5)

# Datasheet button
datasheet_button = tk.Button(selection_frame, text="Open Datasheet", command=open_datasheet, font=("Arial", 12), state="disabled")
datasheet_button.grid(row=2, column=0, columnspan=2, pady=5)

# Start test button
start_test_button = tk.Button(selection_frame, text="Start Test", command=start_test, font=("Arial", 12))
start_test_button.grid(row=3, column=0, padx=5, pady=5)

test_status_label = tk.Label(selection_frame, text="Status: Not Started", font=("Arial", 10), fg="gray")
test_status_label.grid(row=3, column=1, padx=5, pady=5)

# Save report button
save_report_button = tk.Button(root, text="Save Test Report", command=save_report, font=("Arial", 12))
save_report_button.pack(pady=10)


root.mainloop()

0 comments on commit dc5c8ee

Please sign in to comment.