eric6/HexEdit/HexEditMainWindow.py

changeset 8222
5994b80b8760
parent 8220
006ee31b4835
child 8240
93b8a353c4bf
--- a/eric6/HexEdit/HexEditMainWindow.py	Sun Apr 11 16:53:48 2021 +0200
+++ b/eric6/HexEdit/HexEditMainWindow.py	Sun Apr 11 18:45:10 2021 +0200
@@ -940,9 +940,12 @@
         """
         Private slot called to open a binary file in new hex editor window.
         """
-        if not self.__lastOpenPath:
-            if self.__project and self.__project.isOpen():
-                self.__lastOpenPath = self.__project.getProjectPath()
+        if (
+            not self.__lastOpenPath and
+            self.__project is not None and
+            self.__project.isOpen()
+        ):
+            self.__lastOpenPath = self.__project.getProjectPath()
         
         fileName = E5FileDialog.getOpenFileName(
             self,
@@ -1012,9 +1015,12 @@
         Private slot to open a binary file.
         """
         if self.__maybeSave():
-            if not self.__lastOpenPath:
-                if self.__project and self.__project.isOpen():
-                    self.__lastOpenPath = self.__project.getProjectPath()
+            if (
+                not self.__lastOpenPath and
+                self.__project is not None and
+                self.__project.isOpen()
+            ):
+                self.__lastOpenPath = self.__project.getProjectPath()
             
             fileName = E5FileDialog.getOpenFileName(
                 self,
@@ -1057,9 +1063,12 @@
         @return flag indicating success
         @rtype bool
         """
-        if not self.__lastSavePath:
-            if self.__project and self.__project.isOpen():
-                self.__lastSavePath = self.__project.getProjectPath()
+        if (
+            not self.__lastSavePath and
+            self.__project is not None and
+            self.__project.isOpen()
+        ):
+            self.__lastSavePath = self.__project.getProjectPath()
         if not self.__lastSavePath and self.__lastOpenPath:
             self.__lastSavePath = self.__lastOpenPath
         
@@ -1136,9 +1145,12 @@
         @type bool
         """
         savePath = self.__lastSavePath
-        if not savePath:
-            if self.__project and self.__project.isOpen():
-                savePath = self.__project.getProjectPath()
+        if (
+            not savePath and
+            self.__project is not None and
+            self.__project.isOpen()
+        ):
+            savePath = self.__project.getProjectPath()
         if not savePath and self.__lastOpenPath:
             savePath = self.__lastOpenPath
         
@@ -1418,10 +1430,7 @@
         self.__recentMenu.clear()
         
         for idx, rs in enumerate(self.__recent, start=1):
-            if idx < 10:
-                formatStr = '&{0:d}. {1}'
-            else:
-                formatStr = '{0:d}. {1}'
+            formatStr = '&{0:d}. {1}' if idx < 10 else '{0:d}. {1}'
             act = self.__recentMenu.addAction(
                 formatStr.format(
                     idx,

eric ide

mercurial