canfestival/canfestival.py
changeset 2459 21164625b393
parent 2442 b13f021c68a5
child 2736 a81b72ef156c
equal deleted inserted replaced
2458:2a70d5240300 2459:21164625b393
    22 # You should have received a copy of the GNU General Public License
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
       
    27 from __future__ import division
    27 import os
    28 import os
    28 import sys
    29 import sys
    29 import shutil
    30 import shutil
    30 import wx
    31 import wx
    31 from gnosis.xml.pickle import *  # pylint: disable=import-error
    32 from gnosis.xml.pickle import *  # pylint: disable=import-error
   325     def SetParamsAttribute(self, path, value):
   326     def SetParamsAttribute(self, path, value):
   326         if path == "CanFestivalNode.NodeId":
   327         if path == "CanFestivalNode.NodeId":
   327             nodeid = self.CanFestivalNode.getNodeId()
   328             nodeid = self.CanFestivalNode.getNodeId()
   328             if value != nodeid:
   329             if value != nodeid:
   329                 slaves = self.GetSlaveIDs()
   330                 slaves = self.GetSlaveIDs()
   330                 dir = (value - nodeid) / abs(value - nodeid)
   331                 dir = (value - nodeid) // abs(value - nodeid)
   331                 while value in slaves and value >= 0:
   332                 while value in slaves and value >= 0:
   332                     value += dir
   333                     value += dir
   333                 if value < 0:
   334                 if value < 0:
   334                     value = nodeid
   335                     value = nodeid
   335 
   336 
   614         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], local_canfestival_config.getLDFLAGS(CanFestivalPath), True
   615         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))], local_canfestival_config.getLDFLAGS(CanFestivalPath), True
   615 
   616 
   616         if can_driver is not None:
   617         if can_driver is not None:
   617             can_driver_path = os.path.join(CanFestivalPath, "drivers", can_driver, can_driver_name)
   618             can_driver_path = os.path.join(CanFestivalPath, "drivers", can_driver, can_driver_name)
   618             if os.path.exists(can_driver_path):
   619             if os.path.exists(can_driver_path):
   619                 res += ((can_driver_name, file(can_driver_path, "rb")),)
   620                 res += ((can_driver_name, open(can_driver_path, "rb")),)
   620 
   621 
   621         return res
   622         return res