eric6/Project/Project.py

changeset 8205
4a0f1f896341
parent 8164
c8b88e73b56f
child 8218
7c09585bd960
equal deleted inserted replaced
8204:fd477cded1c1 8205:4a0f1f896341
2310 2310
2311 @param fn filename to be checked (string) 2311 @param fn filename to be checked (string)
2312 @return flag indicating, if the project contains the file (boolean) 2312 @return flag indicating, if the project contains the file (boolean)
2313 """ 2313 """
2314 fn = self.getRelativePath(fn) 2314 fn = self.getRelativePath(fn)
2315 if ( 2315 return (
2316 fn in self.pdata["SOURCES"] or 2316 fn in self.pdata["SOURCES"] or
2317 fn in self.pdata["FORMS"] or 2317 fn in self.pdata["FORMS"] or
2318 fn in self.pdata["INTERFACES"] or 2318 fn in self.pdata["INTERFACES"] or
2319 fn in self.pdata["PROTOCOLS"] or 2319 fn in self.pdata["PROTOCOLS"] or
2320 fn in self.pdata["RESOURCES"] or 2320 fn in self.pdata["RESOURCES"] or
2321 fn in self.pdata["OTHERS"] 2321 fn in self.pdata["OTHERS"]
2322 ): 2322 )
2323 return True
2324 else:
2325 return False
2326 2323
2327 def createNewProject(self): 2324 def createNewProject(self):
2328 """ 2325 """
2329 Public slot to built a new project. 2326 Public slot to built a new project.
2330 2327
3560 3557
3561 def startswithProjectPath(self, path): 3558 def startswithProjectPath(self, path):
3562 """ 3559 """
3563 Public method to check, if a path starts with the project path. 3560 Public method to check, if a path starts with the project path.
3564 3561
3565 @param path path to be checked (string) 3562 @param path path to be checked
3563 @type str
3566 @return flag indicating that the path starts with the project path 3564 @return flag indicating that the path starts with the project path
3567 (boolean) 3565 @rtype bool
3568 """ 3566 """
3569 if self.ppath: 3567 return (
3570 if path == self.ppath: 3568 bool(self.ppath) and
3571 return True 3569 (path == self.ppath or
3572 elif ( 3570 Utilities.normcasepath(Utilities.toNativeSeparators(path))
3573 Utilities.normcasepath(Utilities.toNativeSeparators(path)) 3571 .startswith(Utilities.normcasepath(
3574 .startswith(Utilities.normcasepath( 3572 Utilities.toNativeSeparators(self.ppath + "/")))
3575 Utilities.toNativeSeparators(self.ppath + "/"))) 3573 )
3576 ): 3574 )
3577 return True 3575
3578 else:
3579 return False
3580 else:
3581 return False
3582
3583 def getProjectFile(self): 3576 def getProjectFile(self):
3584 """ 3577 """
3585 Public method to get the path of the project file. 3578 Public method to get the path of the project file.
3586 3579
3587 @return path of the project file (string) 3580 @return path of the project file (string)
5557 Private method to create dir entries in the zip file. 5550 Private method to create dir entries in the zip file.
5558 5551
5559 @param path name of the directory entry to create (string) 5552 @param path name of the directory entry to create (string)
5560 @param zipFile open ZipFile object (zipfile.ZipFile) 5553 @param zipFile open ZipFile object (zipfile.ZipFile)
5561 """ 5554 """
5562 if path == "" or path == "/" or path == "\\": 5555 if path in ("", "/", "\\"):
5563 return 5556 return
5564 5557
5565 if not path.endswith("/") and not path.endswith("\\"): 5558 if not path.endswith("/") and not path.endswith("\\"):
5566 path = "{0}/".format(path) 5559 path = "{0}/".format(path)
5567 5560

eric ide

mercurial