Skip to content
Permalink
Browse files

Improvement to contextual menu

- typo in help.htm
  • Loading branch information
slarosa committed Oct 28, 2012
1 parent 83f6712 commit 50f335269bc38862c469326ddc6e5ac34a723275
Showing with 22 additions and 19 deletions.
  1. +2 −2 python/console_help/help.htm
  2. +14 −8 python/console_output.py
  3. +6 −9 python/console_sci.py
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "httpqrc://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="httpqrc://www.w3.org/1999/xhtml">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Help Python Console</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -108,6 +108,9 @@ def __init__(self, parent=None):
self.SendScintilla(QsciScintilla.SCI_SETWRAPMODE, 2)
self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)

self.runShortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_E), self)
self.runShortcut.activated.connect(self.enteredSelected)

def refreshLexerProperties(self):
self.setLexers()

@@ -143,18 +146,16 @@ def clearConsole(self):

def contextMenuEvent(self, e):
menu = QMenu(self)
runAction = menu.addAction("Enter Selected")
copyAction = menu.addAction("Copy CTRL+C")
iconRun = QIcon(":/images/console/iconRunConsole.png")
runAction = menu.addAction(iconRun, "Enter Selected", self.enteredSelected, QKeySequence(Qt.CTRL + Qt.Key_E))
menu.addSeparator()
copyAction = menu.addAction("Copy", self.copy, QKeySequence.Copy)
runAction.setEnabled(False)
copyAction.setEnabled(False)
if self.hasSelectedText():
runAction.setEnabled(True)
copyAction.setEnabled(True)
action = menu.exec_(self.mapToGlobal(e.pos()))
if action == runAction:
cmd = self.selectedText()
self.edit.insertFromDropPaste(cmd)
self.edit.entered()
if action == copyAction:
self.copy()

def copy(self):
"""Copy text to clipboard... or keyboard interrupt"""
@@ -165,3 +166,8 @@ def copy(self):
else:
self.emit(SIGNAL("keyboard_interrupt()"))

def enteredSelected(self):
cmd = self.selectedText()
self.edit.insertFromDropPaste(cmd)
self.edit.entered()

@@ -119,9 +119,7 @@ def __init__(self, parent=None):
self.newShortcutCAS.activated.connect(self.showHistory)
self.connect(self, SIGNAL('userListActivated(int, const QString)'),
self.completion_list_selected)

self.createStandardContextMenu()


def showHistory(self):
self.showUserList(1, QStringList(self.history))

@@ -413,13 +411,12 @@ def keyPressEvent(self, e):

def contextMenuEvent(self, e):
menu = QMenu(self)
copyAction = menu.addAction("Copy CTRL+C")
pasteAction = menu.addAction("Paste CTRL+V")
copyAction = menu.addAction("Copy", self.copy, QKeySequence.Copy)
pasteAction = menu.addAction("Paste", self.paste, QKeySequence.Paste)
copyAction.setEnabled(False)
if self.hasSelectedText():
copyAction.setEnabled(True)
action = menu.exec_(self.mapToGlobal(e.pos()))
if action == copyAction:
self.copy()
elif action == pasteAction:
self.paste()

def mousePressEvent(self, e):
"""

0 comments on commit 50f3352

Please sign in to comment.
You can’t perform that action at this time.