src/eric7/QScintilla/Shell.py

branch
server
changeset 10704
27d21e5163b8
parent 10680
306373ccf8fd
parent 10701
56fce4058bf1
child 10766
d35d6f96c24b
--- a/src/eric7/QScintilla/Shell.py	Wed Apr 10 17:03:56 2024 +0200
+++ b/src/eric7/QScintilla/Shell.py	Wed May 15 10:45:50 2024 +0200
@@ -398,7 +398,7 @@
         for venvName in sorted(venvManager.getVirtualenvNames()):
             act = self.lmenu.addAction(venvName)
             act.setData(venvName)
-        if self.__project.isOpen():
+        if self.__project and self.__project.isOpen():
             self.lmenu.addSeparator()
             act = self.lmenu.addAction(self.tr("Project"))
             act.setData("<<project>>")
@@ -1391,7 +1391,7 @@
         @return flag indicating that the cursor is on the last line
         @rtype bool
         """
-        cline, ccol = self.getCursorPosition()
+        cline, _ccol = self.getCursorPosition()
         return cline == self.lines() - 1
 
     def keyPressEvent(self, ev):
@@ -1707,29 +1707,29 @@
                 elif cmd == QsciScintilla.SCI_LINESCROLLDOWN:
                     self.__QScintillaHistoryDown(cmd)
 
-    def __QScintillaLineUp(self, cmd):  # noqa: U100
+    def __QScintillaLineUp(self, _cmd):
         """
         Private method to handle the cursor up command.
 
-        @param cmd QScintilla command
+        @param _cmd QScintilla command (unused)
         @type int
         """
         self.SendScintilla(QsciScintilla.SCI_LINEUP)
 
-    def __QScintillaLineDown(self, cmd):  # noqa: U100
+    def __QScintillaLineDown(self, _cmd):
         """
         Private method to handle the cursor down command.
 
-        @param cmd QScintilla command
+        @param _cmd QScintilla command (unused)
         @type int
         """
         self.SendScintilla(QsciScintilla.SCI_LINEDOWN)
 
-    def __QScintillaHistoryUp(self, cmd):  # noqa: U100
+    def __QScintillaHistoryUp(self, _cmd):
         """
         Private method to handle the history up command.
 
-        @param cmd QScintilla command
+        @param _cmd QScintilla command (unused)
         @type int
         """
         if self.isHistoryEnabled():
@@ -1771,11 +1771,11 @@
                         self.__setHistoryIndex(index=self.__histidx - 1)
                         self.__useHistory()
 
-    def __QScintillaHistoryDown(self, cmd):  # noqa: U100
+    def __QScintillaHistoryDown(self, _cmd):
         """
         Private method to handle the history down command.
 
-        @param cmd QScintilla command
+        @param _cmd QScintilla command (unused)
         @type int
         """
         if self.isHistoryEnabled():
@@ -1915,7 +1915,7 @@
                                 "Project",
                                 "project",
                             ):
-                                if self.__project.isOpen():
+                                if self.__project and self.__project.isOpen():
                                     self.dbs.startClient(
                                         False,
                                         forProject=True,
@@ -2161,7 +2161,8 @@
         venvName = (
             self.dbs.getProjectEnvironmentString()
             if (
-                self.__project.isOpen()
+                self.__project
+                and self.__project.isOpen()
                 and self.__currentVenv
                 == self.__project.getProjectVenv(resolveDebugger=False)
             )
@@ -2183,7 +2184,7 @@
         """
         venvName = action.data()
         if venvName == "<<project>>":
-            if self.__project.isOpen():
+            if self.__project and self.__project.isOpen():
                 self.__currentWorkingDirectory = self.__project.getProjectPath()
             self.dbs.startClient(
                 False, forProject=True, workingDir=self.__currentWorkingDirectory

eric ide

mercurial