Commit da9df457 authored by Spencer Du's avatar Spencer Du

config added to code now

parent 00f0814d
......@@ -47,32 +47,52 @@ class MainWindow(QtWidgets.QMainWindow):
self.combo.move(100,350)
self.combo.resize(100, 32)
menubar = self.menuBar()
devicesMenu = menubar.addMenu("Devices")
def readFile(fname):
try:
with open(fname, "r") as f:
for item in f:
self.combo.addItem(item)
self.combo.addItem(item, self.importbutton)
except:
print("No devices active")
readFile("list_of_devices_currently_active.txt")
def importbutton(self):
client = device()
client.run()
if not os.path.exists("laser.ini"):
client = device()
client.run()
client.loop_start()
print("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()
self.fileName_UI = self.combo.currentText()
self.loadGUI()
print("Device panel initialised" + "\n")
client.loop_start()
print("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()
self.fileName_UI = self.combo.currentText()
self.loadGUI()
print("Device panel initialised" + "\n")
else:
if os.path.exists("laser.ini"):
client = device()
client.run()
client.loop_start()
print("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()
self.fileName_UI = self.combo.currentText()
self.loadGUI()
print("Laser config set" + "\n")
def loadGUI(self):
module = __import__(self.fileName_UI.rstrip("\n"))
......
This diff is collapsed.
This diff is collapsed.
......@@ -14,175 +14,95 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>62</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>ON</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>60</x>
<y>50</y>
<width>71</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Left filter wheel</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_2">
<property name="geometry">
<rect>
<x>190</x>
<y>50</y>
<width>71</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>170</x>
<y>30</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Right filter wheel</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_3">
<property name="geometry">
<rect>
<x>60</x>
<y>100</y>
<width>71</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Left magnification changer</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_4">
<property name="geometry">
<rect>
<x>190</x>
<y>100</y>
<width>71</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>190</x>
<y>80</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Right magnification changer</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>150</x>
<y>60</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>150</x>
<y>40</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Link</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<property name="geometry">
<rect>
<x>150</x>
<y>110</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>150</x>
<y>90</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Link</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1" rowspan="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Link</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="3">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Left magnification changer</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0" rowspan="2">
<widget class="QComboBox" name="comboBox_3"/>
</item>
<item row="6" column="2" rowspan="2">
<widget class="QComboBox" name="comboBox_4"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Right filter wheel</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Right magnification changer</string>
</property>
</widget>
</item>
<item row="2" column="2" rowspan="3">
<widget class="QComboBox" name="comboBox_2"/>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>ON</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Left filter wheel</string>
</property>
</widget>
</item>
<item row="5" column="1" rowspan="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Link</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
......
......@@ -16,51 +16,53 @@ class Ui_Filterwheel(object):
MainWindow.resize(322, 161)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(10, 10, 62, 19))
self.pushButton.setCheckable(True)
self.pushButton.setChecked(True)
self.pushButton.setObjectName("pushButton")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 1, 1, 2, 1)
self.comboBox = QtWidgets.QComboBox(self.centralwidget)
self.comboBox.setGeometry(QtCore.QRect(60, 50, 71, 22))
self.comboBox.setObjectName("comboBox")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(20, 30, 71, 16))
self.label.setObjectName("label")
self.comboBox_2 = QtWidgets.QComboBox(self.centralwidget)
self.comboBox_2.setGeometry(QtCore.QRect(190, 50, 71, 22))
self.comboBox_2.setObjectName("comboBox_2")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(170, 30, 71, 16))
self.label_2.setObjectName("label_2")
self.comboBox_3 = QtWidgets.QComboBox(self.centralwidget)
self.comboBox_3.setGeometry(QtCore.QRect(60, 100, 71, 22))
self.comboBox_3.setObjectName("comboBox_3")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(20, 80, 111, 16))
self.label_3.setObjectName("label_3")
self.comboBox_4 = QtWidgets.QComboBox(self.centralwidget)
self.comboBox_4.setGeometry(QtCore.QRect(190, 100, 71, 22))
self.comboBox_4.setObjectName("comboBox_4")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(190, 80, 111, 16))
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.comboBox, 2, 0, 3, 1)
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox.setGeometry(QtCore.QRect(150, 60, 16, 16))
self.checkBox.setText("")
self.checkBox.setCheckable(True)
self.checkBox.setChecked(False)
self.checkBox.setObjectName("checkBox")
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setGeometry(QtCore.QRect(150, 40, 21, 20))
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.checkBox, 3, 1, 1, 1)
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1)
self.checkBox_2 = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox_2.setGeometry(QtCore.QRect(150, 110, 16, 16))
self.checkBox_2.setText("")
self.checkBox_2.setObjectName("checkBox_2")
self.gridLayout.addWidget(self.checkBox_2, 7, 1, 1, 1)
self.comboBox_3 = QtWidgets.QComboBox(self.centralwidget)
self.comboBox_3.setObjectName("comboBox_3")
self.gridLayout.addWidget(self.comboBox_3, 6, 0, 2, 1)
self.comboBox_4 = QtWidgets.QComboBox(self.centralwidget)
self.comboBox_4.setObjectName("comboBox_4")
self.gridLayout.addWidget(self.comboBox_4, 6, 2, 2, 1)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 1, 2, 1, 1)
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 5, 2, 1, 1)
self.comboBox_2 = QtWidgets.QComboBox(self.centralwidget)
self.comboBox_2.setObjectName("comboBox_2")
self.gridLayout.addWidget(self.comboBox_2, 2, 2, 3, 1)
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setCheckable(True)
self.pushButton.setChecked(True)
self.pushButton.setObjectName("pushButton")
self.gridLayout.addWidget(self.pushButton, 0, 0, 1, 1)
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.label_6 = QtWidgets.QLabel(self.centralwidget)
self.label_6.setGeometry(QtCore.QRect(150, 90, 21, 20))
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 5, 1, 2, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
......@@ -72,21 +74,17 @@ class Ui_Filterwheel(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton.setText(_translate("MainWindow", "ON"))
self.label.setText(_translate("MainWindow", "Left filter wheel"))
self.label_2.setText(_translate("MainWindow", "Right filter wheel"))
self.label_5.setText(_translate("MainWindow", "Link"))
self.label_3.setText(_translate("MainWindow", "Left magnification changer"))
self.label_2.setText(_translate("MainWindow", "Right filter wheel"))
self.label_4.setText(_translate("MainWindow", "Right magnification changer"))
self.label_5.setText(_translate("MainWindow", "Link"))
self.pushButton.setText(_translate("MainWindow", "ON"))
self.label.setText(_translate("MainWindow", "Left filter wheel"))
self.label_6.setText(_translate("MainWindow", "Link"))
if __name__ == "__main__":
import sys
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_Filterwheel()
......
[445nm]
intensity = 33
[488nm]
intensity = 8
This diff is collapsed.
This diff is collapsed.
......@@ -14,258 +14,127 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>um</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Step</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>210</x>
<y>10</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>um</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3">
<property name="geometry">
<rect>
<x>20</x>
<y>70</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>um</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>130</x>
<y>70</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Step</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_4">
<property name="geometry">
<rect>
<x>160</x>
<y>70</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>210</x>
<y>70</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>um</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Z</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_5">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_5">
<property name="geometry">
<rect>
<x>70</x>
<y>130</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>um</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>130</x>
<y>130</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Step</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_6">
<property name="geometry">
<rect>
<x>160</x>
<y>130</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_6">
<property name="geometry">
<rect>
<x>210</x>
<y>130</y>
<width>41</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>um</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>R</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_7">
<property name="geometry">
<rect>
<x>20</x>
<y>190</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_7">
<property name="geometry">