src/eric7/QScintilla/Shell.py

branch
server
changeset 10704
27d21e5163b8
parent 10680
306373ccf8fd
parent 10701
56fce4058bf1
child 10766
d35d6f96c24b
equal deleted inserted replaced
10680:306373ccf8fd 10704:27d21e5163b8
396 self.lmenu.clear() 396 self.lmenu.clear()
397 venvManager = ericApp().getObject("VirtualEnvManager") 397 venvManager = ericApp().getObject("VirtualEnvManager")
398 for venvName in sorted(venvManager.getVirtualenvNames()): 398 for venvName in sorted(venvManager.getVirtualenvNames()):
399 act = self.lmenu.addAction(venvName) 399 act = self.lmenu.addAction(venvName)
400 act.setData(venvName) 400 act.setData(venvName)
401 if self.__project.isOpen(): 401 if self.__project and self.__project.isOpen():
402 self.lmenu.addSeparator() 402 self.lmenu.addSeparator()
403 act = self.lmenu.addAction(self.tr("Project")) 403 act = self.lmenu.addAction(self.tr("Project"))
404 act.setData("<<project>>") 404 act.setData("<<project>>")
405 if ericApp().getObject("EricServer").isServerConnected(): 405 if ericApp().getObject("EricServer").isServerConnected():
406 self.lmenu.addSeparator() 406 self.lmenu.addSeparator()
1389 Private method to check, if the cursor is on the last line. 1389 Private method to check, if the cursor is on the last line.
1390 1390
1391 @return flag indicating that the cursor is on the last line 1391 @return flag indicating that the cursor is on the last line
1392 @rtype bool 1392 @rtype bool
1393 """ 1393 """
1394 cline, ccol = self.getCursorPosition() 1394 cline, _ccol = self.getCursorPosition()
1395 return cline == self.lines() - 1 1395 return cline == self.lines() - 1
1396 1396
1397 def keyPressEvent(self, ev): 1397 def keyPressEvent(self, ev):
1398 """ 1398 """
1399 Protected method to handle the user input a key at a time. 1399 Protected method to handle the user input a key at a time.
1705 elif cmd == QsciScintilla.SCI_LINESCROLLUP: 1705 elif cmd == QsciScintilla.SCI_LINESCROLLUP:
1706 self.__QScintillaHistoryUp(cmd) 1706 self.__QScintillaHistoryUp(cmd)
1707 elif cmd == QsciScintilla.SCI_LINESCROLLDOWN: 1707 elif cmd == QsciScintilla.SCI_LINESCROLLDOWN:
1708 self.__QScintillaHistoryDown(cmd) 1708 self.__QScintillaHistoryDown(cmd)
1709 1709
1710 def __QScintillaLineUp(self, cmd): # noqa: U100 1710 def __QScintillaLineUp(self, _cmd):
1711 """ 1711 """
1712 Private method to handle the cursor up command. 1712 Private method to handle the cursor up command.
1713 1713
1714 @param cmd QScintilla command 1714 @param _cmd QScintilla command (unused)
1715 @type int 1715 @type int
1716 """ 1716 """
1717 self.SendScintilla(QsciScintilla.SCI_LINEUP) 1717 self.SendScintilla(QsciScintilla.SCI_LINEUP)
1718 1718
1719 def __QScintillaLineDown(self, cmd): # noqa: U100 1719 def __QScintillaLineDown(self, _cmd):
1720 """ 1720 """
1721 Private method to handle the cursor down command. 1721 Private method to handle the cursor down command.
1722 1722
1723 @param cmd QScintilla command 1723 @param _cmd QScintilla command (unused)
1724 @type int 1724 @type int
1725 """ 1725 """
1726 self.SendScintilla(QsciScintilla.SCI_LINEDOWN) 1726 self.SendScintilla(QsciScintilla.SCI_LINEDOWN)
1727 1727
1728 def __QScintillaHistoryUp(self, cmd): # noqa: U100 1728 def __QScintillaHistoryUp(self, _cmd):
1729 """ 1729 """
1730 Private method to handle the history up command. 1730 Private method to handle the history up command.
1731 1731
1732 @param cmd QScintilla command 1732 @param _cmd QScintilla command (unused)
1733 @type int 1733 @type int
1734 """ 1734 """
1735 if self.isHistoryEnabled(): 1735 if self.isHistoryEnabled():
1736 line, col = self.__getEndPos() 1736 line, col = self.__getEndPos()
1737 buf = self.text(line) 1737 buf = self.text(line)
1769 self.__useHistory() 1769 self.__useHistory()
1770 elif self.__histidx > 0: 1770 elif self.__histidx > 0:
1771 self.__setHistoryIndex(index=self.__histidx - 1) 1771 self.__setHistoryIndex(index=self.__histidx - 1)
1772 self.__useHistory() 1772 self.__useHistory()
1773 1773
1774 def __QScintillaHistoryDown(self, cmd): # noqa: U100 1774 def __QScintillaHistoryDown(self, _cmd):
1775 """ 1775 """
1776 Private method to handle the history down command. 1776 Private method to handle the history down command.
1777 1777
1778 @param cmd QScintilla command 1778 @param _cmd QScintilla command (unused)
1779 @type int 1779 @type int
1780 """ 1780 """
1781 if self.isHistoryEnabled(): 1781 if self.isHistoryEnabled():
1782 line, col = self.__getEndPos() 1782 line, col = self.__getEndPos()
1783 buf = self.text(line) 1783 buf = self.text(line)
1913 self.tr("Project"), 1913 self.tr("Project"),
1914 self.tr("Project").lower(), 1914 self.tr("Project").lower(),
1915 "Project", 1915 "Project",
1916 "project", 1916 "project",
1917 ): 1917 ):
1918 if self.__project.isOpen(): 1918 if self.__project and self.__project.isOpen():
1919 self.dbs.startClient( 1919 self.dbs.startClient(
1920 False, 1920 False,
1921 forProject=True, 1921 forProject=True,
1922 workingDir=self.__project.getProjectPath(), 1922 workingDir=self.__project.getProjectPath(),
1923 ) 1923 )
2159 Public slot to handle the 'restart' context menu entry. 2159 Public slot to handle the 'restart' context menu entry.
2160 """ 2160 """
2161 venvName = ( 2161 venvName = (
2162 self.dbs.getProjectEnvironmentString() 2162 self.dbs.getProjectEnvironmentString()
2163 if ( 2163 if (
2164 self.__project.isOpen() 2164 self.__project
2165 and self.__project.isOpen()
2165 and self.__currentVenv 2166 and self.__currentVenv
2166 == self.__project.getProjectVenv(resolveDebugger=False) 2167 == self.__project.getProjectVenv(resolveDebugger=False)
2167 ) 2168 )
2168 else self.__currentVenv 2169 else self.__currentVenv
2169 ) 2170 )
2181 @param action context menu action that was triggered 2182 @param action context menu action that was triggered
2182 @type QAction 2183 @type QAction
2183 """ 2184 """
2184 venvName = action.data() 2185 venvName = action.data()
2185 if venvName == "<<project>>": 2186 if venvName == "<<project>>":
2186 if self.__project.isOpen(): 2187 if self.__project and self.__project.isOpen():
2187 self.__currentWorkingDirectory = self.__project.getProjectPath() 2188 self.__currentWorkingDirectory = self.__project.getProjectPath()
2188 self.dbs.startClient( 2189 self.dbs.startClient(
2189 False, forProject=True, workingDir=self.__currentWorkingDirectory 2190 False, forProject=True, workingDir=self.__currentWorkingDirectory
2190 ) 2191 )
2191 elif venvName == "<<eric-server>>": 2192 elif venvName == "<<eric-server>>":

eric ide

mercurial