uwsift.util.widgets package

Submodules

uwsift.util.widgets.pie_dial module

class uwsift.util.widgets.pie_dial.PieDial(visible: bool = True, opacity: float = 1.0, pie_brush=9, pie_pen=0, strike_out_brush=7, strike_out_pen=0)[source]

Bases: object

Widget for displaying visibility and opacity of a layer.

The available look and behaviour of the QDial widget is not suitable for the purpose of displaying the state of visibility and opacity of a layer. Therefore, a separate widget system was developed.

The opacity is indicated by the filled area of a pie:
  • If, for example, the pie is completely filled, then the opacity is 100%.

  • If the cake is e.g. only half filled, the opacity is 50%.

Visibility is indicated by crossing out or not crossing out the circle. If the cake is crossed out, the layer is invisible and vice versa.

The span angle value and the visibility value are changed via the PieDialEditor.

The source code used as the basis for the custom dial widget is:

https://pastebin.com/yN3B3fc2 https://stackoverflow.com/questions/12011147/how-to-create-a-3-color-gradient-dial-indicator-the-one-that-shows-green-yellow

property opacity
paint(painter: QPainter, rect: QRect)[source]
Parameters:
  • painter

  • rect

property visible
class uwsift.util.widgets.pie_dial.PieDialDelegate(*args, **kwargs)[source]

Bases: QStyledItemDelegate

createEditor(parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) QWidget[source]
Parameters:
  • parent

  • option

  • index

Returns:

paint(self, painter: Optional[QPainter], option: QStyleOptionViewItem, index: QModelIndex)[source]
setEditorData(editor: QWidget, index: QModelIndex) None[source]
Parameters:
  • editor

  • index

setModelData(editor: QWidget, model: QAbstractItemModel, index: QModelIndex) None[source]
Parameters:
  • editor

  • model

  • index

updateEditorGeometry(editor: QWidget, option: QStyleOptionViewItem, index: QModelIndex) None[source]
Parameters:
  • editor

  • option

  • index

class uwsift.util.widgets.pie_dial.PieDialEditor(parent: QWidget, pie_dial: PieDial)[source]

Bases: QWidget

mouseMoveEvent(self, a0: Optional[QMouseEvent])[source]
mousePressEvent(event: QMouseEvent) None[source]
Parameters:

event

mouseReleaseEvent(self, a0: Optional[QMouseEvent])[source]
paintEvent(event: QPaintEvent) None[source]
Parameters:

event

set_pie_dial(pie_dial: PieDial)[source]
Parameters:

pie_dial

wheelEvent(event: QWheelEvent) None[source]
Parameters:

event

class uwsift.util.widgets.pie_dial.SliderPopup(*args, **kwargs)[source]

Bases: QWidget

Custom slider widget that can change a value from 1 to 100 per cent and is displayed in a pop-up window. When the widget is displayed, the value to be changed must be converted if the value is not a percentage value.

property active

Get the current state if the window with the slider is active or not

get_slider() QSlider[source]

Get the slider of the window

show_at(pos: QPoint, val: float)[source]

Show the window at the handed over position

Parameters:
  • pos – the wished position where the window should be shown

  • val – the value which the slider should show at the beginning

uwsift.util.widgets.pie_dial.main()[source]

Module contents