Project/Project.py

changeset 788
5b1b59777460
parent 765
e5cbb3f273eb
child 791
9ec2ac20e54e
equal deleted inserted replaced
786:06290d4db8ab 788:5b1b59777460
190 QObject.__init__(self, parent) 190 QObject.__init__(self, parent)
191 191
192 self.ui = parent 192 self.ui = parent
193 193
194 self.sourceExtensions = { 194 self.sourceExtensions = {
195 "Python" : Preferences.getPython("PythonExtensions"), 195 "Python2" : Preferences.getPython("PythonExtensions"),
196 "Python3" : Preferences.getPython("Python3Extensions"), 196 "Python3" : Preferences.getPython("Python3Extensions"),
197 "Ruby" : ['.rb'], 197 "Ruby" : ['.rb'],
198 "Mixed" : ['.py', '.ptl', '.rb'] 198 "Mixed" : ['.py', '.ptl', '.rb']
199 } 199 }
200 200
201 self.dbgFilters = { 201 self.dbgFilters = {
202 "Python" : self.trUtf8( 202 "Python2" : self.trUtf8(
203 "Python Files (*.py2);;" 203 "Python2 Files (*.py2);;"
204 "Python GUI Files (*.pyw2);;"), 204 "Python2 GUI Files (*.pyw2);;"),
205 "Python3" : self.trUtf8( 205 "Python3" : self.trUtf8(
206 "Python3 Files (*.py *.py3);;" 206 "Python3 Files (*.py *.py3);;"
207 "Python3 GUI Files (*.pyw *.pyw3);;"), 207 "Python3 GUI Files (*.pyw *.pyw3);;"),
208 "Ruby" : self.trUtf8("Ruby Files (*.rb);;"), 208 "Ruby" : self.trUtf8("Ruby Files (*.rb);;"),
209 } 209 }
1821 .format(self.ppath)) 1821 .format(self.ppath))
1822 self.vcs = self.initVCS() 1822 self.vcs = self.initVCS()
1823 return 1823 return
1824 # create an empty __init__.py file to make it a Python package 1824 # create an empty __init__.py file to make it a Python package
1825 # (only for Python and Python3) 1825 # (only for Python and Python3)
1826 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 1826 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]:
1827 fn = os.path.join(self.ppath, "__init__.py") 1827 fn = os.path.join(self.ppath, "__init__.py")
1828 f = open(fn, "w", encoding = "utf-8") 1828 f = open(fn, "w", encoding = "utf-8")
1829 f.close() 1829 f.close()
1830 self.appendFile(fn, True) 1830 self.appendFile(fn, True)
1831 # create an empty main script file, if a name was given 1831 # create an empty main script file, if a name was given
1875 yesDefault = True) 1875 yesDefault = True)
1876 if res: 1876 if res:
1877 self.newProjectAddFiles(ms) 1877 self.newProjectAddFiles(ms)
1878 # create an empty __init__.py file to make it a Python package 1878 # create an empty __init__.py file to make it a Python package
1879 # if none exists (only for Python and Python3) 1879 # if none exists (only for Python and Python3)
1880 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 1880 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]:
1881 fn = os.path.join(self.ppath, "__init__.py") 1881 fn = os.path.join(self.ppath, "__init__.py")
1882 if not os.path.exists(fn): 1882 if not os.path.exists(fn):
1883 f = open(fn, "w", encoding = "utf-8") 1883 f = open(fn, "w", encoding = "utf-8")
1884 f.close() 1884 f.close()
1885 self.appendFile(fn, True) 1885 self.appendFile(fn, True)
2058 if fnmatch.fnmatch(ts, pattern): 2058 if fnmatch.fnmatch(ts, pattern):
2059 self.pdata["TRANSLATIONS"].append(ts) 2059 self.pdata["TRANSLATIONS"].append(ts)
2060 self.projectLanguageAdded.emit(ts) 2060 self.projectLanguageAdded.emit(ts)
2061 if len(self.pdata["MAINSCRIPT"]) == 0 or \ 2061 if len(self.pdata["MAINSCRIPT"]) == 0 or \
2062 len(self.pdata["MAINSCRIPT"][0]) == 0: 2062 len(self.pdata["MAINSCRIPT"][0]) == 0:
2063 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 2063 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]:
2064 self.pdata["MAINSCRIPT"] = ['{0}.py'.format(mainscriptname)] 2064 self.pdata["MAINSCRIPT"] = ['{0}.py'.format(mainscriptname)]
2065 elif self.pdata["PROGLANGUAGE"][0] == "Ruby": 2065 elif self.pdata["PROGLANGUAGE"][0] == "Ruby":
2066 self.pdata["MAINSCRIPT"] = ['{0}.rb'.format(mainscriptname)] 2066 self.pdata["MAINSCRIPT"] = ['{0}.rb'.format(mainscriptname)]
2067 if self.pdata["TRANSLATIONSBINPATH"]: 2067 if self.pdata["TRANSLATIONSBINPATH"]:
2068 tpd = os.path.join(self.ppath, 2068 tpd = os.path.join(self.ppath,

eric ide

mercurial