eric6/Project/Project.py

Wed, 27 Jan 2021 15:09:20 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 27 Jan 2021 15:09:20 +0100
branch
jsonfiles
changeset 8009
29818ac4853c
parent 8006
c4110b8b5931
child 8010
7ce2b8bb0d9b
permissions
-rw-r--r--

Implemented the JSON based session files.

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