Commit 2f6d5628 authored by Spencer Du's avatar Spencer Du

update

parent 2dbcb96f
[445nm]
intensity = 8
[Subscriptions]
445nm = microscope/light_sheet_microscope/UI/laser/445nm
488nm = microscope/light_sheet_microscope/UI/laser/488nm
515nm = microscope/light_sheet_microscope/UI/laser/445nm
561nm = microscope/light_sheet_microscope/UI/laser/561nm
594nm = microscope/light_sheet_microscope/UI/laser/594nm
638nm = microscope/light_sheet_microscope/UI/laser/638nm
[488nm]
intensity = 8
[515nm]
intensity = 8
[561nm]
intensity = 8
[594nm]
intensity = 8
[638nm]
intensity = 8
......@@ -312,6 +312,25 @@ class Ui_Laser(object):
print("488nm laser turned on")
self.pushButton_10.clicked.connect(self.printValue2)
else:
self.pushButton_10.clicked.connect(self.printValue2)
self.pushButton_10.clicked.disconnect(self.printValue2)
self.verticalSlider_2.setValue(0)
self.lineEdit_3.clear()
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/488nm")
client.subscribe("microscope/light_sheet_microscope/UI/laser/488nm")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI/laser/488nm")
client.publish("microscope/light_sheet_microscope/UI/laser/488nm", json.dumps({"type": "device", "payload":{"name": "laser", "wavelength": "488nm", "cmd": "turning off"}}, indent=2))
time.sleep(1)
client.loop_stop()
print("488nm laser turned off")
else:
if self.pushButton_2.isChecked():
client = device()
......@@ -375,6 +394,24 @@ class Ui_Laser(object):
print("515nm laser turned on")
self.pushButton_11.clicked.connect(self.printValue3)
else:
self.pushButton_11.clicked.connect(self.printValue3)
self.pushButton_11.clicked.disconnect(self.printValue3)
self.verticalSlider_3.setValue(0)
self.lineEdit_3.clear()
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/515nm")
client.subscribe("microscope/light_sheet_microscope/UI/laser/515nm")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI/laser/515nm")
client.publish("microscope/light_sheet_microscope/UI/laser/515nm", json.dumps({"type": "device", "payload":{"name": "laser", "wavelength": "515nm", "cmd": "turning off"}}, indent=2))
time.sleep(1)
client.loop_stop()
print("515nm laser turned off")
else:
if self.pushButton_3.isChecked():
client = device()
......@@ -439,6 +476,24 @@ class Ui_Laser(object):
print("561nm laser turned on")
self.pushButton_12.clicked.connect(self.printValue4)
else:
self.pushButton_12.clicked.connect(self.printValue4)
self.pushButton_12.clicked.disconnect(self.printValue4)
self.verticalSlider_4.setValue(0)
self.lineEdit_4.clear()
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/561nm")
client.subscribe("microscope/light_sheet_microscope/UI/laser/561nm")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI/laser/561nm")
client.publish("microscope/light_sheet_microscope/UI/laser/561nm", json.dumps({"type": "device", "payload":{"name": "laser", "wavelength": "561nm", "cmd": "turning off"}}, indent=2))
time.sleep(1)
client.loop_stop()
print("561nm laser turned off")
else:
if self.pushButton_4.isChecked():
client = device()
......@@ -503,6 +558,24 @@ class Ui_Laser(object):
print("594nm laser turned on")
self.pushButton_13.clicked.connect(self.printValue5)
else:
self.pushButton_13.clicked.connect(self.printValue5)
self.pushButton_13.clicked.disconnect(self.printValue5)
self.verticalSlider_3.setValue(0)
self.lineEdit_3.clear()
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/594nm")
client.subscribe("microscope/light_sheet_microscope/UI/laser/594nm")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI/laser/594nm")
client.publish("microscope/light_sheet_microscope/UI/laser/594nm", json.dumps({"type": "device", "payload":{"name": "laser", "wavelength": "594nm", "cmd": "turning off"}}, indent=2))
time.sleep(1)
client.loop_stop()
print("594nm laser turned off")
else:
if self.pushButton_5.isChecked():
client = device()
......@@ -567,6 +640,24 @@ class Ui_Laser(object):
print("638nm laser turned on")
self.pushButton_14.clicked.connect(self.printValue6)
else:
self.pushButton_14.clicked.connect(self.printValue6)
self.pushButton_14.clicked.disconnect(self.printValue6)
self.verticalSlider_6.setValue(0)
self.lineEdit_6.clear()
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/638nm")
client.subscribe("microscope/light_sheet_microscope/UI/laser/638nm")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI/laser/638nm")
client.publish("microscope/light_sheet_microscope/UI/laser/638nm", json.dumps({"type": "device", "payload":{"name": "laser", "wavelength": "638nm", "cmd": "turning off"}}, indent=2))
time.sleep(1)
client.loop_stop()
print("638nm laser turned off")
else:
if self.pushButton_6.isChecked():
client = device()
......@@ -814,7 +905,7 @@ class Ui_Laser(object):
config.add_section("515nm")
except Exception as e:
pass
config.set("515nm", "intensity", textboxValue)
config.set("515nm", "intensity", textboxValue3)
try:
config.add_section("Subscriptions")
except Exception as e:
......@@ -1048,7 +1139,8 @@ class Ui_Laser(object):
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")
print("Laser turned on")
self.pushButton_7.clicked.connect(self.stop)
try:
self.verticalSlider.setValue(config.getint("445nm", "intensity"))
print("455nm laser set")
......@@ -1144,6 +1236,7 @@ class Ui_Laser(object):
client.publish("microscope/light_sheet_microscope/UI/laser", json.dumps({"type": "device", "payload":{"name": "laser", "cmd": "device turning off"}}, indent=2))
time.sleep(1)
client.loop_stop()
self.pushButton_7.clicked.disconnect(self.stop)
self.pushButton_8.setChecked(False)
self.pushButton.setChecked(False)
# self.pushButton.setCheckable(False)
......
str1 = list(map(str,input("Input: ").split(",")))
print(str1)
res = list(map(lambda sub:int(''.join([ele for ele in sub if ele.isnumeric()])), str1))
regular = 2
print(res)
# nums = [int(s) for s in str1.split(',') if s.isdigit()]
# print(nums)
# b = sum(nums)
# print("Final bill is: " + str(b))
\ 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