eric7/Project/ProjectFile.py

branch
eric7
changeset 9023
5c6e160faa32
parent 8881
54e42bc2437a
equal deleted inserted replaced
9022:91efc01ae8cb 9023:5c6e160faa32
5 5
6 """ 6 """
7 Module implementing a class representing the project JSON file. 7 Module implementing a class representing the project JSON file.
8 """ 8 """
9 9
10 import contextlib
11 import copy
10 import json 12 import json
11 import time 13 import time
12 import contextlib
13 import typing 14 import typing
14 15
15 from PyQt6.QtCore import QObject 16 from PyQt6.QtCore import QObject
16 17
17 from EricWidgets import EricMessageBox 18 from EricWidgets import EricMessageBox
61 if Preferences.getProject("TimestampFile"): 62 if Preferences.getProject("TimestampFile"):
62 projectDict["header"]["saved"] = ( 63 projectDict["header"]["saved"] = (
63 time.strftime('%Y-%m-%d, %H:%M:%S') 64 time.strftime('%Y-%m-%d, %H:%M:%S')
64 ) 65 )
65 66
66 projectDict["project"] = self.__project.pdata 67 projectDict["project"] = copy.deepcopy(self.__project.pdata)
67 68
68 # modify paths to contain universal separators 69 # modify paths to contain universal separators
69 for key in ( 70 for key in (
70 "SOURCES", "FORMS", "TRANSLATIONS", "TRANSLATIONEXCEPTIONS", 71 "SOURCES", "FORMS", "TRANSLATIONS", "TRANSLATIONEXCEPTIONS",
71 "RESOURCES", "INTERFACES", "PROTOCOLS", "OTHERS" 72 "RESOURCES", "INTERFACES", "PROTOCOLS", "OTHERS"
72 ): 73 ):
73 with contextlib.suppress(KeyError): 74 with contextlib.suppress(KeyError):
74 projectDict["project"][key] = [ 75 projectDict["project"][key] = sorted([
75 Utilities.fromNativeSeparators(f) 76 Utilities.fromNativeSeparators(f)
76 for f in projectDict["project"][key] 77 for f in projectDict["project"][key]
77 ] 78 ])
78 for key in ( 79 for key in (
79 "SPELLWORDS", "SPELLEXCLUDES", "TRANSLATIONPATTERN", 80 "SPELLWORDS", "SPELLEXCLUDES", "TRANSLATIONPATTERN",
80 "TRANSLATIONSBINPATH", "MAINSCRIPT" 81 "TRANSLATIONSBINPATH", "MAINSCRIPT"
81 ): 82 ):
82 with contextlib.suppress(KeyError): 83 with contextlib.suppress(KeyError):

eric ide

mercurial