Project/Project.py

changeset 833
89f29b985159
parent 816
53e282890577
child 862
eb8b32ebfaad
equal deleted inserted replaced
825:9cdec3c5bc07 833:89f29b985159
572 if removed: 572 if removed:
573 for file in removelist: 573 for file in removelist:
574 self.pdata[index].remove(file) 574 self.pdata[index].remove(file)
575 self.setDirty(True) 575 self.setDirty(True)
576 576
577 def __makePpathRe(self):
578 """
579 Private method to generate a regular expression for the project path.
580 """
581 ppathRe = (self.ppath + os.sep)\
582 .replace("\\","@@")\
583 .replace("/","@@")\
584 .replace("@@",r"[\\/]")
585 if Utilities.isWindowsPlatform():
586 self.ppathRe = re.compile(ppathRe, re.IGNORECASE)
587 else:
588 self.ppathRe = re.compile(ppathRe)
589
577 def __readProject(self, fn): 590 def __readProject(self, fn):
578 """ 591 """
579 Private method to read in a project (.e4p) file. 592 Private method to read in a project (.e4p) file.
580 593
581 @param fn filename of the project file to be read (string) 594 @param fn filename of the project file to be read (string)
595 .format(fn)) 608 .format(fn))
596 return False 609 return False
597 610
598 self.pfile = os.path.abspath(fn) 611 self.pfile = os.path.abspath(fn)
599 self.ppath = os.path.abspath(os.path.dirname(fn)) 612 self.ppath = os.path.abspath(os.path.dirname(fn))
600 if Utilities.isWindowsPlatform(): 613 self.__makePpathRe()
601 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE)
602 else:
603 self.ppathRe = re.compile(re.escape(self.ppath + os.sep))
604 614
605 # insert filename into list of recently opened projects 615 # insert filename into list of recently opened projects
606 self.__syncRecent() 616 self.__syncRecent()
607 617
608 if res: 618 if res:
684 res = False 694 res = False
685 695
686 if res: 696 if res:
687 self.pfile = os.path.abspath(fn) 697 self.pfile = os.path.abspath(fn)
688 self.ppath = os.path.abspath(os.path.dirname(fn)) 698 self.ppath = os.path.abspath(os.path.dirname(fn))
689 if Utilities.isWindowsPlatform(): 699 self.__makePpathRe()
690 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE)
691 else:
692 self.ppathRe = re.compile(re.escape(self.ppath + os.sep))
693 self.name = os.path.splitext(os.path.basename(fn))[0] 700 self.name = os.path.splitext(os.path.basename(fn))[0]
694 self.setDirty(False) 701 self.setDirty(False)
695 702
696 # insert filename into list of recently opened projects 703 # insert filename into list of recently opened projects
697 self.__syncRecent() 704 self.__syncRecent()
1773 1780
1774 dlg = PropertiesDialog(self, True) 1781 dlg = PropertiesDialog(self, True)
1775 if dlg.exec_() == QDialog.Accepted: 1782 if dlg.exec_() == QDialog.Accepted:
1776 self.closeProject() 1783 self.closeProject()
1777 dlg.storeData() 1784 dlg.storeData()
1778 if Utilities.isWindowsPlatform(): 1785 self.__makePpathRe()
1779 self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE)
1780 else:
1781 self.ppathRe = re.compile(re.escape(self.ppath + os.sep))
1782 self.pdata["VCS"] = ['None'] 1786 self.pdata["VCS"] = ['None']
1783 self.opened = True 1787 self.opened = True
1784 if not self.pdata["FILETYPES"]: 1788 if not self.pdata["FILETYPES"]:
1785 self.initFileTypes() 1789 self.initFileTypes()
1786 self.setDirty(True) 1790 self.setDirty(True)

eric ide

mercurial