QScintilla/Shell.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3039
8dd0165d805d
child 3080
6c0a430b19df
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
1269 else: 1269 else:
1270 # language not supported or typo 1270 # language not supported or typo
1271 self.__write( 1271 self.__write(
1272 self.trUtf8( 1272 self.trUtf8(
1273 'Shell language "{0}" not supported.\n') 1273 'Shell language "{0}" not supported.\n')
1274 .format(cmdList[1])) 1274 .format(cmdList[1]))
1275 self.__clientStatement(False) 1275 self.__clientStatement(False)
1276 return 1276 return
1277 cmd = '' 1277 cmd = ''
1278 elif cmd == 'languages': 1278 elif cmd == 'languages':
1279 s = '{0}\n'.format(', '.join(self.clientLanguages)) 1279 s = '{0}\n'.format(', '.join(self.clientLanguages))
1326 Private method to insert a command selected from the history. 1326 Private method to insert a command selected from the history.
1327 1327
1328 @param cmd history entry to be inserted (string) 1328 @param cmd history entry to be inserted (string)
1329 """ 1329 """
1330 self.setCursorPosition(self.prline, self.prcol) 1330 self.setCursorPosition(self.prline, self.prcol)
1331 self.setSelection(self.prline, self.prcol,\ 1331 self.setSelection(self.prline, self.prcol,
1332 self.prline, self.lineLength(self.prline)) 1332 self.prline, self.lineLength(self.prline))
1333 self.removeSelectedText() 1333 self.removeSelectedText()
1334 self.__insertText(cmd) 1334 self.__insertText(cmd)
1335 1335
1336 def __searchHistory(self, txt, startIdx=-1): 1336 def __searchHistory(self, txt, startIdx=-1):
1344 if startIdx == -1: 1344 if startIdx == -1:
1345 idx = 0 1345 idx = 0
1346 else: 1346 else:
1347 idx = startIdx + 1 1347 idx = startIdx + 1
1348 while idx < len(self.history) and \ 1348 while idx < len(self.history) and \
1349 not self.history[idx].startswith(txt): 1349 not self.history[idx].startswith(txt):
1350 idx += 1 1350 idx += 1
1351 return idx 1351 return idx
1352 1352
1353 def __rsearchHistory(self, txt, startIdx=-1): 1353 def __rsearchHistory(self, txt, startIdx=-1):
1354 """ 1354 """
1361 if startIdx == -1: 1361 if startIdx == -1:
1362 idx = len(self.history) - 1 1362 idx = len(self.history) - 1
1363 else: 1363 else:
1364 idx = startIdx - 1 1364 idx = startIdx - 1
1365 while idx >= 0 and \ 1365 while idx >= 0 and \
1366 not self.history[idx].startswith(txt): 1366 not self.history[idx].startswith(txt):
1367 idx -= 1 1367 idx -= 1
1368 return idx 1368 return idx
1369 1369
1370 def focusNextPrevChild(self, next): 1370 def focusNextPrevChild(self, next):
1371 """ 1371 """
1543 else: 1543 else:
1544 E5MessageBox.information( 1544 E5MessageBox.information(
1545 self, 1545 self,
1546 self.trUtf8("Drop Error"), 1546 self.trUtf8("Drop Error"),
1547 self.trUtf8("""<p><b>{0}</b> is not a file.</p>""") 1547 self.trUtf8("""<p><b>{0}</b> is not a file.</p>""")
1548 .format(fname)) 1548 .format(fname))
1549 event.acceptProposedAction() 1549 event.acceptProposedAction()
1550 elif event.mimeData().hasText(): 1550 elif event.mimeData().hasText():
1551 s = event.mimeData().text() 1551 s = event.mimeData().text()
1552 if s: 1552 if s:
1553 event.acceptProposedAction() 1553 event.acceptProposedAction()
1616 1616
1617 The cursor is advanced to the end of the inserted text. 1617 The cursor is advanced to the end of the inserted text.
1618 1618
1619 @param txt text to be inserted (string) 1619 @param txt text to be inserted (string)
1620 """ 1620 """
1621 l = len(txt) 1621 length = len(txt)
1622 line, col = self.getCursorPosition() 1622 line, col = self.getCursorPosition()
1623 self.insertAt(txt, line, col) 1623 self.insertAt(txt, line, col)
1624 if re.search(self.linesepRegExp, txt) is not None: 1624 if re.search(self.linesepRegExp, txt) is not None:
1625 line += 1 1625 line += 1
1626 self.setCursorPosition(line, col + l) 1626 self.setCursorPosition(line, col + length)
1627 1627
1628 def __configure(self): 1628 def __configure(self):
1629 """ 1629 """
1630 Private method to open the configuration dialog. 1630 Private method to open the configuration dialog.
1631 """ 1631 """

eric ide

mercurial