quarchpy 2.1.20.dev2__py2.py3-none-any.whl → 2.1.20.dev3__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. quarchpy/.idea/.name +1 -1
  2. quarchpy/.idea/inspectionProfiles/Project_Default.xml +26 -0
  3. quarchpy/.idea/modules.xml +0 -1
  4. quarchpy/.idea/quarchpy.iml +1 -4
  5. quarchpy/.idea/workspace.xml +21 -226
  6. quarchpy/__pycache__/__init__.cpython-311.pyc +0 -0
  7. quarchpy/__pycache__/_version.cpython-311.pyc +0 -0
  8. quarchpy/__pycache__/connection.cpython-311.pyc +0 -0
  9. quarchpy/__pycache__/run.cpython-311.pyc +0 -0
  10. quarchpy/_version.py +1 -1
  11. quarchpy/config_files/__pycache__/__init__.cpython-311.pyc +0 -0
  12. quarchpy/config_files/__pycache__/quarch_config_parser.cpython-311.pyc +0 -0
  13. quarchpy/connection_specific/QPS/qis/help.txt +12 -4
  14. quarchpy/connection_specific/QPS/qis/qis.jar +0 -0
  15. quarchpy/connection_specific/QPS/qis/qis_lib/CInterface-1.7.8.jar +0 -0
  16. quarchpy/connection_specific/QPS/qis/qis_lib/Collections-2.4.jar +0 -0
  17. quarchpy/connection_specific/QPS/qis/qis_lib/Desktop-1.1.jar +0 -0
  18. quarchpy/connection_specific/QPS/qis/qis_lib/Executor-3.13.jar +0 -0
  19. quarchpy/connection_specific/QPS/qis/qis_lib/JNA-1.2.jar +0 -0
  20. quarchpy/connection_specific/QPS/qis/qis_lib/OS-1.8.jar +0 -0
  21. quarchpy/connection_specific/QPS/qis/qis_lib/QuarchCommon-0.2.9.jar +0 -0
  22. quarchpy/connection_specific/QPS/qis/qis_lib/SystemTray-4.4.jar +0 -0
  23. quarchpy/connection_specific/QPS/qis/qis_lib/Updates-1.1.jar +0 -0
  24. quarchpy/connection_specific/QPS/qis/qis_lib/Utilities-1.46.jar +0 -0
  25. quarchpy/connection_specific/QPS/qis/qis_lib/commons-csv-1.8.jar +0 -0
  26. quarchpy/connection_specific/QPS/qis/qis_lib/javassist-3.29.2-GA.jar +0 -0
  27. quarchpy/connection_specific/QPS/qis/qis_lib/jna-jpms-5.12.1.jar +0 -0
  28. quarchpy/connection_specific/QPS/qis/qis_lib/jna-platform-jpms-5.12.1.jar +0 -0
  29. quarchpy/connection_specific/QPS/qis/qis_lib/kotlin-stdlib-1.9.21.jar +0 -0
  30. quarchpy/connection_specific/QPS/qis/qis_lib/slf4j-api-2.0.9.jar +0 -0
  31. quarchpy/connection_specific/QPS/qis/qis_lib/slf4j-simple-2.0.9.jar +0 -0
  32. quarchpy/connection_specific/QPS/qis/resources/filters/Example.txt +36 -0
  33. quarchpy/connection_specific/QPS/qis/resources/filters/filters.csv +1004 -0
  34. quarchpy/connection_specific/QPS/qis/resources/filters/iec_filters.xml +26 -0
  35. quarchpy/connection_specific/QPS/qis/resources/filters/iec_filters.xml.bak +26 -0
  36. quarchpy/connection_specific/QPS/qps.jar +0 -0
  37. quarchpy/connection_specific/QPS/qps_lib/QuarchCommon-0.2.9.jar +0 -0
  38. quarchpy/connection_specific/QPS/qps_lib/commons-lang3-3.12.0.jar +0 -0
  39. quarchpy/connection_specific/QPS/qps_lib/opencsv-5.9.jar +0 -0
  40. quarchpy/connection_specific/QPS/qps_lib/qis-1.40.jar +0 -0
  41. quarchpy/connection_specific/QPS/scriptCommands.txt +2 -2
  42. quarchpy/connection_specific/__pycache__/StreamChannels.cpython-311.pyc +0 -0
  43. quarchpy/connection_specific/__pycache__/__init__.cpython-311.pyc +0 -0
  44. quarchpy/connection_specific/__pycache__/connection_QIS.cpython-311.pyc +0 -0
  45. quarchpy/connection_specific/__pycache__/connection_QPS.cpython-311.pyc +0 -0
  46. quarchpy/connection_specific/__pycache__/connection_ReST.cpython-311.pyc +0 -0
  47. quarchpy/connection_specific/__pycache__/connection_Serial.cpython-311.pyc +0 -0
  48. quarchpy/connection_specific/__pycache__/connection_TCP.cpython-311.pyc +0 -0
  49. quarchpy/connection_specific/__pycache__/connection_Telnet.cpython-311.pyc +0 -0
  50. quarchpy/connection_specific/__pycache__/connection_USB.cpython-311.pyc +0 -0
  51. quarchpy/connection_specific/__pycache__/connection_mDNS.cpython-311.pyc +0 -0
  52. quarchpy/connection_specific/connection_QIS.py +5 -3
  53. quarchpy/connection_specific/connection_QIS.py.bak +1738 -0
  54. quarchpy/connection_specific/serial/__pycache__/__init__.cpython-311.pyc +0 -0
  55. quarchpy/connection_specific/serial/__pycache__/serialutil.cpython-311.pyc +0 -0
  56. quarchpy/connection_specific/serial/__pycache__/serialwin32.cpython-311.pyc +0 -0
  57. quarchpy/connection_specific/serial/__pycache__/win32.cpython-311.pyc +0 -0
  58. quarchpy/connection_specific/serial/tools/__pycache__/__init__.cpython-311.pyc +0 -0
  59. quarchpy/connection_specific/serial/tools/__pycache__/list_ports.cpython-311.pyc +0 -0
  60. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_common.cpython-311.pyc +0 -0
  61. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_windows.cpython-311.pyc +0 -0
  62. quarchpy/connection_specific/usb_libs/__pycache__/libusb1.cpython-311.pyc +0 -0
  63. quarchpy/connection_specific/usb_libs/__pycache__/usb1.cpython-311.pyc +0 -0
  64. quarchpy/debug/TextScanIP.py +11 -0
  65. quarchpy/debug/__pycache__/SystemTest.cpython-311.pyc +0 -0
  66. quarchpy/debug/__pycache__/__init__.cpython-311.pyc +0 -0
  67. quarchpy/debug/__pycache__/module_debug.cpython-311.pyc +0 -0
  68. quarchpy/debug/__pycache__/simple_terminal.cpython-311.pyc +0 -0
  69. quarchpy/debug/__pycache__/upgrade_quarchpy.cpython-311.pyc +0 -0
  70. quarchpy/debug/__pycache__/versionCompare.cpython-311.pyc +0 -0
  71. quarchpy/device/__pycache__/__init__.cpython-311.pyc +0 -0
  72. quarchpy/device/__pycache__/device.cpython-311.pyc +0 -0
  73. quarchpy/device/__pycache__/quarchArray.cpython-311.pyc +0 -0
  74. quarchpy/device/__pycache__/quarchPPM.cpython-311.pyc +0 -0
  75. quarchpy/device/__pycache__/quarchQPS.cpython-311.pyc +0 -0
  76. quarchpy/device/__pycache__/scanDevices.cpython-311.pyc +0 -0
  77. quarchpy/device/device.py.bak +504 -0
  78. quarchpy/device/quarchPPM.py.bak +67 -0
  79. quarchpy/device/quarchQPS.py.bak +396 -0
  80. quarchpy/device/scanDevices.py.bak +130 -108
  81. quarchpy/disk_test/__pycache__/AbsDiskFinder.cpython-311.pyc +0 -0
  82. quarchpy/disk_test/__pycache__/DiskTargetSelection.cpython-311.pyc +0 -0
  83. quarchpy/disk_test/__pycache__/__init__.cpython-311.pyc +0 -0
  84. quarchpy/disk_test/__pycache__/iometerDiskFinder.cpython-311.pyc +0 -0
  85. quarchpy/docs/CHANGES.rst.bak +4 -2
  86. quarchpy/docs/_build/doctrees/CHANGES.doctree +0 -0
  87. quarchpy/docs/_build/doctrees/environment.pickle +0 -0
  88. quarchpy/docs/_build/doctrees/source/changelog.doctree +0 -0
  89. quarchpy/docs/_build/doctrees/source/quarchpy.fio.doctree +0 -0
  90. quarchpy/docs/_build/html/CHANGES.html +121 -113
  91. quarchpy/docs/_build/html/_sources/CHANGES.rst.txt +6 -1
  92. quarchpy/docs/_build/html/_static/alabaster.css +14 -9
  93. quarchpy/docs/_build/html/_static/basic.css +1 -1
  94. quarchpy/docs/_build/html/_static/pygments.css +1 -1
  95. quarchpy/docs/_build/html/genindex.html +9 -27
  96. quarchpy/docs/_build/html/index.html +62 -60
  97. quarchpy/docs/_build/html/objects.inv +0 -0
  98. quarchpy/docs/_build/html/py-modindex.html +7 -11
  99. quarchpy/docs/_build/html/readme.html +7 -6
  100. quarchpy/docs/_build/html/search.html +7 -6
  101. quarchpy/docs/_build/html/searchindex.js +1 -1
  102. quarchpy/docs/_build/html/source/changelog.html +176 -167
  103. quarchpy/docs/_build/html/source/licenses.html +7 -6
  104. quarchpy/docs/_build/html/source/modules.html +8 -7
  105. quarchpy/docs/_build/html/source/quarchpy.calibration.html +7 -6
  106. quarchpy/docs/_build/html/source/quarchpy.config_files.html +7 -6
  107. quarchpy/docs/_build/html/source/quarchpy.connection_specific.html +7 -6
  108. quarchpy/docs/_build/html/source/quarchpy.debug.html +7 -6
  109. quarchpy/docs/_build/html/source/quarchpy.device.html +7 -6
  110. quarchpy/docs/_build/html/source/quarchpy.disk_test.html +7 -6
  111. quarchpy/docs/_build/html/source/quarchpy.fio.html +9 -34
  112. quarchpy/docs/_build/html/source/quarchpy.html +8 -16
  113. quarchpy/docs/_build/html/source/quarchpy.iometer.html +7 -6
  114. quarchpy/docs/_build/html/source/quarchpy.qis.html +7 -6
  115. quarchpy/docs/_build/html/source/quarchpy.qps.html +7 -6
  116. quarchpy/docs/_build/html/source/quarchpy.user_interface.html +7 -6
  117. quarchpy/docs/_build/html/source/quarchpy.utilities.html +7 -6
  118. quarchpy/docs/_build/html/source/readme.html +7 -6
  119. quarchpy/fio/__pycache__/FIO_interface.cpython-311.pyc +0 -0
  120. quarchpy/fio/__pycache__/__init__.cpython-311.pyc +0 -0
  121. quarchpy/fio/__pycache__/fioDiskFinder.cpython-311.pyc +0 -0
  122. quarchpy/iometer/__pycache__/__init__.cpython-311.pyc +0 -0
  123. quarchpy/iometer/__pycache__/gen_iometer_template.cpython-311.pyc +0 -0
  124. quarchpy/iometer/__pycache__/iometerFuncs.cpython-311.pyc +0 -0
  125. quarchpy/qis/__pycache__/StreamHeaderInfo.cpython-311.pyc +0 -0
  126. quarchpy/qis/__pycache__/__init__.cpython-311.pyc +0 -0
  127. quarchpy/qis/__pycache__/qisFuncs.cpython-311.pyc +0 -0
  128. quarchpy/qps/__pycache__/__init__.cpython-311.pyc +0 -0
  129. quarchpy/qps/__pycache__/qpsFuncs.cpython-311.pyc +0 -0
  130. quarchpy/qps/qpsFuncs.py.bak +28 -68
  131. quarchpy/user_interface/__pycache__/__init__.cpython-311.pyc +0 -0
  132. quarchpy/user_interface/__pycache__/user_interface.cpython-311.pyc +0 -0
  133. quarchpy/user_interface/user_interface.py.bak +749 -0
  134. quarchpy/utilities/TestCenter.py.bak +150 -0
  135. quarchpy/utilities/__pycache__/BitManipulation.cpython-311.pyc +0 -0
  136. quarchpy/utilities/__pycache__/TestCenter.cpython-311.pyc +0 -0
  137. quarchpy/utilities/__pycache__/TimeValue.cpython-311.pyc +0 -0
  138. quarchpy/utilities/__pycache__/Version.cpython-311.pyc +0 -0
  139. quarchpy/utilities/__pycache__/__init__.cpython-311.pyc +0 -0
  140. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/METADATA +1 -1
  141. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/RECORD +143 -114
  142. quarchpy/_version.py.bak +0 -1
  143. quarchpy/connection_specific/connection_mDNS.py.bak +0 -48
  144. quarchpy/debug/SystemTest.py.bak +0 -188
  145. quarchpy/debug/simple_terminal.py.bak +0 -50
  146. quarchpy/fio/FIO_interface.py.bak +0 -322
  147. quarchpy/qis/qisFuncs.py.bak +0 -265
  148. quarchpy/run.py.bak +0 -283
  149. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/WHEEL +0 -0
  150. {quarchpy-2.1.20.dev2.dist-info → quarchpy-2.1.20.dev3.dist-info}/top_level.txt +0 -0
@@ -1,265 +0,0 @@
1
- """
2
- Contains general functions for starting and stopping QIS processes
3
- """
4
-
5
- import os, sys
6
- import time, platform
7
- from threading import Thread, Lock, Event, active_count
8
- from queue import Queue, Empty
9
- from quarchpy.connection_specific.connection_QIS import QisInterface
10
- from quarchpy.user_interface.user_interface import printText
11
- import subprocess
12
- import logging
13
-
14
- def isQisRunning():
15
- """
16
- Checks if a local instance of QIS is running and responding
17
-
18
- Returns
19
- -------
20
- is_running : bool
21
- True if QIS is running and responding
22
-
23
- """
24
-
25
- qisRunning = False
26
- myQis = None
27
-
28
- #attempt to connect to Qis
29
- try:
30
- myQis = QisInterface(connectionMessage=False)
31
- if (myQis is not None):
32
- #if we can connect to qis, it's running
33
- qisRunning = True
34
- except:
35
- #if there's no connection to qis, an exception will be caught
36
- pass
37
-
38
- if (qisRunning is False):
39
- logging.debug("QIS is not running")
40
- return False
41
- else:
42
- logging.debug("QIS is running")
43
- return True
44
-
45
- def startLocalQis(terminal=False, headless=False, args=None):
46
- """
47
- Executes QIS on the local system, using the version contained within quarchpy
48
-
49
- Parameters
50
- ----------
51
- terminal : bool, optional
52
- True if QIS terminal should be shown on startup
53
- headless : bool, optional
54
- True if app should be run in headless mode for non graphical environments
55
- args : list[str], optional
56
- List of additional parameters to be supplied to QIS on the command line
57
-
58
- """
59
- # Gathering Vars needed to build the command
60
- QisPath =os.path.dirname(os.path.abspath(__file__))
61
- QisPath,junk = os.path.split (QisPath)
62
- QisPath = os.path.join(QisPath, "connection_specific","QPS", "qis", "qis.jar")
63
-
64
- # Building the command
65
- # Process command prefix. Needed for headless mode, to support OSs with no system tray.
66
- if (headless == True or (args is not None and "-headless" in args)):
67
- cmdPrefix = "java -Djava.awt.headless=true"
68
- else:
69
- cmdPrefix = "java"
70
- # Process command suffix (additional standard options for QIS).
71
- if (terminal == True):
72
- cmdSuffix = " -terminal"
73
- else:
74
- cmdSuffix = ""
75
- if args is not None:
76
- for option in args:
77
- # Avoid doubling the terminal option
78
- if (option == "-terminal" and terminal == True):
79
- continue
80
- # Headless option is processed seperately as a java command
81
- if (option != "-headless"):
82
- cmdSuffix = cmdSuffix + " " + option
83
- # Find file path and change directory to Qis Location
84
- current_direc = os.getcwd()
85
- os.chdir(os.path.dirname(QisPath))
86
- command = cmdPrefix+" -jar qis.jar"+cmdSuffix
87
-
88
- # Use the command and check QIS has launched
89
- if "-logging=ON" in str(args): #If logging to a terminal window is on then os.system should be used to view logging.
90
- os.system(command)
91
- else:
92
- if sys.version_info[0] < 3:
93
- process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
94
- else:
95
- process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True)
96
-
97
- startTime = time.time() #Checks for Popen launch only
98
- timeout = 10
99
- last_error = ""
100
- last_out = ""
101
- while not isQisRunning():
102
- _get_std_msg_and_err_from_QIS_process(process)
103
-
104
- if time.time() - startTime > timeout:
105
- raise TimeoutError("QIS failed to launch within timelimit of " + str(timeout) + " sec.")
106
- pass
107
-
108
- #change directory back to start directory
109
- os.chdir(current_direc)
110
-
111
-
112
- def reader(stream, q, source, lock,stop_flag):
113
- '''
114
- Used to read output and place it in a queue for multithreaded reading
115
- :param stream:
116
- :param q:
117
- :param source:
118
- :param lock: The lock for the queue
119
- :param stop_flag: Flag to exit the loop and close the thread
120
- :return: None
121
- '''
122
- while not stop_flag.is_set():
123
- line = stream.readline()
124
- if not line:
125
- break
126
- with lock:
127
- q.put((source, line.strip()))
128
-
129
-
130
- def _get_std_msg_and_err_from_QIS_process(process):
131
- '''
132
- Uses multithreading to check for stderr and stdmsg passed by the process that launches QPS
133
- This allows the user to understand why QPS might not have appeared.
134
- :param process: The Process Used to launch QPS
135
- :return: None
136
- '''
137
- # Read back stdmsg and stderr in seperate threads so they are non blocking
138
- q = Queue()
139
- lock = Lock()
140
- stop_flag = Event()
141
-
142
- t1 = Thread(target=reader, args=[process.stdout, q, 'stdout', lock, stop_flag])
143
- t2 = Thread(target=reader, args=[process.stderr, q, 'stderr', lock, stop_flag])
144
- t1.start()
145
- t2.start()
146
- counter = 0
147
- # check for stderr or stdmsg from the queue
148
- while counter <= 3: # If 3 empty reads from the queue then move on to see if QPS is running.
149
- try:
150
- source, line = q.get(timeout=1) # Wait for 1 second for new lines
151
- counter = 0
152
- if source == "stderr":
153
- logging.error(f"{source}: {line}")
154
- else:
155
- printText(f"{source}: {line}")
156
- except Empty:
157
- counter += 1
158
- stop_flag.set() #Close the threads and return to the main loop where QPS is check to see if its started yet
159
-
160
-
161
- def check_remote_qis(host='127.0.0.1', port=9722, timeout=0):
162
- """
163
- Checks if a local or specified instance of QIS is running and responding
164
- This continues to scan until qis is found or a timeout is hit.
165
-
166
- Returns
167
- -------
168
- is_running : bool
169
- True if QIS is running and responding
170
-
171
- """
172
-
173
- qisRunning = False
174
- myQis = None
175
-
176
- start = time.time()
177
- while True:
178
- # attempt to connect to Qis
179
- try:
180
- myQis = QisInterface(host=host, port=port, connectionMessage=False)
181
- if (myQis is not None):
182
- # if we can connect to qis, it's running
183
- qisRunning = True
184
- break
185
- except:
186
- # if there's no connection to qis, an exception will be caught
187
- pass
188
- if (time.time() - start) > timeout:
189
- break
190
-
191
- if (qisRunning is False):
192
- logging.debug("QIS is not running")
193
- return False
194
- else:
195
- logging.debug("QIS is running")
196
- return True
197
-
198
- def checkAndCloseQis(host='127.0.0.1', port=9722):
199
- if isQisRunning() is True:
200
- closeQis()
201
-
202
-
203
- def closeQis(host='127.0.0.1', port=9722):
204
- """
205
- Helper function to close an instance of QIS. By default this is the local version, but
206
- an address can be specified for remote systems.
207
-
208
- Parameters
209
- ----------
210
- host : str, optional
211
- Host IP address if not localhost
212
- port : str, optional
213
- QIS connection port if set to a value other than the default
214
-
215
- """
216
-
217
- myQis = QisInterface(host, port)
218
- retVal=myQis.sendAndReceiveCmd(cmd = "$shutdown")
219
- myQis.disconnect()
220
- time.sleep(1)
221
- return retVal
222
-
223
- #DEPRICATED
224
- def GetQisModuleSelection (QisConnection):
225
- """
226
- Prints a list of modules for user selection
227
-
228
- .. deprecated:: 2.0.12
229
- Use the module selection functions of the QisInterface class instead
230
- """
231
-
232
- # Request a list of all USB and LAN accessible power modules
233
- devList = QisConnection.getDeviceList()
234
- # Removes rest devices
235
- devList = [ x for x in devList if "rest" not in x ]
236
-
237
- # Print the devices, so the user can choose one to connect to
238
- printText ("\n ########## STEP 1 - Select a Quarch Module. ########## \n")
239
- printText (' --------------------------------------------')
240
- printText (' | {:^5} | {:^30}|'.format("INDEX", "MODULE"))
241
- printText (' --------------------------------------------')
242
-
243
- try:
244
- for idx in xrange(len(devList)):
245
- printText (' | {:^5} | {:^30}|'.format(str(idx+1), devList[idx]))
246
- printText(' --------------------------------------------')
247
- except:
248
- for idx in range(len(devList)):
249
- printText (' | {:^5} | {:^30}|'.format(str(idx+1), devList[idx]))
250
- printText(' --------------------------------------------')
251
-
252
- # Get the user to select the device to control
253
- try:
254
- moduleId = int(raw_input ("\n>>> Enter the index of the Quarch module: "))
255
- except NameError:
256
- moduleId = int(input ("\n>>> Enter the index of the Quarch module: "))
257
-
258
- # Verify the selection
259
- if (moduleId > 0 and moduleId <= len(devList)):
260
- myDeviceID = devList[moduleId-1]
261
- else:
262
- myDeviceID = None
263
-
264
- return myDeviceID
265
-
quarchpy/run.py.bak DELETED
@@ -1,283 +0,0 @@
1
- """
2
- This module allows specific quarchpy utilities and embedded applications to be run from the command line
3
- using the format:
4
- > python -m quarchpy.run [option]
5
- """
6
-
7
- # Import the various functions which need to be called from the command line options
8
- from quarchpy.debug.SystemTest import main as systemTestMain
9
- from quarchpy.debug.module_debug import parse_arguments as moduleDebugMain
10
- from quarchpy.qis.qisFuncs import startLocalQis, isQisRunning, closeQis as closeQIS
11
- from quarchpy.qps.qpsFuncs import startLocalQps, isQpsRunning, closeQps as closeQPS
12
- from quarchpy.debug.upgrade_quarchpy import main as uprade_quarchpy_main
13
- from quarchpy.user_interface import*
14
- from quarchpy.debug.simple_terminal import main as simple_terminal_main
15
- import sys, logging, traceback
16
-
17
- def main(args):
18
- """
19
- Main function parses the arguments from the run command only
20
- """
21
-
22
- # Run the internal parser
23
- _parse_run_options(args)
24
-
25
- def _parse_run_options(args):
26
- """
27
- Parses the command line argument supplied via the quarchpy.run command line option
28
-
29
- Parameters
30
- ----------
31
- args : list[str]
32
- List of arguments to process
33
-
34
- """
35
-
36
- found = False
37
-
38
- # Arguments may not always be present
39
- if (len(args) > 0):
40
- # Obtain the list of commands that can be executed
41
- run_options = _get_run_options()
42
- # Try to locate a matching command name, executing it if found and passing in the remaining parameters
43
- main_arg = args[0]
44
- for item in run_options:
45
- if (item[0] == main_arg or item[1] == main_arg):
46
- found = True
47
- item[2](args[1:])
48
- else:
49
- logging.info("No args passed")
50
- found = True
51
- _run_help_function()
52
-
53
- # If parsing failed, error and print the available commands
54
- if (found == False):
55
- logging.error("ERROR - Command line argument not recognised")
56
- _run_help_function()
57
-
58
-
59
- def _get_run_options():
60
- """
61
- Gets the list of options for quarchpy.run commands which can be called. This is used internally to access the available commands
62
-
63
- Returns
64
- -------
65
- options_list : list[list[object]]
66
- List of call parameters, each of which is a list of objects making up the function description
67
-
68
- """
69
-
70
- run_options = []
71
-
72
- # [old_name , simple_name , execute_function , help_description]
73
- run_options.append (["debug_info" , "debug" , _run_debug_function , "Runs system tests which displays useful information for debugging"])
74
- run_options.append ([None , "module_debug", _run_module_debug_function , "Gives debug info on selected module and DUT"])
75
- run_options.append ([None , "qcs" , _run_qcs_function , "Launches Quarch Compliance Suite server"])
76
- run_options.append (["calibration_tool" , "calibration" , _run_calibration_function , "Runs the Quarch power module calibration tool"])
77
- run_options.append ([None , "qis" , _run_qis_function , "Launches Quarch Instrument Server for communication with Quarch power modules"])
78
- run_options.append ([None , "qps" , _run_qps_function , "Launches Quarch Power Studios, for power capture and analysis"])
79
- run_options.append (["simple_terminal" , "terminal" , _run_simple_terminal_function, "Runs the Simple Terminal script"])
80
- run_options.append (["upgrade_quarchpy" , "upgrade" , _run_upgrade_function , "Detects if an update of Quarchpy is available and assists in the upgrade process"])
81
- run_options.append (["h" , "help" , _run_help_function , "Displays the help screen with a list of commands supported"])
82
- run_options.append (["dd" , "list_drives" , _run_show_drives_function , "Displays a list of shown drives on the current system"])
83
-
84
- return run_options
85
-
86
- def _run_simple_terminal_function(args=None):
87
- """
88
- Runs the Simple Terminal script
89
-
90
- Parameters
91
- ----------
92
- None
93
- """
94
- simple_terminal_main()
95
-
96
- def _run_debug_function(args=None):
97
- """
98
- Executes the python debug/system test option, returning details of the installation to the user
99
- for debug purposes
100
-
101
- Parameters
102
- ----------
103
- args : list[str]
104
- List of sub arguments to process
105
-
106
- """
107
-
108
- systemTestMain(args)
109
-
110
- def _run_module_debug_function(args=None):
111
- """
112
- Executes the python debug/system test option, returning details of the installation to the user
113
- for debug purposes
114
-
115
- Parameters
116
- ----------
117
- args : list[str]
118
- List of sub arguments to process
119
-
120
- """
121
-
122
- moduleDebugMain(args)
123
-
124
- def _run_show_drives_function(args=None):
125
- """
126
- Shows a list of current found drives to the user.
127
-
128
- Parameters
129
- ----------
130
- args : list[str]
131
- List of sub arguments to process
132
-
133
- """
134
-
135
- try:
136
- import QuarchpyQCS
137
- from QuarchpyQCS.hostInformation import HostInformation
138
- host_info = HostInformation()
139
- host_info.display_drives()
140
- except ImportError as err:
141
- logging.error(err)
142
- logging.error("Drive detection is now in the QCS standalone package. Please install the QCS package via:")
143
- logging.error("'Pip install quarchQCS'")
144
- logging.error("Then retry this command")
145
-
146
- def _run_qcs_function(args=None):
147
- """
148
- Executes the QCS server back end process
149
-
150
- Parameters
151
- ----------
152
- args : list[str]
153
- List of sub arguments to process
154
-
155
- """
156
-
157
- try:
158
- import QuarchpyQCS
159
- # from QuarchpyQCS.driveTestCore import main as driveTestCoreMain
160
- from QuarchpyQCS.driveTestCore import main as driveTestCoreMain
161
- driveTestCoreMain(args)
162
- except ImportError as err:
163
- logging.error(err)
164
- logging.error("QCS is now a standalone package. Please install the QCS package via:")
165
- logging.error("'Pip install quarchQCS'")
166
- logging.error("Then retry this command")
167
-
168
-
169
- def _run_qis_function(args=None):
170
- """
171
- Executes Quarch Instrumentation Server
172
-
173
- Parameters
174
- ----------
175
- args : list[str]
176
- List of sub arguments to process
177
-
178
- """
179
- shutdown = False
180
- if args != None:
181
- for arg in args:
182
- if "-shutdown" in arg:
183
- shutdown = True
184
- if isQisRunning() == True:
185
- printText("Closing QIS")
186
- closeQIS()
187
- break
188
- else:
189
- printText("QIS is not running")
190
-
191
- if shutdown is False:
192
- startLocalQis(args=args)
193
-
194
-
195
- def _run_qps_function(args=None):
196
- """
197
- Executes Quarch Power Studio
198
-
199
- Parameters
200
- ----------
201
- args : list[str]
202
- List of sub arguments to process
203
-
204
- """
205
- shutdown = False
206
- if args != None:
207
- for arg in args:
208
- if "-shutdown" in arg:
209
- shutdown = True
210
- if isQpsRunning() == True:
211
- printText("Closing QPS")
212
- closeQPS()
213
- break
214
- else:
215
- printText("QPS is not running")
216
-
217
- if shutdown is False:
218
- startLocalQps(args=args)
219
-
220
-
221
- def _run_calibration_function(args=None):
222
- """
223
- Executes the calibration utility for power modules
224
-
225
- Parameters
226
- ----------
227
- args : list[str]
228
- List of sub arguments to process
229
-
230
- """
231
- try:
232
- from quarchCalibration.calibrationUtil import main as calibrationUtilMain
233
- retVal = calibrationUtilMain(args)
234
- return retVal
235
- except ImportError as err:
236
- #TODO check err for a more specific "quarchCalibration" cannot be found rather than a generic import error
237
-
238
- logging.error("Quarch Calibration is now in the quarchCalibration package. Please install the quarchCalibration package via:")
239
- logging.error("'pip install quarchCalibration'")
240
- logging.error("Then retry this command")
241
- traceback.print_exc()
242
-
243
-
244
-
245
-
246
- def _run_upgrade_function(args=None):
247
- """
248
- Checks for updates to quarchpy and runs the update process if required
249
-
250
- Parameters
251
- ----------
252
- args : list[str]
253
- List of sub arguments to process
254
-
255
- """
256
-
257
- uprade_quarchpy_main(args)
258
-
259
-
260
- def _run_help_function(args=None):
261
- """
262
- Shows the quarchpy.run help screen
263
-
264
- Parameters
265
- ----------
266
- args : list[str]
267
- List of sub arguments to process
268
-
269
- """
270
-
271
- printText("quarchpy.run -[Command]")
272
- # Iterate through all of the possible commands and print a nice help string for each
273
- run_options = _get_run_options()
274
- display_options = []
275
- for item in run_options:
276
- short_name = item[1]
277
- description = item[3]
278
- display_options.append([short_name,description])
279
- displayTable(display_options, align="l", tableHeaders=["Command", "Description"])
280
-
281
- if __name__ == "__main__":
282
- main (["qps"])
283
- main (sys.argv[1:])