ConfigTreeNode.py
changeset 1739 ec153828ded2
parent 1738 d2e979738700
child 1740 b789b695b5c6
equal deleted inserted replaced
1738:d2e979738700 1739:ec153828ded2
   451         # Now, try to guess the nearest available channel
   451         # Now, try to guess the nearest available channel
   452         res = DesiredChannel
   452         res = DesiredChannel
   453         while res in AllChannels:  # While channel not free
   453         while res in AllChannels:  # While channel not free
   454             if res < CurrentChannel:  # Want to go down ?
   454             if res < CurrentChannel:  # Want to go down ?
   455                 res -=  1  # Test for n-1
   455                 res -=  1  # Test for n-1
   456                 if res < 0 :
   456                 if res < 0:
   457                     self.GetCTRoot().logger.write_warning(_("Cannot find lower free IEC channel than %d\n") % CurrentChannel)
   457                     self.GetCTRoot().logger.write_warning(_("Cannot find lower free IEC channel than %d\n") % CurrentChannel)
   458                     return CurrentChannel  # Can't go bellow 0, do nothing
   458                     return CurrentChannel  # Can't go bellow 0, do nothing
   459             else :  # Want to go up ?
   459             else:  # Want to go up ?
   460                 res +=  1  # Test for n-1
   460                 res +=  1  # Test for n-1
   461         # Finally set IEC Channel
   461         # Finally set IEC Channel
   462         self.BaseParams.setIEC_Channel(res)
   462         self.BaseParams.setIEC_Channel(res)
   463         return res
   463         return res
   464 
   464