eric7/QScintilla/APIsManager.py

branch
eric7
changeset 9152
8a68afaf1ba2
parent 8881
54e42bc2437a
child 9186
0c28a1670e06
equal deleted inserted replaced
9151:8c5296fe3056 9152:8a68afaf1ba2
6 """ 6 """
7 Module implementing the APIsManager. 7 Module implementing the APIsManager.
8 """ 8 """
9 9
10 import os 10 import os
11 11 import pathlib
12 from PyQt6.QtCore import QDir, QFileInfo, pyqtSignal, QObject 12
13 from PyQt6.QtCore import QDir, pyqtSignal, QObject
13 from PyQt6.Qsci import QsciAPIs 14 from PyQt6.Qsci import QsciAPIs
14 15
15 from . import Lexers 16 from . import Lexers
16 import Preferences 17 import Preferences
17 import Globals 18 import Globals
163 needsPreparation = True 164 needsPreparation = True
164 else: 165 else:
165 # check, if a new preparation is necessary 166 # check, if a new preparation is necessary
166 preparedAPIs = self.__preparedName() 167 preparedAPIs = self.__preparedName()
167 if preparedAPIs: 168 if preparedAPIs:
168 preparedAPIsInfo = QFileInfo(preparedAPIs) 169 preparedPath = pathlib.Path(preparedAPIs)
169 if not preparedAPIsInfo.exists(): 170 if not preparedPath.exists():
170 needsPreparation = True 171 needsPreparation = True
171 else: 172 else:
172 preparedAPIsTime = preparedAPIsInfo.lastModified() 173 preparedAPIsModified = preparedPath.stat().st_mtime
173 apifiles = sorted(Preferences.getEditorAPI( 174 apifiles = sorted(Preferences.getEditorAPI(
174 self.__language, self.__projectType)) 175 self.__language, self.__projectType))
175 if self.__apifiles != apifiles: 176 if self.__apifiles != apifiles:
176 needsPreparation = True 177 needsPreparation = True
177 for apifile in apifiles: 178 for apifile in apifiles:
178 if ( 179 if (
179 QFileInfo(apifile).lastModified() > 180 pathlib.Path(apifile).stat().st_mtime >
180 preparedAPIsTime 181 preparedAPIsModified
181 ): 182 ):
182 needsPreparation = True 183 needsPreparation = True
183 break 184 break
184 185
185 if needsPreparation: 186 if needsPreparation:

eric ide

mercurial