eric7/QScintilla/MiniEditor.py

branch
eric7
changeset 9152
8a68afaf1ba2
parent 8885
b0bbe8bda1f2
--- a/eric7/QScintilla/MiniEditor.py	Wed Jun 15 09:44:07 2022 +0200
+++ b/eric7/QScintilla/MiniEditor.py	Thu Jun 16 18:28:59 2022 +0200
@@ -8,13 +8,14 @@
 """
 
 import os
+import pathlib
 import re
 import contextlib
 
 import editorconfig
 
 from PyQt6.QtCore import (
-    pyqtSignal, pyqtSlot, Qt, QSignalMapper, QPoint, QTimer, QFileInfo, QSize,
+    pyqtSignal, pyqtSlot, Qt, QSignalMapper, QPoint, QTimer, QSize,
     QCoreApplication
 )
 from PyQt6.QtGui import (
@@ -497,7 +498,7 @@
         if not self.__curFile:
             writ = '   '
         else:
-            if QFileInfo(self.__curFile).isWritable():
+            if os.access(self.__curFile, os.W_OK):
                 writ = ' rw'
             else:
                 writ = ' ro'
@@ -2874,7 +2875,7 @@
         @param fullFileName full pathname of the given file (string)
         @return filename part (string)
         """
-        return QFileInfo(fullFileName).fileName()
+        return pathlib.Path(fullFileName).name
 
     def __modificationChanged(self, m):
         """
@@ -3140,7 +3141,7 @@
             sb.showMessage(self.tr('Printing...'))
             QApplication.processEvents()
             if self.__curFile:
-                printer.setDocName(QFileInfo(self.__curFile).fileName())
+                printer.setDocName(pathlib.Path(self.__curFile).name)
             else:
                 printer.setDocName(self.tr("Untitled"))
             if (
@@ -3175,7 +3176,7 @@
         
         printer = Printer(mode=QPrinter.PrinterMode.HighResolution)
         if self.__curFile:
-            printer.setDocName(QFileInfo(self.__curFile).fileName())
+            printer.setDocName(pathlib.Path(self.__curFile).name)
         else:
             printer.setDocName(self.tr("Untitled"))
         preview = QPrintPreviewDialog(printer, self)

eric ide

mercurial