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"))
......
......@@ -14,431 +14,232 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QSlider" name="horizontalSlider">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>160</width>
<height>16</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>190</x>
<y>40</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>301</x>
<y>40</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>ms</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<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>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Delay</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Mode</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>40</x>
<y>100</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Right</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>40</x>
<y>120</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>120</x>
<y>120</y>
<width>59</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>130</x>
<y>100</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Link</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_2">
<property name="geometry">
<rect>
<x>160</x>
<y>120</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>160</x>
<y>100</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Left</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Lines</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_3">
<property name="geometry">
<rect>
<x>40</x>
<y>160</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>90</x>
<y>160</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<property name="geometry">
<rect>
<x>130</x>
<y>160</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="comboBox_4">
<property name="geometry">
<rect>
<x>160</x>
<y>160</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>210</x>
<y>160</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>40</x>
<y>190</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Crop ROI</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Top</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_5">
<property name="geometry">
<rect>
<x>40</x>
<y>210</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>90</x>
<y>210</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Width</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_6">
<property name="geometry">
<rect>
<x>40</x>
<y>240</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_5">
<property name="geometry">
<rect>
<x>90</x>
<y>240</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>130</x>
<y>210</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Left</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_7">
<property name="geometry">
<rect>
<x>170</x>
<y>210</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_6">
<property name="geometry">
<rect>
<x>220</x>
<y>210</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>130</x>
<y>240</y>
<width>39</width>
<height>11</height>
</rect>
</property>
<property name="text">
<string>Height</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_8">
<property name="geometry">
<rect>
<x>170</x>
<y>240</y>
<width>52</width>
<height>16</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_7">
<property name="geometry">
<rect>
<x>220</x>
<y>240</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_8">
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>71</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>Reset Crop ROI</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="2">
<widget class="QPushButton" name="pushButton_2">
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
</item>
<item row="7" column="3" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string>Reset Crop ROI</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Link</string>
</property>
</widget>
</item>
<item row="4" column="4" colspan="3">
<widget class="QComboBox" name="comboBox_2"/>
</item>
<item row="5" column="3">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_3"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Delay</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Crop ROI</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="5" column="4" colspan="2">
<widget class="QComboBox" name="comboBox_4"/>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="comboBox_5"/>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pushButton_5">
<property name="font">
<font>
<pointsize>6</pointsize>
</font>
</property>
<property name="text">
<string>px</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Lines</string>
</property>
</widget>
</item>
<item row="0" 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="1" column="0" colspan="5">
<widget class="QSlider" name="horizontalSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="5" colspan="2">
<widget class="QComboBox" name="comboBox_7"/>