src/eric7/QScintilla/Editor.py

branch
eric7-maintenance
changeset 11019
27cd57e98461
parent 10941
07cad049002c
parent 11006
a671918232f3
child 11118
967a88a16a21
--- a/src/eric7/QScintilla/Editor.py	Thu Oct 03 17:06:51 2024 +0200
+++ b/src/eric7/QScintilla/Editor.py	Thu Oct 31 10:54:33 2024 +0100
@@ -461,12 +461,16 @@
                 if FileSystemUtilities.isRemoteFileName(self.fileName):
                     fileIsRemote = True
                     fileExists = self.__remotefsInterface.exists(self.fileName)
-                    fileSizeKB = (
-                        self.__remotefsInterface.stat(self.fileName, ["st_size"])[
-                            "st_size"
-                        ]
-                        // 1024
-                    )
+                    try:
+                        fileSizeKB = (
+                            self.__remotefsInterface.stat(self.fileName, ["st_size"])[
+                                "st_size"
+                            ]
+                            // 1024
+                        )
+                    except KeyError:
+                        # should not happen, but play it save
+                        fileSizeKB = 0
                 elif FileSystemUtilities.isDeviceFileName(self.fileName):
                     fileIsRemote = False
                     fileExists = False
@@ -2864,7 +2868,7 @@
                     (self.fileName, ln),
                     (cond, temp, enabled, ignorecount),
                     condHistory,
-                    self,
+                    parent=self,
                     modal=True,
                 )
                 if dlg.exec() == QDialog.DialogCode.Accepted:
@@ -8769,7 +8773,7 @@
         """
         from eric7.Project.AddLanguageDialog import AddLanguageDialog
 
-        dlg = AddLanguageDialog(self)
+        dlg = AddLanguageDialog(parent=self)
         if dlg.exec() == QDialog.DialogCode.Accepted:
             lang = dlg.getSelectedLanguage()
             line, index = self.getCursorPosition()
@@ -9195,7 +9199,7 @@
 
         if self.spell:
             cline, cindex = self.getCursorPosition()
-            dlg = SpellCheckingDialog(self.spell, 0, self.length(), self)
+            dlg = SpellCheckingDialog(self.spell, 0, self.length(), parent=self)
             dlg.exec()
             self.setCursorPosition(cline, cindex)
             if Preferences.getEditor("AutoSpellCheckingEnabled"):
@@ -9211,7 +9215,7 @@
         sline, sindex, eline, eindex = self.getSelection()
         startPos = self.positionFromLineIndex(sline, sindex)
         endPos = self.positionFromLineIndex(eline, eindex)
-        dlg = SpellCheckingDialog(self.spell, startPos, endPos, self)
+        dlg = SpellCheckingDialog(self.spell, startPos, endPos, parent=self)
         dlg.exec()
 
     @pyqtSlot()
@@ -9225,7 +9229,7 @@
         wordStart, wordEnd = self.getWordBoundaries(line, index)
         wordStartPos = self.positionFromLineIndex(line, wordStart)
         wordEndPos = self.positionFromLineIndex(line, wordEnd)
-        dlg = SpellCheckingDialog(self.spell, wordStartPos, wordEndPos, self)
+        dlg = SpellCheckingDialog(self.spell, wordStartPos, wordEndPos, parent=self)
         dlg.exec()
 
     @pyqtSlot()
@@ -9669,7 +9673,7 @@
         if not self.selectionIsRectangle():
             return
 
-        dlg = SortOptionsDialog()
+        dlg = SortOptionsDialog(parent=self)
         if dlg.exec() == QDialog.DialogCode.Accepted:
             ascending, alnum, caseSensitive = dlg.getData()
             (
@@ -10278,12 +10282,16 @@
                 and self.project.isOpen()
                 and self.project.isProjectCategory(self.fileName, "SOURCES")
             )
-            dlg = BlackConfigurationDialog(withProject=withProject)
+            dlg = BlackConfigurationDialog(withProject=withProject, parent=self)
             if dlg.exec() == QDialog.DialogCode.Accepted:
                 config = dlg.getConfiguration()
 
                 formattingDialog = BlackFormattingDialog(
-                    config, [self.fileName], project=self.project, action=action
+                    config,
+                    [self.fileName],
+                    project=self.project,
+                    action=action,
+                    parent=self,
                 )
                 formattingDialog.exec()
 
@@ -10314,7 +10322,7 @@
                 and self.project.isOpen()
                 and self.project.isProjectCategory(self.fileName, "SOURCES")
             )
-            dlg = IsortConfigurationDialog(withProject=withProject)
+            dlg = IsortConfigurationDialog(withProject=withProject, parent=self)
             if dlg.exec() == QDialog.DialogCode.Accepted:
                 config = dlg.getConfiguration()
 
@@ -10323,5 +10331,6 @@
                     [self.fileName],
                     project=self.project if withProject else None,
                     action=action,
+                    parent=self,
                 )
                 formattingDialog.exec()

eric ide

mercurial