Project/Project.py

branch
5_0_x
changeset 827
e7f6008ab82b
parent 792
a13346916170
equal deleted inserted replaced
823:64fa9ab70ddd 827:e7f6008ab82b
539 if removed: 539 if removed:
540 for file in removelist: 540 for file in removelist:
541 self.pdata[index].remove(file) 541 self.pdata[index].remove(file)
542 self.setDirty(True) 542 self.setDirty(True)
543 543
544 def __makePpathRe(self):
545 """
546 Private method to generate a regular expression for the project path.
547 """
548 ppathRe = (self.ppath + os.sep)\
549 .replace("\\","@@")\
550 .replace("/","@@")\
551 .replace("@@",r"[\\/]")
552 if Utilities.isWindowsPlatform():
553 self.ppathRe = re.compile(ppathRe, re.IGNORECASE)
554 else:
555 self.ppathRe = re.compile(ppathRe)
556
544 def __readProject(self, fn): 557 def __readProject(self, fn):
545 """ 558 """
546 Private method to read in a project (.e4p, .e4pz) file. 559 Private method to read in a project (.e4p, .e4pz) file.
547 560
548 @param fn filename of the project file to be read (string) 561 @param fn filename of the project file to be read (string)
575 .format(fn)) 588 .format(fn))
576 return False 589 return False
577 590
578 self.pfile = os.path.abspath(fn) 591 self.pfile = os.path.abspath(fn)
579 self.ppath = os.path.abspath(os.path.dirname(fn)) 592 self.ppath = os.path.abspath(os.path.dirname(fn))
580 if Utilities.isWindowsPlatform(): 593 self.__makePpathRe()
581 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE)
582 else:
583 self.ppathRe = re.compile(re.escape(self.ppath + os.sep))
584 594
585 # insert filename into list of recently opened projects 595 # insert filename into list of recently opened projects
586 self.__syncRecent() 596 self.__syncRecent()
587 597
588 # now read the file 598 # now read the file
734 res = self.__writeXMLProject(fn) 744 res = self.__writeXMLProject(fn)
735 745
736 if res: 746 if res:
737 self.pfile = os.path.abspath(fn) 747 self.pfile = os.path.abspath(fn)
738 self.ppath = os.path.abspath(os.path.dirname(fn)) 748 self.ppath = os.path.abspath(os.path.dirname(fn))
739 if Utilities.isWindowsPlatform(): 749 self.__makePpathRe()
740 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE)
741 else:
742 self.ppathRe = re.compile(re.escape(self.ppath + os.sep))
743 self.name = os.path.splitext(os.path.basename(fn))[0] 750 self.name = os.path.splitext(os.path.basename(fn))[0]
744 self.setDirty(False) 751 self.setDirty(False)
745 752
746 # insert filename into list of recently opened projects 753 # insert filename into list of recently opened projects
747 self.__syncRecent() 754 self.__syncRecent()
2255 2262
2256 dlg = PropertiesDialog(self, True) 2263 dlg = PropertiesDialog(self, True)
2257 if dlg.exec_() == QDialog.Accepted: 2264 if dlg.exec_() == QDialog.Accepted:
2258 self.closeProject() 2265 self.closeProject()
2259 dlg.storeData() 2266 dlg.storeData()
2260 if Utilities.isWindowsPlatform(): 2267 self.__makePpathRe()
2261 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE)
2262 else:
2263 self.ppathRe = re.compile(re.escape(self.ppath + os.sep))
2264 self.pdata["VCS"] = ['None'] 2268 self.pdata["VCS"] = ['None']
2265 self.opened = True 2269 self.opened = True
2266 if not self.pdata["FILETYPES"]: 2270 if not self.pdata["FILETYPES"]:
2267 self.initFileTypes() 2271 self.initFileTypes()
2268 self.setDirty(True) 2272 self.setDirty(True)

eric ide

mercurial