Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
GEPARD
GEPARD
Commits
ec4f0cff
Commit
ec4f0cff
authored
Sep 10, 2020
by
Josef Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix in importing WITecCom
Fixed circular import
parent
f6214343
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
36 deletions
+36
-36
instrumentcom/WITecCOM.py
instrumentcom/WITecCOM.py
+6
-5
instrumentcom/instrumentConfig.py
instrumentcom/instrumentConfig.py
+30
-31
No files found.
instrumentcom/WITecCOM.py
View file @
ec4f0cff
...
...
@@ -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
from
.instrumentComBase
import
InstrumentComBase
from
.instrumentConfig
import
SpecScanParameter
# from .instrumentConfig import SpecScanParameter
from
.
import
instrumentConfig
as
ic
from
..errors
import
showErrorMessageAsWidget
except
ImportError
:
from
instrumentComBase
import
InstrumentComBase
...
...
@@ -97,8 +98,8 @@ class WITecCOM(InstrumentComBase):
CLSID
=
"{C45E77CE-3D66-489A-B5E2-159F443BD1AA}"
magn
=
20
specScanParameters
=
[
SpecScanParameter
(
'IntegrationTime (s)'
,
'double'
,
default
=
0.5
,
minVal
=
0.01
,
maxVal
=
100
),
SpecScanParameter
(
'Accumulations'
,
'int'
,
default
=
5
,
minVal
=
1
,
maxVal
=
100
)]
specScanParameters
=
[
ic
.
SpecScanParameter
(
'IntegrationTime (s)'
,
'double'
,
default
=
0.5
,
minVal
=
0.01
,
maxVal
=
100
),
ic
.
SpecScanParameter
(
'Accumulations'
,
'int'
,
default
=
5
,
minVal
=
1
,
maxVal
=
100
)]
def
__init__
(
self
,
logger
,
hostname
=
None
):
super
().
__init__
()
...
...
@@ -259,8 +260,8 @@ class WITecCOM(InstrumentComBase):
self
.
advSpec
:
SpectraHandler
=
SpectraHandler
(
self
)
if
'Autofocus'
not
in
[
param
.
name
for
param
in
self
.
specScanParameters
]:
self
.
specScanParameters
.
append
(
SpecScanParameter
(
'Autofocus'
,
'checkBox'
,
default
=
False
))
self
.
specScanParameters
.
append
(
SpecScanParameter
(
'Spectra Batch Size'
,
'int'
,
default
=
1000
,
minVal
=
1
,
maxVal
=
1e6
))
self
.
specScanParameters
.
append
(
ic
.
SpecScanParameter
(
'Autofocus'
,
'checkBox'
,
default
=
False
))
self
.
specScanParameters
.
append
(
ic
.
SpecScanParameter
(
'Spectra Batch Size'
,
'int'
,
default
=
1000
,
minVal
=
1
,
maxVal
=
1e6
))
@
comErrorRepeater
def
getBrightness
(
self
):
...
...
instrumentcom/instrumentConfig.py
View file @
ec4f0cff
...
...
@@ -23,7 +23,6 @@ import configparser
__all__
=
[
"InstrumentControl"
,
"defaultPath"
,
"simulatedRaman"
,
"SpecScanParameter"
]
defaultPath
=
os
.
path
.
dirname
(
os
.
path
.
split
(
__file__
)[
0
])
config
=
configparser
.
ConfigParser
()
...
...
@@ -32,6 +31,36 @@ config.read(os.path.join(defaultPath, 'gepard.cfg'))
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
:
defaultPath
=
config
[
"Defaults"
][
"file_path"
]
print
(
'default Path is now:'
,
defaultPath
)
...
...
@@ -77,33 +106,3 @@ elif interface == "THERMO_FTIR":
from
.thermoFTIRCom
import
ThermoFTIRCom
InstrumentControl
=
ThermoFTIRCom
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment