Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions preditor/gui/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ def codeHighlighter(self):
"""
return self._uiCodeHighlighter

def contextMenuEvent(self, event):
menu = self.createStandardContextMenu()
menu.setFont(self.window().font())
menu.exec(self.mapToGlobal(event.pos()))

def doubleSingleShotSetScrollValue(self, origPercent):
"""This double QTimer.singleShot monkey business seems to be the only way
to get scroll.maximum() to update properly so that we calc newValue
Expand Down Expand Up @@ -241,17 +246,6 @@ def mouseReleaseEvent(self, event):
QApplication.restoreOverrideCursor()
return super(ConsolePrEdit, self).mouseReleaseEvent(event)

def wheelEvent(self, event):
"""Override of wheelEvent to allow for font resizing by holding ctrl while"""
# scrolling. If used in LoggerWindow, use that wheel event
# May not want to import LoggerWindow, so perhaps
# check by str(type())
ctrlPressed = event.modifiers() == Qt.KeyboardModifier.ControlModifier
if ctrlPressed and "LoggerWindow" in str(type(self.window())):
self.window().wheelEvent(event)
else:
QTextEdit.wheelEvent(self, event)

def keyReleaseEvent(self, event):
"""Override of keyReleaseEvent to determine when to end navigation of
previous commands
Expand Down Expand Up @@ -293,7 +287,7 @@ def errorHyperlink(self):
cmdTempl = window.textEditorCmdTempl

# Bail if not setup properly
if workboxName is None:
if not workboxName:
msg = (
"Cannot use traceback hyperlink (Correct the path with Options "
"> Set Preferred Text Editor Path).\n"
Expand Down Expand Up @@ -340,7 +334,7 @@ def errorHyperlink(self):
)
subprocess.Popen(command)
except (ValueError, OSError):
msg = "The provided text editor command template is not valid:\n {}"
msg = "The provided text editor command is not valid:\n {}"
msg = msg.format(cmdTempl)
print(msg)
elif workboxName is not None:
Expand Down Expand Up @@ -433,9 +427,11 @@ def getWorkboxLine(self, name, lineNum):
workbox = self.window().workbox_for_name(name)
if not workbox:
return None
if lineNum > workbox.lines():

num_lines = workbox.__num_lines__()
if lineNum > num_lines:
return None
txt = workbox.text(lineNum).strip() + "\n"
txt = workbox.__text_line__(lineNum=lineNum).strip() + "\n"
return txt

def executeString(
Expand Down
Loading
Loading