Commit 12d245d4 authored by Spencer Du's avatar Spencer Du

update

parent 93785362
......@@ -64,7 +64,7 @@ class MainWindow(QtWidgets.QMainWindow):
client.run()
client.loop_start()
print("Connected to broker")
print("\n" + "Connected to broker")
time.sleep(1)
print("Subscribing to topic", "microscope/light_sheet_microscope/UI/add device")
client.subscribe("microscope/light_sheet_microscope/UI/add device")
......@@ -75,44 +75,7 @@ class MainWindow(QtWidgets.QMainWindow):
sender = self.sender()
self.fileName_UI = sender.text()
self.loadGUI()
print("Device panel initialised" + "\n")
# def importbutton(self):
# if not os.path.exists("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/add device")
# client.subscribe("microscope/light_sheet_microscope/UI/add device")
# print("Publishing message to topic", "microscope/light_sheet_microscope/UI/add device")
# client.publish("microscope/light_sheet_microscope/UI/add device", json.dumps({"type": "system", "payload":{"cmd": "init device panel"}}, indent=2))
# time.sleep(1)
# client.loop_stop()
# sender = self.sender()
# self.fileName_UI = sender.text()
# self.loadGUI()
# print("Device panel initialised" + "\n")
# else:
# if os.path.exists("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": "set config"}}, indent=2))
# time.sleep(1)
# client.loop_stop()
# sender = self.sender()
# self.fileName_UI = sender.text()
# self.loadGUI()
print("Device panel initialised")
def loadGUI(self):
module = __import__(self.fileName_UI.rstrip("\n"))
......
......@@ -15,26 +15,16 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="8" column="3" colspan="2">
<widget class="QLabel" name="label_11">
<item row="2" column="8">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Left</string>
<string>ms</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="lineEdit_5"/>
</item>
<item row="6" column="4" colspan="2">
<widget class="QLineEdit" name="lineEdit_3"/>
</item>
<item row="4" column="4" colspan="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QPushButton" name="pushButton_5">
<property name="font">
......@@ -57,10 +47,20 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_9">
<item row="8" column="3" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Top</string>
<string>Left</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="lineEdit_5"/>
</item>
<item row="4" column="4" colspan="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
......@@ -74,11 +74,25 @@
</property>
</widget>
</item>
<item row="2" column="6" colspan="2">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="8" column="5">
<widget class="QLineEdit" name="lineEdit_6"/>
</item>
<item row="2" column="6" colspan="2">
<widget class="QLineEdit" name="lineEdit"/>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item row="3" column="8">
<widget class="QPushButton" name="pushButton_9">
......@@ -111,24 +125,34 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_8">
<item row="6" column="2">
<widget class="QPushButton" name="pushButton_2">
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>Reset Crop ROI</string>
<string>px</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<item row="9" column="3" colspan="2">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Mode</string>
<string>Height</string>
</property>
</widget>
</item>
<item row="2" column="8">
<widget class="QPushButton" name="pushButton">
<item row="6" column="6" colspan="2">
<widget class="QPushButton" name="pushButton_3">
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>ms</string>
<string>px</string>
</property>
</widget>
</item>
......@@ -142,34 +166,30 @@
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButton_2">
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>px</string>
<string>Exposure Time</string>
</property>
</widget>
</item>
<item row="9" column="3" colspan="2">
<widget class="QLabel" name="label_12">
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Height</string>
<string>Lines</string>
</property>
</widget>
</item>
<item row="6" column="6" colspan="2">
<widget class="QPushButton" name="pushButton_3">
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>px</string>
<string>Delay</string>
</property>
</widget>
</item>
......@@ -197,19 +217,6 @@
</item>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Exposure Time</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QComboBox" name="comboBox">
<item>
......@@ -234,27 +241,10 @@
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Lines</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Delay</string>
</property>
</widget>
</item>
<item row="9" column="5">
<widget class="QLineEdit" name="lineEdit_7"/>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<item row="7" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string/>
<string>Crop ROI</string>
</property>
</widget>
</item>
......@@ -270,16 +260,19 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_8">
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="text">
<string>Crop ROI</string>
<string/>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="lineEdit_4"/>
</item>
<item row="9" column="5">
<widget class="QLineEdit" name="lineEdit_7"/>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
......@@ -287,6 +280,13 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string>OFF</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
......
This diff is collapsed.
[Filter wheels]
left filter wheel = 2
right filter wheel = 2
left magnification changer = 22.2x
right magnification changer = 22.2x
[laser]
status = off
......@@ -211,8 +211,8 @@ class Ui_Laser(object):
config = configparser.RawConfigParser()
f = open("laser.ini", "w")
config.add_section("laser")
config.set("laser", "status", "on")
config.add_section("Laser")
config.set("Laser", "status", "on")
config.write(f)
else:
pass
......@@ -239,6 +239,9 @@ class Ui_Laser(object):
def btnstate(self):
if os.path.exists("laser.ini"):
config = configparser.RawConfigParser()
config.read("laser.ini")
if self.pushButton.isChecked():
client = device()
client.run()
......@@ -254,12 +257,27 @@ class Ui_Laser(object):
client.loop_stop()
print("445nm laser turned on")
config = configparser.RawConfigParser()
config.read("laser.ini")
try:
self.verticalSlider.setValue(config.getint("445nm", "intensity"))
print("455nm laser set")
except Exception as e:
pass
try:
self.lineEdit.setText(str(config.getint("445nm", "intensity")))
print("455nm laser textbox set" + "\n")
except Exception as e:
pass
f = open("laser.ini", "w")
config.add_section("445nm")
config.set("445nm", "status", "on")
try:
config.add_section("445nm")
except Exception as e:
pass
try:
config.set("445nm", "status", "on")
except Exception as e:
pass
config.write(f)
self.pushButton_9.clicked.connect(self.printValue)
......@@ -298,6 +316,8 @@ class Ui_Laser(object):
def btnstate2(self):
if os.path.exists("laser.ini"):
config = configparser.RawConfigParser()
config.read("laser.ini")
if self.pushButton_2.isChecked():
client = device()
client.run()
......@@ -312,14 +332,28 @@ class Ui_Laser(object):
time.sleep(1)
client.loop_stop()
print("488nm laser turned on")
config = configparser.RawConfigParser()
config.read("laser.ini")
try:
self.verticalSlider_2.setValue(config.getint("488nm", "intensity"))
print("488nm laser set")
except Exception as e:
pass
try:
self.lineEdit_2.setText(str(config.getint("488nm", "intensity")))
print("488nm laser textbox set" + "\n")
except Exception as e:
pass
f = open("laser.ini", "w")
config.add_section("488nm")
config.set("488nm", "status", "on")
config.write(f)
try:
config.add_section("488nm")
except Exception as e:
pass
try:
config.set("488nm", "status", "on")
except Exception as e:
pass
config.write(f)
self.pushButton_10.clicked.connect(self.printValue2)
else:
......@@ -357,6 +391,8 @@ class Ui_Laser(object):
def btnstate3(self):
if os.path.exists("laser.ini"):
config = configparser.RawConfigParser()
config.read("laser.ini")
if self.pushButton_3.isChecked():
client = device()
client.run()
......@@ -372,13 +408,27 @@ class Ui_Laser(object):
client.loop_stop()
print("515nm laser turned on")
config = configparser.RawConfigParser()
config.read("laser.ini")
try:
self.verticalSlider_3.setValue(config.getint("515nm", "intensity"))
print("515nm laser set")
except Exception as e:
pass
try:
self.lineEdit_3.setText(str(config.getint("515nm", "intensity")))
print("515nm laser textbox set" + "\n")
except Exception as e:
pass
f = open("laser.ini", "w")
config.add_section("515nm")
config.set("515nm", "status", "on")
config.write(f)
try:
config.add_section("515nm")
except Exception as e:
pass
try:
config.set("515nm", "status", "on")
except Exception as e:
pass
config.write(f)
self.pushButton_11.clicked.connect(self.printValue3)
else:
......@@ -416,6 +466,8 @@ class Ui_Laser(object):
def btnstate4(self):
if os.path.exists("laser.ini"):
config = configparser.RawConfigParser()
config.read("laser.ini")
if self.pushButton_4.isChecked():
client = device()
client.run()
......@@ -431,13 +483,27 @@ class Ui_Laser(object):
client.loop_stop()
print("561nm laser turned on")
config = configparser.RawConfigParser()
config.read("laser.ini")
try:
self.verticalSlider_4.setValue(config.getint("561nm", "intensity"))
print("561nm laser set")
except Exception as e:
pass
try:
self.lineEdit_4.setText(str(config.getint("561nm", "intensity")))
print("561nm laser textbox set" + "\n")
except Exception as e:
pass
f = open("laser.ini", "w")
config.add_section("561nm")
config.set("561nm", "status", "on")
config.write(f)
try:
config.add_section("561nm")
except Exception as e:
pass
try:
config.set("561nm", "status", "on")
except Exception as e:
pass
config.write(f)
self.pushButton_12.clicked.connect(self.printValue4)
else:
......@@ -475,6 +541,8 @@ class Ui_Laser(object):
def btnstate5(self):
if os.path.exists("laser.ini"):
config = configparser.RawConfigParser()
config.read("laser.ini")
if self.pushButton_5.isChecked():
client = device()
client.run()
......@@ -490,13 +558,27 @@ class Ui_Laser(object):
client.loop_stop()
print("594nm laser turned on")
config = configparser.RawConfigParser()
config.read("laser.ini")
try:
self.verticalSlider_5.setValue(config.getint("594nm", "intensity"))
print("594nm laser set")
except Exception as e:
pass
try:
self.lineEdit_5.setText(str(config.getint("594nm", "intensity")))
print("594nm laser textbox set" + "\n")
except Exception as e:
pass
f = open("laser.ini", "w")
config.add_section("594nm")
config.set("594nm", "status", "on")
config.write(f)
try:
config.add_section("594nm")
except Exception as e:
pass
try:
config.set("594nm", "status", "on")
except Exception as e:
pass
config.write(f)
self.pushButton_13.clicked.connect(self.printValue5)
else:
......@@ -534,6 +616,8 @@ class Ui_Laser(object):
def btnstate6(self):
if os.path.exists("laser.ini"):
config = configparser.RawConfigParser()
config.read("laser.ini")
if self.pushButton_6.isChecked():
client = device()
client.run()
......@@ -549,12 +633,26 @@ class Ui_Laser(object):
client.loop_stop()
print("638nm laser turned on")
config = configparser.RawConfigParser()
config.read("laser.ini")
try:
self.verticalSlider_6.setValue(config.getint("638nm", "intensity"))
print("638nm laser set")
except Exception as e:
pass
try:
self.lineEdit_6.setText(str(config.getint("638nm", "intensity")))
print("638nm laser textbox set" + "\n")
except Exception as e:
pass
f = open("laser.ini", "w")
config.add_section("638nm")
config.set("638nm", "status", "on")
try:
config.add_section("638nm")
except Exception as e:
pass
try:
config.set("638nm", "status", "on")
except Exception as e:
pass
config.write(f)
self.pushButton_14.clicked.connect(self.printValue6)
......@@ -596,6 +694,7 @@ class Ui_Laser(object):
textboxValue = self.lineEdit.text()
if self.lineEdit.text() == "":
self.verticalSlider.setValue(0)
textboxValue = str(0)
else:
self.verticalSlider.setValue(int(textboxValue))
......@@ -641,6 +740,7 @@ class Ui_Laser(object):
textboxValue2 = self.lineEdit_2.text()
if self.lineEdit_2.text() == "":
self.verticalSlider_2.setValue(0)
textboxValue2 = str(0)
else:
self.verticalSlider_2.setValue(int(textboxValue2))
......@@ -686,6 +786,7 @@ class Ui_Laser(object):
textboxValue3 = self.lineEdit_3.text()
if self.lineEdit_3.text() == "":
self.verticalSlider_3.setValue(0)
textboxValue3 = str(0)
else:
self.verticalSlider_3.setValue(int(textboxValue3))
......@@ -731,6 +832,7 @@ class Ui_Laser(object):
textboxValue4 = self.lineEdit_4.text()
if self.lineEdit_4.text() == "":
self.verticalSlider_4.setValue(0)
textboxValue4 = str(0)