Skip to content

Commit d1bc316

Browse files
utility fix cont
1 parent 7af34fb commit d1bc316

3 files changed

Lines changed: 30 additions & 33 deletions

File tree

pica/keithley/k2400/IV_K2400_GUI.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def run_script_process(script_path):
5656
def launch_plotter_utility():
5757
"""Finds and launches the plotter utility script in a new process."""
5858
script_dir = os.path.dirname(os.path.abspath(__file__))
59+
# Go up 2 levels: k2400 -> keithley -> pica
5960
plotter_path = os.path.join(
6061
script_dir,
61-
"..",
62-
"Utilities",
63-
"PlotterUtil_GUI.py")
62+
"..", "..", "utils", "PlotterUtil_GUI.py")
63+
6464
if not os.path.exists(plotter_path):
6565
messagebox.showerror("File Not Found",
6666
f"Plotter Utility not found at:\n{plotter_path}")
@@ -73,12 +73,11 @@ def launch_plotter_utility():
7373
def launch_gpib_scanner():
7474
"""Finds and launches the GPIB scanner utility in a new process."""
7575
script_dir = os.path.dirname(os.path.abspath(__file__))
76-
# Assuming the standard PICA project structure
76+
# Go up 2 levels: k2400 -> keithley -> pica
7777
scanner_path = os.path.join(
7878
script_dir,
79-
"..",
80-
"Utilities",
81-
"GPIB_Instrument_Scanner_GUI.py")
79+
"..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
80+
8281
if not os.path.exists(scanner_path):
8382
messagebox.showerror("File Not Found",
8483
f"GPIB Scanner not found at:\n{scanner_path}")

pica/keithley/k6517b/High_Resistance/IV_K6517B_GUI.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,39 @@ def run_script_process(script_path):
5959
def launch_plotter_utility():
6060
"""Finds and launches the plotter utility script in a new process."""
6161
try:
62-
# Assumes the plotter is in a standard location relative to this script
6362
script_dir = os.path.dirname(os.path.abspath(__file__))
63+
# Go up 3 levels: High_Resistance -> k6517b -> keithley -> pica
6464
plotter_path = os.path.join(
6565
script_dir,
66-
"..",
67-
"..",
68-
"Utilities",
69-
"PlotterUtil_GUI.py")
66+
"..", "..", "..", "utils", "PlotterUtil_GUI.py")
67+
7068
if not os.path.exists(plotter_path):
7169
messagebox.showerror(
7270
"File Not Found",
7371
f"Plotter utility not found at expected path:\n{plotter_path}")
7472
return
7573
Process(target=run_script_process, args=(plotter_path,)).start()
7674
except Exception as e:
77-
messagebox.showerror("Launch Error",
78-
f"Failed to launch Plotter Utility: {e}")
75+
messagebox.showerror("Launch Error", f"Failed to launch Plotter Utility: {e}")
7976

8077

8178
def launch_gpib_scanner():
8279
"""Finds and launches the GPIB scanner utility in a new process."""
8380
try:
84-
# Assumes the scanner is in a standard location relative to this script
8581
script_dir = os.path.dirname(os.path.abspath(__file__))
82+
# Go up 3 levels: High_Resistance -> k6517b -> keithley -> pica
8683
scanner_path = os.path.join(
8784
script_dir,
88-
"..",
89-
"..",
90-
"Utilities",
91-
"GPIB_Instrument_Scanner_GUI.py")
85+
"..", "..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
86+
9287
if not os.path.exists(scanner_path):
9388
messagebox.showerror(
9489
"File Not Found",
9590
f"GPIB Scanner not found at expected path:\n{scanner_path}")
9691
return
9792
Process(target=run_script_process, args=(scanner_path,)).start()
9893
except Exception as e:
99-
messagebox.showerror(
100-
"Launch Error",
101-
f"Failed to launch GPIB Scanner: {e}")
94+
messagebox.showerror("Launch Error", f"Failed to launch GPIB Scanner: {e}")
10295
# -------------------------------------------------------------------------------
10396
# --- REAL INSTRUMENT BACKEND ---
10497
# This section has been updated to incorporate the logic from the V5 Core script.

pica/keithley/k6517b/Pyroelectricity/Pyroelectric_K6517B_L350_GUI.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,32 @@ def run_script_process(script_path):
5353
def launch_plotter_utility():
5454
"""Finds and launches the plotter utility script in a new process."""
5555
script_dir = os.path.dirname(os.path.abspath(__file__))
56-
# Path is two directories up from the script location to reach project root
56+
# Go up 3 levels: Pyroelectricity -> k6517b -> keithley -> pica
5757
plotter_path = os.path.join(
5858
script_dir,
59-
"..",
60-
"..",
61-
"Utilities",
62-
"PlotterUtil_GUI.py")
59+
"..", "..", "..", "utils", "PlotterUtil_GUI.py")
60+
61+
if not os.path.exists(plotter_path):
62+
messagebox.showerror(
63+
"File Not Found",
64+
f"Plotter utility not found at expected path:\n{plotter_path}")
65+
return
6366
Process(target=run_script_process, args=(plotter_path,)).start()
6467

6568

6669
def launch_gpib_scanner():
6770
"""Finds and launches the GPIB scanner utility in a new process."""
6871
script_dir = os.path.dirname(os.path.abspath(__file__))
69-
# Path is three directories up from the script location to reach project
70-
# root
72+
# Go up 3 levels: Pyroelectricity -> k6517b -> keithley -> pica
7173
scanner_path = os.path.join(
7274
script_dir,
73-
"..",
74-
"..",
75-
"Utilities",
76-
"GPIB_Instrument_Scanner_GUI.py")
75+
"..", "..", "..", "utils", "GPIB_Instrument_Scanner_GUI.py")
76+
77+
if not os.path.exists(scanner_path):
78+
messagebox.showerror(
79+
"File Not Found",
80+
f"GPIB Scanner not found at expected path:\n{scanner_path}")
81+
return
7782
Process(target=run_script_process, args=(scanner_path,)).start()
7883

7984

0 commit comments

Comments
 (0)