Package client :: Package Viewers :: Class BasinViewer
[hide private]
[frames] | no frames]

Class BasinViewer

source code


Overview

This class holds a graphical representation (in a tree format) of all the BASIN objects currently accounted for by the GUI. It will only keep track of those BASIN objects that were made while in %autopx mode (IPython1's auto-parallel mode).

The general way that it does this is by relying on the BASIN_ipython_shell.IPythonView object for a few things. First, the IPythonView must be able to catch each time a top-level region is created. Then it must stored that information on the parallel engine by appending the name of this new top-level region to a variable named BASIN_TOPLEVEL_REGION_LIST. It is a newline deliminated string containing the names of top-level Regions.

Since Regions are able to self-examine themselves, all that needs to be stored is their variable name. From that it can get the total information about objects that are children to it. From their it constructs the tree using the following classes:

Nested Classes [hide private]

Inherited from PyQt4.QtGui.QAbstractItemView: CursorAction, DragDropMode, DropIndicatorPosition, EditTrigger, EditTriggers, ScrollHint, ScrollMode, SelectionBehavior, SelectionMode, State

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

Inherited from PyQt4.QtGui.QPaintDevice: PaintDeviceMetric

Instance Methods [hide private]
 
__init__(self, layout, parent, bridge)
This sets up the QTreeWidget to have 4 columns:
source code
 
Update(self, topRegions)
This should only ever be called from the BASIN_bridge.Bridge class.
source code
 
getSingleSelectedItem(self)
This will retrieve the item currently selected by the user.
source code
 
makeBasin(self)
This is called initially, and after each Update.
source code
 
MakeTopRegion(self, var)
This will be called by Update for as many times as there are top-level Regions.
source code
 
mouseMoveEvent(self, ev)
This is used to initiate a drag sequence.
source code
 
mousePressEvent(self, ev)
Captures the initial position of a mouse button being pressed.
source code
 
mouseDoubleClickEvent(self, ev)
This method merely grabs the currently selected item and sends it on its way to the BASIN_dock.Dock.
source code
 
mouseReleaseEvent(self, ev)
This method will check to see if the user released the right button of the mouse while over the RegionTree.
source code
 
rightClick(self, position)
This method is obviously called on a right-click and drops down a menu generated by this function.
source code
 
AttributeToList(self) source code
 
CreateRegion(self)
This method will potentially create a top-level Region.
source code
 
dragEnterEvent(self, ev)
This initial drag event merely checks to make sure that the source of the drag came from the BASIN_variable_viewer.List object.
source code
 
dragMoveEvent(self, ev)
This midway drag move event merely checks to make sure that the source of the drag came from the BASIN_variable_viewer.List object.
source code
 
dropEvent(self, ev)
This method will determine the type of free variable being dropped on the RegionTree, and the exact object type it was dropped on.
source code
 
_appendAttributeFromFreeVar(self, source, target)
This will occur when a user drags a free variable BASIN Attribute and drops it onto a RegionTree object that is capable of being its parent, in this case Lists or Grids.
source code
 
_appendGridFromFreeVar(self, source, target)
This will occur when a user drags a free variable BASIN Grid and drops it onto a RegionTree object that is capable of being its parent, in this case Regions.
source code
 
_appendListFromFreeVar(self, source, target)
This will occur when a user drags a free variable BASIN List and drops it onto a RegionTree object that is capable of being its parent, in this case Regions.
source code
 
_appendRegionFromFreeVar(self, source, target)
This will occur when a user drags a free variable BASIN Region and drops it onto a RegionTree object that is capable of being its parent, in this case Regions.
source code

Inherited from PyQt4.QtGui.QTreeWidget: actionEvent, addTopLevelItem, addTopLevelItems, changeEvent, childEvent, clear, closeEditor, closeEvent, closePersistentEditor, collapseItem, columnCount, columnCountChanged, columnMoved, columnResized, commitData, connectNotify, contextMenuEvent, create, currentChanged, currentColumn, currentItem, customEvent, destroy, dirtyRegionOffset, disconnectNotify, dragLeaveEvent, drawBranches, drawFrame, drawRow, drawTree, dropIndicatorPosition, dropMimeData, edit, editItem, editorDestroyed, enabledChange, enterEvent, event, executeDelayedItemsLayout, expandItem, findItems, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPreviousChild, fontChange, headerItem, hideEvent, horizontalOffset, horizontalScrollbarAction, horizontalScrollbarValueChanged, horizontalStepsPerItem, indexFromItem, indexOfTopLevelItem, indexRowSizeHint, inputMethodEvent, insertTopLevelItem, insertTopLevelItems, invisibleRootItem, isIndexHidden, isItemExpanded, isItemHidden, isItemSelected, isSortingEnabled, itemAt, itemFromIndex, itemWidget, items, keyPressEvent, keyReleaseEvent, languageChange, leaveEvent, metric, mimeData, mimeTypes, moveCursor, moveEvent, openPersistentEditor, paintEvent, paletteChange, receivers, reexpand, resetInputContext, resizeEvent, rowsAboutToBeRemoved, rowsInserted, rowsRemoved, scheduleDelayedItemsLayout, scrollContentsBy, scrollDirtyRegion, scrollToItem, selectedIndexes, selectedItems, selectionChanged, selectionCommand, sender, setColumnCount, setCurrentItem, setDirtyRegion, setHeaderItem, setHeaderLabel, setHeaderLabels, setHorizontalStepsPerItem, setItemExpanded, setItemHidden, setItemSelected, setItemWidget, setSelection, setSortingEnabled, setState, setVerticalStepsPerItem, setViewportMargins, setupViewport, showEvent, sizeHintForColumn, sortColumn, sortItems, startDrag, state, supportedDropActions, tabletEvent, takeTopLevelItem, timerEvent, topLevelItem, topLevelItemCount, updateEditorData, updateEditorGeometries, updateGeometries, updateMicroFocus, verticalOffset, verticalScrollbarAction, verticalScrollbarValueChanged, verticalStepsPerItem, viewOptions, viewportEvent, visualItemRect, visualRegionForSelection, wheelEvent, windowActivationChange

Inherited from PyQt4.QtGui.QTreeView: allColumnsShowFocus, collapse, collapseAll, columnAt, columnViewportPosition, columnWidth, dataChanged, doItemsLayout, expand, expandAll, header, hideColumn, indentation, indexAbove, indexAt, indexBelow, isAnimated, isColumnHidden, isExpanded, isRowHidden, itemsExpandable, keyboardSearch, reset, resizeColumnToContents, rootIsDecorated, scrollTo, selectAll, setAllColumnsShowFocus, setAnimated, setColumnHidden, setColumnWidth, setExpanded, setHeader, setIndentation, setItemsExpandable, setModel, setRootIndex, setRootIsDecorated, setRowHidden, setSelectionModel, setUniformRowHeights, showColumn, sortByColumn, uniformRowHeights, visualRect

Inherited from PyQt4.QtGui.QAbstractItemView: alternatingRowColors, clearSelection, currentIndex, dragDropMode, dragDropOverwriteMode, dragEnabled, editTriggers, hasAutoScroll, horizontalScrollMode, iconSize, indexWidget, inputMethodQuery, itemDelegate, itemDelegateForColumn, itemDelegateForRow, model, rootIndex, scrollToBottom, scrollToTop, selectionBehavior, selectionMode, selectionModel, setAlternatingRowColors, setAutoScroll, setCurrentIndex, setDragDropMode, setDragDropOverwriteMode, setDragEnabled, setDropIndicatorShown, setEditTriggers, setHorizontalScrollMode, setIconSize, setIndexWidget, setItemDelegate, setItemDelegateForColumn, setItemDelegateForRow, setSelectionBehavior, setSelectionMode, setTabKeyNavigation, setTextElideMode, setVerticalScrollMode, showDropIndicator, sizeHintForIndex, sizeHintForRow, tabKeyNavigation, textElideMode, verticalScrollMode

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, find, 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.QAbstractItemView: AboveItem, AllEditTriggers, AnimatingState, AnyKeyPressed, BelowItem, CollapsingState, ContiguousSelection, CurrentChanged, DoubleClicked, DragDrop, DragOnly, DragSelectingState, DraggingState, DropOnly, EditKeyPressed, EditingState, EnsureVisible, ExpandingState, ExtendedSelection, InternalMove, MoveDown, MoveEnd, MoveHome, MoveLeft, MoveNext, MovePageDown, MovePageUp, MovePrevious, MoveRight, MoveUp, MultiSelection, NoDragDrop, NoEditTriggers, NoSelection, NoState, OnItem, OnViewport, PositionAtBottom, PositionAtCenter, PositionAtTop, ScrollPerItem, ScrollPerPixel, SelectColumns, SelectItems, SelectRows, SelectedClicked, SingleSelection

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, layout, parent, bridge)
(Constructor)

source code 

This sets up the QTreeWidget to have 4 columns:

  1. Data - The name of the data
  2. Type - It's BASIN object type
  3. Dimensions - Applicable only to BASIN Attributes
  4. Alias - The name of the alias, if it exists Aliases are actual python variables that reference the represented
Parameters:
  • layout () - The parent's layout. This will be automatically added to the layout.
  • parent () - The parent object of this tree.
  • bridge (Bridge) - The overall connecting bridge class which gets set to self._bridge
Overrides: object.__init__

Update(self, topRegions)

source code 

Overview

This should only ever be called from the BASIN_bridge.Bridge class.

It clears out all current entries and then re-populates them based off of a (hopefully) new BASIN_TOPLEVEL_REGION_LIST.

Presumably this program also uses a BASIN_variable_viewer.VariableList object. In such a case, this must be updated BEFORE the VariableList is, and thus it should really only be handled at one point, thus I let the bridge handle Update.

getSingleSelectedItem(self)

source code 

Overview

This will retrieve the item currently selected by the user. It is possible (although unlikely) that more than one, or none, may be selected. In such a case, a False signal is returned.

makeBasin(self)

source code 

Overview

This is called initially, and after each Update. All it doesi s create the top-most object in the tree structure. It has no real value, just a place-holder for everything else to go under, much like a 'root' that must exist first, regardless of anything.

MakeTopRegion(self, var)

source code 

Overview

This will be called by Update for as many times as there are top-level Regions. It will take the name of said Region and call its `basin_kernel` method `Region::get_client_information`. This generates a string containing information about all sub-objects of this Region.

All This really does is take the name of the Region, and this information string and pass it to the constructor of BASIN_region_viewer.TopRegion along with the reference to the top-most root in the tree, where new top-level regions will be under.

mouseMoveEvent(self, ev)

source code 

Overview

This is used to initiate a drag sequence. Basically a drag will only start when the user has pressed on an object, and moved a minimum distance. This is to prevent slight movements during double-clicks as being interepreted incorrectly.

Overrides: PyQt4.QtGui.QWidget.mouseMoveEvent

mousePressEvent(self, ev)

source code 

Overview

Captures the initial position of a mouse button being pressed. The onyl real use for this is in conjunction with mouseMoveEvent, which will initiate a drag sequence if the mouse has moved a minimum distance from this initial point.

Overrides: PyQt4.QtGui.QWidget.mousePressEvent

mouseDoubleClickEvent(self, ev)

source code 

Overview

This method merely grabs the currently selected item and sends it on its way to the BASIN_dock.Dock. Presumably the Dock can handle it from there.

Overrides: PyQt4.QtGui.QWidget.mouseDoubleClickEvent

mouseReleaseEvent(self, ev)

source code 

Overview

This method will check to see if the user released the right button of the mouse while over the RegionTree. If so, it sends the position of the release to the appropriate handling method, rightClick.

Overrides: PyQt4.QtGui.QWidget.mouseReleaseEvent

rightClick(self, position)

source code 

Overview

This method is obviously called on a right-click and drops down a menu generated by this function.

It depends on the exact object you clicked on, for what options will appear in the menu.

Generally speaking the user will see options for:

  • Copying / Pasting (All BASIN types)
  • Creating an Alias (All BASIN types)
  • Deleting (All BASIN types)
  • Creating an appropriate blank sub-object
  • Exporting (Regions only)
  • Adding it to the Dock Widget (All BASIN types, though there is no garauntee the dock will do anything useful with it)

CreateRegion(self)

source code 

Overview

This method will potentially create a top-level Region. It will call a dialog which will request a name from the user, or they can cancel. The given name will become the name of the new top- level Region, or nothing will happen given a blank name / cancel.

dragEnterEvent(self, ev)

source code 

Overview

This initial drag event merely checks to make sure that the source of the drag came from the BASIN_variable_viewer.List object.

Overrides: PyQt4.QtGui.QWidget.dragEnterEvent

dragMoveEvent(self, ev)

source code 

Overview

This midway drag move event merely checks to make sure that the source of the drag came from the BASIN_variable_viewer.List object.

Overrides: PyQt4.QtGui.QWidget.dragMoveEvent

dropEvent(self, ev)

source code 

Overview

This method will determine the type of free variable being dropped on the RegionTree, and the exact object type it was dropped on.

Overrides: PyQt4.QtGui.QWidget.dropEvent

_appendAttributeFromFreeVar(self, source, target)

source code 

Overview

This will occur when a user drags a free variable BASIN Attribute and drops it onto a RegionTree object that is capable of being its parent, in this case Lists or Grids.

To accomplish this, it can use the internal `basin_kernel` command to add the attribute. Also, the GUI will need to be updated that this has made. This is because we aren't destroying the free floating attribute, but it just turns into an alias for the object you are adGui ding into the RegionTree.

_appendGridFromFreeVar(self, source, target)

source code 

Overview

This will occur when a user drags a free variable BASIN Grid and drops it onto a RegionTree object that is capable of being its parent, in this case Regions.

To accomplish this, it can use the internal `basin_kernel` command to add the Grid. Also, the GUI will need to be updated that this has made. This is because we aren't destroying the free floating Grid, but it just turns into an alias for the object you are adding into the RegionTree.

_appendListFromFreeVar(self, source, target)

source code 

Overview

This will occur when a user drags a free variable BASIN List and drops it onto a RegionTree object that is capable of being its parent, in this case Regions.

To accomplish this, it can use the internal `basin_kernel` command to add the List. Also, the GUI will need to be updated that this has made. This is because we aren't destroying the free floating List, but it just turns into an alias for the object you are adding into the RegionTree.

_appendRegionFromFreeVar(self, source, target)

source code 

Overview

This will occur when a user drags a free variable BASIN Region and drops it onto a RegionTree object that is capable of being its parent, in this case Regions.

To accomplish this, it can use the internal `basin_kernel` command to add the Region. Also, the GUI will need to be updated that this has made. This is because we aren't destroying the free floating Region, but it just turns into an alias for the object you are adding into the RegionTree.