eric6/Project/Project.py

changeset 8259
2bbec88047dd
parent 8258
82b608e352ec
child 8265
0090cfa83159
equal deleted inserted replaced
8258:82b608e352ec 8259:2bbec88047dd
605 "makefile": "OTHERS", 605 "makefile": "OTHERS",
606 "Makefile": "OTHERS", 606 "Makefile": "OTHERS",
607 } 607 }
608 608
609 # Sources 609 # Sources
610 if self.pdata["MIXEDLANGUAGE"]: 610 sourceKey = (
611 sourceKey = "Mixed" 611 "Mixed"
612 else: 612 if self.pdata["MIXEDLANGUAGE"] else
613 sourceKey = self.pdata["PROGLANGUAGE"] 613 self.pdata["PROGLANGUAGE"]
614 )
614 for ext in self.__sourceExtensions(sourceKey): 615 for ext in self.__sourceExtensions(sourceKey):
615 self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES" 616 self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES"
616 617
617 # IDL interfaces 618 # IDL interfaces
618 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES" 619 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES"
3128 Public slot to save the current project to a different file. 3129 Public slot to save the current project to a different file.
3129 3130
3130 @return flag indicating success (boolean) 3131 @return flag indicating success (boolean)
3131 """ 3132 """
3132 defaultFilter = self.tr("Project Files (*.epj)") 3133 defaultFilter = self.tr("Project Files (*.epj)")
3133 if self.ppath: 3134 defaultPath = (
3134 defaultPath = self.ppath 3135 self.ppath
3135 else: 3136 if self.ppath else
3136 defaultPath = ( 3137 (Preferences.getMultiProject("Workspace") or
3137 Preferences.getMultiProject("Workspace") or 3138 Utilities.getHomeDir())
3138 Utilities.getHomeDir() 3139 )
3139 )
3140 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 3140 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
3141 self.parent(), 3141 self.parent(),
3142 self.tr("Save project as"), 3142 self.tr("Save project as"),
3143 defaultPath, 3143 defaultPath,
3144 self.tr("Project Files (*.epj);;" 3144 self.tr("Project Files (*.epj);;"
4644 curpath = os.path.join(self.ppath, directory) 4644 curpath = os.path.join(self.ppath, directory)
4645 try: 4645 try:
4646 newSources = os.listdir(curpath) 4646 newSources = os.listdir(curpath)
4647 except OSError: 4647 except OSError:
4648 newSources = [] 4648 newSources = []
4649 if self.pdata["TRANSLATIONPATTERN"]: 4649 pattern = (
4650 pattern = ( 4650 self.pdata["TRANSLATIONPATTERN"].replace("%language%", "*")
4651 self.pdata["TRANSLATIONPATTERN"] 4651 if self.pdata["TRANSLATIONPATTERN"] else
4652 .replace("%language%", "*") 4652 "*.ts"
4653 ) 4653 )
4654 else:
4655 pattern = "*.ts"
4656 binpattern = self.__binaryTranslationFile(pattern) 4654 binpattern = self.__binaryTranslationFile(pattern)
4657 for ns in newSources: 4655 for ns in newSources:
4658 # ignore hidden files and directories 4656 # ignore hidden files and directories
4659 if ns.startswith('.'): 4657 if ns.startswith('.'):
4660 continue 4658 continue
5420 5418
5421 if not listOK: 5419 if not listOK:
5422 continue 5420 continue
5423 5421
5424 names = sorted(names) 5422 names = sorted(names)
5425 if archiveName: 5423 archive = (
5426 archive = os.path.join(self.ppath, archiveName) 5424 os.path.join(self.ppath, archiveName)
5427 else: 5425 if archiveName else
5428 archive = os.path.join( 5426 os.path.join(self.ppath,
5429 self.ppath, 5427 self.pdata["MAINSCRIPT"].replace(".py", ".zip"))
5430 self.pdata["MAINSCRIPT"].replace(".py", ".zip")) 5428 )
5431 try: 5429 try:
5432 archiveFile = zipfile.ZipFile(archive, "w") 5430 archiveFile = zipfile.ZipFile(archive, "w")
5433 except OSError as why: 5431 except OSError as why:
5434 E5MessageBox.critical( 5432 E5MessageBox.critical(
5435 self.ui, 5433 self.ui,
5656 not self.pdata["MAKEPARAMS"]["MakeEnabled"] or 5654 not self.pdata["MAKEPARAMS"]["MakeEnabled"] or
5657 self.__makeProcess is not None 5655 self.__makeProcess is not None
5658 ): 5656 ):
5659 return 5657 return
5660 5658
5661 if self.pdata["MAKEPARAMS"]["MakeExecutable"]: 5659 prog = (
5662 prog = self.pdata["MAKEPARAMS"]["MakeExecutable"] 5660 self.pdata["MAKEPARAMS"]["MakeExecutable"]
5663 else: 5661 if self.pdata["MAKEPARAMS"]["MakeExecutable"] else
5664 prog = Project.DefaultMake 5662 Project.DefaultMake
5663 )
5665 5664
5666 args = [] 5665 args = []
5667 if self.pdata["MAKEPARAMS"]["MakeParameters"]: 5666 if self.pdata["MAKEPARAMS"]["MakeParameters"]:
5668 args.extend(Utilities.parseOptionString( 5667 args.extend(Utilities.parseOptionString(
5669 self.pdata["MAKEPARAMS"]["MakeParameters"])) 5668 self.pdata["MAKEPARAMS"]["MakeParameters"]))

eric ide

mercurial