447 if editor is None: |
447 if editor is None: |
448 if self.fileName: |
448 if self.fileName: |
449 if not Utilities.MimeTypes.isTextFile(self.fileName): |
449 if not Utilities.MimeTypes.isTextFile(self.fileName): |
450 raise OSError() |
450 raise OSError() |
451 |
451 |
452 if ( |
452 if FileSystemUtilities.isRemoteFileName(self.fileName): |
453 FileSystemUtilities.isPlainFileName(self.fileName) |
453 fileIsRemote = True |
454 and pathlib.Path(self.fileName).exists() |
454 fileExists = self.__remotefsInterface.exists(self.fileName) |
455 ): |
455 fileSizeKB = self.__remotefsInterface.stat( |
|
456 self.fileName, ["st_size"] |
|
457 )["st_size"] // 1024 |
|
458 else: |
|
459 fileIsRemote = False |
|
460 fileExists = pathlib.Path(self.fileName).exists() |
456 fileSizeKB = pathlib.Path(self.fileName).stat().st_size // 1024 |
461 fileSizeKB = pathlib.Path(self.fileName).stat().st_size // 1024 |
|
462 if fileExists: |
457 if fileSizeKB > Preferences.getEditor("RejectFilesize"): |
463 if fileSizeKB > Preferences.getEditor("RejectFilesize"): |
458 EricMessageBox.warning( |
464 EricMessageBox.warning( |
459 None, |
465 None, |
460 self.tr("Open File"), |
466 self.tr("Open File"), |
461 self.tr( |
467 self.tr( |
481 icon=EricMessageBox.Warning, |
487 icon=EricMessageBox.Warning, |
482 ) |
488 ) |
483 if not res: |
489 if not res: |
484 raise OSError() |
490 raise OSError() |
485 |
491 |
486 self.readFile(self.fileName, createIt=True) |
492 self.readFile(self.fileName, createIt=True, isRemote=fileIsRemote) |
487 |
|
488 elif FileSystemUtilities.isRemoteFileName(self.fileName): |
|
489 self.readFile(self.fileName, createIt=True, isRemote=True) |
|
490 |
493 |
491 self.__bindLexer(self.fileName) |
494 self.__bindLexer(self.fileName) |
492 self.__bindCompleter(self.fileName) |
495 self.__bindCompleter(self.fileName) |
493 self.checkSyntax() |
496 self.checkSyntax() |
494 self.isResourcesFile = self.fileName.endswith(".qrc") |
497 self.isResourcesFile = self.fileName.endswith(".qrc") |