1- """
2- PICA Command Line Interface (CLI)
3-
4- This module handles the parsing of command-line arguments to launch
5- specific instrument control GUIs and utility scripts.
6- """
7- # pica/cli.py
8-
91import os
102import sys
113import subprocess
3325 "pica.utils.PlotterUtil_GUI" ,
3426]
3527
36- # Metadata & Terms
3728APP_NAME = "PICA Command Line Interface"
3829VERSION = "17.0"
3930AUTHORS = "Prathamesh K. Deshmukh, Sudip Mukherjee"
5041"""
5142
5243def print_banner ():
53- """Prints the professional header."""
54- print ("\033 [H\033 [J" ) # Clear screen
44+ print ("\033 [H\033 [J" )
5545 print ("=" * 60 )
5646 print (f" { APP_NAME } (v{ VERSION } )" )
5747 print (f" { AFFILIATION } " )
@@ -65,14 +55,10 @@ def print_banner():
6555
6656
6757def find_scripts (base_path ):
68- """
69- Recursively finds all python files ending with 'Instrument_Control.py'.
70- Returns a list of tuples: (Display Name, Full Path)
71- """
7258 scripts = []
7359 base = Path (base_path )
7460
75- # Exclude development/utility scripts that are not main measurement modules
61+ # Exclude non- main measurement scripts.
7662 exclude_list = [
7763 "BasicTest_S830_Instrument_Control.py" ,
7864 "GPIB_InterfaceTest_Simple_Instrument_Control.py" ,
@@ -82,18 +68,16 @@ def find_scripts(base_path):
8268 if path .name in exclude_list :
8369 continue
8470
85- # Create a readable name from the filename
86- # e.g., 'IV_K2400_Loop_Instrument_Control.py' -> 'IV K2400 Loop'
71+ # Create readable name from filename.
8772 name = path .stem .replace ("_Instrument_Control" , "" ).replace ("_" , " " )
8873
89- # Get path relative to the run location for clarity, or absolute
74+ # Get relative or absolute path.
9075 scripts .append ((name , str (path )))
9176
9277 return sorted (scripts )
9378
9479
9580def run_script (script_path ):
96- """Runs the selected script using the current python interpreter."""
9781 print (f"\n [INFO] Module: { os .path .basename (script_path )} " )
9882 print ("[INFO] Enter arguments below, or press ENTER for defaults." )
9983
@@ -116,7 +100,6 @@ def run_script(script_path):
116100
117101
118102def main ():
119- # Detect where the 'pica' package is located
120103 current_dir = os .path .dirname (os .path .abspath (__file__ ))
121104
122105 while True :
@@ -157,4 +140,4 @@ def main():
157140 time .sleep (1.5 )
158141
159142if __name__ == "__main__" :
160- main ()
143+ main ()
0 commit comments