Skip to content

Commit 9fd6bf5

Browse files
Fixed some paths in PICA
1 parent 040fcf7 commit 9fd6bf5

1 file changed

Lines changed: 24 additions & 21 deletions

File tree

PICA_Launcher_V5.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,22 @@ class PICALauncherApp:
8383
FONT_INFO = ('Segoe UI', FONT_SIZE_BASE)
8484
LOGO_FILE = resource_path("_assets/LOGO/UGC_DAE_CSR.jpeg")
8585
MANUAL_FILE = resource_path("_assets/Manuals")
86-
c README_FILE = resource_path("PICA_README.md")
8786
README_FILE = resource_path("README.md")
8887
LICENSE_FILE = resource_path("LICENSE")
8988
LOGO_SIZE = 140
9089

9190
SCRIPT_PATHS = {
92-
"Delta Mode I-V Sweep": resource_path("Delta_mode_Keithley_6221_2182A/Delta_Mode_IV_GUI_V1.py"),
93-
"Delta Mode R-T (Active)": resource_path("Delta_mode_Keithley_6221_2182A/Delta_Mode_Active_Temp_Control_V1.py"),
94-
"Delta Mode I-V Sweep": resource_path("Delta_mode_Keithley_6221_2182A/K6221_DC_Sweep_V7.py"),
95-
"Delta Mode R-T (Active)": resource_path("Delta_mode_Keithley_6221_2182A/Delta_Mode_Active_Temp_Control_V2.py"),
91+
# Based on Updates.md, using the latest versions of scripts.
92+
"Delta Mode I-V Sweep": resource_path("Delta_mode_Keithley_6221_2182A/Delta_Mode_IV_Ambient.py"),
93+
"Delta Mode R-T (Active)": resource_path("Delta_mode_Keithley_6221_2182A/Delta_Mode_Active_Temp_Control.py"),
9694
"Delta Mode R-T (Passive)": resource_path("Delta_mode_Keithley_6221_2182A/Delta_Lakeshore_Frontend_Passive_V1.py"),
9795
"K2400 I-V": resource_path("Keithley_2400/Frontend_IV_2400_V3.py"),
98-
"K2400 R-T": resource_path("Keithley_2400/Frontend_Keithley_2400_Lakeshore_350_V_vs_T_V1.py"),
96+
"K2400 R-T": resource_path("Keithley_2400/Frontend_Keithley_2400_Lakeshore_350_V_vs_T.py"),
9997
"K2400_2182 I-V": resource_path("Keithley_2400_Keithley_2182/IV_Sweep_Keithley_2182.py"),
10098
"K2400_2182 R-T": resource_path("Keithley_2400_Keithley_2182/VT_Curve_IV_Sweep_Keithley_2400_2182_Lakeshore_350.py"),
10199
"K6517B I-V": resource_path("Keithley_6517B/High_Resistance/Keithley_6517B_IV_Frontend_V9.py"),
102-
"K6517B Resistivity": resource_path("Keithley_6517B/High_Resistance/6517B_high_resistance_lakeshore_RT_Frontend_V11p2_5Always.py"),
103-
"K6517B R-T (Active)": resource_path("Keithley_6517B/High_Resistance/6517B_high_resistance_lakeshore_RT_Frontend_V11p2_5Always.py"),
100+
"K6517B R-T (Active)": resource_path("Keithley_6517B/High_Resistance/6517B_high_resistance_lakeshore_RT_Frontend.py"),
104101
"K6517B R-T (Passive)": resource_path("Keithley_6517B/High_Resistance/6517B_high_resistance_lakeshore_RT_Frontend_V12_Passive.py"),
105-
"Pyroelectric Current": resource_path("Keithley_6517B\Pyroelectricity\Pyroelectric_Measurement_GUI_V1.py"),
106102
"Pyroelectric Current": resource_path("Keithley_6517B/Pyroelectricity/Pyroelectric_Measurement_GUI_V1.py"),
107103
"Lakeshore Temp Control": resource_path("Lakeshore_350_340/lakeshore350_temp_ramp_Frontend_V4.py"),
108104
"Lakeshore Temp Monitor": resource_path("Lakeshore_350_340/lakeshore350_passive_monitor_Frontend_V1.py"),
@@ -239,14 +235,10 @@ def create_launcher_panel(self, parent):
239235
mid_res_frame2.columnconfigure(0, weight=1)
240236
self._create_launch_button(mid_res_frame2, "I-V Measurement", "K2400_2182 I-V").grid(row=0, column=0, sticky='ew', pady=(0, 2), padx=(0, 4))
241237
self._create_launch_button(mid_res_frame2, "R vs. T Measurement", "K2400_2182 R-T").grid(row=1, column=0, sticky='ew', pady=(2, 0), padx=(0, 4))
242-
ttk.Button(mid_res_frame2, text="📁", style='Icon.TButton', command=lambda: self.open_script_folder("Keithley_2400_Keithley_2182")).grid(row=0, column=1, rowspan=2, sticky='ns')
238+
ttk.Button(mid_res_frame2, text="📁", style='Icon.TButton', command=lambda: self.open_script_folder("K2400_2182 I-V")).grid(row=0, column=1, rowspan=2, sticky='ns')
243239

244-
high_res_frame = ttk.LabelFrame(left_col, text='High Resistance (Keithley 6517B)'); high_res_frame.pack(fill='x', expand=True, pady=GROUP_PAD_Y)
245240
high_res_frame = ttk.LabelFrame(right_col, text='High Resistance (Keithley 6517B)'); high_res_frame.pack(fill='x', expand=True, pady=GROUP_PAD_Y)
246241
high_res_frame.columnconfigure(0, weight=1)
247-
self._create_launch_button(high_res_frame, "I-V Measurement", "K6517B I-V").grid(row=0, column=0, sticky='ew', pady=(0, 2), padx=(0, 4))
248-
self._create_launch_button(high_res_frame, "R vs. T (Active)", "K6517B Resistivity").grid(row=1, column=0, sticky='ew', pady=(2, 2), padx=(0, 4))
249-
self._create_launch_button(high_res_frame, "R vs. T (Passive)", "K6517B R-T (Passive)").grid(row=2, column=0, sticky='ew', pady=(2, 0), padx=(0, 4))
250242
self._create_launch_button(high_res_frame, "I-V Measurement", "K6517B I-V").grid(row=0, column=0, sticky='ew', padx=(0, 4), pady=(0,2))
251243
self._create_launch_button(high_res_frame, "R vs. T (Active)", "K6517B R-T (Active)").grid(row=1, column=0, sticky='ew', padx=(0, 4), pady=(2,2))
252244
self._create_launch_button(high_res_frame, "R vs. T (Passive)", "K6517B R-T (Passive)").grid(row=2, column=0, sticky='ew', padx=(0, 4), pady=(2,0))
@@ -255,7 +247,7 @@ def create_launcher_panel(self, parent):
255247
pyro_frame = ttk.LabelFrame(right_col, text='Pyroelectric Measurement (Keithley 6517B)'); pyro_frame.pack(fill='x', expand=True, pady=GROUP_PAD_Y)
256248
pyro_frame.columnconfigure(0, weight=1)
257249
self._create_launch_button(pyro_frame, "Pyro Current vs. Temp", "Pyroelectric Current").grid(row=0, column=0, sticky='ew', padx=(0, 4))
258-
ttk.Button(pyro_frame, text="📁", style='Icon.TButton', command=lambda: self.open_script_folder("Keithley_6517B\Pyroelectricity")).grid(row=0, column=1, sticky='ns')
250+
ttk.Button(pyro_frame, text="📁", style='Icon.TButton', command=lambda: self.open_script_folder("Pyroelectric Current")).grid(row=0, column=1, sticky='ns')
259251

260252
lakeshore_frame = ttk.LabelFrame(right_col, text='Temperature Control (Lakeshore 350)'); lakeshore_frame.pack(fill='x', expand=True, pady=GROUP_PAD_Y)
261253
lakeshore_frame.columnconfigure(0, weight=1)
@@ -271,7 +263,7 @@ def create_launcher_panel(self, parent):
271263
lockin_frame = ttk.LabelFrame(right_col, text='Lock-in Amplifier'); lockin_frame.pack(fill='x', expand=True, pady=GROUP_PAD_Y)
272264
lockin_frame.columnconfigure(0, weight=1)
273265
self._create_launch_button(lockin_frame, "AC Measurement", "Lock-in AC Measurement").grid(row=0, column=0, sticky='ew', padx=(0, 4))
274-
ttk.Button(lockin_frame, text="📁", style='Icon.TButton', command=lambda: self.open_script_folder("Lock_in_amplifier")).grid(row=0, column=1, sticky='ns')
266+
ttk.Button(lockin_frame, text="📁", style='Icon.TButton', command=lambda: self.open_script_folder("Lock-in AC Measurement")).grid(row=0, column=1, sticky='ns')
275267

276268
canvas.pack(side='left', fill='both', expand=True)
277269
scrollbar.pack(side='right', fill='y')
@@ -373,15 +365,26 @@ def _show_file_in_window(self, file_path, title):
373365
text_area.pack(expand=True, fill='both')
374366
text_area.config(state='disabled')
375367
ttk.Button(win, text="Close", style='App.TButton', command=win.destroy).pack(pady=10, padx=10, fill='x')
376-
368+
377369
def open_script_folder(self, script_key):
370+
# Special case for folder names passed directly
371+
if script_key == "Keithley_2400":
372+
folder_path = os.path.abspath(resource_path(script_key))
373+
self._open_path(folder_path)
374+
return
375+
378376
script_path = self.SCRIPT_PATHS.get(script_key)
379-
if not script_path or not os.path.exists(script_path):
380-
self.log(f"ERROR: Path for '{script_key}' is invalid.")
381-
messagebox.showwarning("Path Invalid", f"Script path for '{script_key}' is invalid.")
377+
if not script_path:
378+
self.log(f"ERROR: Script key '{script_key}' not found in SCRIPT_PATHS.")
379+
messagebox.showwarning("Key Not Found", f"The script key '{script_key}' is not defined.")
382380
return
381+
383382
folder_path = os.path.dirname(os.path.abspath(script_path))
384-
self._open_path(folder_path)
383+
if os.path.exists(folder_path):
384+
self._open_path(folder_path)
385+
else:
386+
self.log(f"ERROR: Folder path does not exist: {folder_path}")
387+
messagebox.showwarning("Path Not Found", f"The folder for '{script_key}' could not be found.")
385388

386389
def open_readme(self):
387390
self._show_file_in_window(self.README_FILE, "README")

0 commit comments

Comments
 (0)