Project/Project.py

changeset 651
e8020b9ac2b9
parent 613
5a6ee2af8ec0
child 765
e5cbb3f273eb
equal deleted inserted replaced
650:5f690e984e59 651:e8020b9ac2b9
12 import shutil 12 import shutil
13 import glob 13 import glob
14 import fnmatch 14 import fnmatch
15 import copy 15 import copy
16 import zipfile 16 import zipfile
17 import io
18 import re 17 import re
19 18
20 from PyQt4.QtCore import * 19 from PyQt4.QtCore import *
21 from PyQt4.QtGui import * 20 from PyQt4.QtGui import *
22 21
1808 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 1807 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]:
1809 fn = os.path.join(self.ppath, "__init__.py") 1808 fn = os.path.join(self.ppath, "__init__.py")
1810 f = open(fn, "w", encoding = "utf-8") 1809 f = open(fn, "w", encoding = "utf-8")
1811 f.close() 1810 f.close()
1812 self.appendFile(fn, True) 1811 self.appendFile(fn, True)
1812 # create an empty main script file, if a name was given
1813 if len(self.pdata["MAINSCRIPT"]) and self.pdata["MAINSCRIPT"][0]:
1814 if not os.path.isabs(self.pdata["MAINSCRIPT"][0]):
1815 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])
1816 else:
1817 ms = self.pdata["MAINSCRIPT"][0]
1818 f = open(ms, "w")
1819 f.close()
1820 self.appendFile(ms, True)
1813 tpd = os.path.join(self.ppath, self.translationsRoot) 1821 tpd = os.path.join(self.ppath, self.translationsRoot)
1814 if not self.translationsRoot.endswith(os.sep): 1822 if not self.translationsRoot.endswith(os.sep):
1815 tpd = os.path.dirname(tpd) 1823 tpd = os.path.dirname(tpd)
1816 if not os.path.isdir(tpd): 1824 if not os.path.isdir(tpd):
1817 os.makedirs(tpd) 1825 os.makedirs(tpd)
1832 if not os.path.exists(mgmtDir): 1840 if not os.path.exists(mgmtDir):
1833 os.makedirs(mgmtDir) 1841 os.makedirs(mgmtDir)
1834 1842
1835 try: 1843 try:
1836 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0]) 1844 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])
1837 if os.path.exists(ms): 1845 if not os.path.exists(ms):
1838 self.appendFile(ms) 1846 f = open(ms, "w")
1847 f.close()
1848 self.appendFile(ms)
1839 except IndexError: 1849 except IndexError:
1840 ms = "" 1850 ms = ""
1841 1851
1842 # add existing files to the project 1852 # add existing files to the project
1843 res = E5MessageBox.yesNo(self.ui, 1853 res = E5MessageBox.yesNo(self.ui,

eric ide

mercurial