Exemple #1
0
 def onMacroStatusUpdated(self, data):
     macro = data[0]
     if macro is None:
         return
     data = data[1][0]
     state, range, step, id = data["state"], data["range"], data[
         "step"], data["id"]
     if id is None:
         return
     id = int(id)
     if id != self.macroId():
         return
     macroName = macro.name
     shortMessage = ""
     if state == "start":
         self.macroStarted.emit("DoorOutput")
         self.macroProgressBar.setRange(range[0], range[1])
         self.playMacroAction.setEnabled(False)
         self.pauseMacroAction.setEnabled(True)
         self.stopMacroAction.setEnabled(True)
         self.plotablesFilterChanged.emit(None)
         self.plotablesFilterChanged.emit(standardPlotablesFilter)
         shortMessage = "Macro %s started." % macroName
     elif state == "pause":
         self.playMacroAction.setText("Resume macro")
         self.playMacroAction.setToolTip("Resume macro")
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         shortMessage = "Macro %s paused." % macroName
     elif state == "resume":
         self.playMacroAction.setText("Start macro")
         self.playMacroAction.setToolTip("Start macro")
         self.playMacroAction.setEnabled(False)
         self.pauseMacroAction.setEnabled(True)
         shortMessage = "Macro %s resumed." % macroName
     elif state == "stop" or state == "finish":
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         self.stopMacroAction.setEnabled(False)
         shortMessage = "Macro %s finished." % macroName
     elif state == "exception":
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         self.stopMacroAction.setEnabled(False)
         shortMessage = "Macro %s error." % macroName
         exc_value, exc_stack = data['exc_value'], data['exc_stack']
         exceptionDialog = TaurusMessageBox(MacroRunException, exc_value,
                                            exc_stack)
         exceptionDialog.exec_()
     elif state == "abort":
         self.playMacroAction.setText("Start macro")
         self.playMacroAction.setToolTip("Start macro")
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         self.stopMacroAction.setEnabled(False)
         shortMessage = "Macro %s stopped." % macroName
     elif state == "step":
         shortMessage = "Macro %s at %d %% of progress." % (macroName, step)
     self.shortMessageEmitted.emit(shortMessage)
     self.macroProgressBar.setValue(step)
Exemple #2
0
 def onMacroStatusUpdated(self, data):
     macro = data[0]
     if macro is None:
         return
     data = data[1][0]
     state, range, step, id = data["state"], data[
         "range"], data["step"], data["id"]
     if id is None:
         return
     id = int(id)
     if id != self.macroId():
         return
     macroName = macro.name
     shortMessage = ""
     if state == "start":
         self.macroStarted.emit("DoorOutput")
         self.macroProgressBar.setRange(range[0], range[1])
         self.playMacroAction.setEnabled(False)
         self.pauseMacroAction.setEnabled(True)
         self.stopMacroAction.setEnabled(True)
         self.plotablesFilterChanged.emit(None)
         self.plotablesFilterChanged.emit(standardPlotablesFilter)
         shortMessage = "Macro %s started." % macroName
     elif state == "pause":
         self.playMacroAction.setText("Resume macro")
         self.playMacroAction.setToolTip("Resume macro")
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         shortMessage = "Macro %s paused." % macroName
     elif state == "resume":
         self.playMacroAction.setText("Start macro")
         self.playMacroAction.setToolTip("Start macro")
         self.playMacroAction.setEnabled(False)
         self.pauseMacroAction.setEnabled(True)
         shortMessage = "Macro %s resumed." % macroName
     elif state == "stop" or state == "finish":
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         self.stopMacroAction.setEnabled(False)
         shortMessage = "Macro %s finished." % macroName
     elif state == "exception":
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         self.stopMacroAction.setEnabled(False)
         shortMessage = "Macro %s error." % macroName
         exc_value, exc_stack = data['exc_value'], data['exc_stack']
         exceptionDialog = TaurusMessageBox(
             MacroRunException, exc_value, exc_stack)
         exceptionDialog.exec_()
     elif state == "abort":
         self.playMacroAction.setText("Start macro")
         self.playMacroAction.setToolTip("Start macro")
         self.playMacroAction.setEnabled(True)
         self.pauseMacroAction.setEnabled(False)
         self.stopMacroAction.setEnabled(False)
         shortMessage = "Macro %s stopped." % macroName
     elif state == "step":
         shortMessage = "Macro %s at %d %% of progress." % (macroName, step)
     self.shortMessageEmitted.emit(shortMessage)
     self.macroProgressBar.setValue(step)
Exemple #3
0
 def safe_run(self, conn):
     # child process
     try:
         return self.run(conn)
     except Exception as e:
         msgbox = TaurusMessageBox(*sys.exc_info())
         conn.send((e, False))
         msgbox.exec_()
 def reconnect(self):
     dev = self.getModelObj()
     if not dev:
         return
     try:
         dev.Init()
     except:
         msgbox = TaurusMessageBox(*sys.exc_info())
         msgbox.exec_()
 def stop(self):
     dev = self.getModelObj()
     if not dev:
         return
     try:
         dev.Stop()
     except:
         msgbox = TaurusMessageBox(*sys.exc_info())
         msgbox.exec_()
Exemple #6
0
 def on_toggle(self, down):
     try:
         self._on_toggle(down)
     except:
         import sys
         from taurus.qt.qtgui.dialog import TaurusMessageBox
         msgbox = TaurusMessageBox(*sys.exc_info())
         msgbox.setWindowTitle("Error locking device")
         if self.update_button().status == LockStatus.Locked:
             msgbox.setText(self._lock_info.status_msg)
         msgbox.exec_()
Exemple #7
0
 def on_toggle(self, down):
     try:
         self._on_toggle(down)
     except:
         import sys
         from taurus.qt.qtgui.dialog import TaurusMessageBox
         msgbox = TaurusMessageBox(*sys.exc_info())
         msgbox.setWindowTitle("Error locking device")
         if self.update_button().status == LockStatus.Locked:
             msgbox.setText(self._lock_info.status_msg)
         msgbox.exec_()
Exemple #8
0
 def onMacroStatusUpdated(self, data):
     macro = data[0]
     if macro is None:
         return
     data = data[1][0]
     state, range, step, id = str(
         data["state"]), data["range"], data["step"], data["id"]
     if id is None:
         return
     id = int(id)
     if not id in self.macroIds():
         return
     macroName = macro.name
     shortMessage = ""
     if state == "start":
         #@todo: Check this signal because it doesn't work,
         # emitExecutionStarted is not set!!!
         if self.emitExecutionStarted():
             self.macroStarted.emit("DoorOutput")
         self.tree.setRangeForMacro(id, range)
         self.playSequenceAction.setEnabled(False)
         self.pauseSequenceAction.setEnabled(True)
         self.stopSequenceAction.setEnabled(True)
         if id == self.firstMacroId():
             self.plotablesFilterChanged.emit(None)
             self.plotablesFilterChanged.emit(standardPlotablesFilter)
             shortMessage = "Sequence started."
         elif not self.isFullSequencePlot():
             self.plotablesFilterChanged.emit(None)
         shortMessage += " Macro %s started." % macroName
     elif state == "pause":
         self.playSequenceAction.setText("Resume sequence")
         self.playSequenceAction.setToolTip("Resume sequence")
         self.playSequenceAction.setEnabled(True)
         self.pauseSequenceAction.setEnabled(False)
         shortMessage = "Macro %s paused." % macroName
     elif state == "resume":
         self.playSequenceAction.setText("Start sequence")
         self.playSequenceAction.setToolTip("Start sequence")
         self.playSequenceAction.setEnabled(False)
         self.pauseSequenceAction.setEnabled(True)
         shortMessage = "Macro %s resumed." % macroName
     elif state == "stop" or state == "finish":
         shortMessage = "Macro %s finished." % macroName
         if id == self.lastMacroId():
             self.playSequenceAction.setEnabled(True)
             self.pauseSequenceAction.setEnabled(False)
             self.stopSequenceAction.setEnabled(False)
             shortMessage += " Sequence finished."
     elif state == 'exception':
         self.playSequenceAction.setEnabled(True)
         self.pauseSequenceAction.setEnabled(False)
         self.stopSequenceAction.setEnabled(False)
         shortMessage = "Macro %s error." % macroName
         exc_value, exc_stack = data['exc_value'], data['exc_stack']
         exceptionDialog = TaurusMessageBox(MacroRunException, exc_value,
                                            exc_stack)
         exceptionDialog.exec_()
     elif state == 'abort':
         self.playSequenceAction.setText("Start sequence")
         self.playSequenceAction.setToolTip("Start sequence")
         self.playSequenceAction.setEnabled(True)
         self.pauseSequenceAction.setEnabled(False)
         self.stopSequenceAction.setEnabled(False)
         shortMessage = "Macro %s stopped." % macroName
     elif state == "step":
         shortMessage = "Macro %s at %d %% of progress." % (macroName, step)
     self.shortMessageEmitted.emit(shortMessage)
     self.tree.setProgressForMacro(id, step)
Exemple #9
0
 def onMacroStatusUpdated(self, data):
     macro = data[0]
     if macro is None:
         return
     data = data[1][0]
     state, range, step, id = str(data["state"]), data[
         "range"], data["step"], data["id"]
     if id is None:
         return
     id = int(id)
     if not id in self.macroIds():
         return
     macroName = macro.name
     shortMessage = ""
     if state == "start":
         #@todo: Check this signal because it doesn't work,
         # emitExecutionStarted is not set!!!
         if self.emitExecutionStarted():
             self.macroStarted.emit("DoorOutput")
         self.tree.setRangeForMacro(id, range)
         self.playSequenceAction.setEnabled(False)
         self.pauseSequenceAction.setEnabled(True)
         self.stopSequenceAction.setEnabled(True)
         if id == self.firstMacroId():
             self.plotablesFilterChanged.emit(None)
             self.plotablesFilterChanged.emit(standardPlotablesFilter)
             shortMessage = "Sequence started."
         elif not self.isFullSequencePlot():
             self.plotablesFilterChanged.emit(None)
         shortMessage += " Macro %s started." % macroName
     elif state == "pause":
         self.playSequenceAction.setText("Resume sequence")
         self.playSequenceAction.setToolTip("Resume sequence")
         self.playSequenceAction.setEnabled(True)
         self.pauseSequenceAction.setEnabled(False)
         shortMessage = "Macro %s paused." % macroName
     elif state == "resume":
         self.playSequenceAction.setText("Start sequence")
         self.playSequenceAction.setToolTip("Start sequence")
         self.playSequenceAction.setEnabled(False)
         self.pauseSequenceAction.setEnabled(True)
         shortMessage = "Macro %s resumed." % macroName
     elif state == "stop" or state == "finish":
         shortMessage = "Macro %s finished." % macroName
         if id == self.lastMacroId():
             self.playSequenceAction.setEnabled(True)
             self.pauseSequenceAction.setEnabled(False)
             self.stopSequenceAction.setEnabled(False)
             shortMessage += " Sequence finished."
     elif state == 'exception':
         self.playSequenceAction.setEnabled(True)
         self.pauseSequenceAction.setEnabled(False)
         self.stopSequenceAction.setEnabled(False)
         shortMessage = "Macro %s error." % macroName
         exc_value, exc_stack = data['exc_value'], data['exc_stack']
         exceptionDialog = TaurusMessageBox(
             MacroRunException, exc_value, exc_stack)
         exceptionDialog.exec_()
     elif state == 'abort':
         self.playSequenceAction.setText("Start sequence")
         self.playSequenceAction.setToolTip("Start sequence")
         self.playSequenceAction.setEnabled(True)
         self.pauseSequenceAction.setEnabled(False)
         self.stopSequenceAction.setEnabled(False)
         shortMessage = "Macro %s stopped." % macroName
     elif state == "step":
         shortMessage = "Macro %s at %d %% of progress." % (macroName,
                                                            step)
     self.shortMessageEmitted.emit(shortMessage)
     self.tree.setProgressForMacro(id, step)