Package client :: Module IPythonShell :: Class CommandHistory
[hide private]
[frames] | no frames]

Class CommandHistory

source code


Nested Classes [hide private]

Inherited from PyQt4.QtGui.QTextEdit: AutoFormatting, AutoFormattingFlag, ExtraSelection, LineWrapMode

Inherited from PyQt4.QtGui.QFrame: Shadow, Shape, StyleMask

Inherited from PyQt4.QtGui.QPaintDevice: PaintDeviceMetric

Instance Methods [hide private]
 
__init__(self, shell, bridge)
CommandHistory.__init__ (self, shell, bridge)
source code
 
scrollToBottom(self) source code
 
correctString(self, string)
CommandHistory.correctString (self, string)
source code
 
writeCommand(self, string)
CommandHistory.writeCommand (self, string)
source code
 
writeResult(self, string)
CommandHistory.writeResult (self, string)
source code
 
writeComment(self, string)
CommandHistory.writeComment (self, string)
source code
 
writeMetaComment(self)
CommandHistory.writeMetaComment (self)
source code
 
mousePressEvent(self, ev)
CommandHistory.mousePressEvent (self, ev)
source code
 
keyPressEvent(self, ev)
CommandHistory.keyPressEvent (self, ev)
source code
 
rightClick(self, position)
CommandHistory.rightClick (self, position)
source code
 
zoomIn(self)
CommandHistory.zoomIn (self)
source code
 
zoomOut(self)
CommandHistory.zoomIn (self)
source code
 
loadSettings(self) source code

Inherited from PyQt4.QtGui.QTextEdit: acceptRichText, actionEvent, alignment, anchorAt, append, autoFormatting, canInsertFromMimeData, canPaste, changeEvent, childEvent, clear, closeEvent, connectNotify, contextMenuEvent, copy, create, createMimeDataFromSelection, createStandardContextMenu, currentCharFormat, currentFont, cursorForPosition, cursorRect, cursorWidth, customEvent, cut, destroy, disconnectNotify, document, documentTitle, dragEnterEvent, dragLeaveEvent, dragMoveEvent, drawFrame, dropEvent, enabledChange, ensureCursorVisible, enterEvent, event, extraSelections, find, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPreviousChild, fontChange, fontFamily, fontItalic, fontPointSize, fontUnderline, fontWeight, hideEvent, inputMethodEvent, inputMethodQuery, insertFromMimeData, insertHtml, insertPlainText, isReadOnly, isUndoRedoEnabled, keyReleaseEvent, languageChange, leaveEvent, lineWrapColumnOrWidth, lineWrapMode, loadResource, mergeCurrentCharFormat, metric, mouseDoubleClickEvent, mouseMoveEvent, mouseReleaseEvent, moveCursor, moveEvent, overwriteMode, paintEvent, paletteChange, paste, receivers, redo, resetInputContext, resizeEvent, scrollContentsBy, scrollToAnchor, selectAll, sender, setAcceptRichText, setAlignment, setAutoFormatting, setCurrentCharFormat, setCurrentFont, setCursorWidth, setDocument, setDocumentTitle, setExtraSelections, setFontFamily, setFontItalic, setFontPointSize, setFontUnderline, setFontWeight, setHtml, setLineWrapColumnOrWidth, setLineWrapMode, setOverwriteMode, setPlainText, setReadOnly, setTabChangesFocus, setTabStopWidth, setText, setTextColor, setTextCursor, setTextInteractionFlags, setUndoRedoEnabled, setViewportMargins, setWordWrapMode, setupViewport, showEvent, tabChangesFocus, tabStopWidth, tabletEvent, textColor, textCursor, textInteractionFlags, timerEvent, toHtml, toPlainText, undo, updateMicroFocus, viewportEvent, wheelEvent, windowActivationChange, wordWrapMode

Inherited from PyQt4.QtGui.QAbstractScrollArea: addScrollBarWidget, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, minimumSizeHint, scrollBarWidgets, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, sizeHint, verticalScrollBar, verticalScrollBarPolicy, viewport

Inherited from PyQt4.QtGui.QFrame: frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth

Inherited from PyQt4.QtGui.QWidget: acceptDrops, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, contentsRect, contextMenuPolicy, cursor, devType, ensurePolished, focusPolicy, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabShortcut, handle, hasFocus, hasMouseTracking, height, heightForWidth, hide, inputContext, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isEnabledToTLW, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isTopLevel, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, layout, layoutDirection, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, mouseGrabber, move, nextInFocusChain, normalGeometry, overrideWindowFlags, overrideWindowState, paintEngine, palette, parentWidget, pos, raise_, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, repaint, resize, restoreGeometry, saveGeometry, scroll, setAcceptDrops, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedWidth, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setMask, setMaximumHeight, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setShortcutAutoRepeat, setShortcutEnabled, setShown, setSizeIncrement, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowTitle, show, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, testAttribute, toolTip, topLevelWidget, underMouse, unsetCursor, unsetLayoutDirection, update, updateGeometry, updatesEnabled, visibleRegion, whatsThis, width, winId, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, x, x11Info, x11PictureHandle, y

Inherited from PyQt4.QtCore.QObject: blockSignals, children, connect, deleteLater, disconnect, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, emit, eventFilter, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setProperty, signalsBlocked, startTimer, thread, tr, trUtf8

Inherited from PyQt4.QtGui.QPaintDevice: depth, heightMM, logicalDpiX, logicalDpiY, numColors, paintingActive, physicalDpiX, physicalDpiY, widthMM

Inherited from sip.wrapper: __delattr__, __getattribute__, __new__, __setattr__

Inherited from object: __hash__, __reduce__, __reduce_ex__, __repr__, __str__

Class Variables [hide private]

Inherited from PyQt4.QtGui.QTextEdit: AutoAll, AutoBulletList, AutoNone, FixedColumnWidth, FixedPixelWidth, NoWrap, WidgetWidth

Inherited from PyQt4.QtGui.QFrame: Box, HLine, NoFrame, Panel, Plain, Raised, Shadow_Mask, Shape_Mask, StyledPanel, Sunken, VLine, WinPanel

Inherited from PyQt4.QtGui.QPaintDevice: PdmDepth, PdmDpiX, PdmDpiY, PdmHeight, PdmHeightMM, PdmNumColors, PdmPhysicalDpiX, PdmPhysicalDpiY, PdmWidth, PdmWidthMM

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, shell, bridge)
(Constructor)

source code 

CommandHistory.__init__ (self, shell, bridge)

This initialization sets up a normal QTextEdit, then sets up a bunch of color/font/size settings to be used later. After the default settings are loaded, it will attempt to load them from the configuration file ~/.basin/client/ipython_appearance.conf

Overrides: object.__init__

correctString(self, string)

source code 

CommandHistory.correctString (self, string)

This will simply return a string, given a string. It is 'corrected' in the sense that it is passed a normal string, however, it will be re-formatted to be used as html. This means newlines become <br>, spaces become &nbsp;, etc...

writeCommand(self, string)

source code 

CommandHistory.writeCommand (self, string)

Commands are text strings that either the user has typed and entered via the CommandLine, or commands that were pragmatically entered (and decided that user should be informed of).

This method takes a given string and displays it on itself (a QTextEdit) given the pre-loaded settings of what a "Command" looks like. These settings are loaded at startup, or anytime the user edits them in the preferences menu. Note that editing these display settings will NOT retroactively change previous commands written.

Settings may be found in the following file: ~/.basin/client/ipython_appearance.conf

writeResult(self, string)

source code 

CommandHistory.writeResult (self, string)

Results are what the ipython environment returns after having received a command. Quite often this includes the command entered as well (notably ipython's magic commands will not include the command as a part of the output). There is an optional setting, kept in the bridge, to reduce the output displayed. If this option is set then the results are more of an abridged version of the ipython output (notably that output won't be for every node in use, just one). Otherwise results are exact copies, with their color having been stripped, of ipython environment results.

This method takes a given string and displays it on itself (a QTextEdit) given the pre-loaded settings of what a "Result" looks like. These settings are loaded at startup, or anytime the user edits them in the preferences menu. Note that editing these display settings will NOT retroactively change previous results written.

Settings may be found in the following file: ~/.basin/client/ipython_appearance.conf

writeComment(self, string)

source code 

CommandHistory.writeComment (self, string)

Comments (probably not the best name to describe these) are messages that aren't associated with a normal python/ipython session. They are messages this gui has decided to display in the ipython box. For instance, if you enter a command with 'def', 'for', 'if', or 'while', then it will tell you that you are in multi-line mode, and that you need to enter a blank line to get out of it. Not a python command, but certainly pertinant to ipython.

This method takes a given string and displays it on itself (a QTextEdit) given the pre-loaded settings of what a "Comment" looks like. These settings are loaded at startup, or anytime the user edits them in the preferences menu. Note that editing these display settings will NOT retroactively change previous comments written.

Settings may be found in the following file: ~/.basin/client/ipython_appearance.conf

writeMetaComment(self)

source code 

CommandHistory.writeMetaComment (self)

This method prints out a standard message to the command history stating that the command entered is a meta-command, one which isn't an actual python command, but that the client will break up into a bunch of commands to be executed. This is merely a message stating this as a comment.

mousePressEvent(self, ev)

source code 

CommandHistory.mousePressEvent (self, ev)

This method is called whenever the user clicks on the CommandHistory. It is only looking to see if it was a right click, in which case it calls rightClick, otherwise behaves like a normal QTextEdit.

Overrides: PyQt4.QtGui.QWidget.mousePressEvent

keyPressEvent(self, ev)

source code 

CommandHistory.keyPressEvent (self, ev)

This method is called whenever the user presses on a key while the CommandHistory is in focus. It is only searching to see if the `+` or `-` keys were pressed.

  • `+` Increases the font size
  • `-` Decreases the font size Both will do this to everything in the entire CommandHistory.

If netiher were pressed, it proceeds to call the standard QTextEdit's keyPressEvent to behave normally.

Overrides: PyQt4.QtGui.QWidget.keyPressEvent

rightClick(self, position)

source code 

CommandHistory.rightClick (self, position)

This method will be called whenever the user performs a right click. It will display three options in a menu at the point `position`, where the user had clicked.

The options are to:

  • Save the current history to a log file
  • Increase the font size
  • Decrease the font size

zoomIn(self)

source code 

CommandHistory.zoomIn (self)

This method is attached to the '+' (note it needs shift) key as well as a right-click menu when right-clicking on the CommandHistory.

It will increase everything in the history's font size by 1.

Overrides: PyQt4.QtGui.QTextEdit.zoomIn

zoomOut(self)

source code 

CommandHistory.zoomIn (self)

This method is attached to the '-' key as well as a right-click menu when right-clicking on the CommandHistory.

It will decrease everything in the history's font size by 1.

Overrides: PyQt4.QtGui.QTextEdit.zoomOut