--- a/src/eric7/ViewManager/ViewManager.py Wed Apr 10 17:03:56 2024 +0200 +++ b/src/eric7/ViewManager/ViewManager.py Wed May 15 10:45:50 2024 +0200 @@ -148,6 +148,7 @@ # initialize the file system watcher watcher = EricFileSystemWatcher.instance() watcher.fileModified.connect(self.__watchedFileChanged) + watcher.error.connect(self.__watcherError) self.__watchedFilePaths = [] @@ -5825,7 +5826,7 @@ self._modificationStatusChanged(editor.isModified(), editor) self._checkActions(editor) - cline, cindex = editor.getCursorPosition() + cline, _cindex = editor.getCursorPosition() cline += 1 if isinstance(lineno, list): if len(lineno) > 1: @@ -5997,7 +5998,7 @@ self.openSourceFile(fn, line) self.setFileLine(fn, line) - def setFileLine(self, fn, line, error=False, syntaxError=False): + def setFileLine(self, fn, line, error=False): """ Public method to update the user interface when the current program or line changes. @@ -6008,8 +6009,6 @@ @type int @param error flag indicating an error highlight @type bool - @param syntaxError flag indicating a syntax error - @type bool """ try: newWin, self.currentEditor = self.getEditor(fn) @@ -6023,7 +6022,7 @@ self.__setSbFile(fn, line, encoding=enc, language=lang, eol=eol, zoom=zoom) # Change the highlighted line. - self.currentEditor.highlight(line, error, syntaxError) + self.currentEditor.highlight(line=line, error=error) self.currentEditor.highlightVisible() self._checkActions(self.currentEditor, False) @@ -6219,6 +6218,9 @@ filetype=filetype, tv=ericApp().getObject("TaskViewer"), ) + + self.addWatchedFilePath(fn) + editor = assembly.getEditor() self.editors.append(editor) self.__connectEditor(editor) @@ -6227,8 +6229,6 @@ self.editorOpenedEd.emit(editor) self.editorCountChanged.emit(len(self.editors)) - self.addWatchedFilePath(fn) - newWin = True if newWin: @@ -8200,6 +8200,43 @@ for editor in editorList: editor.recordModificationTime() + @pyqtSlot(int, str) + def __watcherError(self, errno, strerror): + """ + Private slot to handle an error of the file system watcher. + + @param errno numeric error code + @type int + @param strerror error message as provided by the operating system + @type str + """ + if errno == 24: + EricMessageBox.critical( + self, + self.tr("File System Watcher Error"), + self.tr( + """<p>The operating system resources for file system watches""" + """ are exhausted. This limit should be increased. On a Linux""" + """ system you should """ + """<ul>""" + """<li>sudo nano /etc/sysctl.conf</li>""" + """<li>add to the bottom "fs.inotify.max_user_instances""" + """ = 1024"</li>""" + """<li>save and close the editor</li>""" + """<li>sudo sysctl -p</li>""" + """</ul></p><p>Error Message: {0}</p>""" + ).format(strerror), + ) + else: + EricMessageBox.critical( + self, + self.tr("File System Watcher Error"), + self.tr( + "The file system watcher reported an error with code <b>{0}</b>." + "</p><p>Error Message: {1}</p>" + ).format(errno, strerror), + ) + def addWatchedFilePath(self, filePath): """ Public method to add a file to the list of monitored files.