Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Spencer Du
control software
Commits
9744b051
Commit
9744b051
authored
Nov 29, 2019
by
Spencer Du
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c8edcb4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
179 additions
and
0 deletions
+179
-0
laser2.py
laser2.py
+179
-0
No files found.
laser2.py
View file @
9744b051
...
...
@@ -195,6 +195,7 @@ class Ui_Laser(object):
self
.
pushButton_8
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
self
.
pushButton_8
.
setCheckable
(
True
)
self
.
pushButton_8
.
setChecked
(
True
)
self
.
pushButton_8
.
clicked
.
connect
(
self
.
on
)
self
.
pushButton_8
.
setObjectName
(
"pushButton_8"
)
self
.
gridLayout
.
addWidget
(
self
.
pushButton_8
,
1
,
0
,
1
,
2
)
self
.
pushButton_7
=
QtWidgets
.
QPushButton
(
self
.
centralwidget
)
...
...
@@ -1051,6 +1052,107 @@ class Ui_Laser(object):
config
.
set
(
"Subscriptions"
,
"638nm"
,
"microscope/light_sheet_microscope/UI/laser/638nm"
)
config
.
write
(
f
)
def
on
(
self
):
if
self
.
pushButton_8
.
isChecked
():
if
os
.
path
.
exists
(
"laser.ini"
):
config
=
configparser
.
RawConfigParser
()
config
.
read
(
"laser.ini"
)
client
=
device
()
client
.
run
()
client
.
loop_start
()
print
(
"
\n
"
+
"Connected to broker"
)
time
.
sleep
(
1
)
print
(
"Subscribing to topic"
,
"microscope/light_sheet_microscope/UI/laser"
)
client
.
subscribe
(
"microscope/light_sheet_microscope/UI/laser"
)
print
(
"Publishing message to topic"
,
"microscope/light_sheet_microscope/UI/laser"
)
client
.
publish
(
"microscope/light_sheet_microscope/UI/laser"
,
json
.
dumps
({
"type"
:
"device"
,
"payload"
:{
"name"
:
"laser"
,
"cmd"
:
"laser turning on"
}},
indent
=
2
))
time
.
sleep
(
1
)
client
.
loop_stop
()
print
(
"laser turned on"
)
try
:
self
.
verticalSlider
.
setValue
(
config
.
getint
(
"445nm"
,
"intensity"
))
print
(
"455nm laser set"
)
self
.
pushButton
.
setChecked
(
True
)
except
Exception
as
e
:
print
(
"455nm laser not set"
)
try
:
self
.
lineEdit
.
setText
(
str
(
config
.
getint
(
"445nm"
,
"intensity"
)))
print
(
"455nm laser textbox set"
)
except
Exception
as
e
:
print
(
"455nm laser textbox not set"
)
try
:
self
.
verticalSlider_2
.
setValue
(
config
.
getint
(
"488nm"
,
"intensity"
))
print
(
"488nm laser set"
)
self
.
pushButton_2
.
setChecked
(
True
)
except
Exception
as
e
:
print
(
"488nm laser not set"
)
try
:
self
.
lineEdit_2
.
setText
(
str
(
config
.
getint
(
"488nm"
,
"intensity"
)))
print
(
"488nm laser textbox set"
)
except
Exception
as
e
:
print
(
"488nm laser textbox not set"
)
try
:
self
.
verticalSlider_3
.
setValue
(
config
.
getint
(
"515nm"
,
"intensity"
))
print
(
"515nm laser set"
)
self
.
pushButton_3
.
setChecked
(
True
)
except
Exception
as
e
:
print
(
"515nm laser not set"
)
try
:
self
.
lineEdit_3
.
setText
(
str
(
config
.
getint
(
"515nm"
,
"intensity"
)))
print
(
"515nm laser textbox set"
)
except
Exception
as
e
:
print
(
"515nm laser textbox not set"
)
try
:
self
.
verticalSlider_4
.
setValue
(
config
.
getint
(
"561nm"
,
"intensity"
))
print
(
"561nm laser set"
)
self
.
pushButton_4
.
setChecked
(
True
)
except
Exception
as
e
:
print
(
"561nm laser not set"
)
try
:
self
.
lineEdit_4
.
setText
(
str
(
config
.
getint
(
"561nm"
,
"intensity"
)))
print
(
"561nm laser textbox set"
)
except
Exception
as
e
:
print
(
"561nm laser textbox not set"
)
try
:
self
.
verticalSlider_5
.
setValue
(
config
.
getint
(
"594nm"
,
"intensity"
))
print
(
"594nm laser set"
)
self
.
pushButton_5
.
setChecked
(
True
)
except
Exception
as
e
:
print
(
"594nm laser not set"
)
try
:
self
.
lineEdit_5
.
setText
(
str
(
config
.
getint
(
"594nm"
,
"intensity"
)))
print
(
"594nm laser textbox set"
)
except
Exception
as
e
:
print
(
"594nm laser textbox not set"
)
try
:
self
.
verticalSlider_6
.
setValue
(
config
.
getint
(
"638nm"
,
"intensity"
))
print
(
"638nm laser set"
)
self
.
pushButton_6
.
setChecked
(
True
)
except
Exception
as
e
:
print
(
"638nm laser not set"
)
try
:
self
.
lineEdit_6
.
setText
(
str
(
config
.
getint
(
"638nm"
,
"intensity"
)))
print
(
"638nm laser textbox set"
)
except
Exception
as
e
:
print
(
"638nm laser textbox not set"
)
else
:
print
(
"Config file does not exist"
)
else
:
print
(
"hi"
)
def
stop
(
self
):
client
=
device
()
client
.
run
()
...
...
@@ -1065,6 +1167,83 @@ class Ui_Laser(object):
time
.
sleep
(
1
)
client
.
loop_stop
()
self
.
pushButton_8
.
setChecked
(
False
)
self
.
pushButton
.
setChecked
(
False
)
self
.
pushButton
.
setCheckable
(
False
)
try
:
self
.
pushButton
.
clicked
.
disconnect
(
self
.
btnstate
)
except
Exception
as
e
:
pass
try
:
self
.
pushButton_9
.
clicked
.
disconnect
(
self
.
printValue
)
except
Exception
as
e
:
pass
self
.
verticalSlider
.
setValue
(
0
)
self
.
lineEdit
.
clear
()
self
.
pushButton_2
.
setChecked
(
False
)
self
.
pushButton_2
.
setCheckable
(
False
)
try
:
self
.
pushButton_2
.
clicked
.
disconnect
(
self
.
btnstate2
)
except
Exception
as
e
:
pass
try
:
self
.
pushButton_10
.
clicked
.
disconnect
(
self
.
printValue2
)
except
Exception
as
e
:
pass
self
.
verticalSlider_2
.
setValue
(
0
)
self
.
lineEdit_2
.
clear
()
self
.
pushButton_3
.
setChecked
(
False
)
self
.
pushButton_3
.
setCheckable
(
False
)
try
:
self
.
pushButton_3
.
clicked
.
disconnect
(
self
.
btnstate3
)
except
Exception
as
e
:
pass
try
:
self
.
pushButton_11
.
clicked
.
disconnect
(
self
.
printValue3
)
except
Exception
as
e
:
pass
self
.
verticalSlider_3
.
setValue
(
0
)
self
.
lineEdit_3
.
clear
()
self
.
pushButton_4
.
setChecked
(
False
)
self
.
pushButton_4
.
setCheckable
(
False
)
try
:
self
.
pushButton_4
.
clicked
.
disconnect
(
self
.
btnstate4
)
except
Exception
as
e
:
pass
try
:
self
.
pushButton_12
.
clicked
.
disconnect
(
self
.
printValue4
)
except
Exception
as
e
:
pass
self
.
verticalSlider_4
.
setValue
(
0
)
self
.
lineEdit_4
.
clear
()
self
.
pushButton_5
.
setChecked
(
False
)
self
.
pushButton_5
.
setCheckable
(
False
)
try
:
self
.
pushButton_5
.
clicked
.
disconnect
(
self
.
btnstate5
)
except
Exception
as
e
:
pass
try
:
self
.
pushButton_13
.
clicked
.
disconnect
(
self
.
printValue5
)
except
Exception
as
e
:
pass
self
.
verticalSlider_5
.
setValue
(
0
)
self
.
lineEdit_5
.
clear
()
self
.
pushButton_6
.
setChecked
(
False
)
self
.
pushButton_6
.
setCheckable
(
False
)
try
:
self
.
pushButton_6
.
clicked
.
disconnect
(
self
.
btnstate6
)
except
Exception
as
e
:
pass
try
:
self
.
pushButton_14
.
clicked
.
disconnect
(
self
.
printValue6
)
except
Exception
as
e
:
pass
self
.
verticalSlider_6
.
setValue
(
0
)
self
.
lineEdit_6
.
clear
()
print
(
"Laser turned off"
)
def
retranslateUi
(
self
,
Laser
):
...
...
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