2217 "<p>The project directory <b>{0}</b> is not" |
2217 "<p>The project directory <b>{0}</b> is not" |
2218 " writable.</p>") |
2218 " writable.</p>") |
2219 .format(self.ppath)) |
2219 .format(self.ppath)) |
2220 return |
2220 return |
2221 |
2221 |
2222 try: |
2222 if self.pdata["MAINSCRIPT"]: |
2223 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) |
2223 if not os.path.isabs(self.pdata["MAINSCRIPT"]): |
|
2224 ms = os.path.join( |
|
2225 self.ppath, self.pdata["MAINSCRIPT"]) |
|
2226 else: |
|
2227 ms = self.pdata["MAINSCRIPT"] |
2224 if not os.path.exists(ms): |
2228 if not os.path.exists(ms): |
2225 try: |
2229 try: |
2226 f = open(ms, "w") |
2230 f = open(ms, "w") |
2227 f.close() |
2231 f.close() |
2228 except EnvironmentError as err: |
2232 except EnvironmentError as err: |
2232 self.tr( |
2236 self.tr( |
2233 "<p>The mainscript <b>{0}</b> could not" |
2237 "<p>The mainscript <b>{0}</b> could not" |
2234 " be created.<br/>Reason: {1}</p>") |
2238 " be created.<br/>Reason: {1}</p>") |
2235 .format(self.ppath, str(err))) |
2239 .format(self.ppath, str(err))) |
2236 self.appendFile(ms) |
2240 self.appendFile(ms) |
2237 except IndexError: |
2241 else: |
2238 ms = "" |
2242 ms = "" |
2239 |
2243 |
2240 # add existing files to the project |
2244 # add existing files to the project |
2241 res = E5MessageBox.yesNo( |
2245 res = E5MessageBox.yesNo( |
2242 self.ui, |
2246 self.ui, |
2482 dlg = PropertiesDialog(self, False) |
2486 dlg = PropertiesDialog(self, False) |
2483 if dlg.exec_() == QDialog.Accepted: |
2487 if dlg.exec_() == QDialog.Accepted: |
2484 projectType = self.pdata["PROJECTTYPE"] |
2488 projectType = self.pdata["PROJECTTYPE"] |
2485 dlg.storeData() |
2489 dlg.storeData() |
2486 self.setDirty(True) |
2490 self.setDirty(True) |
2487 try: |
2491 if self.pdata["MAINSCRIPT"]: |
2488 ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) |
2492 if not os.path.isabs(self.pdata["MAINSCRIPT"]): |
|
2493 ms = os.path.join( |
|
2494 self.ppath, self.pdata["MAINSCRIPT"]) |
|
2495 else: |
|
2496 ms = self.pdata["MAINSCRIPT"] |
2489 if os.path.exists(ms): |
2497 if os.path.exists(ms): |
2490 self.appendFile(ms) |
2498 self.appendFile(ms) |
2491 except IndexError: |
|
2492 pass |
|
2493 |
2499 |
2494 if self.pdata["PROJECTTYPE"] != projectType: |
2500 if self.pdata["PROJECTTYPE"] != projectType: |
2495 # reinitialize filetype associations |
2501 # reinitialize filetype associations |
2496 self.initFileTypes() |
2502 self.initFileTypes() |
2497 |
2503 |
2754 .regenerateProjectTasks(quiet=True) |
2760 .regenerateProjectTasks(quiet=True) |
2755 |
2761 |
2756 if restoreSession: |
2762 if restoreSession: |
2757 # open the main script |
2763 # open the main script |
2758 if self.pdata["MAINSCRIPT"]: |
2764 if self.pdata["MAINSCRIPT"]: |
2759 self.sourceFile.emit( |
2765 if not os.path.isabs(self.pdata["MAINSCRIPT"]): |
2760 os.path.join( |
2766 ms = os.path.join( |
2761 self.ppath, self.pdata["MAINSCRIPT"])) |
2767 self.ppath, self.pdata["MAINSCRIPT"]) |
|
2768 else: |
|
2769 ms = self.pdata["MAINSCRIPT"] |
|
2770 self.sourceFile.emit(ms) |
2762 |
2771 |
2763 # open a project session file being quiet about errors |
2772 # open a project session file being quiet about errors |
2764 if reopen: |
2773 if reopen: |
2765 self.__readSession(quiet=True, indicator="_tmp") |
2774 self.__readSession(quiet=True, indicator="_tmp") |
2766 elif Preferences.getProject("AutoLoadSession"): |
2775 elif Preferences.getProject("AutoLoadSession"): |