Skip to content

Commit 6f48d50

Browse files
committed
Commit for Thales version 5.9.1
Only updated the required Thales version, no other features added. Enums replaced by IntEnums. Error message if the software version does not fit more specified.
1 parent 601f296 commit 6f48d50

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

thales_remote/script_wrapper.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
"""
2626

27-
from enum import Enum
27+
from enum import Enum, IntEnum
2828
import re
2929
import shutil
3030
import os
@@ -33,14 +33,14 @@
3333
from thales_remote.error import ThalesRemoteError, TermConnectionError
3434
from thales_remote.connection import ThalesRemoteConnection
3535

36-
MINIMUM_THALES_VERSION = "5.9.0"
36+
MINIMUM_THALES_VERSION = "5.9.1"
3737

3838

3939
def versiontuple(v):
4040
return tuple(map(int, (v.split("."))))
4141

4242

43-
class PotentiostatMode(Enum):
43+
class PotentiostatMode(IntEnum):
4444
"""
4545
working modes for the potentiostat
4646
"""
@@ -50,7 +50,7 @@ class PotentiostatMode(Enum):
5050
POTMODE_PSEUDOGALVANOSTATIC = 3
5151

5252

53-
class ScanStrategy(Enum):
53+
class ScanStrategy(IntEnum):
5454
"""
5555
options for the EIS scan strategy
5656
@@ -75,7 +75,7 @@ def stringToEnum(cls, string: str):
7575
return stringEnumMap.get(string)
7676

7777

78-
class ScanDirection(Enum):
78+
class ScanDirection(IntEnum):
7979
"""
8080
set the scan direction for EIS measurements.
8181
@@ -97,7 +97,7 @@ def stringToEnum(cls, string: str):
9797
return stringEnumMap.get(string)
9898

9999

100-
class FileNaming(Enum):
100+
class FileNaming(IntEnum):
101101
"""
102102
options for the file names in Thales.
103103
@@ -122,7 +122,7 @@ def stringToEnum(cls, string: str):
122122
return stringEnumMap.get(string)
123123

124124

125-
class Pad4Mode(Enum):
125+
class Pad4Mode(IntEnum):
126126
"""
127127
options for the PAD4 operating mode.
128128
@@ -150,21 +150,27 @@ def __init__(self, remoteConnection: ThalesRemoteConnection):
150150
try:
151151
versionReply = self.getThalesVersion(timeout=1)
152152
except TermConnectionError as err:
153-
raise ThalesRemoteError("Please update your Thales version.")
153+
raise ThalesRemoteError(
154+
"Please update the Thales software, it is too old for this package version."
155+
)
154156

155157
if "devel" in versionReply:
156158
print("devel version")
157159
elif "" == versionReply:
158160
# timeout
159-
raise ThalesRemoteError("Please update your Thales version.")
161+
raise ThalesRemoteError(
162+
"Please update the Thales software, it is too old for this package version."
163+
)
160164
else:
161165
match = re.search(r"(\d+.\d+.\d+)", versionReply)
162166
versionString = match.group(1)
163-
versionComp = versiontuple(versionString) < versiontuple(
167+
thalesToOld = versiontuple(versionString) < versiontuple(
164168
MINIMUM_THALES_VERSION
165169
)
166-
if versionComp:
167-
raise ThalesRemoteError("Please update your Thales version.")
170+
if thalesToOld:
171+
raise ThalesRemoteError(
172+
f"Please update the Thales software. This package requires at least version {MINIMUM_THALES_VERSION}, but version {versionString} is installed."
173+
)
168174
return
169175

170176
def getCurrent(self) -> float:
@@ -179,7 +185,7 @@ def getCurrent(self) -> float:
179185

180186
def getPotential(self) -> float:
181187
"""
182-
fead the measured potential from the device
188+
read the measured potential from the device
183189
184190
:returns: the measured potential value
185191
"""
@@ -189,7 +195,7 @@ def getPotential(self) -> float:
189195

190196
def getVoltage(self) -> float:
191197
"""
192-
fead the measured potential from the device
198+
read the measured potential from the device
193199
194200
:returns: the measured potential value
195201
"""

0 commit comments

Comments
 (0)