API documentation

core module

contains QtCore-based classes

class prettyqt.core.Object[source]

Bases: PyQt5.QtCore.QObject

class prettyqt.core.CoreApplication[source]

Bases: PyQt5.QtCore.QCoreApplication

class prettyqt.core.IODevice[source]

Bases: PyQt5.QtCore.QIODevice

class prettyqt.core.FileDevice[source]

Bases: PyQt5.QtCore.QFileDevice

class prettyqt.core.File[source]

Bases: PyQt5.QtCore.QFile

class prettyqt.core.Buffer[source]

Bases: PyQt5.QtCore.QBuffer

class prettyqt.core.Settings(*args, settings_id=None)[source]

Bases: PyQt5.QtCore.QSettings

classmethod get_default_format()[source]

returns default settings format

possible values are “native”, “ini”

Return type:str
Returns:default settings format
get_scope()[source]

returns scope

possible values are “user”, “system”

Return type:str
Returns:scope
group(prefix)[source]

context manager for setting groups

Parameters:prefix (str) – setting prefix for group
read_array(prefix)[source]

context manager for reading arrays

Parameters:prefix (str) – prefix for settings array
classmethod set_default_format(fmt)[source]

sets the default format

possible values are “native”, “ini”

Parameters:mode – the default format to use
Raises:ValueError – invalid format
classmethod set_path(fmt, scope, path)[source]

sets the path to the settings file

Parameters:
  • fmt – the default format to use
  • scope (str) – the scope to use
Raises:

ValueError – invalid format or scope

value(key, default=None)[source]
write_array(prefix, size=-1)[source]

context manager for writing arrays

Parameters:
  • prefix (str) – prefix for settings array
  • size (int) – size of settings array
class prettyqt.core.Date[source]

Bases: PyQt5.QtCore.QDate

class prettyqt.core.DateTime[source]

Bases: PyQt5.QtCore.QDateTime

prettyqt.core.Size

alias of PyQt5.QtCore.QSize

prettyqt.core.SizeF

alias of PyQt5.QtCore.QSizeF

prettyqt.core.Point

alias of PyQt5.QtCore.QPoint

prettyqt.core.PointF

alias of PyQt5.QtCore.QPointF

class prettyqt.core.Timer[source]

Bases: PyQt5.QtCore.QTimer

class prettyqt.core.Translator[source]

Bases: PyQt5.QtCore.QTranslator

class prettyqt.core.Thread[source]

Bases: PyQt5.QtCore.QThread

prettyqt.core.Rect

alias of PyQt5.QtCore.QRect

prettyqt.core.RectF

alias of PyQt5.QtCore.QRectF

class prettyqt.core.MimeData[source]

Bases: PyQt5.QtCore.QMimeData

class prettyqt.core.Dir[source]

Bases: PyQt5.QtCore.QDir

class prettyqt.core.DirIterator[source]

Bases: PyQt5.QtCore.QDirIterator

prettyqt.core.Slot()

@pyqtSlot(*types, name: Optional[str], result: Optional[str])

This is a decorator applied to Python methods of a QObject that marks them as Qt slots. The non-keyword arguments are the types of the slot arguments and each may be a Python type object or a string specifying a C++ type. name is the name of the slot and defaults to the name of the method. result is type of the value returned by the slot.

prettyqt.core.Property

alias of PyQt5.QtCore.pyqtProperty

class prettyqt.core.RegExp[source]

Bases: PyQt5.QtCore.QRegExp

class prettyqt.core.RegularExpression[source]

Bases: PyQt5.QtCore.QRegularExpression

class prettyqt.core.Runnable[source]

Bases: PyQt5.QtCore.QRunnable

class prettyqt.core.ModelIndex[source]

Bases: PyQt5.QtCore.QModelIndex

class prettyqt.core.ThreadPool[source]

Bases: PyQt5.QtCore.QThreadPool

prettyqt.core.Signal

alias of PyQt5.QtCore.pyqtSignal

class prettyqt.core.AbstractItemModel[source]

Bases: PyQt5.QtCore.QAbstractItemModel

change_layout()[source]

content manager to change the layout

wraps calls with correct signals emitted at beginning: layoutAboutToBeChanged emitted at end: layoutChanged

reset_model()[source]

content manager to reset the model

wraps calls with correct signals emitted at beginning: beginResetModel emitted at end: endResetModel

class prettyqt.core.AbstractProxyModel[source]

Bases: PyQt5.QtCore.QAbstractProxyModel

class prettyqt.core.AbstractListModel[source]

Bases: PyQt5.QtCore.QAbstractListModel

class prettyqt.core.SortFilterProxyModel[source]

Bases: PyQt5.QtCore.QSortFilterProxyModel

class prettyqt.core.AbstractTableModel[source]

Bases: PyQt5.QtCore.QAbstractTableModel

widgets module

contains QtWidgets-based classes

class prettyqt.widgets.Application[source]

Bases: PyQt5.QtWidgets.QApplication

classmethod copy_to_clipboard(text)[source]

Sets clipboard to supplied text

set_icon(icon)[source]

set the icon for the menu

Parameters:icon (Union[QIcon, str, None]) – icon to use
class prettyqt.widgets.AbstractSlider[source]

Bases: PyQt5.QtWidgets.QAbstractSlider

is_horizontal()[source]

check if silder is horizontal

Return type:bool
Returns:True if horizontal, else False
is_vertical()[source]

check if silder is vertical

Return type:bool
Returns:True if vertical, else False
scroll_to_max()[source]

scroll to the maximum value of the slider

scroll_to_min()[source]

scroll to the minimum value of the slider

set_horizontal()[source]

set slider orientation to horizontal

set_vertical()[source]

set slider orientation to vertical

class prettyqt.widgets.AbstractButton[source]

Bases: PyQt5.QtWidgets.QAbstractButton

set_icon(icon)[source]

set the icon for the button

Parameters:icon (Union[QIcon, str, None]) – icon to use
class prettyqt.widgets.AbstractSpinBox(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QAbstractSpinBox

get_button_symbols()[source]

returns button symbol type

possible values are “none”, “up_down”, “plus_minus”

Return type:str
Returns:button symbol type
get_correction_mode()[source]

returns correction mode

possible values are “to_previous”, “to_nearest”

Return type:str
Returns:correction mode
get_step_type()[source]

returns step type

possible values are “default”, “adaptive”

Return type:str
Returns:step type
set_button_symbols(mode)[source]

sets button symbol type

possible values are “none”, “up_down”, “plus_minus”

Parameters:mode (str) – button symbol type to use
Raises:ValueError – invalid button symbol type
set_correction_mode(mode)[source]

sets correction mode

possible values are “to_previous”, “to_nearest”

Parameters:mode (str) – correction mode to use
Raises:ValueError – invalid correction mode
set_step_type(mode)[source]

sets step type

possible values are “default”, “adaptive”

Parameters:mode (str) – step type to use
Raises:ValueError – invalid step type
class prettyqt.widgets.AbstractScrollArea(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QAbstractScrollArea

get_size_adjust_policy()[source]

returns size adjust policy

possible values are “content”, “first_show”, “ignored”

Return type:str
Returns:size adjust policy
scroll_to_bottom()[source]

scroll to the bottom of the scroll area

scroll_to_top()[source]

scroll to the top of the scroll area

set_horizontal_scrollbar_policy(mode)[source]

sets the horizontal scrollbar visibility

possible values are “always_on”, “always_off”, “as_needed”

Parameters:mode (str) – visibilty to set
Raises:ValueError – invalid scrollbar policy
set_horizontal_scrollbar_width(width)[source]

sets the horizontal scrollbar width

Parameters:width (int) – width in pixels
set_scrollbar_policy(mode)[source]

sets the policy for both scrollbars

possible values are “always_on”, “always_off”, “as_needed”

Parameters:mode (str) – visibilty to set
Raises:ValueError – invalid scrollbar policy
set_scrollbar_width(width)[source]

sets the width for both scrollbars

Parameters:width (int) – width in pixels
set_size_adjust_policy(policy)[source]

set size adjust policy

Valid values are “content”, “first_show”, “ignored”

Parameters:policy (str) – size adjust policy to use
Raises:ValueError – invalid size adjust policy
set_vertical_scrollbar_policy(mode)[source]

sets the vertical scrollbar visibility

possible values are “always_on”, “always_off”, “as_needed”

Parameters:mode (str) – visibilty to set
Raises:ValueError – invalid scrollbar policy
set_vertical_scrollbar_width(width)[source]

sets the vertical scrollbar width

Parameters:width (int) – width in pixels
class prettyqt.widgets.AbstractItemView(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QAbstractItemView

get_selection_behaviour()[source]

returns current selection behaviour

Possible values: “rows”, “columns”, “items”

Return type:str
Returns:selection behaviour
get_selection_mode()[source]

returns current selection mode

Possible values: “single”, “extended”, “multi” or “none”

Return type:str
Returns:selection mode
highlight_when_inactive()[source]

also highlight items when widget does not have focus

jump_to_column(col_num)[source]

make sure column at given index is visible

scrolls to column at given index

Parameters:col_num (int) – column to scroll to
num_selected()[source]

returns amount of selected rows

Return type:int
Returns:amount of selected rows
scroll_to_bottom()[source]

override to use abstractitemview-way of scrolling to bottom

scroll_to_top()[source]

override to use abstractitemview-way of scrolling to top

selectAll()[source]

Override, we dont want to selectAll for too many items for performance reasons

selected_data()[source]

returns generator yielding selected userData

Return type:Generator[Any, None, None]
selected_indexes()[source]

returns list of selected indexes in first row

Return type:List[QModelIndex]
selected_names()[source]

returns generator yielding item names

Return type:Generator[Any, None, None]
selected_rows()[source]

returns generator yielding row nums

Return type:Generator[int, None, None]
setModel(model)[source]

delete old selection model explicitely, seems to help with memory usage

set_selection_behaviour(behaviour)[source]

set selection behaviour for given item view

Allowed values are “rows”, “columns”, “items”

Parameters:behaviour (str) – selection behaviour to use
Raises:ValueError – behaviour does not exist
set_selection_mode(mode)[source]

set selection mode for given item view

Allowed values are “single”, “extended”, “multi” or “none”

Parameters:mode (str) – selection mode to use
Raises:ValueError – mode does not exist
toggle_select_all()[source]

select all items from list (deselect when all selected)

class prettyqt.widgets.MdiSubWindow[source]

Bases: PyQt5.QtWidgets.QMdiSubWindow

class prettyqt.widgets.MdiArea(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QMdiArea

get_tab_position()[source]

returns current tab position

Possible values: “north”, “south”, “west”, “east”

Return type:str
Returns:tab position
get_view_mode()[source]

returns current view mode

Possible values: “default”, “tabbed”

Return type:str
Returns:view mode
get_window_order()[source]

returns current window order

Possible values: “creation”, “stacking”, “activation”

Return type:str
Returns:view mode
set_tab_position(position)[source]

set tab position for the MDI area

Valid values are “north”, “south”, “west”, “east”

Parameters:position (str) – tabs position to use
Raises:ValueError – tab position does not exist
set_view_mode(mode)[source]

set view mode for the MDI area

Valid values are “default”, “tabbed”

Parameters:mode (str) – view mode to use
Raises:ValueError – view mode does not exist
set_window_order(mode)[source]

set the window order behaviour for the MDI area

Valid values are “creation”, “stacking”, “activation”

Parameters:mode (str) – window order behaviour to use
Raises:ValueError – window order mode not existing.
class prettyqt.widgets.ScrollBar(orientation='horizontal', parent=None)[source]

Bases: PyQt5.QtWidgets.QScrollBar

class prettyqt.widgets.ScrollArea(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QScrollArea

class prettyqt.widgets.Widget[source]

Bases: PyQt5.QtWidgets.QWidget

get_contextmenu_policy()[source]

returns current contextmenu policy

Possible values: “none”, “prevent”, “default”, “actions”,
“custom”, “showhide_menu”
Return type:str
Returns:contextmenu policy
get_modality()[source]

get the current modality modes as a string

Possible values: “modeless”, “window”, “application”

Return type:str
Returns:modality mode str
resize(self, QSize)[source]

resize(self, int, int)

set_contextmenu_policy(policy)[source]

set contextmenu policy for given item view

Allowed values are “none”, “prevent”, “default”, “actions”,
“custom”, “showhide_menu”
Parameters:policy (str) – contextmenu policy to use
Raises:ValueError – policy does not exist
set_modality(modality='window')[source]

set modality for the dialog

Valid values for modality: “modeless”, “window”, “application”

Parameters:modality (str) – modality for the main window (default: {“window”})
Raises:ValueError – modality type does not exist
set_size_policy(horizontal=None, vertical=None)[source]

sets the sizes policy

possible values for both parameters are “fixed”, “minimum”, “maximum”, “preferred”, “expanding”, “minimum_expanding” and “ignored”

Parameters:
class prettyqt.widgets.DesktopWidget[source]

Bases: PyQt5.QtWidgets.QDesktopWidget

class prettyqt.widgets.GraphicsItem[source]

Bases: PyQt5.QtWidgets.QGraphicsItem

class prettyqt.widgets.Style[source]

Bases: PyQt5.QtWidgets.QStyle

class prettyqt.widgets.StyleOption[source]

Bases: PyQt5.QtWidgets.QStyleOption

class prettyqt.widgets.SpacerItem[source]

Bases: PyQt5.QtWidgets.QSpacerItem

class prettyqt.widgets.SizePolicy[source]

Bases: PyQt5.QtWidgets.QSizePolicy

get_control_type()[source]

returns control type

possible values are “default”, “buttonbox”, “checkbox”, “combobox”, “frame”, “groupbox”, “label”, “line”, “lineedit”, “pushbutton”, “radiobutton”, “slider”, “spinbox”, “tabwidget”, “toolbutton”

Return type:str
Returns:control type
get_horizontal_policy()[source]

returns size policy

possible values are “fixed”, “minimum”, “maximum”, “preferred”, “expanding”, “minimum_expanding” and “ignored”

Return type:str
Returns:horizontal size policy
get_vertical_policy()[source]

returns size policy

possible values are “fixed”, “minimum”, “maximum”, “preferred”, “expanding”, “minimum_expanding” and “ignored”

Return type:str
Returns:vertical size policy
set_control_type(mode)[source]

sets the control type

possible values are “default”, “buttonbox”, “checkbox”, “combobox”, “frame”, “groupbox”, “label”, “line”, “lineedit”, “pushbutton”, “radiobutton”, “slider”, “spinbox”, “tabwidget”, “toolbutton”

Parameters:mode (str) – control type to set
set_horizontal_policy(mode)[source]

sets the horizontal policy

possible values are “fixed”, “minimum”, “maximum”, “preferred”, “expanding”, “minimum_expanding” and “ignored”

Parameters:mode (str) – policy to set
set_vertical_policy(mode)[source]

sets the horizontal policy

possible values are “fixed”, “minimum”, “maximum”, “preferred”, “expanding”, “minimum_expanding” and “ignored”

Parameters:mode (str) – policy to set
class prettyqt.widgets.StylePainter[source]

Bases: PyQt5.QtWidgets.QStylePainter

class prettyqt.widgets.BaseDialog[source]

Bases: PyQt5.QtWidgets.QDialog

keyPressEvent(self, QKeyEvent)[source]
set_icon(icon)[source]

set the icon for the menu

Parameters:icon (Union[QIcon, str, None]) – icon to use
class prettyqt.widgets.Dialog(title='', icon=None, parent=None, delete_on_close=True, layout=None)[source]

Bases: prettyqt.widgets.dialog.BaseDialog

class prettyqt.widgets.MessageBox(icon=None, title=None, text='', details='', buttons=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QMessageBox

add_button(button)[source]

add a default button

Valid arguments: “none”, “cancel”, “ok”, “save”, “open”, “close”,
“discard”, “apply”, “reset”, “restore_defaults”, “help”, “save_all”, “yes”, “yes_to_all”, “no”, “no_to_all”, “abort”, “retry”, “ignore”
Parameters:button (str) – button to add
Returns:created button
Raises:ValueError – Button type not available
get_text_format()[source]

returns current text format

Possible values: “rich”, “plain”, “auto”

Return type:str
Returns:text format
set_icon(icon)[source]

set the icon for the menu

Parameters:icon – icon to use
set_text_format(text_format)[source]

set the text format

Allowed values are “rich”, “plain”, “auto”

Parameters:mode – text format to use
Raises:ValueError – text format does not exist
class prettyqt.widgets.ErrorMessage[source]

Bases: PyQt5.QtWidgets.QErrorMessage

class prettyqt.widgets.FileSystemModel(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QFileSystemModel

Class to populate a filesystem treeview

data(self, QModelIndex, role: int = Qt.DisplayRole) → Any[source]
class prettyqt.widgets.LayoutItem[source]

Bases: PyQt5.QtWidgets.QLayoutItem

class prettyqt.widgets.Layout[source]

Bases: PyQt5.QtWidgets.QLayout

get_size_mode()[source]

returns current size mode

Possible values: “maximum”, “fixed”

Return type:str
Returns:size mode
set_alignment(alignment, item=None)[source]

Sets the alignment for widget / layout to alignment and returns true if w is found in this layout (not including child layouts)

Allowed values for alignment: “left”, “right”, “top”, “bottom”

Parameters:
  • alignment (str) – alignment for the layout
  • item – set alignment for specific child only
Raises:

ValueError – alignment does not exist

set_size_mode(mode)[source]

set the size mode of the layout

Allowed values are “maximum”, “fixed”

Parameters:mode (str) – size mode for the layout
Raises:ValueError – size mode does not exist
class prettyqt.widgets.FormLayout(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QFormLayout

class prettyqt.widgets.BoxLayout(orientation='horizontal', parent=None, margin=None)[source]

Bases: PyQt5.QtWidgets.QBoxLayout

class prettyqt.widgets.StackedLayout[source]

Bases: PyQt5.QtWidgets.QStackedLayout

class prettyqt.widgets.GridLayout[source]

Bases: PyQt5.QtWidgets.QGridLayout

class prettyqt.widgets.ToolBox[source]

Bases: PyQt5.QtWidgets.QToolBox

class prettyqt.widgets.Slider(orientation='horizontal', parent=None)[source]

Bases: PyQt5.QtWidgets.QSlider

get_tick_position()[source]

returns tick position

possible values are “none”, “both_sides”, “above”, “below”

Return type:str
Returns:tick position
set_tick_position(position)[source]

sets the tick position for the slider

allowed values are “none”, “both_sides”, “above”, “below”, “left”, “right” for vertical orientation of the slider, “above” equals to “left” and “below” to “right”

Parameters:position (str) – position for the ticks
class prettyqt.widgets.StyleOptionSlider[source]

Bases: PyQt5.QtWidgets.QStyleOptionSlider

is_horizontal()[source]

check if silder is horizontal

Return type:bool
Returns:True if horizontal, else False
is_vertical()[source]

check if silder is vertical

Return type:bool
Returns:True if vertical, else False
set_horizontal()[source]

set slider orientation to horizontal

set_vertical()[source]

set slider orientation to vertical

class prettyqt.widgets.Frame[source]

Bases: PyQt5.QtWidgets.QFrame

class prettyqt.widgets.ListWidgetItem[source]

Bases: PyQt5.QtWidgets.QListWidgetItem

get_checkstate()[source]

returns checkstate

possible values are “unchecked”, “partial”, “checked”

Return type:str
Returns:checkstate
set_checkstate(state)[source]

set checkstate of the checkbox

valid values are: unchecked, partial, checked

Parameters:state (str) – checkstate to use
Raises:ValueError – invalid checkstate
set_icon(icon)[source]

set the icon for the action

Parameters:icon (Union[QIcon, str, None]) – icon to use
class prettyqt.widgets.TreeWidgetItem[source]

Bases: PyQt5.QtWidgets.QTreeWidgetItem

get_checkstate()[source]

returns checkstate

possible values are “unchecked”, “partial”, “checked”

Return type:str
Returns:checkstate
set_checkstate(state)[source]

set checkstate of the checkbox

valid values are: unchecked, partial, checked

Parameters:state (str) – checkstate to use
Raises:ValueError – invalid checkstate
set_icon(icon)[source]

set the icon for the action

Parameters:icon (Union[QIcon, str, None]) – icon to use
class prettyqt.widgets.Action(text='', icon=None, parent=None, shortcut='', tooltip='')[source]

Bases: PyQt5.QtWidgets.QAction

get_priority()[source]

returns current priority

Possible values: “low”, “normal”, “high”

Return type:str
Returns:priority
get_shortcut_context()[source]

returns shortcut context

Possible values: “widget”, “widget_with_children”, “window”, “application”

Return type:str
Returns:shortcut context
set_icon(icon)[source]

set the icon for the action

Parameters:icon (Union[QIcon, str, None]) – icon to use
set_priority(priority)[source]

set priority of the action

Allowed values are “low”, “normal”, “high”

Parameters:mode – priority for the action
Raises:ValueError – priority does not exist
set_shortcut_context(context)[source]

set shortcut context

Allowed values are “widget”, “widget_with_children”, “window”, “application”

Parameters:mode – shortcut context
Raises:ValueError – shortcut context does not exist
class prettyqt.widgets.WidgetAction(text='', icon=None, parent=None, shortcut='', tooltip='')[source]

Bases: PyQt5.QtWidgets.QWidgetAction

class prettyqt.widgets.ToolButton[source]

Bases: PyQt5.QtWidgets.QToolButton

get_arrow_type()[source]

returns arrow type

possible values are “none”, “up”, “down”, “left”, “right”

Return type:str
Returns:arrow type
get_popup_mode()[source]

returns popup mode

possible values are “delayed”, “menu_button”, “instant”

Return type:str
Returns:popup mode
set_arrow_type(mode)[source]

sets the arrow type of the toolbutton

valid values are: “none”, “up”, “down”, “left”, “right”

Parameters:mode (str) – arrow type to use
Raises:ValueError – invalid arrow type
set_popup_mode(mode)[source]

sets the popup mode of the toolbutton

valid values are: “delayed”, “menu_button”, “instant”

Parameters:mode (str) – popup mode to use
Raises:ValueError – invalid popup mode
class prettyqt.widgets.ToolTip[source]

Bases: PyQt5.QtWidgets.QToolTip

class prettyqt.widgets.Menu(title='', icon=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QMenu

add_action(label, callback=None, icon=None, checkable=False, checked=False, shortcut=None, status_tip=None)[source]

Add an action to the menu

Parameters:
  • label (Union[str, Action]) – Label for button
  • callback (Optional[Callable]) – gets called when action is triggered
  • icon (Optional[Any]) – icon for button (default: {None})
  • checkable (bool) – as checkbox button (default: {False})
  • checked (bool) – if checkable, turn on by default (default: {False})
  • shortcut (Optional[str]) – Shortcut for action (a) (default: {None})
  • status_tip (Optional[str]) – Status tip to be shown in status bar (default: {None})
Return type:

Action

Returns:

Action added to menu

set_icon(icon)[source]

set the icon for the menu

Parameters:icon (Union[QIcon, str, None]) – icon to use
class prettyqt.widgets.MenuBar[source]

Bases: PyQt5.QtWidgets.QMenuBar

class prettyqt.widgets.StatusBar(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QStatusBar

class prettyqt.widgets.TabWidget(parent=None, closable=False, detachable=False)[source]

Bases: PyQt5.QtWidgets.QTabWidget

Widget for managing the tabs section

attach_tab(widget, name, icon, insert_at=None)[source]

Re-attach the tab by removing the content from the DetachedTab window, closing it, and placing the content back into the DetachableTabWidget

@param widget the content widget from the DetachedTab window @param name the name of the detached tab @param icon the window icon for the detached tab @param insert_at insert the re-attached tab at the given index

close_detached_tabs()[source]

Close all tabs that are currently detached

detach_tab(index, point)[source]

Detach the tab by removing it’s contents and placing them in a DetachedTab window

@param index index location of the tab to be detached @param point screen pos for creating the new DetachedTab window

get_tab_shape()[source]

returns tab shape

possible values are “roundes”, “triangular”

Return type:str
Returns:tab shape
open_widget(widget, title='Unnamed')[source]

create a tab containing delivered widget

set_tab_shape(shape)[source]

set tab shape for the tabwidget

Valid values are “rounded” and “triangular”

Parameters:shape (str) – tab shape to use
Raises:ValueError – tab shape does not exist
class prettyqt.widgets.TabBar(parent=None)[source]

Bases: PyQt5.QtWidgets.QTabBar

get_elide_mode()[source]

returns elide mode

possible values are “left”, “right”, “middle”, “none”

Return type:str
Returns:elide mode
get_remove_behaviour()[source]

returns remove behaviour

possible values are “left_tab”, “right_tab”, “previous_tab”

Return type:str
Returns:remove behaviour
mouseDoubleClickEvent(self, QMouseEvent)[source]
set_elide_mode(mode)[source]

set elide mode

Valid values are “left”, “right”, “middle”, “none”

Parameters:policy – elide mode to use
Raises:ValueError – invalid elide mode
set_remove_behaviour(mode)[source]

sets the remove hehaviour

What tab should be set as current when removeTab is called if the removed tab is also the current tab. Possible values: left, right, previous :type mode: str :param mode: new remove behaviour

class prettyqt.widgets.ToolBar(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QToolBar

get_style()[source]

returns current style

Possible values: “icon”, “text”, “text_below_icon”, “text_beside_icon”

Return type:str
Returns:style
is_area_allowed(area)[source]

check if toolbar is allowed at specified area

Valid values for area: “left”, “right”, “top”, “bottom”

Parameters:area (str) – area of the toolbar
Raises:ValueError – area does not exist
class prettyqt.widgets.HeaderView(orientation=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QHeaderView

contextMenuEvent(event)[source]

context menu for our files tree

class prettyqt.widgets.DockWidget(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QDockWidget

Customized DockWidget class contains a custom TitleBar with maximise button

class prettyqt.widgets.Label(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QLabel

get_text_format()[source]

returns current text format

Possible values: “rich”, “plain”, “auto”

Return type:str
Returns:text format
get_text_interaction()[source]

returns current text interaction mode

Possible values: “none”, “by_mouse”, “by_keyboard”

Return type:str
Returns:text interaction mode
set_text_format(text_format)[source]

set the text format

Allowed values are “rich”, “plain”, “auto”

Parameters:mode – text format to use
Raises:ValueError – text format does not exist
set_text_interaction(interaction_type)[source]

set the text interaction mode

Allowed values are “none”, “by_mouse”, “by_keyboard”

Parameters:mode – text interaction mode to use
Raises:ValueError – text interaction mode does not exist
class prettyqt.widgets.PushButton(label=None, parent=None, callback=None)[source]

Bases: PyQt5.QtWidgets.QPushButton

class prettyqt.widgets.CommandLinkButton(label=None, parent=None, callback=None)[source]

Bases: PyQt5.QtWidgets.QCommandLinkButton

class prettyqt.widgets.RadioButton(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QRadioButton

class prettyqt.widgets.ComboBox(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QComboBox

get_insert_policy()[source]

returns insert policy

possible values are “no_insert”, “top”, “current”, “bottom”, “after_current”, “before_current”, “alphabetically”

Return type:str
Returns:insert policy
get_size_adjust_policy()[source]

returns size adjust policy

possible values are “content”, “first_show”, “min_length”, “min_length_with_icon”

Return type:str
Returns:size adjust policy
set_insert_policy(policy)[source]

set insert policy

valid values are “no_insert”, “top”, “current”, “bottom”, “after_current”, “before_current”, “alphabetically”

Parameters:policy (str) – insert policy to use
Raises:ValueError – invalid insert policy
set_size_adjust_policy(policy)[source]

set size adjust policy

possible values are “content”, “first_show”, “min_length”, “min_length_with_icon”

Parameters:policy (str) – size adjust policy to use
Raises:ValueError – invalid size adjust policy
class prettyqt.widgets.SpinBox(parent=None, min_value=None, max_value=None, default_value=None)[source]

Bases: PyQt5.QtWidgets.QSpinBox

class prettyqt.widgets.DoubleSpinBox(parent=None, min_value=None, max_value=None, default_value=None)[source]

Bases: PyQt5.QtWidgets.QDoubleSpinBox

class prettyqt.widgets.CheckBox(label='', parent=None, checked=False)[source]

Bases: PyQt5.QtWidgets.QCheckBox

get_checkstate()[source]

returns checkstate

possible values are “unchecked”, “partial”, “checked”

Return type:bool
Returns:checkstate
set_checkstate(state)[source]

set checkstate of the checkbox

valid values are: unchecked, partial, checked

Parameters:state (str) – checkstate to use
Raises:ValueError – invalid checkstate
class prettyqt.widgets.LineEdit(default_value='', read_only=False, parent=None)[source]

Bases: PyQt5.QtWidgets.QLineEdit

font()[source]
Return type:Font
get_echo_mode()[source]

returns echo mode

possible values are “normal”, “no_echo”, “password”, “echo_on_edit”

Return type:str
Returns:echo mode
set_echo_mode(mode)[source]

set echo mode

Valid values are “normal”, “no_echo”, “password”, “echo_on_edit”

Parameters:policy – echo mode to use
Raises:ValueError – invalid echo mode
set_read_only(value=True)[source]

set test to read only

Parameters:value (bool) – True, for read-only, otherwise False
class prettyqt.widgets.KeySequenceEdit(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QKeySequenceEdit

class prettyqt.widgets.TextEdit(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTextEdit

class prettyqt.widgets.DateEdit(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QDateEdit

class prettyqt.widgets.TimeEdit(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTimeEdit

class prettyqt.widgets.DateTimeEdit(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QDateTimeEdit

class prettyqt.widgets.CalendarWidget[source]

Bases: PyQt5.QtWidgets.QCalendarWidget

class prettyqt.widgets.PlainTextEdit(text='', parent=None, read_only=False)[source]

Bases: PyQt5.QtWidgets.QPlainTextEdit

set_read_only(value=True)[source]

set test to read only

Parameters:value (bool) – True, for read-only, otherwise False
class prettyqt.widgets.TextBrowser(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTextBrowser

class prettyqt.widgets.ProgressBar(text_visible=True, parent=None)[source]

Bases: PyQt5.QtWidgets.QProgressBar

Progress dialog

wrapper for QtWidgets.QProgressBar

get_alignment()[source]

returns current alignment

Possible values: “left”, “right”, “top”, “bottom”

Return type:str
Returns:alignment
get_text_direction()[source]

returns current text direction

Possible values are “top_to_bottom”, “bottom_to_top”

Return type:str
Returns:Text direction
set_alignment(alignment)[source]

set the alignment of the layout

Allowed values are “left”, “right”, “top”, “bottom”

Parameters:mode – alignment for the layout
Raises:ValueError – alignment does not exist
set_text_direction(text_direction)[source]

set the text direction of the layout

Allowed values are “top_to_bottom”, “bottom_to_top”

Parameters:mode – text direction for the layout
Raises:ValueError – text direction does not exist
class prettyqt.widgets.ColumnView(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QColumnView

class prettyqt.widgets.ListView(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QListView

get_view_mode()[source]

returns view mode

possible values are “list”, “icon”

Return type:str
Returns:view mode
set_view_mode(mode)[source]

set view mode

possible values are “list”, “icon”

Parameters:mode (str) – view mode to use
Raises:ValueError – invalid view mode
class prettyqt.widgets.ListWidget(parent=None, selection_mode='single')[source]

Bases: PyQt5.QtWidgets.QListWidget

class prettyqt.widgets.TreeView(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTreeView

class prettyqt.widgets.TreeWidget(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTreeWidget

class prettyqt.widgets.TableView(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTableView

class prettyqt.widgets.TableWidget(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QTableWidget

class prettyqt.widgets.SplashScreen(path, width=None)[source]

Bases: PyQt5.QtWidgets.QSplashScreen

class prettyqt.widgets.ProgressDialog(parent=None)[source]

Bases: PyQt5.QtWidgets.QProgressDialog

Progress dialog

wrapper for QtWidgets.QProgressDialog

class prettyqt.widgets.FontDialog[source]

Bases: PyQt5.QtWidgets.QFontDialog

class prettyqt.widgets.FileDialog(path=None, mode='open', caption='', path_id=None, extension_filter=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QFileDialog

simple dialog used to display some widget

directory()[source]

return current directory

returns current directory level as a Pathlib object

Return type:Path
Returns:Pathlib object
get_accept_mode()[source]

returns accept mode

possible values are “save”, “open”

Return type:str
Returns:accept mode
get_file_mode()[source]

returns file mode

possible values are “existing_file”, “existing_files”, “any_file”, “directory”

Return type:str
Returns:file mode
get_label_text(label)[source]

returns label text

possible values are “look_in”, “filename”, “filetype”, “accept”, “reject”

Return type:str
Returns:label text
get_view_mode()[source]

returns view mode

possible values are “detail”, “list”

Return type:str
Returns:view mode
set_accept_mode(mode)[source]

set accept mode

possible values are “save”, “open”

Parameters:mode (str) – accept mode to use
Raises:ValueError – invalid accept mode
set_file_mode(mode)[source]

sets the file mode of the dialog

allowed values are “existing_file”, “existing_files”, “any_file” “directory”

Parameters:mode (str) – mode to use
set_filter(extension_dict)[source]

set filter based on given dictionary

dict must contain “‘name’: [‘.ext1’, ‘.ext2’]” as key-value pairs

Parameters:extension_dict (dict) – filter dictionary
set_label_text(label, text)[source]

sets the label text for button label

possible values for label are “look_in”, “filename”, “filetype”, “accept”, “reject”

Parameters:
  • label (str) – button to set text for
  • text (str) – text to use
set_view_mode(mode)[source]

set view mode

possible values are “detail”, “list”

Parameters:mode (str) – view mode to use
Raises:ValueError – invalid view mode
class prettyqt.widgets.ColorDialog[source]

Bases: PyQt5.QtWidgets.QColorDialog

class prettyqt.widgets.InputDialog[source]

Bases: PyQt5.QtWidgets.QInputDialog

class prettyqt.widgets.DialogButtonBox(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QDialogButtonBox

add_button(button, role='accept', callback=None)[source]

add a button

Parameters:
  • button – button to add
  • role – role of the button
  • callback – function to call when button gets clicked
Returns:

created button

Raises:

ValueError – Button type not available

add_default_button(button, callback=None)[source]

add a default button

Valid arguments: “cancel”, “ok”, “save”, “open”, “close”,
“discard”, “apply”, “reset”, “restore_defaults”, “help”, “save_all”, “yes”, “yes_to_all”, “no”, “no_to_all”, “abort”, “retry”, “ignore”
Parameters:
  • button (str) – button to add
  • callback – function to call when button gets clicked
Returns:

created button

Raises:

ValueError – Button type not available

classmethod create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)[source]
get_orientation()[source]

returns current orientation

Possible values: “horizontal”, “vertical”

Return type:str
Returns:orientation
set_orientation(orientation)[source]

set the orientation of the button box

Allowed values are “horizontal”, “vertical”

Parameters:mode – orientation for the button box
Raises:ValueError – orientation does not exist
class prettyqt.widgets.ButtonGroup[source]

Bases: PyQt5.QtWidgets.QButtonGroup

class prettyqt.widgets.GroupBox(title='', checkable=False, parent=None)[source]

Bases: PyQt5.QtWidgets.QGroupBox

GroupBox widget

A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves keyboard focus to one of the group box’s child widgets.

class prettyqt.widgets.Splitter(orientation='horizontal', parent=None)[source]

Bases: PyQt5.QtWidgets.QSplitter

get_orientation()[source]

returns current orientation

Possible values: “horizontal”, “vertical”

Return type:str
Returns:orientation
set_orientation(orientation)[source]

set the orientation of the splitter

Allowed values are “horizontal”, “vertical”

Parameters:mode – orientation for the splitter
Raises:ValueError – orientation does not exist
class prettyqt.widgets.Wizard[source]

Bases: PyQt5.QtWidgets.QWizard

class prettyqt.widgets.WizardPage[source]

Bases: PyQt5.QtWidgets.QWizardPage

class prettyqt.widgets.MainWindow(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QMainWindow

Class for our mainWindow includes all docks, a centralwidget and a toolbar

add_toolbar(toolbar, position='top')[source]

adds a toolbar to the mainmenu at specified area

Valid values for position: “left”, “right”, “top”, “bottom”

Parameters:
  • toolbar – toolbar to use
  • position (str) – position of the toolbar
Raises:

ValueError – position does not exist

add_toolbar_break(position='top')[source]

Adds a toolbar break to the given area after all the other objects that are present.

Valid values for position: “left”, “right”, “top”, “bottom”

Parameters:position (str) – position of the toolbar
Raises:ValueError – position does not exist
closeEvent(event)[source]

override, gets executed when app gets closed. saves GUI settings

createPopupMenu(self) → QMenu[source]
set_icon(icon)[source]

set the icon for the menu

Parameters:icon (Union[QIcon, str, None]) – icon to use
toggle_fullscreen()[source]

toggle between fullscreen and regular size

class prettyqt.widgets.AbstractItemDelegate[source]

Bases: PyQt5.QtWidgets.QAbstractItemDelegate

class prettyqt.widgets.ItemDelegate[source]

Bases: PyQt5.QtWidgets.QItemDelegate

class prettyqt.widgets.StyledItemDelegate[source]

Bases: PyQt5.QtWidgets.QStyledItemDelegate