-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui.py
150 lines (109 loc) · 6.55 KB
/
gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import tkinter as tk
from tkinter import filedialog, ttk
def guiInit(self):
#FRAMES
ssh_frame = tk.Frame(self)
ssh_frame.grid(row=0,column=0, sticky="w")
playback_frame = tk.Frame(self)
playback_frame.grid(row=1,column=0)
capture_frame = tk.Frame(self)
capture_frame.grid(row=2,column=0)
ssh_header = tk.Label(ssh_frame,text="Connect to DUT", font=("Arial", 16))
ssh_header.grid(row=0, column=0)
self.ip_entry = tk.Entry(ssh_frame)
self.ip_entry.grid(row=1, column=0)
self.user_entry = tk.Entry(ssh_frame)
self.user_entry.insert(0, "test")
self.user_entry.grid(row=2, column=0)
self.password_entry = tk.Entry(ssh_frame, show="*")
self.password_entry.insert(0, "test")
self.password_entry.grid(row=3, column=0)
connect_button = tk.Button(ssh_frame, text="Connect", command=self.connectThread)
connect_button.grid(row=4, column=0)
duration_label = tk.Label(self, text="Duration")
duration_label.grid(row=0, column=0, sticky="ne", padx="130")
self.duration_entry = tk.Entry(self)
self.duration_entry.insert(0, "15")
self.duration_entry.grid(row=0, column=0, sticky="ne")
refresh_endpoints_button = tk.Button(self,text="Refresh Endpoints", command=self.getAudioDevices)
refresh_endpoints_button.grid(row=0, column=0, sticky="ne", pady=20, padx=11)
self.status_label = tk.Label(self, text="1")
self.status_label.grid(row=0, column=0, sticky="ne", padx=11, pady=50)
separator1 = ttk.Separator(ssh_frame, orient="horizontal")
separator1.grid(row=5, column=0, columnspan=8, pady=10, sticky='ew')
#PLAYBACK
pb_header = tk.Label(playback_frame, text="Playback", font=("Arial", 16))
pb_header.grid(row=0, column=0)
pb_dev_label = tk.Label(playback_frame, text="Device")
pb_dev_label.grid(row=1, column=0)
self.pb_dev_entry = tk.Entry(playback_frame)
self.pb_dev_entry.insert(0, "1,1")
self.pb_dev_entry.grid(row=1, column=1)
pb_channel_label = tk.Label(playback_frame, text="Channels")
pb_channel_label.grid(row=1, column=2)
self.pb_channel_entry = tk.Entry(playback_frame)
self.pb_channel_entry.insert(0, "2")
self.pb_channel_entry.grid(row=1, column=3)
pb_format_label = tk.Label(playback_frame, text="Format")
pb_format_label.grid(row=1, column=4)
self.pb_format_entry = tk.Entry(playback_frame)
self.pb_format_entry.insert(0, "S24_LE")
self.pb_format_entry.grid(row=1, column=5)
pb_freq_label = tk.Label(playback_frame, text="Frequency")
pb_freq_label.grid(row=1, column=6)
self.pb_freq_entry = tk.Entry(playback_frame)
self.pb_freq_entry.insert(0, "48000")
self.pb_freq_entry.grid(row=1, column=7)
pb_file_label = tk.Label(playback_frame, text="Choose file to upload")
pb_file_label.grid(row=2, column=0)
self.pb_exec_button = tk.Button(playback_frame, text="Test", command=self.playbackThread)
self.pb_exec_button.grid(row=2, column=7, sticky="e", padx=5)
def browseFile():
self.pb_file_entry = filedialog.askopenfilename()
self.pb_file_button = tk.Button(playback_frame, text="Browse", command=browseFile)
self.pb_file_button.grid(row=2, column=1)
separator2 = ttk.Separator(playback_frame, orient="horizontal")
separator2.grid(row=3, column=0, columnspan=8, pady=10, sticky='ew')
#CAPTURE
self.cp_header = tk.Label(capture_frame, text="Capture", font=("Arial", 16))
self.cp_header.grid(row=0, column=0)
self.cp_dev_label = tk.Label(capture_frame, text="Device")
self.cp_dev_label.grid(row=1, column=0)
self.cp_dev_entry = tk.Entry(capture_frame)
self.cp_dev_entry.insert(0, "1,1")
self.cp_dev_entry.grid(row=1, column=1)
self.cp_channel_label = tk.Label(capture_frame, text="Channels")
self.cp_channel_label.grid(row=1, column=2)
self.cp_channel_entry = tk.Entry(capture_frame)
self.cp_channel_entry.insert(0, "2")
self.cp_channel_entry.grid(row=1, column=3)
self.cp_format_label = tk.Label(capture_frame, text="Format")
self.cp_format_label.grid(row=1, column=4)
self.cp_format_entry = tk.Entry(capture_frame)
self.cp_format_entry.insert(0, "S24_LE")
self.cp_format_entry.grid(row=1, column=5)
self.cp_freq_label = tk.Label(capture_frame, text="Frequency")
self.cp_freq_label.grid(row=1, column=6)
self.cp_freq_entry = tk.Entry(capture_frame)
self.cp_freq_entry.insert(0, "48000")
self.cp_freq_entry.grid(row=1, column=7)
self.cp_file_label = tk.Label(capture_frame, text="Name file to download")
self.cp_file_label.grid(row=2, column=0)
self.cp_file_entry = tk.Entry(capture_frame)
self.cp_file_entry.insert(0, "test.wav")
self.cp_file_entry.grid(row=2, column=1)
self.cp_exec_button = tk.Button(capture_frame, text="Test", command=self.captureThread)
self.cp_exec_button.grid(row=2, column=7, sticky="e", padx=5)
separator3 = ttk.Separator(capture_frame, orient="horizontal")
separator3.grid(row=3, column=0, columnspan=8, pady=10, sticky='ew')
self.text_area = tk.Text(self, bg="black", fg="white", wrap=tk.WORD)
self.text_area.insert(tk.END, "Connect to DUT to show Audio endpoints \n\n 1. Playback \n\tRemember to turn on recording on controller\n\tSelect the file to upload and play on DUT, and press 'Test'\n\n 2. Capture\n\tRemember to play sine from controller to be recorded\n\tChoose the name of file that will be downloaded, and press 'Test'\n\nIMPORTANT!\nTry not to change connections because the cleanup for used files function only works on 1 connection per session\n\nOpen on local not on share. Permissions issues etc.")
self.text_area.configure(state=tk.DISABLED)
self.text_area.grid(row=3, column=0, sticky="nsew")
self.grid_rowconfigure(3, weight=1)
self.grid_columnconfigure(0, weight=1)
self.text_area2 = tk.Text(self, bg="black", fg="white", wrap=tk.WORD, height=1)
self.text_area2.configure(state=tk.DISABLED)
self.text_area2.grid(row=4, column=0, sticky="nsew")
self.grid_rowconfigure(4, weight=0)
self.grid_columnconfigure(0, weight=1)