Commit ec22b789 authored by Spencer Du's avatar Spencer Du

Import relevant module from menu item implemented

parent bf0681e0
......@@ -34,30 +34,17 @@ class MainWindow(QtWidgets.QMainWindow):
client.subscribe("microscope/light_sheet_microscope/UI/devices")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI/devices")
client.publish("microscope/light_sheet_microscope/UI/devices", json.dumps({"type": "system", "payload":{"cmd": "get all devices"}}, indent=2))
time.sleep(1)
pybutton = QPushButton('Add device', self)
pybutton.clicked.connect(self.importbutton)
time.sleep(1)
pybutton.move(100, 400)
pybutton.resize(150, 32)
self.combo = QComboBox(self)
self.combo.move(100,350)
self.combo.resize(100, 32)
menubar = self.menuBar()
fileMenu = menubar.addMenu('Devices')
def readFile(fname):
try:
with open(fname, "r") as f:
for item in f:
menubar = self.menuBar()
fileMenu = menubar.addMenu('Devices')
deviceImport = QAction(item, self)
deviceImport = fileMenu.addAction(item)
deviceImport.triggered.connect(self.importbutton)
fileMenu.addAction(deviceImport)
self.combo.addItem(item, self.importbutton)
except:
print("No devices active")
readFile("list_of_device(s)_currently_active.txt")
......@@ -76,7 +63,8 @@ class MainWindow(QtWidgets.QMainWindow):
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()
sender = self.sender()
self.fileName_UI = sender.text()
self.loadGUI()
print("Device panel initialised" + "\n")
else:
......@@ -93,7 +81,8 @@ class MainWindow(QtWidgets.QMainWindow):
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()
sender = self.sender()
self.fileName_UI = sender.text()
self.loadGUI()
print("Laser config set" + "\n")
......
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