Package schrodinger :: Package ui :: Package qt :: Module layout
[hide private]
[frames] | no frames]

Module layout

Contains helpers for creating layouts.

Copyright Schrodinger, LLC. All rights reserved.

Functions [hide private]
 
_add_to_layout(obj, layout, *args, **kwargs)
Cycles through adding to a layout.
 
_apply_box_settings(layout, objects, margins=None, spacing=5)
Private function to apply common settings to a QtWidgets.QHBoxLayout or QtWidgets.QVBoxLayout object.
 
get_widgets(layout)
Helper function to generate each widget in the supplied layout.
 
grid(objects, stretch=False, margins=None, hspace=5, vspace=5)
Function used to create a L{QtWidgets.QGridLayout} object.
 
hbox(objects, margins=None, spacing=5)
Function used to create a QtWidgets.QHBoxLayout object.
 
vbox(objects, margins=None, spacing=5)
Function used to create a QtWidgets.QVBoxLayout object.
Variables [hide private]
  COL_SPAN = 2
  ROW_SPAN = 1
  STRETCH = 0
hash(x)
  __package__ = 'schrodinger.ui.qt'
Function Details [hide private]

_add_to_layout(obj, layout, *args, **kwargs)

 

Cycles through adding to a layout. First it tries to add the obj as a widget, then as an item and finally as a layout.

_apply_box_settings(layout, objects, margins=None, spacing=5)

 

Private function to apply common settings to a QtWidgets.QHBoxLayout or QtWidgets.QVBoxLayout object.

Parameters:
  • objects (mixed (list or single object)) - Objects (widget, item, layout) to add
  • stretch (bool) - Whether or not to add a stretch to the end of the layout
  • margins (tuple) - Margins used in QtWidgets.QHBoxLayout.setContentsMargins

grid(objects, stretch=False, margins=None, hspace=5, vspace=5)

 

Function used to create a L{QtWidgets.QGridLayout} object. The C{objects}
is a list of objects that will populate the grid. The grid's row
count will equal the length of C{objects} and it's column count will
equal the length of the row with the most items. If you want to skip 
a column, set it to C{None}, and if you want a column to span multiple
columns add a L{schrodinger.application.bioluminate.layout.ROW_SPAN}
to all the preceding columns you want it to occupy.

Example:
C{objects = [
    [ layout.ROW_SPAN, layout.ROW_SPAN, label, None, line_edit],
    [ double_spinner,  push_button, line_edit ]
  ]
  grid = layout.grid(objects)
}

The above will return a grid layout like:

--------------------------------------------------------------
|                 label                    |   |  line_edit  |
-------------------------------------------------------------
| double_spinner | push_button | line_edit |   |             |
--------------------------------------------------------------


@param objects: Objects (widget, item, or layout) to add to a single
                L{QtWidgets.QGridLayout}
@type objects : list of lists

hbox(objects, margins=None, spacing=5)

 

Function used to create a QtWidgets.QHBoxLayout object.

Parameters:
  • objects (mixed (list or single object)) - Objects (widget, item, layout) to add
  • margins (tuple) - Margins used in QtWidgets.QHBoxLayout.setContentsMargins

vbox(objects, margins=None, spacing=5)

 

Function used to create a QtWidgets.QVBoxLayout object.

Parameters:
  • objects (mixed (list or single object)) - Objects (widget, item, layout) to add
  • margins (tuple) - Margins used in QtWidgets.QHBoxLayout.setContentsMargins