PLCControler.py
changeset 570 37ba389e5c01
parent 567 eb523c4fa2da
child 616 8a60ffcfd70b
equal deleted inserted replaced
569:4ce166451816 570:37ba389e5c01
    21 #You should have received a copy of the GNU General Public
    21 #You should have received a copy of the GNU General Public
    22 #License along with this library; if not, write to the Free Software
    22 #License along with this library; if not, write to the Free Software
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24 
    24 
    25 from xml.dom import minidom
    25 from xml.dom import minidom
    26 from types import StringType, UnicodeType
    26 from types import StringType, UnicodeType, TupleType
    27 import cPickle
    27 import cPickle
    28 import os,sys,re
    28 import os,sys,re
    29 import datetime
    29 import datetime
    30 from time import localtime
    30 from time import localtime
    31 
    31 
   309             if properties is not None:
   309             if properties is not None:
   310                 self.Project.setfileHeader(properties)
   310                 self.Project.setfileHeader(properties)
   311                 self.Project.setcontentHeader(properties)
   311                 self.Project.setcontentHeader(properties)
   312             if name is not None or properties is not None:
   312             if name is not None or properties is not None:
   313                 self.BufferProject()
   313                 self.BufferProject()
   314             
   314     
       
   315     # Return project name
       
   316     def GetProjectName(self, debug=False):
       
   317         project = self.GetProject(debug)
       
   318         if project is not None:
       
   319             return project.getname()
       
   320         return None
       
   321     
   315     # Return project properties
   322     # Return project properties
   316     def GetProjectProperties(self, debug = False):
   323     def GetProjectProperties(self, debug = False):
   317         project = self.GetProject(debug)
   324         project = self.GetProject(debug)
   318         if project is not None:
   325         if project is not None:
   319             properties = project.getfileHeader()
   326             properties = project.getfileHeader()
  1356         if type is not None:
  1363         if type is not None:
  1357             return not type.startswith("ANY")
  1364             return not type.startswith("ANY")
  1358         return True
  1365         return True
  1359 
  1366 
  1360     def IsLocatableType(self, type, debug = False):
  1367     def IsLocatableType(self, type, debug = False):
       
  1368         if isinstance(type, TupleType):
       
  1369             return False 
  1361         project = self.GetProject(debug)
  1370         project = self.GetProject(debug)
  1362         if project is not None:
  1371         if project is not None:
  1363             datatype = project.getdataType(type)
  1372             datatype = project.getdataType(type)
  1364             if datatype is not None:
  1373             if datatype is not None:
  1365                 return project.IsLocatableType(datatype)
  1374                 return project.IsLocatableType(datatype)
  2693             if filepath:
  2702             if filepath:
  2694                 self.SetFilePath(filepath)
  2703                 self.SetFilePath(filepath)
  2695             return True
  2704             return True
  2696 
  2705 
  2697 #-------------------------------------------------------------------------------
  2706 #-------------------------------------------------------------------------------
       
  2707 #                       Search in Current Project Functions
       
  2708 #-------------------------------------------------------------------------------
       
  2709 
       
  2710     def SearchInProject(self, criteria):
       
  2711         return self.Project.Search(criteria)
       
  2712 
       
  2713 #-------------------------------------------------------------------------------
  2698 #                      Current Buffering Management Functions
  2714 #                      Current Buffering Management Functions
  2699 #-------------------------------------------------------------------------------
  2715 #-------------------------------------------------------------------------------
  2700 
  2716 
  2701     """
  2717     """
  2702     Return a copy of the project
  2718     Return a copy of the project