Skip to content

Commit 83da1fa

Browse files
utilities paths fix
1 parent d1bc316 commit 83da1fa

13 files changed

Lines changed: 149 additions & 176 deletions

pica/keithley/delta_mode/Delta_RT_K6221_K2182_L350_Sensing_GUI.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,44 +62,37 @@ def run_script_process(script_path):
6262
def launch_plotter_utility():
6363
"""Finds and launches the plotter utility script in a new process."""
6464
try:
65-
# Assumes the plotter is in a standard location relative to this script
6665
script_dir = os.path.dirname(os.path.abspath(__file__))
66+
# Go up 2 levels: delta_mode -> keithley -> pica
6767
plotter_path = os.path.join(
6868
script_dir,
69-
"..",
70-
"Utilities",
71-
"PlotterUtil_GUI.py")
69+
"..", "..", "utils", "PlotterUtil_GUI.py")
7270
if not os.path.exists(plotter_path):
7371
messagebox.showerror(
7472
"File Not Found",
7573
f"Plotter utility not found at expected path:\n{plotter_path}")
7674
return
7775
Process(target=run_script_process, args=(plotter_path,)).start()
7876
except Exception as e:
79-
messagebox.showerror("Launch Error",
80-
f"Failed to launch Plotter Utility: {e}")
77+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
8178

8279

8380
def launch_gpib_scanner():
8481
"""Finds and launches the GPIB scanner utility in a new process."""
8582
try:
86-
# Assumes the scanner is in a standard location relative to this script
8783
script_dir = os.path.dirname(os.path.abspath(__file__))
84+
# Go up 2 levels: delta_mode -> keithley -> pica
8885
scanner_path = os.path.join(
8986
script_dir,
90-
"..",
91-
"Utilities",
92-
"GPIB_Instrument_Scanner_GUI.py")
87+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
9388
if not os.path.exists(scanner_path):
9489
messagebox.showerror(
9590
"File Not Found",
9691
f"GPIB Scanner not found at expected path:\n{scanner_path}")
9792
return
9893
Process(target=run_script_process, args=(scanner_path,)).start()
9994
except Exception as e:
100-
messagebox.showerror(
101-
"Launch Error",
102-
f"Failed to launch GPIB Scanner: {e}")
95+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
10396

10497

10598
# -------------------------------------------------------------------------------

pica/keithley/delta_mode/Delta_RT_K6221_K2182_L350_T_Control_GUI.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,42 +44,39 @@ def run_script_process(script_path):
4444

4545

4646
def launch_plotter_utility():
47+
"""Finds and launches the plotter utility script in a new process."""
4748
try:
4849
script_dir = os.path.dirname(os.path.abspath(__file__))
50+
# Go up 2 levels: delta_mode -> keithley -> pica
4951
plotter_path = os.path.join(
5052
script_dir,
51-
"..",
52-
"Utilities",
53-
"PlotterUtil_GUI.py")
53+
"..", "..", "utils", "PlotterUtil_GUI.py")
5454
if not os.path.exists(plotter_path):
5555
messagebox.showerror(
5656
"File Not Found",
5757
f"Plotter utility not found at expected path:\n{plotter_path}")
5858
return
5959
Process(target=run_script_process, args=(plotter_path,)).start()
6060
except Exception as e:
61-
messagebox.showerror("Launch Error",
62-
f"Failed to launch Plotter Utility: {e}")
61+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
6362

6463

6564
def launch_gpib_scanner():
65+
"""Finds and launches the GPIB scanner utility in a new process."""
6666
try:
6767
script_dir = os.path.dirname(os.path.abspath(__file__))
68+
# Go up 2 levels: delta_mode -> keithley -> pica
6869
scanner_path = os.path.join(
6970
script_dir,
70-
"..",
71-
"Utilities",
72-
"GPIB_Instrument_Scanner_GUI.py")
71+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
7372
if not os.path.exists(scanner_path):
7473
messagebox.showerror(
7574
"File Not Found",
7675
f"GPIB Scanner not found at expected path:\n{scanner_path}")
7776
return
7877
Process(target=run_script_process, args=(scanner_path,)).start()
7978
except Exception as e:
80-
messagebox.showerror(
81-
"Launch Error",
82-
f"Failed to launch GPIB Scanner: {e}")
79+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
8380

8481

8582
def resource_path(relative_path):

pica/keithley/delta_mode/IV_K6221_DC_Sweep_GUI.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,14 @@ def launch_plotter_utility():
6969
"""Finds and launches the plotter utility script in a new process."""
7070
try:
7171
script_dir = os.path.dirname(os.path.abspath(__file__))
72-
plotter_path = os.path.join(script_dir, "..", "..", "utils", "PlotterUtil_GUI.py")
72+
# Go up 2 levels: delta_mode -> keithley -> pica
73+
plotter_path = os.path.join(
74+
script_dir,
75+
"..", "..", "utils", "PlotterUtil_GUI.py")
7376
if not os.path.exists(plotter_path):
74-
messagebox.showerror("File Not Found", f"Plotter utility not found at expected path:\n{plotter_path}")
77+
messagebox.showerror(
78+
"File Not Found",
79+
f"Plotter utility not found at expected path:\n{plotter_path}")
7580
return
7681
Process(target=run_script_process, args=(plotter_path,)).start()
7782
except Exception as e:
@@ -81,9 +86,14 @@ def launch_gpib_scanner():
8186
"""Finds and launches the GPIB scanner utility in a new process."""
8287
try:
8388
script_dir = os.path.dirname(os.path.abspath(__file__))
84-
scanner_path = os.path.join(script_dir, "..", "..", "utils", "GPIB_scan_GUI.py")
89+
# Go up 2 levels: delta_mode -> keithley -> pica
90+
scanner_path = os.path.join(
91+
script_dir,
92+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
8593
if not os.path.exists(scanner_path):
86-
messagebox.showerror("File Not Found", f"GPIB Scanner not found at expected path:\n{scanner_path}")
94+
messagebox.showerror(
95+
"File Not Found",
96+
f"GPIB Scanner not found at expected path:\n{scanner_path}")
8797
return
8898
Process(target=run_script_process, args=(scanner_path,)).start()
8999
except Exception as e:

pica/keithley/k2400/RT_K2400_L350_T_Control_GUI.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,37 @@ def run_script_process(script_path):
6161
def launch_plotter_utility():
6262
"""Finds and launches the plotter utility script in a new process."""
6363
try:
64-
# Assumes the plotter is in a standard location relative to this script
6564
script_dir = os.path.dirname(os.path.abspath(__file__))
65+
# Go up 2 levels: k2400 -> keithley -> pica
6666
plotter_path = os.path.join(
6767
script_dir,
68-
"..",
69-
"Utilities",
70-
"PlotterUtil_GUI.py")
68+
"..", "..", "utils", "PlotterUtil_GUI.py")
7169
if not os.path.exists(plotter_path):
7270
messagebox.showerror(
7371
"File Not Found",
7472
f"Plotter utility not found at expected path:\n{plotter_path}")
7573
return
7674
Process(target=run_script_process, args=(plotter_path,)).start()
7775
except Exception as e:
78-
messagebox.showerror("Launch Error",
79-
f"Failed to launch Plotter Utility: {e}")
76+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
8077

8178

8279
def launch_gpib_scanner():
83-
script_dir = os.path.dirname(os.path.abspath(__file__))
84-
scanner_path = os.path.join(
85-
script_dir,
86-
"..",
87-
"Utilities",
88-
"GPIB_Instrument_Scanner_GUI.py")
89-
Process(target=run_script_process, args=(scanner_path,)).start()
80+
"""Finds and launches the GPIB scanner utility in a new process."""
81+
try:
82+
script_dir = os.path.dirname(os.path.abspath(__file__))
83+
# Go up 2 levels: k2400 -> keithley -> pica
84+
scanner_path = os.path.join(
85+
script_dir,
86+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
87+
if not os.path.exists(scanner_path):
88+
messagebox.showerror(
89+
"File Not Found",
90+
f"GPIB Scanner not found at expected path:\n{scanner_path}")
91+
return
92+
Process(target=run_script_process, args=(scanner_path,)).start()
93+
except Exception as e:
94+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
9095

9196
# -------------------------------------------------------------------------------
9297
# --- BACKEND INSTRUMENT CONTROL ---

pica/keithley/k2400/RT_K2400_L350_T_Sensing_GUI.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,38 +128,37 @@ def run_script_process(script_path):
128128
def launch_plotter_utility():
129129
"""Finds and launches the plotter utility script in a new process."""
130130
try:
131-
# Assumes the plotter is in a standard location relative to this script
132131
script_dir = os.path.dirname(os.path.abspath(__file__))
132+
# Go up 2 levels: k2400 -> keithley -> pica
133133
plotter_path = os.path.join(
134134
script_dir,
135-
"..",
136-
"Utilities",
137-
"PlotterUtil_GUI.py")
135+
"..", "..", "utils", "PlotterUtil_GUI.py")
138136
if not os.path.exists(plotter_path):
139137
messagebox.showerror(
140138
"File Not Found",
141139
f"Plotter utility not found at expected path:\n{plotter_path}")
142140
return
143141
Process(target=run_script_process, args=(plotter_path,)).start()
144142
except Exception as e:
145-
messagebox.showerror("Launch Error",
146-
f"Failed to launch Plotter Utility: {e}")
143+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
147144

148145

149146
def launch_gpib_scanner():
150147
"""Finds and launches the GPIB scanner utility in a new process."""
151148
try:
152149
script_dir = os.path.dirname(os.path.abspath(__file__))
150+
# Go up 2 levels: k2400 -> keithley -> pica
153151
scanner_path = os.path.join(
154152
script_dir,
155-
"..",
156-
"Utilities",
157-
"GPIB_Instrument_Scanner_GUI.py")
153+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
154+
if not os.path.exists(scanner_path):
155+
messagebox.showerror(
156+
"File Not Found",
157+
f"GPIB Scanner not found at expected path:\n{scanner_path}")
158+
return
158159
Process(target=run_script_process, args=(scanner_path,)).start()
159160
except Exception as e:
160-
messagebox.showerror(
161-
"Launch Error",
162-
f"Failed to launch GPIB Scanner: {e}")
161+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
163162

164163

165164
class RT_GUI_Passive:

pica/keithley/k2400_2182/IV_K2400_K2182_GUI.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,35 +65,38 @@ def run_script_process(script_path):
6565

6666
def launch_plotter_utility():
6767
"""Finds and launches the plotter utility script in a new process."""
68-
script_dir = os.path.dirname(os.path.abspath(__file__))
69-
plotter_path = os.path.join(
70-
script_dir,
71-
"..",
72-
"Utilities",
73-
"PlotterUtil_GUI.py")
74-
Process(target=run_script_process, args=(plotter_path,)).start()
68+
try:
69+
script_dir = os.path.dirname(os.path.abspath(__file__))
70+
# Go up 2 levels: k2400_2182 -> keithley -> pica
71+
plotter_path = os.path.join(
72+
script_dir,
73+
"..", "..", "utils", "PlotterUtil_GUI.py")
74+
if not os.path.exists(plotter_path):
75+
messagebox.showerror(
76+
"File Not Found",
77+
f"Plotter utility not found at expected path:\n{plotter_path}")
78+
return
79+
Process(target=run_script_process, args=(plotter_path,)).start()
80+
except Exception as e:
81+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
7582

7683

7784
def launch_gpib_scanner():
7885
"""Finds and launches the GPIB scanner utility in a new process."""
7986
try:
80-
# Assumes the scanner is in a standard location relative to this script
8187
script_dir = os.path.dirname(os.path.abspath(__file__))
88+
# Go up 2 levels: k2400_2182 -> keithley -> pica
8289
scanner_path = os.path.join(
8390
script_dir,
84-
"..",
85-
"Utilities",
86-
"GPIB_Instrument_Scanner_GUI.py")
91+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
8792
if not os.path.exists(scanner_path):
8893
messagebox.showerror(
8994
"File Not Found",
9095
f"GPIB Scanner not found at expected path:\n{scanner_path}")
9196
return
9297
Process(target=run_script_process, args=(scanner_path,)).start()
9398
except Exception as e:
94-
messagebox.showerror(
95-
"Launch Error",
96-
f"Failed to launch GPIB Scanner: {e}")
99+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
97100

98101
# -------------------------------------------------------------------------------
99102
# --- BACKEND INSTRUMENT CONTROL ---

pica/keithley/k2400_2182/RT_K2400_K2182_L350_T_Sensing_GUI.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,33 +71,36 @@ def run_script_process(script_path):
7171
def launch_plotter_utility():
7272
"""Finds and launches the plotter utility script in a new process."""
7373
try:
74-
# Assumes the plotter is in a standard location relative to this script
7574
script_dir = os.path.dirname(os.path.abspath(__file__))
75+
# Go up 2 levels: k2400_2182 -> keithley -> pica
7676
plotter_path = os.path.join(
7777
script_dir,
78-
"..",
79-
"Utilities",
80-
"PlotterUtil_GUI.py")
78+
"..", "..", "utils", "PlotterUtil_GUI.py")
8179
if not os.path.exists(plotter_path):
8280
messagebox.showerror(
8381
"File Not Found",
8482
f"Plotter utility not found at expected path:\n{plotter_path}")
8583
return
8684
Process(target=run_script_process, args=(plotter_path,)).start()
8785
except Exception as e:
88-
messagebox.showerror("Launch Error",
89-
f"Failed to launch Plotter Utility: {e}")
90-
86+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
9187

9288
def launch_gpib_scanner():
9389
"""Finds and launches the GPIB scanner utility in a new process."""
94-
scanner_path = os.path.join(
95-
os.path.dirname(
96-
os.path.abspath(__file__)),
97-
"..",
98-
"Utilities",
99-
"GPIB_Instrument_Scanner_GUI.py")
100-
Process(target=run_script_process, args=(scanner_path,)).start()
90+
try:
91+
script_dir = os.path.dirname(os.path.abspath(__file__))
92+
# Go up 2 levels: k2400_2182 -> keithley -> pica
93+
scanner_path = os.path.join(
94+
script_dir,
95+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
96+
if not os.path.exists(scanner_path):
97+
messagebox.showerror(
98+
"File Not Found",
99+
f"GPIB Scanner not found at expected path:\n{scanner_path}")
100+
return
101+
Process(target=run_script_process, args=(scanner_path,)).start()
102+
except Exception as e:
103+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
101104

102105

103106
# -------------------------------------------------------------------------------

pica/keithley/k2400_2182/RT_K2400_K2182_T_Control_GUI.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,36 @@ def run_script_process(script_path):
5858
def launch_plotter_utility():
5959
"""Finds and launches the plotter utility script in a new process."""
6060
try:
61-
# Assumes the plotter is in a standard location relative to this script
6261
script_dir = os.path.dirname(os.path.abspath(__file__))
62+
# Go up 2 levels: k2400_2182 -> keithley -> pica
6363
plotter_path = os.path.join(
6464
script_dir,
65-
"..",
66-
"Utilities",
67-
"PlotterUtil_GUI.py")
65+
"..", "..", "utils", "PlotterUtil_GUI.py")
6866
if not os.path.exists(plotter_path):
6967
messagebox.showerror(
7068
"File Not Found",
7169
f"Plotter utility not found at expected path:\n{plotter_path}")
7270
return
7371
Process(target=run_script_process, args=(plotter_path,)).start()
7472
except Exception as e:
75-
messagebox.showerror("Launch Error",
76-
f"Failed to launch Plotter Utility: {e}")
77-
73+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
7874

7975
def launch_gpib_scanner():
8076
"""Finds and launches the GPIB scanner utility in a new process."""
81-
base_path = os.path.dirname(os.path.abspath(__file__))
82-
scanner_path = os.path.join(
83-
base_path,
84-
"..",
85-
"Utilities",
86-
"GPIB_Instrument_Scanner_GUI.py")
87-
Process(target=run_script_process, args=(scanner_path,)).start()
77+
try:
78+
script_dir = os.path.dirname(os.path.abspath(__file__))
79+
# Go up 2 levels: k2400_2182 -> keithley -> pica
80+
scanner_path = os.path.join(
81+
script_dir,
82+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
83+
if not os.path.exists(scanner_path):
84+
messagebox.showerror(
85+
"File Not Found",
86+
f"GPIB Scanner not found at expected path:\n{scanner_path}")
87+
return
88+
Process(target=run_script_process, args=(scanner_path,)).start()
89+
except Exception as e:
90+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
8891

8992

9093
# -------------------------------------------------------------------------------

0 commit comments

Comments
 (0)