eric6/Project/Project.py

Fri, 22 Jan 2021 16:48:43 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 22 Jan 2021 16:48:43 +0100
changeset 7998
cd41c844862f
parent 7992
0d1e35a10a0b
child 8000
47b15df088e4
permissions
-rw-r--r--

Editor
- added functionality to insert docstring templates via the context menu (cursor placed on first line of function definition) or after entering the docstring start string (e.g. """ for Python)

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7911
diff changeset
3 # Copyright (c) 2002 - 2021 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
7959
44e15eda6506 Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7955
diff changeset
37 from UI.NotificationWidget import NotificationTypes
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
39 from E5Gui.E5Action import E5Action, createActionGroup
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
44
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 class Project(QObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Class implementing the project management functionality.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
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
49 @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
50 @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
51 @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
52 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
53 @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
54 @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
55 @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
56 @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
57 @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
58 @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
59 @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
60 @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
61 @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
62 @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
63 @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
64 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
65 @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
66 @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
67 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
68 @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
69 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
70 @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
71 created
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
72 @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
73 before the newProject() signal is sent
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 @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
75 @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
76 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
77 @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
78 @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
79 @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
80 before the projectOpened() signal is sent
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 @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
82 @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
83 before the projectClosed() signal is sent
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 @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
85 @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
86 has been renamed
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
87 @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
88 were changed
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
89 @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
90 from the project
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
91 @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
92 repopulated
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
93 @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
94 repopulated
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
95 @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
96 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
97 @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
98 monitoring thread
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 @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
100 @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
101 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
102 @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
103 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
104 @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
105 @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
106 a QProcess on stdout
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
107 @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
108 a QProcess on stderr
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
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
110 dirty = pyqtSignal(bool)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
111 projectLanguageAdded = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
112 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
113 projectLanguageRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
114 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
115 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
116 projectFormCompiled = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
117 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
118 projectSourceRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
119 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
120 projectInterfaceRemoved = pyqtSignal(str)
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
121 projectProtocolAdded = pyqtSignal(str)
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
122 projectProtocolRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
123 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
124 projectResourceRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
125 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
126 projectOthersRemoved = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
127 projectAboutToBeCreated = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
128 newProjectHooks = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
129 newProject = pyqtSignal()
476
121633976eca Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 461
diff changeset
130 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
131 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
132 linguistFile = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
133 projectOpenedHooks = pyqtSignal()
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
134 projectOpened = pyqtSignal()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
135 projectClosedHooks = pyqtSignal()
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
136 projectClosed = pyqtSignal()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
137 projectFileRenamed = pyqtSignal(str, str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
138 projectPropertiesChanged = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
139 directoryRemoved = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
140 prepareRepopulateItem = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
141 completeRepopulateItem = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
142 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
143 vcsStatusMonitorInfo = pyqtSignal(str)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
144 reinitVCS = pyqtSignal()
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
145 showMenu = pyqtSignal(str, QMenu)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
146 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
147 projectChanged = pyqtSignal()
6244
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
148 appendStdout = pyqtSignal(str)
233eea858c32 Project: added dummy methods for make related private methods
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6240
diff changeset
149 appendStderr = pyqtSignal(str)
476
121633976eca Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 461
diff changeset
150
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 248
diff changeset
151 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
152
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
153 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
154 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
155
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
156 def __init__(self, parent=None, filename=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 @param parent parent widget (usually the ui object) (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 @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
162 """
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
163 super(Project, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 self.ui = parent
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166
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
167 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
168 "Python3",
7166
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
169 "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
170 "Ruby",
3439
08aa0cef69e3 Continued improving JavaScript support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3438
diff changeset
171 "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
172 ]
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
173
5254
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
174 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
175 "Python3": self.tr(
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
176 "Python3 Files (*.py *.py3);;"
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
177 "Python3 GUI Files (*.pyw *.pyw3);;"),
0
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
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 self.vcsMenu = None
6254
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6252
diff changeset
181 self.__makeProcess = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 self.__initProjectTypes()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self.__initData()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.recent = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.__loadRecent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 if filename is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 self.openProject(filename)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 self.vcs = self.initVCS()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
195 from .ProjectBrowserModel import ProjectBrowserModel
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 self.__model = ProjectBrowserModel(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197
945
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.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
199 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
200 self.profiledata = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 self.applicationDiagram = None
2034
8de0fc1f7fef Implemented functions to load UML graphics from disc.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2031
diff changeset
202 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
203 self.__findProjectFileDialog = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
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
205 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
206 """
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 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
208
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 @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
210 @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
211 """
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
212 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
213 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
214 # *.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
215 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
216 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
217 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
218 return extensions
7166
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
219 elif language == "MicroPython":
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
220 extensions = Preferences.getPython("Python3Extensions")
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
221 # *.py should always be associated with source files
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
222 for ext in [".py"]:
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
223 if ext not in extensions:
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
224 extensions.append(ext)
5a184952ba77 More MicroPython related fixes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7164
diff changeset
225 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
226 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
227 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
228 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
229 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
230 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
231 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
232 ['.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
233 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
234 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
235
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
236 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
237 """
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 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
239
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 @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
241 """
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 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
243
5254
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
244 def getDebuggerFilters(self, language):
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
245 """
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
246 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
247
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
248 @param language programming language
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
249 @type str
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
250 @return filter string
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
251 @rtype str
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
252 """
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
253 try:
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
254 return self.__dbgFilters[language]
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
255 except KeyError:
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
256 return ""
c89ecaa0eda3 Fixed a regression in the project debugger properties dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5244
diff changeset
257
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 def __initProjectTypes(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 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
261 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.__fileTypeCallbacks = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 self.__lexerAssociationCallbacks = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 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
265
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
266 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
267 "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
268 "PyQt5C": self.tr("PyQt5 Console"),
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
269 "PyQt6": self.tr("PyQt6 GUI"),
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
270 "PyQt6C": self.tr("PyQt6 Console"),
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
271 "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
272 "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
273 "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
274 }
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
275
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
276 self.__projectProgLanguages = {
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
277 "Python3": ["PyQt5", "PyQt5C", "PyQt6", "PyQt6C", "E6Plugin",
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
278 "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
279 "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
280 "Ruby": ["Console", "Other"],
4009
098c303a6857 Extended the project object a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
281 "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
282 }
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
283
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
284 if Utilities.checkPyside(variant=2):
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
285 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
286 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
287 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
288 ["PySide2", "PySide2C"])
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6265
diff changeset
289
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
290 if Utilities.checkPyside(variant=6):
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
291 self.__projectTypes["PySide6"] = self.tr("PySide6 GUI")
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
292 self.__projectTypes["PySide6C"] = self.tr("PySide6 Console")
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
293 self.__projectProgLanguages["Python3"].extend(
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
294 ["PySide6", "PySide6C"])
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
295
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
296 def getProjectTypes(self, progLanguage=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 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
299
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
300 @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
301 (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 @return reference to the dictionary of project types.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 """
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
304 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
305 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
306 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
307 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
308 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
309 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
310 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
311
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
312 def hasProjectType(self, type_, progLanguage=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 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
315
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
316 @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
317 @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
318 @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
319 """
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
320 if progLanguage:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
321 return (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
322 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
323 type_ in self.__projectProgLanguages[progLanguage]
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
324 )
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
325 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
326 return type_ in self.__projectTypes
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
328 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
329 binaryTranslationsCallback=None,
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
330 lexerAssociationCallback=None, progLanguages=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 Public method to register a project type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 @param type_ internal type designator to be registered (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 @param description more verbose type name (display string) (string)
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
336 @param fileTypeCallback reference to a method returning a dictionary
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 of filetype associations.
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
338 @param binaryTranslationsCallback reference to a method returning
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
339 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
340 translation file
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
341 @param lexerAssociationCallback reference to a method returning the
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 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
343 a file
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
344 @param progLanguages programming languages supported by the
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
345 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
346 """
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
347 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
348 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
349 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
350 # 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
351 return
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
352
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
353 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
354 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
355 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
356 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
357 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
358 """<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
359 """ 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
360 .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
361 )
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
362 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
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 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
365 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
366 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
367 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
368 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
369 """<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
370 """ registered with Programming Language"""
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
371 """ <b>{1}</b>.</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
372 .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
373 )
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
374 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
375
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 if type_ in self.__projectTypes:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
377 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
378 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
379 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
380 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
381 """ registered.</p>""").format(type_)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 self.__projectTypes[type_] = description
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 self.__fileTypeCallbacks[type_] = fileTypeCallback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
387 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
388 binaryTranslationsCallback
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
389 )
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
390 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
391 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
392 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
393 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
394 # 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
395 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
396 self.__projectProgLanguages[progLanguage].append(type_)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 def unregisterProjectType(self, type_):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 Public method to unregister a project type.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 @param type_ internal type designator to be unregistered (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 """
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
404 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
405 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
406 self.__projectProgLanguages[progLanguage].remove(type_)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 if type_ in self.__projectTypes:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 del self.__projectTypes[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 if type_ in self.__fileTypeCallbacks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 del self.__fileTypeCallbacks[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 if type_ in self.__lexerAssociationCallbacks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 del self.__lexerAssociationCallbacks[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 if type_ in self.__binaryTranslationsCallbacks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 del self.__binaryTranslationsCallbacks[type_]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 def __initData(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 Private method to initialize the project data part.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 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
421 self.__dirty = False # dirty flag
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 self.pfile = "" # name of the project file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 self.ppath = "" # name of the project directory
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.translationsRoot = "" # the translations prefix
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.name = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 self.opened = False
6955
7a8a2963cbdc Project: fixed a little inaccuracy not causing any issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
427 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
428 # 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
429 self.otherssubdirs = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 self.vcs = None
1874
7d5589d8699a Did the first step in the enhanced VCS handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1871
diff changeset
431 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
432 self.dbgVirtualEnv = ''
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 self.dbgCmdline = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 self.dbgWd = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 self.dbgEnv = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 self.dbgReportExceptions = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 self.dbgExcList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 self.dbgExcIgnoreList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 self.dbgAutoClearShell = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 self.dbgTracePython = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 self.dbgAutoContinue = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442
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
443 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
444 "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
445 "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
446 "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
447 "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
448 "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
449 "INTERFACES": [],
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5899
diff changeset
450 "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
451 "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
452 "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
453 "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
454 "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
455 "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
456 "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
457 "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
458 "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
459 "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
460 "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
461 "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
462 "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
463 "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
464 "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
465 "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
466 "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
467 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
468 "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
469 "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
470 "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
471 "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
472 "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
473 "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
474 "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
475 "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
476 "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
477 "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
478 "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
479 "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
480 "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
481 "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
482 "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
483 "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
484 },
6439
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
485 "IDLPARAMS": {
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
486 "IncludeDirs": [],
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
487 "DefinedNames": [],
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
488 "UndefinedNames": [],
86dd19e45d95 Project, ProjectInterfacesBrowser: started to implement some configuration capabilities for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6437
diff changeset
489 },
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
490 "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
491 "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
492 "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
493 "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
494 },
6615
386607e32376 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6604
diff changeset
495 "RCCPARAMS": {
6604
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
496 "CompressionThreshold": 70, # default value
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
497 "CompressLevel": 0, # use zlib default
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
498 "CompressionDisable": False,
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
499 "PathPrefix": "",
a73d553ef521 ProjectFormsBrowser: started implementing support for rcc compiler options
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
500 },
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
501 "EOL": -1,
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7992
diff changeset
502 "DOCSTRING": "",
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
503 }
0
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 self.__initDebugProperties()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506
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
507 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
508 "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
509 "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
510 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 self.vcs = self.initVCS()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 def getData(self, category, key):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 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
517
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 @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
519 PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS,
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
520 DOCUMENTATIONPARMS or OTHERTOOLSPARMS)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 @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
522 @return a copy of the requested data or None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 """
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
524 if (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
525 category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS",
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
526 "PACKAGERSPARMS", "DOCUMENTATIONPARMS",
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
527 "OTHERTOOLSPARMS"] and
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
528 key in self.pdata[category]
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
529 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 return copy.deepcopy(self.pdata[category][key])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 def setData(self, category, key, data):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536 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
537
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 @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
539 PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS,
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
540 DOCUMENTATIONPARMS or OTHERTOOLSPARMS)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 @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
542 @param data data to be stored
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 @return flag indicating success (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
545 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
546 "PACKAGERSPARMS", "DOCUMENTATIONPARMS",
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
547 "OTHERTOOLSPARMS"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 # 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
551 # 1. there were none, now there are
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 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
553 self.pdata[category][key] = copy.deepcopy(data)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 # 2. there were some, now there aren't
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 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
557 del self.pdata[category][key]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 # 3. there were some and still are
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 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
561 if data != self.pdata[category][key]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 self.pdata[category][key] = copy.deepcopy(data)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 # 4. there were none and none are given
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 def initFileTypes(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
571 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
572 values.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 """
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
574 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
575 "*.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
576 "*.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
577 "*.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
578 "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
579 "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
580 "*.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
581 "GNUmakefile": "OTHERS",
3ea0b969f608 Project: add a (currently) empty slot to handle the 'executeMake' signal.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6228
diff changeset
582 "makefile": "OTHERS",
3ea0b969f608 Project: add a (currently) empty slot to handle the 'executeMake' signal.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6228
diff changeset
583 "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
584 }
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
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
586 # 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
587 if self.pdata["MIXEDLANGUAGE"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 sourceKey = "Mixed"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 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
590 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
591 for ext in self.__sourceExtensions(sourceKey):
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 401
diff changeset
592 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
593
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 # IDL interfaces
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 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
596
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
597 # Protobuf Files
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
598 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
599
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 # 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
601 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
602 "PyQt5",
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
603 "PyQt6",
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
604 "PySide2",
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
605 "PySide6"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 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
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 # 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
609 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
610 "PyQt5", "PyQt5C",
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
611 "PySide2", "PySide2C",
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
612 "PySide6", "PySide6C"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 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
614
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
615 # 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
616 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
617 "PyQt5", "PyQt5C",
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
618 "PyQt6", "PyQt6C",
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
619 "PySide2", "PySide2C",
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
620 "PySide6", "PySide6C"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 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
623
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
624 # Project type specific ones
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 try:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
626 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
627 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
628 ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 self.pdata["FILETYPES"].update(ftypes)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 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
632
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 def updateFileTypes(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
637 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
638 values.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 """
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
640 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
641 "PyQt5", "PyQt5C",
7907
7991ea245c20 Added support for PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
642 "PyQt6", "PyQt6C",
7911
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
643 "PySide2", "PySide2C",
4621c9082a43 Added support for PySide6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7907
diff changeset
644 "PySide6", "PySide6C"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 if "*.ts" not in self.pdata["FILETYPES"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 if "*.qm" not in self.pdata["FILETYPES"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 try:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
650 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
651 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
652 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
653 for pattern, ftype in list(ftypes.items()):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 if pattern not in self.pdata["FILETYPES"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 self.pdata["FILETYPES"][pattern] = ftype
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 def __loadRecent(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 Private method to load the recently opened project filenames.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 self.recent = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 Preferences.Prefs.rsettings.sync()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 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
667 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
668 for f in rp:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 if QFileInfo(f).exists():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 self.recent.append(f)
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 __saveRecent(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 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
675 """
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
676 Preferences.Prefs.rsettings.setValue(recentNameProject, self.recent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 Preferences.Prefs.rsettings.sync()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 def getMostRecent(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 Public method to get the most recently opened project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 @return path of the most recently opened project (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 if len(self.recent):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686 return self.recent[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 def getModel(self):
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 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
693
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 @return reference to the project browser model (ProjectBrowserModel)
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 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
697
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
698 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
699 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
700 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
701 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
702 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
703
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
704 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
705 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
706 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
707 """
6dea4abd3097 Project: fixed some issue renaming files and directories via the active VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
708 self.__model.stopFileSystemMonitoring()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 def getVcs(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 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
713
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 @return reference to the VCS object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 return self.vcs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 def handlePreferencesChanged(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 Public slot used to handle the preferencesChanged signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 if self.pudata["VCSSTATUSMONITORINTERVAL"]:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
723 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
724 self.pudata["VCSSTATUSMONITORINTERVAL"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
726 self.setStatusMonitorInterval(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 Preferences.getVCS("StatusMonitorInterval"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 self.__model.preferencesChanged()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730
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
731 def setDirty(self, dirty):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 Public method to set the dirty state.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734
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
735 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
736
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
737 @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
738 @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
739 """
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
740 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
741 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
742 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
743 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
744 self.projectChanged.emit()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 def isDirty(self):
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 Public method to return the dirty state.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 @return dirty state (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 """
517
fe6fe492f82e Fixed an issue related to the usage of new style signal/slot.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
752 return self.__dirty
0
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 def isOpen(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 Public method to return the opened state.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 @return open state (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 return self.opened
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 def __checkFilesExist(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
764 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
765
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 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
767 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
768 dirty state of the project is changed accordingly.
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 index key of the list to be checked (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 removed = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 removelist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 for file in self.pdata[index]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 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
776 removelist.append(file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 removed = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 if removed:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 for file in removelist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 self.pdata[index].remove(file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 self.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 def __readProject(self, fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 """
608
d8fea1e76975 Removed capability to write compressed project (and related) files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 607
diff changeset
786 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
787
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 @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
789 @return flag indicating success
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 """
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
791 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
792 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
793 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
794 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
795 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
796 res = not reader.hasError()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 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
798 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
799 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
800 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
801 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
802 self.tr(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
803 "<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
804 .format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 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
806
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 self.pfile = os.path.abspath(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 self.ppath = os.path.abspath(os.path.dirname(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 # insert filename into list of recently opened projects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 self.__syncRecent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 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
814 if self.pdata["TRANSLATIONPATTERN"]:
7265
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
815 self.translationsRoot = self.pdata["TRANSLATIONPATTERN"].split(
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
816 "%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
817 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
818 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
819 self.pdata["MAINSCRIPT"])[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 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
821 dn = self.translationsRoot
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 dn = os.path.dirname(self.translationsRoot)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 if dn not in self.subdirs:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825 self.subdirs.append(dn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 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
828
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
829 # 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
830 # project directory
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 self.__checkFilesExist("SOURCES")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 self.__checkFilesExist("FORMS")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 self.__checkFilesExist("INTERFACES")
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
834 self.__checkFilesExist("PROTOCOLS")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 self.__checkFilesExist("TRANSLATIONS")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 self.__checkFilesExist("RESOURCES")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 self.__checkFilesExist("OTHERS")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 # 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
840 for fn in (
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
841 self.pdata["SOURCES"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
842 self.pdata["FORMS"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
843 self.pdata["INTERFACES"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
844 self.pdata["PROTOCOLS"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
845 self.pdata["RESOURCES"] +
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
846 self.pdata["TRANSLATIONS"]
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
847 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 dn = os.path.dirname(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 if dn not in self.subdirs:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 self.subdirs.append(dn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 # get the names of other subdirectories
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 for fn in self.pdata["OTHERS"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 dn = os.path.dirname(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 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
856 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
857
ee3a13a0ad59 Finished the introduction of a project hash to identify the project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 151
diff changeset
858 # 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
859 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
860 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
861 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
862 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
863 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
864 self.pdata["HASH"] = hashStr
151
00c27aeede62 Introduced a hash value to identify a project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 122
diff changeset
865 self.setDirty(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
869 def __writeProject(self, fn=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 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
872
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 @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
874 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
875 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
876 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
877 'save as' action.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
878 @return flag indicating success
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 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
881 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
882 self.pdata["VCSOTHERDATA"] = copy.deepcopy(
0665c4d509c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
883 self.vcs.vcsGetOtherData())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
884
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
885 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
886 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
887 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
888 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
889 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
890 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
891
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 if fn is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 fn = self.pfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894
610
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
895 f = QFile(fn)
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
896 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
897 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
898 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
899 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
900 res = True
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
901 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
902 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
903 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
904 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
905 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
906 "<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
907 " written.</p>").format(fn))
610
3a625b0793d8 Migrated the project writer to a stream writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 608
diff changeset
908 res = False
0
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 if res:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 self.pfile = os.path.abspath(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 self.ppath = os.path.abspath(os.path.dirname(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 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
914 self.setDirty(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 # insert filename into list of recently opened projects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 self.__syncRecent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 def __readUserProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 """
2964
84b65fb9e780 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2888
diff changeset
923 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
924 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 if self.pfile is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 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
929 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
930 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
931 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
932 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
933 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
934 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
935 reader.readXML()
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
936 f.close()
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
937 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
938 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
939 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
940 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
941 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
942 "<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
943 " <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
944
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 def __writeUserProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 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
948 """
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
949 if self.pfile is None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 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
953 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
954
606
cc26d1c27da5 Migrated user project properties handler to user project properties reader/writer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 599
diff changeset
955 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
956 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
957 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
958 UserProjectWriter(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
959 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
960 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
961 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
962 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
963 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
964 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
965 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
966 "<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
967 " could not be written.</p>").format(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968
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 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
970 """
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
971 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
972 """
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
973 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
974 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
975 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
976 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
977 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
978 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
979 '{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
980 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
981 '{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
982 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
983 self.sessActGrp.findChild(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
984 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
985 self.sessActGrp.findChild(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
986 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
987
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
988 @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
989 def __readSession(self, quiet=False, indicator=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 """
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
991 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
992
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993 @param quiet flag indicating quiet operations.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994 If this flag is true, no errors are reported.
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
995 @param indicator indicator string (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 if self.pfile is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 if not quiet:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
999 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1000 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
1001 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
1002 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1003 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004
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
1005 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
1006 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
1007 '{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
1008 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
1009 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
1010 '{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
1011
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1012 f = QFile(fn)
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1013 if f.open(QIODevice.ReadOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
1014 from E5XML.SessionReader import SessionReader
599
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1015 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
1016 reader.readXML(quiet=quiet)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 f.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 else:
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("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
1023 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1024 "<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
1025 " read.</p>").format(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
1027 @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
1028 def __writeSession(self, quiet=False, indicator=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029 """
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
1030 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
1031
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 @param quiet flag indicating quiet operations.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 If this flag is true, no errors are reported.
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
1034 @param indicator indicator string (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 """
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
1036 if self.pfile is None:
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("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 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
1045 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
1046 '{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
1047
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1048 f = QFile(fn)
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1049 if f.open(QIODevice.WriteOnly):
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2380
diff changeset
1050 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
1051 SessionWriter(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1052 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
1053 f.close()
599
ee87fe94bf96 Migrated the session handler to session reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 594
diff changeset
1054 else:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1055 if not quiet:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1056 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1057 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
1058 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
1059 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1060 "<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
1061 " written.</p>").format(fn))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1062
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1063 def __deleteSession(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1064 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065 Private method to delete the session file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1066 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1067 if self.pfile is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1068 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1069 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
1070 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
1071 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1072 return
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 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
1075
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
1076 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
1077 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
1078 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
1079 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
1080 self.getProjectManagementDir(), "{0}.e4s".format(fname))]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1081 if os.path.exists(fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1082 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 os.remove(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1084 except OSError:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1085 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1086 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
1087 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
1088 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
1089 "<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
1090 " not be deleted.</p>").format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1091
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1092 def __readTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1093 """
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
1094 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
1095 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1096 if self.pfile is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1097 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
1098 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
1099 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
1100 self.tr("Please save the project first."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1101 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1102
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
1103 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
1104 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
1105 '{0}.e6t'.format(base))
58