コード例 #1
0
 def apply(self):
     if self.putOnApply:
         if self.node.on != self.node_state.get_active():
             try:
                 self.node.on = self.node_state.get_active()
             except Exception:
                 if self.node_state.get_active():
                     state = 'on'
                 else:
                     state = 'off'
                 MDSplusErrorMsg(
                     'Error setting node on/off state',
                     'Error turning node %s %s\n\n%s' %
                     (self.node.minpath, state, sys.exc_info()[1]))
                 raise
         if hasattr(self, 'xdbox'):
             try:
                 if self.node.compare(self.xdbox.value) != 1:
                     self.node.record = self.xdbox.value
                 self.reset()
             except Exception:
                 MDSplusErrorMsg(
                     'Error storing value',
                     'Error storing value in to %s\n\n%s' %
                     (self.node.minpath, sys.exc_info()[1]))
コード例 #2
0
 def apply(self):
     if self.putOnApply:
         if self.getNode().on != self.get_active():
             try:
                 self.getNode().on = self.get_active()
             except Exception:
                 if self.get_active():
                     state = 'on'
                 else:
                     state = 'off'
                 MDSplusErrorMsg(
                     'Error setting node on/off state',
                     'Error turning node %s %s\n\n%s' %
                     (self.getNode.minpath, state, sys.exc_info()[1]))
                 raise
         if self.getNode().on != self.get_active():
             try:
                 self.getNode().on = self.get_active()
             except Exception:
                 if self.get_active():
                     state = 'on'
                 else:
                     state = 'off'
                 MDSplusErrorMsg(
                     'Error setting node on/off state',
                     'Error turning node %s %s\n\n%s' %
                     (self.getNode.minpath, state, sys.exc_info()[1]))
                 raise
コード例 #3
0
 def getValue(self):
     ans=Window()
     t=self.startIdx.get_text()
     if t == '':
         ans.startIdx=None
     else:
         try:
             ans.startIdx=Data.compile(self.startIdx.get_text())
         except Exception:
             msg="Invalid startIdx specified.\n\n%s" % (sys.exc_info()[1],)
             MDSplusErrorMsg('Invalid StartIdx',msg)
             raise
     t=self.endIdx.get_text()
     if t == '':
         ans.endIdx=None
     else:
         try:
             ans.endIdx=Data.compile(self.endIdx.get_text())
         except Exception:
             msg="Invalid endIdx specified.\n\n%s" % (sys.exc_info()[1],)
             MDSplusErrorMsg('Invalid EndIdx',msg)
             raise
     t=self.timeAt0.get_text()
     if t != '':
         try:
             ans.timeAt0=Data.compile(self.timeAt0.get_text())
         except Exception:
             msg="Invalid timeAt0 specified.\n\n%s" % (sys.exc_info()[1],)
             MDSplusErrorMsg('Invalid TimeAt0',msg)
             raise
     return ans
コード例 #4
0
 def getValue(self):
     ans = Range()
     t = self.begin.get_text()
     if t == '':
         ans.begin = None
     else:
         try:
             ans.begin = Data.compile(self.begin.get_text())
         except Exception:
             msg = "Invalid begin specified.\n\n%s" % (sys.exc_info()[1], )
             MDSplusErrorMsg('Invalid Begin', msg)
             raise
     t = self.ending.get_text()
     if t == '':
         ans.ending = None
     else:
         try:
             ans.ending = Data.compile(self.ending.get_text())
         except Exception:
             msg = "Invalid ending specified.\n\n%s" % (sys.exc_info()[1], )
             MDSplusErrorMsg('Invalid Ending', msg)
             raise
     t = self.delta.get_text()
     if t != '':
         try:
             ans.delta = Data.compile(self.delta.get_text())
         except Exception:
             msg = "Invalid delta specified.\n\n%s" % (sys.exc_info()[1], )
             MDSplusErrorMsg('Invalid Delta', msg)
             raise
     return ans
コード例 #5
0
 def getValue(self):
     ans = Dispatch(dispatch_type=2)
     ans.ident = self.ident.get_text()
     try:
         ans.ident = Data.compile(ans.ident)
     except Exception:
         pass
     ans.phase = self.phase.get_text()
     try:
         ans.phase = Data.compile(ans.phase)
     except Exception:
         pass
     try:
         ans.when = Data.compile(self.sequence.get_text())
     except Exception:
         msg = "Invalid sequence specified.\n\n%s" % (sys.exc_info()[1], )
         MDSplusErrorMsg('Invalid Sequence', msg)
         raise
     ans.completion = self.event.get_text()
     if ans.completion == '':
         ans.completion = None
     else:
         try:
             ans.completion = Data.compile(ans.event)
         except Exception:
             pass
     return ans
コード例 #6
0
 def apply(self):
     if self.putOnApply:
         try:
             if self.node.compare(self.xdbox.value) != 1:
                 self.node.record=self.xdbox.value
             self.reset()
         except Exception:
             MDSplusErrorMsg('Error storing value','Error storing value in to %s\n\n%s' % (self.node.minpath,sys.exc_info()[1]))
コード例 #7
0
 def getValue(self):
     try:
         return Data.compile(self.get_text())
     except Exception:
         MDSplusErrorMsg(
             'Invalid Expression',
             'Invalid expression specified.\n\n%s\n\n%s' %
             (self.get_text(), sys.exc_info()[1]))
         raise
コード例 #8
0
 def getValue(self):
     ans = Method()
     ans.method = self.method.get_text()
     try:
         ans.method = Data.compile(ans.method)
     except Exception:
         pass
     try:
         ans.object = Data.compile(self.device.get_text())
     except Exception:
         msg = "Invalid device specified.\n\n%s" % (sys.exc_info()[1], )
         MDSplusErrorMsg('Invalid Device', msg)
         raise
     if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
         ans.timeout = None
     else:
         try:
             ans.timeout = Data.compile(self.timeout.get_text())
         except Exception:
             msg = "Invalid timeout specified.\n\n%s" % (
                 sys.exc_info()[1], )
             MDSplusErrorMsg('Invalid Timeout', msg)
             raise
     idx = len(self.args) - 1
     found = False
     while idx >= 0:
         t = self.args[idx].get_text()
         if t == '':
             if found:
                 ans.setArgumentAt(idx, None)
         else:
             try:
                 a = Data.compile(t)
             except Exception:
                 msg = "Invalid argument (%d) specified.\n\n%s" % (
                     idx + 1,
                     sys.exc_info()[1],
                 )
                 MDSplusErrorMsg('Invalid Argument', msg)
                 raise
             ans.setArgumentAt(idx, a)
             found = True
         idx = idx - 1
     return ans
コード例 #9
0
 def getValue(self):
     if self.get_text() == "":
         return None
     else:
         try:
             return self.node.compile(self.get_text())
         except Exception:
             MDSplusErrorMsg(
                 'Invalid value', 'Invalid value specified.\n\n%s\n\n%s' %
                 (self.get_text(), sys.exc_info()[1]))
             raise
コード例 #10
0
 def applyPart(self, channel, field, idx):
     value = channel[field].get_text()
     if value == '':
         value = None
     else:
         try:
             value = Data.compile(value)
         except Exception:
             MDSplusErrorMsg(
                 'Invalid value',
                 'Error compiling %s for channel %d\n\n%s\n\n%s' %
                 (field, idx, value, sys.exc_info()[1]))
             raise
     try:
         if channel[field + 'Node'].compare(value) != 1:
             channel[field + 'Node'].record = value
     except Exception:
         MDSplusErrorMsg(
             'Error storing value',
             'Error storing value %s for channel %d\n\n\%s' %
             (field, idx, sys.exc_info()[1]))
コード例 #11
0
 def getValue(self):
     ans=Routine()
     ans.image=self.image.get_text()
     try:
         ans.image=Data.compile(ans.image)
     except Exception:
         pass
     ans.routine=self.routine.get_text()
     try:
         ans.routine=Data.compile(ans.routine)
     except Exception:
         pass
     if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
         ans.timeout=None
     else:
         try:
             ans.timeout=Data.compile(self.timeout.get_text())
         except Exception:
             msg="Invalid timeout specified.\n\n%s" % (sys.exc_info()[1],)
             MDSplusErrorMsg('Invalid Timeout',msg)
             raise
     idx=len(self.args)-1
     found=False
     while idx >= 0:
         t = self.args[idx].get_text()
         if t == '':
             if found:
                 ans.setArgumentAt(idx,None)
         else:
             try:
                 a=Data.compile(t)
             except Exception:
                 msg="Invalid argument specified.\n\n%s" % (sys.exc_info()[1],)
                 MDSplusErrorMsg('Invalid Argument',msg)
                 raise
             ans.setArgumentAt(idx,a)
             found=True
         idx=idx-1
     return ans
コード例 #12
0
 def apply(self):
     if self.putOnApply:
         idx = 0
         for channel in self.channels:
             idx = idx + 1
             if channel['dataNode'].on != channel['on'].get_active():
                 try:
                     channel['dataNode'].on = channel['on'].get_active()
                 except Exception:
                     if channel['on'].get_active():
                         state = 'on'
                     else:
                         state = 'off'
                     MDSplusErrorMsg(
                         'Error setting node on/off state',
                         'Error turning node %s %s\n\n%s' %
                         (channel['dataNode'].minpath, state,
                          sys.exc_info()[1]))
                     raise
             self.applyPart(channel, 'startIdx', idx)
             self.applyPart(channel, 'endIdx', idx)
             if self.incNidOffset > -1:
                 self.applyPart(channel, 'inc', idx)