예제 #1
0
파일: editor.py 프로젝트: NexeyaSGara/PANIC
 def onAckStateChanged(self,checked=False):
     if not self.validate('onAcknowledge(%s)'%checked,self._currentAlarm.tag):
         setCheckBox(self._dataWidget._wi.AcknowledgedCheckBox,int(not self._dataWidget._wi.AcknowledgedCheckBox.isChecked()))
         return
     print 'onAckStateChanged(%s,%s)'%(self.getCurrentAlarm().tag,checked)
     if checked:
         prompt=QtGui.QInputDialog
         cmt, reply=prompt.getText(self,'Input dialog','This will prevent reminders from being sent..\nType a comment to continue:')
         comment=get_user()+': '+str(cmt)
         #reply=Qt.QMessageBox.question(self,"Warning!","Alarm will be Acknowledged.\nDo you want to continue?\n"+
                 #self.getCurrentAlarm().tag,QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes)
         if reply == QtGui.QMessageBox.Yes:
             try:
                 print('\tacknowledge '+self.getCurrentAlarm().tag)
                 taurus.Device(self.getCurrentAlarm().device).command_inout('Acknowledge',[str(self.getCurrentAlarm().tag), str(comment)])
             except: print traceback.format_exc()
             setCheckBox(self._dataWidget._wi.ackCheckBox,True)
         else: #Clean up the checkbox
             setCheckBox(self._dataWidget._wi.ackCheckBox,not self.getCurrentAlarm().get_enabled())
     else:
         try:
             print('\trenounce '+self.getCurrentAlarm().tag)
             taurus.Device(self.getCurrentAlarm().device).command_inout('Renounce',str(self.getCurrentAlarm().tag))
         except: print traceback.format_exc()
         setCheckBox(self._dataWidget._wi.ackCheckBox,False)
     self.valueChanged()
예제 #2
0
파일: editor.py 프로젝트: NexeyaSGara/PANIC
 def ResetAlarm(self,alarm=None):
     prompt,cmt=QtGui.QInputDialog,''
     alarms = [self.getCurrentAlarm()]
     msg = 'The following alarms will be reseted:\n\t'+'\n\t'.join([t.tag for t in alarms])
     print 'In AlarmGUI.ResetAlarm(): %s'%msg
     while len(cmt)==0:
         cmt, ok=prompt.getText(self,'Input dialog',msg+'\n\n'+'Must type a comment to continue:')
         if not ok: return
     comment=get_user()+': '+cmt
     for alarm in alarms:
         try: alarm.reset(comment) #It also tries to reset hidden alarms
         except: print traceback.format_exc()
     self.valueChanged()
예제 #3
0
파일: editor.py 프로젝트: NexeyaSGara/PANIC
 def AcknowledgeAlarm(self):
     """THIS METHOD IS NEVER CALLED!?!?!?!?!?!?!"""
     alarm = self.getCurrentAlarm()
     print 'In AlarmForm.AcknowledgeAlarm(%s)' % (alarm.tag)
     comment, ok = QtGui.QInputDialog.getText(self,'Input dialog','Type a comment to continue:')
     comment = get_user()+': '+comment
     if ok and len(str(comment)) != 0:
         try:
             alarm.reset(comment) #... Why it resets instead of Acknowledge?
             #taurus.Device(alarm.device).command_inout('Acknowledge',[tag, comment])
         except:
             print traceback.format_exc()
         self.valueChanged()
     elif ok and len(str(comment)) < 3:
         self.AcknowledgeAlarm()
예제 #4
0
 def onDisStateChanged(self, checked=False):
     if not self.validate('onDisable(%s)' % checked,
                          self._currentAlarm.tag):
         setCheckBox(
             self._dataWidget._wi.disabledCheckBox,
             int(not self._dataWidget._wi.disabledCheckBox.isChecked()))
         return
     print 'onDisStateChanged(%s,%s)' % (self.getCurrentAlarm().tag,
                                         checked)
     if checked:
         reply = Qt.QMessageBox.question(
             self, "Warning!",
             "Alarm will be disabled.\nDo you want to continue?\n" +
             self.getCurrentAlarm().tag,
             QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
             QtGui.QMessageBox.Yes)
         if reply == QtGui.QMessageBox.Yes:
             comment = 'DISABLED by ' + get_user()
             try:
                 print('\tdisabling ' + self.getCurrentAlarm().tag)
                 taurus.Device(self.getCurrentAlarm().device).command_inout(
                     'Disable',
                     [str(self.getCurrentAlarm().tag),
                      str(comment)])
             except:
                 print traceback.format_exc()
             setCheckBox(self._dataWidget._wi.disabledCheckBox, True)
         else:  #Clean up the checkbox
             setCheckBox(self._dataWidget._wi.disabledCheckBox,
                         not self.getCurrentAlarm().get_enabled())
     else:
         try:
             print('\tenabling ' + self.getCurrentAlarm().tag)
             taurus.Device(self.getCurrentAlarm().device).command_inout(
                 'Enable', str(self.getCurrentAlarm().tag))
         except:
             print traceback.format_exc()
         setCheckBox(self._dataWidget._wi.disabledCheckBox, False)
     self.valueChanged()
예제 #5
0
파일: editor.py 프로젝트: sergirubio/panic
 def onDisStateChanged(self,checked=False):
     if not self.validate('onDisable(%s)'%checked,self._currentAlarm.tag):
         setCheckBox(self._dataWidget._wi.disabledCheckBox,int(not self._dataWidget._wi.disabledCheckBox.isChecked()))
         return
     print 'onDisStateChanged(%s,%s)'%(self.getCurrentAlarm().tag,checked)
     if checked:
         reply=Qt.QMessageBox.question(self,"Warning!","Alarm will be disabled.\nDo you want to continue?\n"+self.getCurrentAlarm().tag,
             QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes)
         if reply == QtGui.QMessageBox.Yes:
             comment='DISABLED by '+get_user()
             try:
                 print('\tdisabling '+self.getCurrentAlarm().tag)
                 taurus.Device(self.getCurrentAlarm().device).command_inout('Disable',[str(self.getCurrentAlarm().tag), str(comment)])
             except: print traceback.format_exc()
             setCheckBox(self._dataWidget._wi.disabledCheckBox,True)
         else: #Clean up the checkbox
             setCheckBox(self._dataWidget._wi.disabledCheckBox,not self.getCurrentAlarm().get_enabled())
     else:
         try:
             print('\tenabling '+self.getCurrentAlarm().tag)
             taurus.Device(self.getCurrentAlarm().device).command_inout('Enable',str(self.getCurrentAlarm().tag))
         except: print traceback.format_exc()
         setCheckBox(self._dataWidget._wi.disabledCheckBox,False)
     self.valueChanged()