Commit ec4f0cff authored by Josef Brandt's avatar Josef Brandt

Fix in importing WITecCom

Fixed circular import
parent f6214343
...@@ -32,7 +32,8 @@ from socket import gethostname ...@@ -32,7 +32,8 @@ from socket import gethostname
try: # when running the witectesting, the paths have to be differently, as it is in the same directory as the other raman com modules try: # when running the witectesting, the paths have to be differently, as it is in the same directory as the other raman com modules
from .instrumentComBase import InstrumentComBase from .instrumentComBase import InstrumentComBase
from .instrumentConfig import SpecScanParameter # from .instrumentConfig import SpecScanParameter
from . import instrumentConfig as ic
from ..errors import showErrorMessageAsWidget from ..errors import showErrorMessageAsWidget
except ImportError: except ImportError:
from instrumentComBase import InstrumentComBase from instrumentComBase import InstrumentComBase
...@@ -97,8 +98,8 @@ class WITecCOM(InstrumentComBase): ...@@ -97,8 +98,8 @@ class WITecCOM(InstrumentComBase):
CLSID = "{C45E77CE-3D66-489A-B5E2-159F443BD1AA}" CLSID = "{C45E77CE-3D66-489A-B5E2-159F443BD1AA}"
magn = 20 magn = 20
specScanParameters = [SpecScanParameter('IntegrationTime (s)', 'double', default=0.5, minVal=0.01, maxVal=100), specScanParameters = [ic.SpecScanParameter('IntegrationTime (s)', 'double', default=0.5, minVal=0.01, maxVal=100),
SpecScanParameter('Accumulations', 'int', default=5, minVal=1, maxVal=100)] ic.SpecScanParameter('Accumulations', 'int', default=5, minVal=1, maxVal=100)]
def __init__(self, logger, hostname=None): def __init__(self, logger, hostname=None):
super().__init__() super().__init__()
...@@ -259,8 +260,8 @@ class WITecCOM(InstrumentComBase): ...@@ -259,8 +260,8 @@ class WITecCOM(InstrumentComBase):
self.advSpec: SpectraHandler = SpectraHandler(self) self.advSpec: SpectraHandler = SpectraHandler(self)
if 'Autofocus' not in [param.name for param in self.specScanParameters]: if 'Autofocus' not in [param.name for param in self.specScanParameters]:
self.specScanParameters.append(SpecScanParameter('Autofocus', 'checkBox', default=False)) self.specScanParameters.append(ic.SpecScanParameter('Autofocus', 'checkBox', default=False))
self.specScanParameters.append(SpecScanParameter('Spectra Batch Size', 'int', default=1000, minVal=1, maxVal=1e6)) self.specScanParameters.append(ic.SpecScanParameter('Spectra Batch Size', 'int', default=1000, minVal=1, maxVal=1e6))
@comErrorRepeater @comErrorRepeater
def getBrightness(self): def getBrightness(self):
......
...@@ -23,7 +23,6 @@ import configparser ...@@ -23,7 +23,6 @@ import configparser
__all__ = ["InstrumentControl", "defaultPath", "simulatedRaman", "SpecScanParameter"] __all__ = ["InstrumentControl", "defaultPath", "simulatedRaman", "SpecScanParameter"]
defaultPath = os.path.dirname(os.path.split(__file__)[0]) defaultPath = os.path.dirname(os.path.split(__file__)[0])
config = configparser.ConfigParser() config = configparser.ConfigParser()
...@@ -32,6 +31,36 @@ config.read(os.path.join(defaultPath, 'gepard.cfg')) ...@@ -32,6 +31,36 @@ config.read(os.path.join(defaultPath, 'gepard.cfg'))
interface = "SIMULATED_RAMAN_CONTROL" interface = "SIMULATED_RAMAN_CONTROL"
class SpecScanParameter(object):
def __init__(self, name, dtype, default=None, minVal=None, maxVal=None, valList=None, openFileType=None):
self.name = name
self.dtype = dtype
self.value = default
self.minVal = minVal
self.maxVal = maxVal
self.valList = valList
self.openFileType = openFileType
if not self.hasValidType():
print('erroreneous type in setting parameter:', self.dtype)
def hasValidType(self):
if self.dtype in ['int', 'double', 'checkBox', 'combobox', 'selectBtn']:
return True
else:
return False
def value_of(self, obj):
if self.dtype in ['int', 'double']:
return obj.value()
elif self.dtype == 'checkBox':
return obj.isChecked()
elif self.dtype == 'combobox':
return obj.currentText()
elif self.dtype == 'selectBtn':
return obj.text()
try: try:
defaultPath = config["Defaults"]["file_path"] defaultPath = config["Defaults"]["file_path"]
print('default Path is now:', defaultPath) print('default Path is now:', defaultPath)
...@@ -77,33 +106,3 @@ elif interface == "THERMO_FTIR": ...@@ -77,33 +106,3 @@ elif interface == "THERMO_FTIR":
from .thermoFTIRCom import ThermoFTIRCom from .thermoFTIRCom import ThermoFTIRCom
InstrumentControl = ThermoFTIRCom InstrumentControl = ThermoFTIRCom
simulatedRaman = False simulatedRaman = False
class SpecScanParameter(object):
def __init__(self, name, dtype, default=None, minVal=None, maxVal=None, valList=None, openFileType=None):
self.name = name
self.dtype = dtype
self.value = default
self.minVal = minVal
self.maxVal = maxVal
self.valList = valList
self.openFileType = openFileType
if not self.hasValidType():
print('erroreneous type in setting parameter:', self.dtype)
def hasValidType(self):
if self.dtype in ['int', 'double', 'checkBox', 'combobox', 'selectBtn']:
return True
else:
return False
def value_of(self, obj):
if self.dtype in ['int', 'double']:
return obj.value()
elif self.dtype == 'checkBox':
return obj.isChecked()
elif self.dtype == 'combobox':
return obj.currentText()
elif self.dtype == 'selectBtn':
return obj.text()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment