eric6/Project/Project.py

Sat, 14 Nov 2020 17:51:47 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 14 Nov 2020 17:51:47 +0100
changeset 7830
72499e626226
parent 7785
9978016560ec
child 7836
2f0d208b8137
permissions
-rw-r--r--

Project: fixed an issue creating a new project where the main script is in a package.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7265
diff changeset
3 # Copyright (c) 2002 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the project management functionality.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import time
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 import shutil
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 import glob
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import fnmatch
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import copy
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import zipfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
18 from PyQt5.QtCore import (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
19 pyqtSlot, QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice,
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
20 QByteArray, QObject, QProcess
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 )
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
22 from PyQt5.QtGui import QKeySequence
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
23 from PyQt5.QtWidgets import (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
24 QLineEdit, QToolBar, QDialog, QInputDialog, QApplication, QMenu, QAction
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
25 )
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3644
diff changeset
26 from PyQt5.Qsci import QsciScintilla
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
28 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 535
diff changeset
29 from E5Gui import E5FileDialog, E5MessageBox
5244
54a0f215a6f0 Added a dialog to select from a list and extended the plug-in archive build process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5232
diff changeset
30 from E5Gui.E5ListSelectionDialog import E5ListSelectionDialog
54a0f215a6f0 Added a dialog to select from a list and extended the plug-in archive build process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5232
diff changeset
31 from E5Gui.E5ProgressDialog import E5ProgressDialog
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
32 from E5Gui.E5OverrideCursor import E5OverrideCursor, E5OverridenCursor
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 from Globals import recentNameProject
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 import UI.PixmapCache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
38 from E5Gui.E5Action import E5Action, createActionGroup
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
43
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 class Project(QObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 Class implementing the project management functionality.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
48 @signal dirty(bool) emitted when the dirty state changes
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
49 @signal projectLanguageAdded(str) emitted after a new language was added
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
50 @signal projectLanguageAddedByCode(str) emitted after a new language was
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
51 added. The language code is sent by this signal.
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
52 @signal projectLanguageRemoved(str) emitted after a language was removed
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
53 @signal projectFormAdded(str) emitted after a new form was added
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
54 @signal projectFormRemoved(str) emitted after a form was removed
1864
1c8d0747ba9f Introduced the 'projectFormCompiled' signal to support eric5 assistant scanning sources generated from forms files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1721
diff changeset
55 @signal projectFormCompiled(str) emitted after a form was compiled
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
56 @signal projectSourceAdded(str) emitted after a new source file was added
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
57 @signal projectSourceRemoved(str) emitted after a source was removed
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
58 @signal projectInterfaceAdded(str) emitted after a new IDL file was added
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
59 @signal projectInterfaceRemoved(str) emitted after a IDL file was removed
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
60 @signal projectProtocolAdded(str) emitted after a new proto file was added
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
61 @signal projectProtocolRemoved(str) emitted after a proto file was removed
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
62 @signal projectResourceAdded(str) emitted after a new resource file was
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
63 added
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
64 @signal projectResourceRemoved(str) emitted after a resource was removed
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
65 @signal projectOthersAdded(str) emitted after a file or directory was added
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
66 to the OTHERS project data area
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
67 @signal projectOthersRemoved(str) emitted after a file was removed from the
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
68 OTHERS project data area
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
69 @signal projectAboutToBeCreated() emitted just before the project will be
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
70 created
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
71 @signal newProjectHooks() emitted after a new project was generated but
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
72 before the newProject() signal is sent
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @signal newProject() emitted after a new project was generated
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
74 @signal sourceFile(str) emitted after a project file was read to
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
75 open the main script
4985
03ac1a030529 Added a dialog to quickly search for files in the list of project files (thanks to Mike C. Fletcher for contributing the majority of this code).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
76 @signal designerFile(str) emitted to open a found designer file
03ac1a030529 Added a dialog to quickly search for files in the list of project files (thanks to Mike C. Fletcher for contributing the majority of this code).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
77 @signal linguistFile(str) emitted to open a found translation file
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
78 @signal projectOpenedHooks() emitted after a project file was read but
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
79 before the projectOpened() signal is sent
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 @signal projectOpened() emitted after a project file was read
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
81 @signal projectClosedHooks() emitted after a project file was closed but
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
82 before the projectClosed() signal is sent
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 @signal projectClosed() emitted after a project was closed
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
84 @signal projectFileRenamed(str, str) emitted after a file of the project
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
85 has been renamed
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
86 @signal projectPropertiesChanged() emitted after the project properties
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
87 were changed
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
88 @signal directoryRemoved(str) emitted after a directory has been removed
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
89 from the project
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
90 @signal prepareRepopulateItem(str) emitted before an item of the model is
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
91 repopulated
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
92 @signal completeRepopulateItem(str) emitted after an item of the model was
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
93 repopulated
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
94 @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
95 the monitoring thread (ok, nok, op, off) and a status message
6529
1c2968f124b7 VCS: added capability to show some VCS info in the status bar of the main window (next to the status LED).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6488
diff changeset
96 @signal vcsStatusMonitorInfo(str) emitted to signal some info of the
1c2968f124b7 VCS: added capability to show some VCS info in the status bar of the main window (next to the status LED).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6488
diff changeset
97 monitoring thread
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 @signal reinitVCS() emitted after the VCS has been reinitialized
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
99 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
100 name of the menu and a reference to the menu are given.
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
101 @signal lexerAssociationsChanged() emitted after the lexer associations
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
102 have been changed
2853
0866c3aac79f Added code to propagate a change of the project or its VCS status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2798
diff changeset
103 @signal projectChanged() emitted to signal a change of the project
6244
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
104 @signal appendStdout(str) emitted after something was received from
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
105 a QProcess on stdout
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
106 @signal appendStderr(str) emitted after something was received from
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
107 a QProcess on stderr
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 """
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
109 dirty = pyqtSignal(bool)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
110 projectLanguageAdded = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
111 projectLanguageAddedByCode = pyqtSignal(str)
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
112 projectLanguageRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
113 projectFormAdded = pyqtSignal(str)
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
114 projectFormRemoved = pyqtSignal(str)
1864
1c8d0747ba9f Introduced the 'projectFormCompiled' signal to support eric5 assistant scanning sources generated from forms files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1721
diff changeset
115 projectFormCompiled = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
116 projectSourceAdded = pyqtSignal(str)
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
117 projectSourceRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
118 projectInterfaceAdded = pyqtSignal(str)
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
119 projectInterfaceRemoved = pyqtSignal(str)
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
120 projectProtocolAdded = pyqtSignal(str)
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
121 projectProtocolRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
122 projectResourceAdded = pyqtSignal(str)
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
123 projectResourceRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
124 projectOthersAdded = pyqtSignal(str)
765
e5cbb3f273eb Added code to emit a signal when a file is removed from the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 651
diff changeset
125 projectOthersRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
126 projectAboutToBeCreated = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
127 newProjectHooks = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
128 newProject = pyqtSignal()
476
121633976eca Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 461
diff changeset
129 sourceFile = pyqtSignal(str)
4985
03ac1a030529 Added a dialog to quickly search for files in the list of project files (thanks to Mike C. Fletcher for contributing the majority of this code).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
130 designerFile = pyqtSignal(str)
03ac1a030529 Added a dialog to quickly search for files in the list of project files (thanks to Mike C. Fletcher for contributing the majority of this code).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
131 linguistFile = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
132 projectOpenedHooks = pyqtSignal()
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
133 projectOpened = pyqtSignal()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
134 projectClosedHooks = pyqtSignal()
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
135 projectClosed = pyqtSignal()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
136 projectFileRenamed = pyqtSignal(str, str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
137 projectPropertiesChanged = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
138 directoryRemoved = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
139 prepareRepopulateItem = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
140 completeRepopulateItem = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
141 vcsStatusMonitorStatus = pyqtSignal(str, str)
6529
1c2968f124b7 VCS: added capability to show some VCS info in the status bar of the main window (next to the status LED).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6488
diff changeset
142 vcsStatusMonitorInfo = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
143 reinitVCS = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
144 showMenu = pyqtSignal(str, QMenu)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
145 lexerAssociationsChanged = pyqtSignal()
2853
0866c3aac79f Added code to propagate a change of the project or its VCS status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2798
diff changeset
146 projectChanged = pyqtSignal()
6244
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
147 appendStdout = pyqtSignal(str)
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
148 appendStderr = pyqtSignal(str)
476
121633976eca Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 461
diff changeset
149
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
150 eols = [os.linesep, "\n", "\r", "\r\n"]
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
151
6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
152 DefaultMake = "make"
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
153 DefaultMakefile = "makefile"
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
154
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
155 def __init__(self, parent=None, filename=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 @param parent parent widget (usually the ui object) (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 @param filename optional filename of a project file to open (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2521
diff changeset
162 super(Project, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 self.ui = parent
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
166 self.__progLanguages = [
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
167 "Python3",
7166
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
168 "MicroPython",
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
169 "Ruby",
3439
08aa0cef69e3 Continued improving JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3438
diff changeset
170 "JavaScript",
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
171 ]
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
172
5254
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
173 self.__dbgFilters = {
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
174 "Python3": self.tr(
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
175 "Python3 Files (*.py *.py3);;"
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
176 "Python3 GUI Files (*.pyw *.pyw3);;"),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 }
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 self.vcsMenu = None
6254
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6252
diff changeset
180 self.__makeProcess = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 self.__initProjectTypes()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 self.__initData()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.recent = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.__loadRecent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 if filename is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 self.openProject(filename)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 self.vcs = self.initVCS()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
194 from .ProjectBrowserModel import ProjectBrowserModel
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 self.__model = ProjectBrowserModel(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
197 self.codemetrics = None
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
198 self.codecoverage = None
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
199 self.profiledata = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 self.applicationDiagram = None
2034
8de0fc1f7fef Implemented functions to load UML graphics from disc.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2031
diff changeset
201 self.loadedDiagram = None
4985
03ac1a030529 Added a dialog to quickly search for files in the list of project files (thanks to Mike C. Fletcher for contributing the majority of this code).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
202 self.__findProjectFileDialog = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203
3700
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
204 def __sourceExtensions(self, language):
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
205 """
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
206 Private method to get the source extensions of a programming language.
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
207
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
208 @param language programming language (string)
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
209 @return source extensions (list of string)
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
210 """
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
211 if language == "Python3":
4050
c8594f4f1b71 Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4041
diff changeset
212 extensions = Preferences.getPython("Python3Extensions")
c8594f4f1b71 Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4041
diff changeset
213 # *.py and *.pyw should always be associated with source files
c8594f4f1b71 Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4041
diff changeset
214 for ext in [".py", ".pyw"]:
c8594f4f1b71 Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4041
diff changeset
215 if ext not in extensions:
c8594f4f1b71 Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4041
diff changeset
216 extensions.append(ext)
c8594f4f1b71 Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4041
diff changeset
217 return extensions
7166
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
218 elif language == "MicroPython":
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
219 extensions = Preferences.getPython("Python3Extensions")
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
220 # *.py should always be associated with source files
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
221 for ext in [".py"]:
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
222 if ext not in extensions:
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
223 extensions.append(ext)
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
224 return extensions
3700
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
225 elif language == "Ruby":
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
226 return ['.rb']
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
227 elif language == "JavaScript":
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
228 return ['.js']
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
229 elif language == "Mixed":
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
230 return (Preferences.getPython("Python3Extensions") +
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
231 ['.rb', '.js'])
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
232 else:
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
233 return [""]
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
234
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
235 def getProgrammingLanguages(self):
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
236 """
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
237 Public method to get the programming languages supported by project.
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
238
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
239 @return list of supported programming languages (list of string)
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
240 """
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
241 return self.__progLanguages[:]
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
242
5254
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
243 def getDebuggerFilters(self, language):
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
244 """
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
245 Public method to get the debugger filters for a programming language.
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
246
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
247 @param language programming language
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
248 @type str
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
249 @return filter string
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
250 @rtype str
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
251 """
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
252 try:
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
253 return self.__dbgFilters[language]
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
254 except KeyError:
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
255 return ""
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
256
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 def __initProjectTypes(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 Private method to initialize the list of supported project types.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 self.__fileTypeCallbacks = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.__lexerAssociationCallbacks = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 self.__binaryTranslationsCallbacks = {}
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
264
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
265 self.__projectTypes = {
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
266 "PyQt5": self.tr("PyQt5 GUI"),
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
267 "PyQt5C": self.tr("PyQt5 Console"),
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
268 "E6Plugin": self.tr("Eric6 Plugin"),
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
269 "Console": self.tr("Console"),
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
270 "Other": self.tr("Other"),
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
271 }
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
272
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
273 self.__projectProgLanguages = {
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
274 "Python3": ["PyQt5", "PyQt5C", "E6Plugin", "Console", "Other"],
7164
6da6a0a5a448 Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7050
diff changeset
275 "MicroPython": ["Console", "Other"],
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
276 "Ruby": ["Console", "Other"],
4009
098c303a6857 Extended the project object a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
277 "JavaScript": ["Other"],
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
278 }
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
279
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
280 if Utilities.checkPyside():
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
281 self.__projectTypes["PySide2"] = self.tr("PySide2 GUI")
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
282 self.__projectTypes["PySide2C"] = self.tr("PySide2 Console")
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
283 self.__projectProgLanguages["Python3"].extend(
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
284 ["PySide2", "PySide2C"])
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
285
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
286 def getProjectTypes(self, progLanguage=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 Public method to get the list of supported project types.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
290 @param progLanguage programming language to get project types for
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
291 (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 @return reference to the dictionary of project types.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 """
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
294 if progLanguage and progLanguage in self.__projectProgLanguages:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
295 ptypes = {}
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
296 for ptype in self.__projectProgLanguages[progLanguage]:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
297 ptypes[ptype] = self.__projectTypes[ptype]
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
298 return ptypes
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
299 else:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
300 return self.__projectTypes
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
301
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
302 def hasProjectType(self, type_, progLanguage=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 Public method to check, if a project type is already registered.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
306 @param type_ internal type designator (string)
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
307 @param progLanguage programming language of the project type (string)
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
308 @return flag indicating presence of the project type (boolean)
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
309 """
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
310 if progLanguage:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
311 return (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
312 progLanguage in self.__projectProgLanguages and
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
313 type_ in self.__projectProgLanguages[progLanguage]
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
314 )
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
315 else:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
316 return type_ in self.__projectTypes
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
318 def registerProjectType(self, type_, description, fileTypeCallback=None,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
319 binaryTranslationsCallback=None,
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
320 lexerAssociationCallback=None, progLanguages=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 Public method to register a project type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 @param type_ internal type designator to be registered (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 @param description more verbose type name (display string) (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 @keyparam fileTypeCallback reference to a method returning a dictionary
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 of filetype associations.
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
328 @keyparam binaryTranslationsCallback reference to a method returning
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
329 the name of the binary translation file given the name of the raw
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 translation file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 @keyparam lexerAssociationCallback reference to a method returning the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 lexer type to be used for syntax highlighting given the name of
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 a file
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
334 @keyparam progLanguages programming languages supported by the
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
335 project type (list of string)
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
336 """
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
337 if progLanguages:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
338 for progLanguage in progLanguages:
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
339 if progLanguage in ["Python", "Python2"]:
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
340 # ignore that silently for Python2
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
341 return
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
342
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
343 if progLanguage not in self.__projectProgLanguages:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
344 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
345 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
346 self.tr("Registering Project Type"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
347 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
348 """<p>The Programming Language <b>{0}</b> is not"""
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
349 """ supported (project type: {1}).</p>""")
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
350 .format(progLanguage, type_)
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
351 )
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
352 return
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
353
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
354 if type_ in self.__projectProgLanguages[progLanguage]:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
355 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
356 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
357 self.tr("Registering Project Type"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
358 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
359 """<p>The Project type <b>{0}</b> is already"""
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
360 """ registered with Programming Language"""
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
361 """ <b>{1}</b>.</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
362 .format(type_, progLanguage)
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
363 )
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
364 return
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
365
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 if type_ in self.__projectTypes:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
367 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
368 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
369 self.tr("Registering Project Type"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
370 self.tr("""<p>The Project type <b>{0}</b> is already"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
371 """ registered.</p>""").format(type_)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 self.__projectTypes[type_] = description
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 self.__fileTypeCallbacks[type_] = fileTypeCallback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
377 self.__binaryTranslationsCallbacks[type_] = (
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
378 binaryTranslationsCallback
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
379 )
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
380 if progLanguages:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
381 for progLanguage in progLanguages:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
382 self.__projectProgLanguages[progLanguage].append(type_)
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
383 else:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
384 # no specific programming languages given -> add to all
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
385 for progLanguage in self.__projectProgLanguages:
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
386 self.__projectProgLanguages[progLanguage].append(type_)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 def unregisterProjectType(self, type_):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 Public method to unregister a project type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 @param type_ internal type designator to be unregistered (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
394 for progLanguage in self.__projectProgLanguages:
2193
fc37253e4dbd Fixed an issue in the project manager unregistering a plug-in for a programming language and corrected a typo in a display string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2192
diff changeset
395 if type_ in self.__projectProgLanguages[progLanguage]:
2040
4cefd094353b Made the selectable project types of the project properties dialog dependent upon the selected programming language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2034
diff changeset
396 self.__projectProgLanguages[progLanguage].remove(type_)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 if type_ in self.__projectTypes:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 del self.__projectTypes[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 if type_ in self.__fileTypeCallbacks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 del self.__fileTypeCallbacks[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 if type_ in self.__lexerAssociationCallbacks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 del self.__lexerAssociationCallbacks[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 if type_ in self.__binaryTranslationsCallbacks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 del self.__binaryTranslationsCallbacks[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 def __initData(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 Private method to initialize the project data part.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 self.loaded = False # flag for the loaded status
517
fe6fe492f82e Fixed an issue related to the usage of new style signal/slot.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
411 self.__dirty = False # dirty flag
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 self.pfile = "" # name of the project file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 self.ppath = "" # name of the project directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 self.translationsRoot = "" # the translations prefix
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 self.name = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 self.opened = False
6955
7a8a2963cbdc Project: fixed a little inaccuracy not causing any issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
417 self.subdirs = []
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3600
diff changeset
418 # record the project dir as a relative path (i.e. empty path)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 self.otherssubdirs = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.vcs = None
1874
7d5589d8699a Did the first step in the enhanced VCS handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1871
diff changeset
421 self.vcsRequested = False
6352
4bdc6503df81 Continued to remove all explicit references to Python interpreters and replace them by references to virtual environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6303
diff changeset
422 self.dbgVirtualEnv = ''
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 self.dbgCmdline = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.dbgWd = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.dbgEnv = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 self.dbgReportExceptions = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 self.dbgExcList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 self.dbgExcIgnoreList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 self.dbgAutoClearShell = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 self.dbgTracePython = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 self.dbgAutoContinue = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
433 self.pdata = {
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
434 "DESCRIPTION": "",
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
435 "VERSION": "",
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
436 "SOURCES": [],
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
437 "FORMS": [],
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
438 "RESOURCES": [],
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
439 "INTERFACES": [],
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
440 "PROTOCOLS": [],
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
441 "OTHERS": [],
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
442 "TRANSLATIONS": [],
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
443 "TRANSLATIONEXCEPTIONS": [],
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
444 "TRANSLATIONPATTERN": "",
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
445 "TRANSLATIONSBINPATH": "",
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
446 "MAINSCRIPT": "",
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
447 "VCS": "None",
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
448 "VCSOPTIONS": {},
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
449 "VCSOTHERDATA": {},
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
450 "AUTHOR": '',
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
451 "EMAIL": '',
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
452 "HASH": '',
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
453 "PROGLANGUAGE": "Python3",
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
454 "MIXEDLANGUAGE": False,
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
455 "PROJECTTYPE": "PyQt5",
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
456 "SPELLLANGUAGE":
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
457 Preferences.getEditor("SpellCheckingDefaultLanguage"),
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
458 "SPELLWORDS": '',
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
459 "SPELLEXCLUDES": '',
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
460 "FILETYPES": {},
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
461 "LEXERASSOCS": {},
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
462 "PROJECTTYPESPECIFICDATA": {},
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
463 "CHECKERSPARMS": {},
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
464 "PACKAGERSPARMS": {},
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
465 "DOCUMENTATIONPARMS": {},
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
466 "OTHERTOOLSPARMS": {},
6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
467 "MAKEPARAMS": {
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
468 "MakeEnabled": False,
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
469 "MakeExecutable": "",
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
470 "MakeFile": "",
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
471 "MakeTarget": "",
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
472 "MakeParameters": "",
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
473 "MakeTestOnly": True,
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6244
diff changeset
474 },
6439
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
475 "IDLPARAMS": {
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
476 "IncludeDirs": [],
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
477 "DefinedNames": [],
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
478 "UndefinedNames": [],
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
479 },
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
480 "UICPARAMS": {
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
481 "Package": "",
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
482 "RcSuffix": "",
7050
b66cac9a6560 Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7007
diff changeset
483 "PackagesRoot": "",
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
484 },
6615
386607e32376 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6604
diff changeset
485 "RCCPARAMS": {
6604
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
486 "CompressionThreshold": 70, # default value
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
487 "CompressLevel": 0, # use zlib default
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
488 "CompressionDisable": False,
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
489 "PathPrefix": "",
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
490 },
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
491 "EOL": -1,
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
492 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 self.__initDebugProperties()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
496 self.pudata = {
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
497 "VCSOVERRIDE": "",
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
498 "VCSSTATUSMONITORINTERVAL": 0,
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
499 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 self.vcs = self.initVCS()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 def getData(self, category, key):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 Public method to get data out of the project data store.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 @param category category of the data to get (string, one of
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
508 PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS,
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
509 DOCUMENTATIONPARMS or OTHERTOOLSPARMS)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 @param key key of the data entry to get (string).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 @return a copy of the requested data or None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 """
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
513 if (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
514 category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS",
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
515 "PACKAGERSPARMS", "DOCUMENTATIONPARMS",
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
516 "OTHERTOOLSPARMS"] and
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
517 key in self.pdata[category]
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
518 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 return copy.deepcopy(self.pdata[category][key])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 def setData(self, category, key, data):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 Public method to store data in the project data store.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 @param category category of the data to get (string, one of
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
528 PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS,
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
529 DOCUMENTATIONPARMS or OTHERTOOLSPARMS)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 @param key key of the data entry to get (string).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 @param data data to be stored
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 @return flag indicating success (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
534 if category not in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS",
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
535 "PACKAGERSPARMS", "DOCUMENTATIONPARMS",
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
536 "OTHERTOOLSPARMS"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 # test for changes of data and save them in the project
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 # 1. there were none, now there are
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 if key not in self.pdata[category] and len(data) > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 self.pdata[category][key] = copy.deepcopy(data)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 # 2. there were some, now there aren't
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 elif key in self.pdata[category] and len(data) == 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 del self.pdata[category][key]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 # 3. there were some and still are
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 elif key in self.pdata[category] and len(data) > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 if data != self.pdata[category][key]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 self.pdata[category][key] = copy.deepcopy(data)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 # 4. there were none and none are given
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 def initFileTypes(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
560 Public method to initialize the filetype associations with default
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
561 values.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 """
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
563 self.pdata["FILETYPES"] = {
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
564 "*.txt": "OTHERS",
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
565 "*.md": "OTHERS",
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
566 "*.rst": "OTHERS",
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
567 "README": "OTHERS",
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
568 "README.*": "OTHERS",
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
569 "*.e4p": "OTHERS",
6240
3ea0b969f608 Project: add a (currently) empty slot to handle the 'executeMake' signal.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6228
diff changeset
570 "GNUmakefile": "OTHERS",
3ea0b969f608 Project: add a (currently) empty slot to handle the 'executeMake' signal.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6228
diff changeset
571 "makefile": "OTHERS",
3ea0b969f608 Project: add a (currently) empty slot to handle the 'executeMake' signal.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6228
diff changeset
572 "Makefile": "OTHERS",
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
573 }
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
574
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
575 # Sources
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
576 if self.pdata["MIXEDLANGUAGE"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 sourceKey = "Mixed"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 else:
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
579 sourceKey = self.pdata["PROGLANGUAGE"]
3700
7f0ef2b1baf3 Changed the source extension of the Project class to be a private method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3691
diff changeset
580 for ext in self.__sourceExtensions(sourceKey):
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 401
diff changeset
581 self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES"
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
582
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
583 # IDL interfaces
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES"
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
585
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
586 # Protobuf Files
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
587 self.pdata["FILETYPES"]["*.proto"] = "PROTOCOLS"
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
588
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
589 # Forms
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
590 if self.pdata["PROJECTTYPE"] in ["E6Plugin",
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
591 "PyQt5",
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
592 "PySide2"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 self.pdata["FILETYPES"]["*.ui"] = "FORMS"
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
594
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
595 # Resources
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
596 if self.pdata["PROJECTTYPE"] in ["E6Plugin",
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
597 "PyQt5", "PyQt5C",
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
598 "PySide2", "PySide2C"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 self.pdata["FILETYPES"]["*.qrc"] = "RESOURCES"
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
600
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
601 # Translations
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
602 if self.pdata["PROJECTTYPE"] in ["E6Plugin",
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
603 "PyQt5", "PyQt5C",
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
604 "PySide2", "PySide2C"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS"
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
607
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
608 # Project type specific ones
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 try:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
610 if self.__fileTypeCallbacks[
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
611 self.pdata["PROJECTTYPE"]] is not None:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
612 ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 self.pdata["FILETYPES"].update(ftypes)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 pass
5462
52b2f19226e7 Extended the list of default file type associations to include common documentation file patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
616
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 def updateFileTypes(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
621 Public method to update the filetype associations with new default
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
622 values.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 """
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
624 if self.pdata["PROJECTTYPE"] in ["E6Plugin",
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
625 "PyQt5", "PyQt5C",
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
626 "PySide2", "PySide2C"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 if "*.ts" not in self.pdata["FILETYPES"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 if "*.qm" not in self.pdata["FILETYPES"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 try:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
632 if self.__fileTypeCallbacks[
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
633 self.pdata["PROJECTTYPE"]] is not None:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
634 ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]()
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
635 for pattern, ftype in list(ftypes.items()):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 if pattern not in self.pdata["FILETYPES"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 self.pdata["FILETYPES"][pattern] = ftype
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 def __loadRecent(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 Private method to load the recently opened project filenames.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 self.recent = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 Preferences.Prefs.rsettings.sync()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 rp = Preferences.Prefs.rsettings.value(recentNameProject)
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
649 if rp is not None:
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
650 for f in rp:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 if QFileInfo(f).exists():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 self.recent.append(f)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 def __saveRecent(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 Private method to save the list of recently opened filenames.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 """
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
658 Preferences.Prefs.rsettings.setValue(recentNameProject, self.recent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 Preferences.Prefs.rsettings.sync()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 def getMostRecent(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 Public method to get the most recently opened project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 @return path of the most recently opened project (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 if len(self.recent):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 return self.recent[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 def getModel(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 Public method to get a reference to the project browser model.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 @return reference to the project browser model (ProjectBrowserModel)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 return self.__model
7518
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
679
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
680 def startFileSystemMonitoring(self):
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
681 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
682 Public method to (re)start monitoring the project file system.
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
683 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
684 self.__model.startFileSystemMonitoring()
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
685
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
686 def stopFileSystemMonitoring(self):
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
687 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
688 Public method to stop monitoring the project file system.
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
689 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
690 self.__model.stopFileSystemMonitoring()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 def getVcs(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 Public method to get a reference to the VCS object.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 @return reference to the VCS object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 return self.vcs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 def handlePreferencesChanged(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702 Public slot used to handle the preferencesChanged signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 if self.pudata["VCSSTATUSMONITORINTERVAL"]:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
705 self.setStatusMonitorInterval(
5098
bc74f74a95f5 Started to clean up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5096
diff changeset
706 self.pudata["VCSSTATUSMONITORINTERVAL"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
708 self.setStatusMonitorInterval(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 Preferences.getVCS("StatusMonitorInterval"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 self.__model.preferencesChanged()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
713 def setDirty(self, dirty):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 Public method to set the dirty state.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
717 It emits the signal dirty(bool).
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
718
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
719 @param dirty dirty state
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
720 @type bool
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
721 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
722 self.__dirty = dirty
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
723 self.saveAct.setEnabled(dirty)
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6576
diff changeset
724 self.dirty.emit(dirty)
2853
0866c3aac79f Added code to propagate a change of the project or its VCS status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2798
diff changeset
725 if self.__dirty:
0866c3aac79f Added code to propagate a change of the project or its VCS status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2798
diff changeset
726 self.projectChanged.emit()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 def isDirty(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 Public method to return the dirty state.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 @return dirty state (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 """
517
fe6fe492f82e Fixed an issue related to the usage of new style signal/slot.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
734 return self.__dirty
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 def isOpen(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 Public method to return the opened state.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 @return open state (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 return self.opened
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 def __checkFilesExist(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
746 Private method to check, if the files in a list exist.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 The files in the indicated list are checked for existance in the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 filesystem. Non existant files are removed from the list and the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 dirty state of the project is changed accordingly.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 @param index key of the list to be checked (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 removed = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 removelist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 for file in self.pdata[index]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 if not os.path.exists(os.path.join(self.ppath, file)):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 removelist.append(file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 removed = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 if removed:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 for file in removelist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 self.pdata[index].remove(file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 def __readProject(self, fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 """
608
d8fea1e76975 Removed capability to write compressed project (and related) files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 607
diff changeset
768 Private method to read in a project (.e4p) file.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 @param fn filename of the project file to be read (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 @return flag indicating success
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 """
609
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
773 f = QFile(fn)
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
774 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
775 from E5XML.ProjectReader import ProjectReader
609
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
776 reader = ProjectReader(f, self)
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
777 reader.readXML()
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
778 res = not reader.hasError()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 f.close()
609
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
780 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
781 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
782 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
783 self.tr("Read project file"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
784 self.tr(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
785 "<p>The project file <b>{0}</b> could not be read.</p>")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
786 .format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 return False
609
463fc2891cbf Migrated the project handler to project reader and removed XML handling source no longer needed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
788
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 self.pfile = os.path.abspath(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 self.ppath = os.path.abspath(os.path.dirname(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 # insert filename into list of recently opened projects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 self.__syncRecent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 if res:
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
796 if self.pdata["TRANSLATIONPATTERN"]:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
797 self.translationsRoot = self.pdata["TRANSLATIONPATTERN"].split(
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
798 "%language%")[0]
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
799 elif self.pdata["MAINSCRIPT"]:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
800 self.translationsRoot = os.path.splitext(
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5098
diff changeset
801 self.pdata["MAINSCRIPT"])[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 if os.path.isdir(os.path.join(self.ppath, self.translationsRoot)):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 dn = self.translationsRoot
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 dn = os.path.dirname(self.translationsRoot)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 if dn not in self.subdirs:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 self.subdirs.append(dn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 self.name = os.path.splitext(os.path.basename(fn))[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
811 # check, if the files of the project still exist in the
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
812 # project directory
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 self.__checkFilesExist("SOURCES")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 self.__checkFilesExist("FORMS")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 self.__checkFilesExist("INTERFACES")
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
816 self.__checkFilesExist("PROTOCOLS")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 self.__checkFilesExist("TRANSLATIONS")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 self.__checkFilesExist("RESOURCES")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 self.__checkFilesExist("OTHERS")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 # get the names of subdirectories the files are stored in
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
822 for fn in (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
823 self.pdata["SOURCES"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
824 self.pdata["FORMS"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
825 self.pdata["INTERFACES"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
826 self.pdata["PROTOCOLS"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
827 self.pdata["RESOURCES"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
828 self.pdata["TRANSLATIONS"]
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
829 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 dn = os.path.dirname(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 if dn not in self.subdirs:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 self.subdirs.append(dn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 # get the names of other subdirectories
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 for fn in self.pdata["OTHERS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 dn = os.path.dirname(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 if dn not in self.otherssubdirs:
152
ee3a13a0ad59 Finished the introduction of a project hash to identify the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
838 self.otherssubdirs.append(dn)
ee3a13a0ad59 Finished the introduction of a project hash to identify the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
839
ee3a13a0ad59 Finished the introduction of a project hash to identify the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
840 # create hash value, if it doesn't have one
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
841 if reader.version.startswith("5.") and not self.pdata["HASH"]:
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
842 hashStr = str(QCryptographicHash.hash(
1670
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
843 QByteArray(self.ppath.encode("utf-8")),
6fd889391d2c Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
844 QCryptographicHash.Sha1).toHex(),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
845 encoding="utf-8")
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
846 self.pdata["HASH"] = hashStr
151
00c27aeede62 Introduced a hash value to identify a project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 122
diff changeset
847 self.setDirty(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
851 def __writeProject(self, fn=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 Private method to save the project infos to a project file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 @param fn optional filename of the project file to be written (string).
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
856 If fn is None, the filename stored in the project object
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
857 is used. This is the 'save' action. If fn is given, this filename
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
858 is used instead of the one in the project object. This is the
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
859 'save as' action.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 @return flag indicating success
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 if self.vcs is not None:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
863 self.pdata["VCSOPTIONS"] = copy.deepcopy(self.vcs.vcsGetOptions())
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
864 self.pdata["VCSOTHERDATA"] = copy.deepcopy(
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
865 self.vcs.vcsGetOtherData())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866
5100
2c193da9b94f Finished cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5099
diff changeset
867 if not self.pdata["HASH"]:
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
868 hashStr = str(QCryptographicHash.hash(
2380
0121b9ab8edb Little enhancement to project to read eric4 project files without 'upgrading' them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2319
diff changeset
869 QByteArray(self.ppath.encode("utf-8")),
0121b9ab8edb Little enhancement to project to read eric4 project files without 'upgrading' them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2319
diff changeset
870 QCryptographicHash.Sha1).toHex(),
0121b9ab8edb Little enhancement to project to read eric4 project files without 'upgrading' them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2319
diff changeset
871 encoding="utf-8")
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
872 self.pdata["HASH"] = hashStr
2380
0121b9ab8edb Little enhancement to project to read eric4 project files without 'upgrading' them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2319
diff changeset
873
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 if fn is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
875 fn = self.pfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876
610
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
877 f = QFile(fn)
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
878 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
879 from E5XML.ProjectWriter import ProjectWriter
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
880 ProjectWriter(f, os.path.splitext(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
881 os.path.basename(fn))[0]).writeXML()
610
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
882 res = True
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
883 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
884 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
885 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
886 self.tr("Save project file"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
887 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
888 "<p>The project file <b>{0}</b> could not be"
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
889 " written.</p>").format(fn))
610
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
890 res = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 if res:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 self.pfile = os.path.abspath(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 self.ppath = os.path.abspath(os.path.dirname(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 self.name = os.path.splitext(os.path.basename(fn))[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
896 self.setDirty(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
897
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 # insert filename into list of recently opened projects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899 self.__syncRecent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 def __readUserProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 """
2964
84b65fb9e780 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2888
diff changeset
905 Private method to read in the user specific project file (.e4q).
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 if self.pfile is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 fn, ext = os.path.splitext(os.path.basename(self.pfile))
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 401
diff changeset
911 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4q'.format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 if os.path.exists(fn):
606
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
913 f = QFile(fn)
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
914 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
915 from E5XML.UserProjectReader import UserProjectReader
606
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
916 reader = UserProjectReader(f, self)
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
917 reader.readXML()
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
918 f.close()
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
919 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
920 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
921 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
922 self.tr("Read user project properties"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
923 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
924 "<p>The user specific project properties file"
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
925 " <b>{0}</b> could not be read.</p>").format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 def __writeUserProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 Private method to write the project data to an XML file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 """
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
931 if self.pfile is None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 fn, ext = os.path.splitext(os.path.basename(self.pfile))
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 401
diff changeset
935 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4q'.format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936
606
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
937 f = QFile(fn)
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
938 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
939 from E5XML.UserProjectWriter import UserProjectWriter
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
940 UserProjectWriter(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
941 f, os.path.splitext(os.path.basename(fn))[0]).writeXML()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 f.close()
606
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
943 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
944 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
945 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
946 self.tr("Save user project properties"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
947 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
948 "<p>The user specific project properties file <b>{0}</b>"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 " could not be written.</p>").format(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950
2427
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
951 def __showContextMenuSession(self):
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
952 """
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
953 Private slot called before the Session menu is shown.
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
954 """
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
955 enable = True
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
956 if self.pfile is None:
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
957 enable = False
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
958 else:
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
959 fn, ext = os.path.splitext(os.path.basename(self.pfile))
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
960 fn_new = os.path.join(self.getProjectManagementDir(),
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
961 '{0}.e5s'.format(fn))
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
962 fn_old = os.path.join(self.getProjectManagementDir(),
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
963 '{0}.e4s'.format(fn))
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
964 enable = os.path.exists(fn_new) or os.path.exists(fn_old)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
965 self.sessActGrp.findChild(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
966 QAction, "project_load_session").setEnabled(enable)
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
967 self.sessActGrp.findChild(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
968 QAction, "project_delete_session").setEnabled(enable)
2427
46481fe988d2 Added code to enable/disable certain entries of the Project->Session and Project->Debugger menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
969
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
970 @pyqtSlot()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
971 def __readSession(self, quiet=False, indicator=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 """
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
973 Private method to read in the project session file (.e5s or .e4s).
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 @param quiet flag indicating quiet operations.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 If this flag is true, no errors are reported.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 @keyparam indicator indicator string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
978 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 if self.pfile is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 if not quiet:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
981 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
982 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
983 self.tr("Read project session"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
984 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
987 fn1, ext = os.path.splitext(os.path.basename(self.pfile))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
988 fn = os.path.join(self.getProjectManagementDir(),
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
989 '{0}{1}.e5s'.format(fn1, indicator))
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
990 if not os.path.exists(fn):
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
991 fn = os.path.join(self.getProjectManagementDir(),
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
992 '{0}{1}.e4s'.format(fn1, indicator))
599
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
993
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
994 f = QFile(fn)
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
995 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
996 from E5XML.SessionReader import SessionReader
599
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
997 reader = SessionReader(f, False)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
998 reader.readXML(quiet=quiet)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 f.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 if not quiet:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1002 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1003 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1004 self.tr("Read project session"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1005 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1006 "<p>The project session file <b>{0}</b> could not be"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 " read.</p>").format(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
1009 @pyqtSlot()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
1010 def __writeSession(self, quiet=False, indicator=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 """
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1012 Private method to write the session data to an XML file (.e5s).
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 @param quiet flag indicating quiet operations.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 If this flag is true, no errors are reported.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1016 @keyparam indicator indicator string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 """
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
1018 if self.pfile is None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 if not quiet:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1020 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1021 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1022 self.tr("Save project session"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1023 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 fn, ext = os.path.splitext(os.path.basename(self.pfile))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
1027 fn = os.path.join(self.getProjectManagementDir(),
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1028 '{0}{1}.e5s'.format(fn, indicator))
599
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1029
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1030 f = QFile(fn)
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1031 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
1032 from E5XML.SessionWriter import SessionWriter
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1033 SessionWriter(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1034 f, os.path.splitext(os.path.basename(fn))[0]).writeXML()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 f.close()
599
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1036 else:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 if not quiet:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1038 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1039 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1040 self.tr("Save project session"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1041 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1042 "<p>The project session file <b>{0}</b> could not be"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 " written.</p>").format(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045 def __deleteSession(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047 Private method to delete the session file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1048 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1049 if self.pfile is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1050 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1051 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1052 self.tr("Delete project session"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1053 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1054 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1055
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1056 fname, ext = os.path.splitext(os.path.basename(self.pfile))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057
3600
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1058 for fn in [
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1059 os.path.join(
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1060 self.getProjectManagementDir(), "{0}.e5s".format(fname)),
7d17c492ab95 Started implementing functionality to save expanded file and directory entries of the project browsers to the session.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1061 os.path.join(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1062 self.getProjectManagementDir(), "{0}.e4s".format(fname))]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1063 if os.path.exists(fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1064 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065 os.remove(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1066 except OSError:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1067 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1068 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1069 self.tr("Delete project session"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1070 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1071 "<p>The project session file <b>{0}</b> could"
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1072 " not be deleted.</p>").format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1073
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1074 def __readTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1075 """
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1076 Private method to read in the project tasks file (.e6t).
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1078 if self.pfile is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1079 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1080 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1081 self.tr("Read tasks"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1082 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1084
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1085 base, ext = os.path.splitext(os.path.basename(self.pfile))
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1086 fn = os.path.join(self.getProjectManagementDir(),
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1087 '{0}.e6t'.format(base))
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 583
diff changeset
1088 if not os.path.exists(fn):
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1089 # try again with the old extension
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1090 fn = os.path.join(self.getProjectManagementDir(),
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1091 '{0}.e4t'.format(base))
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1092 if not os.path.exists(fn):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3935
diff changeset
1093 return
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 583
diff changeset
1094 f = QFile(fn)
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 583
diff changeset
1095 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
1096 from E5XML.TasksReader import TasksReader
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 583
diff changeset
1097 reader = TasksReader(f, True)
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 583
diff changeset
1098 reader.readXML()
594
cded89ee3e30 Added forgotten close() statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 585
diff changeset
1099 f.close()
585
f40889943c0a Migrated the tasks handler to tasks reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 583
diff changeset
1100 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1101 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1102 self.ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1103 self.tr("Read tasks"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1104 self.tr(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
1105 "<p>The tasks file <b>{0}</b> could not be read.</p>")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
1106 .format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs