Components

Very basic components used by other widgets.

These are relatively sparsely documented because their operation is mostly self-explanatory

Classes:

DoubleSlider([decimals])

Slider capable of representing floats

EditableLabel([parent])

Editable label https://gist.github.com/mfessenden/baa2b87b8addb0b60e54a11c1da48046

KeyPressHandler

Custom key press handler https://gist.github.com/mfessenden/baa2b87b8addb0b60e54a11c1da48046

OnOffButton(state_labels, str] =, toggled, …)

Simple extension of toggle button with styling for clearer ‘ON’ vs ‘OFF’

QHLine([parent, color])

with respct to https://stackoverflow.com/a/51057516

QVLine([parent, color])

Functions:

mono_font()

module function to return a PySide2.QtGui.QFont to use as the mono font.

class pvp.gui.widgets.components.DoubleSlider(decimals=1, *args, **kargs)[source]

Slider capable of representing floats

Ripped off from and https://stackoverflow.com/a/50300848 ,

Thank you!!!

Methods:

_maximum()

_minimum()

_singleStep()

emitDoubleValueChanged()

maximum(self)

minimum(self)

setDecimals(decimals)

setMaximum(self, arg__1)

setMinimum(self, arg__1)

setSingleStep(self, arg__1)

setValue(self, arg__1)

singleStep(self)

value(self)

Attributes:

doubleValueChanged(*args, **kwargs)

staticMetaObject

doubleValueChanged(*args, **kwargs) = <PySide2.QtCore.Signal object>
setDecimals(decimals)[source]
emitDoubleValueChanged()[source]
value(self)int[source]
setMinimum(self, arg__1: int)[source]
setMaximum(self, arg__1: int)[source]
minimum(self)int[source]
_minimum()[source]
maximum(self)int[source]
_maximum()[source]
setSingleStep(self, arg__1: int)[source]
singleStep(self)int[source]
_singleStep()[source]
setValue(self, arg__1: int)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.components.KeyPressHandler[source]

Custom key press handler https://gist.github.com/mfessenden/baa2b87b8addb0b60e54a11c1da48046

Attributes:

escapePressed(*args, **kwargs)

returnPressed(*args, **kwargs)

staticMetaObject

Methods:

eventFilter(self, watched, event)

escapePressed(*args, **kwargs) = <PySide2.QtCore.Signal object>
returnPressed(*args, **kwargs) = <PySide2.QtCore.Signal object>
eventFilter(self, watched: PySide2.QtCore.QObject, event: PySide2.QtCore.QEvent)bool[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.components.EditableLabel(parent=None, **kwargs)[source]

Editable label https://gist.github.com/mfessenden/baa2b87b8addb0b60e54a11c1da48046

Methods:

create_signals()

escapePressedAction()

Escape event handler

labelPressedEvent(event)

Set editable if the left mouse button is clicked

labelUpdatedAction()

Indicates the widget text has been updated

returnPressedAction()

Return/enter event handler

setEditable(editable)

setLabelEditableAction()

Action to make the widget editable

setText(text)

Standard QLabel text setter

text()

Standard QLabel text getter

Attributes:

staticMetaObject

textChanged(*args, **kwargs)

textChanged(*args, **kwargs) = <PySide2.QtCore.Signal object>
create_signals()[source]
text()[source]

Standard QLabel text getter

setText(text)[source]

Standard QLabel text setter

labelPressedEvent(event)[source]

Set editable if the left mouse button is clicked

setLabelEditableAction()[source]

Action to make the widget editable

setEditable(editable: bool)[source]
labelUpdatedAction()[source]

Indicates the widget text has been updated

returnPressedAction()[source]

Return/enter event handler

escapePressedAction()[source]

Escape event handler

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.components.QHLine(parent=None, color='#FFFFFF')[source]

with respct to https://stackoverflow.com/a/51057516

Methods:

setColor(color)

Attributes:

staticMetaObject

setColor(color)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.components.QVLine(parent=None, color='#FFFFFF')[source]

Methods:

setColor(color)

Attributes:

staticMetaObject

setColor(color)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.components.OnOffButton(state_labels: Tuple[str, str] = 'ON', 'OFF', toggled: bool = False, *args, **kwargs)[source]

Simple extension of toggle button with styling for clearer ‘ON’ vs ‘OFF’

Parameters
  • state_labels (tuple) – tuple of strings to set when toggled and untoggled

  • toggled (bool) – initialize the button as toggled

  • *args – passed to QPushButton

  • **kwargs – passed to QPushButton

Methods:

__init__([state_labels, toggled])

param state_labels

tuple of strings to set when toggled and untoggled

set_state(state)

Attributes:

staticMetaObject

__init__(state_labels: Tuple[str, str] = 'ON', 'OFF', toggled: bool = False, *args, **kwargs)[source]
Parameters
  • state_labels (tuple) – tuple of strings to set when toggled and untoggled

  • toggled (bool) – initialize the button as toggled

  • *args – passed to QPushButton

  • **kwargs – passed to QPushButton

set_state(state: bool)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>