The scrollableList module

The scrollableList module contains the ScrollableList class which provides and implementation of the BaseWidget class to display a WidgetList within a QScrollArea.

The ScrollableList class

Inheritance diagram of pyamp.ui.qt.scrollableList.ScrollableList

class pyamp.ui.qt.scrollableList.ScrollableList(name=None, controller=None, mainWindow=None, logData=None, logColor=0)[source]

The ScrollableList class creates a BaseWidget that contains a QScrollArea which displays a WidgetList inside of the scroll area. This allows a the user to scroll through the WidgetList to see previously added widgets.

In order to fix the size of the scroll area, subclasses of ScrollableList should set the size class property which is a QSize object.

  • name – The name of the BaseWidget
  • controller – The controller for the BaseWidget
  • mainWindow – The main window
  • logData – The pyamp.logging.LogData object
  • logColor – The color to use for logging
addItem(item)[source]

Add an item to the ScrollabelList widget.

addWidget(widget)[source]

Add a widget to the ScrollableList widget.

clearWidgets()[source]

Clear all of the widgets from the ScrollableList.

createElements()[source]

Override the BaseWidget createElements class.

getScrollArea()[source]

Get the QScrollArea for this widget.

getWidgetList()[source]

Get the WidgetList for this ScrollabeList.

horizontalPolicy

The horizontalPolicy property contains the ScrollBarPolicy for the horizontal scrollbar.

margin

The margin property contains the margin between all items in the list.

scroll(amount)[source]

Scroll the vertical scrollbar by the given amount.

  • amount – The amount to scroll (negative being scrolling up, and

    is positive scrolling down)

scrollTo(y=0)[source]

Scroll to the given position.

  • y – The y position to scroll to
scrollToBottom()[source]

Scroll to the bottom of the list.

scrollToTop()[source]

Scroll to the top of the list.

size

The size property contains the size of the scrollable list.

sizeHint()[source]

Override the QWidget sizeHint function to return the size of this ScrollableList.

verticalPolicy

The verticalPolicy property contains the ScrollBarPolicy for the vertical scrollbar.

The BaseWidget class

Inheritance diagram of pyamp.ui.qt.scrollableList.BaseWidget

class pyamp.ui.qt.scrollableList.BaseWidget(name=None, controller=None, mainWindow=None, logData=None, logColor=0)

The BaseWidget class provides an implementation of the amp.ui.qt.BaseView class designed to set up and create a PyQt4.QtGui.QWidget object.

This class provides serveral functions which can be overridden by subclasses to easily add features to the BaseWidget. These functions are called in the following order during the set up process:

  1. configure()
  2. configureLayout()
  3. createElements()
  4. setupConnections()
  • name – The name of the BaseWidget
  • controller – The controller for the BaseWidget
  • mainWindow – The main window
  • logData – The pyamp.logging.LogData object
  • logColor – The color to use for logging
addElement(element)

Add an element to the main layout.

  • element – The element to add
addElements(elements)

Add a list of elements to the main layout.

  • elements – The list of elements
addItem(item)

Add an item to the main layout.

  • item – The item to add
addWidget(widget)

Add a widget to the main layout.

  • widget – The widget to add
clear()

Remove all of the child widgets and items currently for this BaseWidget.

clearItems()

Clear all the items from this BaseWidget.

clearWidgets()

Clear all the widgets from this BaseWidget.

configure()

Configure the view.

configureLayout()

Configure the layout for this view.

createElements()

Create the elements for this view. Return the list of widgets, or items in the order that they should be added to the layout.

createLayout()

Create the main layout.

getItems()

Return the list of child items for this BaseWidget.

getWidgets()

Return the list of child widgets for this BaseWidget.

layoutType

The layoutType property contains the type of layout to use for this Widget. It should be a value from the LayoutType class.

paintEvent(_event)

Override the paintEvent function to allow StylSheets to work for this QWidget.

Note this function was taken from the documentation of style sheets
for custom QWidget classes.
  • _event – The QPaintEvent
setMargins(left=None, top=None, right=None, bottom=None)

Set the content margins for this widget’s layout.

  • left – The left margin
  • top – The top margin
  • right – The right margin
  • bottom – The bottom margin
setSpacing(spacing)

Set the spacing between components in the layout.

  • spacing – The spacing
setStyleSheet(styleSheet)

Set the style sheet for this widget.

  • styleSheet – The StyleSheet
setupConnections()

Set up any connections this view requires.

setupView()

Create and set up this view.

tabOrder

The tabOrder property allows concrete widgets to set their tab order. Each element in the list will be tab connected to the next element in the list. The list will cycle around to the front so the final element is tab connected to the first element.

The WidgetList class

Inheritance diagram of pyamp.ui.qt.scrollableList.WidgetList

class pyamp.ui.qt.scrollableList.WidgetList(name=None, controller=None, mainWindow=None, logData=None, logColor=0)

The WidgetList class defines a BaseWidget object that has the ability to display a list of widgets vertically one after the other. This class handles resizing the widget appropriately based on the widgets that are in the list.

  • name – The name of the BaseWidget
  • controller – The controller for the BaseWidget
  • mainWindow – The main window
  • logData – The pyamp.logging.LogData object
  • logColor – The color to use for logging
addItem(item)

Add an item to the widget list.

  • item – The item to add
addWidget(widget)

Add a widget to this widget list.

  • widget – The widget to add
clear()

Clear all the widgets from the list.

setHorizontalRezizePolicy(policy)

Set the horizontal resize policy.

  • policy – The new resize policy
setMargin(margin)

Set the margin for this widget list.

  • margin – The margin to use
setVerticalResizePolicy(policy)

Set the vertical resize policy.

  • policy – The new resize policy

The ScrollBarPolicy class

Inheritance diagram of pyamp.ui.qt.scrollableList.ScrollBarPolicy

class pyamp.ui.qt.scrollableList.ScrollBarPolicy[source]

The ScrollBarPolicy class contains the policies which control the visibility of a scrollbar.

AlwaysOff

The scrollbar will never be displayed.

AlwaysOn

The scrollbar will always be displayed.

AsNeeded

The scrollbar will be visible only when the all of the scroll area cannot be viewed at once.

Table Of Contents

Previous topic

The styleSheet module

Next topic

The baseView module

This Page