The baseWidget module

The baseWidget module contains the BaseWidget class which provides an implementation of the BaseView specific to creating an extending a QWidget object.

The BaseView class

Inheritance diagram of pyamp.ui.qt.baseWidget.BaseView

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

The BaseView class provides a base framework for creating Qt objects.

It provides several functions that are called in a specific order, and are to be overridden by subclasses in order to provide a specific implementation for the BaseView. These functions pertain to certain aspects of setting up a view and are called in the following order:

  1. configure()
  2. createLayout()
  3. configureLayout()
  4. setupView()
  5. setupConnections()

This class implements the pyamp.logging.Loggable interface and provides the ability to specify the logData object as well as the color to use for logging (the default color is to use a white foreground color).

  • name – The name of the BaseView
  • controller – The controller for the BaseView
  • mainWindow – The main window
  • logData – The LogData object
  • logColor – The color to use for the logger
completeSetup()

Finish setting up the view.

Note

This function should be overridden by subclasses.

configure()

Configure the view.

Note

This function should be overridden by subclasses.

configureLayout()

Configure the layout for this view.

Note

This function should be overridden by subclasses.

createLayout()

Create the main layout.

Note

This function should be overridden by subclasses.

setController(controller)

Set the controller object for this view.

  • controller – The controller
setupConnections()

Set up any connections this view requires.

Note

This function should be overridden by subclasses.

setupView()

Create and set up this view.

Note

This function should be overridden by subclasses.

The LayoutType class

Inheritance diagram of pyamp.ui.qt.baseWidget.LayoutType

class pyamp.ui.qt.baseWidget.LayoutType[source]

The LayoutType class contains definitions of the different types of layouts.

classmethod get(layoutType)[source]

Get the Qt layout object for the given layout type.

  • layoutType – The type of layout

The BaseWidget class

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

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

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)[source]

Add an element to the main layout.

  • element – The element to add
addElements(elements)[source]

Add a list of elements to the main layout.

  • elements – The list of elements
addItem(item)[source]

Add an item to the main layout.

  • item – The item to add
addWidget(widget)[source]

Add a widget to the main layout.

  • widget – The widget to add
clear()[source]

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

clearItems()[source]

Clear all the items from this BaseWidget.

clearWidgets()[source]

Clear all the widgets from this BaseWidget.

configure()[source]

Configure the view.

configureLayout()[source]

Configure the layout for this view.

createElements()[source]

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()[source]

Create the main layout.

getItems()[source]

Return the list of child items for this BaseWidget.

getWidgets()[source]

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)[source]

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)[source]

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)[source]

Set the spacing between components in the layout.

  • spacing – The spacing
setStyleSheet(styleSheet)[source]

Set the style sheet for this widget.

  • styleSheet – The StyleSheet
setupConnections()[source]

Set up any connections this view requires.

setupView()[source]

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.

Table Of Contents

Previous topic

The widgetList module

Next topic

The interrupt module

This Page