eric6/Project/Project.py

Sun, 11 Apr 2021 18:45:10 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 11 Apr 2021 18:45:10 +0200
changeset 8222
5994b80b8760
parent 8221
0572a215bd2f
child 8228
772103b14c18
permissions
-rw-r--r--

Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).

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