Skip to main content

qt_extras

Provides various extras for PyQt, including menu_button, list_button, list_layouts, autofit, SigBlock, ShutUpQT, WidgetDisabler and DevilBox

Classes:

SigBlock:

A context manager which blocks widgets from generating signals.

Use like:

with SigBlock(b_open, b_close):
	b_open.setChecked(True)
	b_close.setChecked(False)

ShutUpQT(object):

A context manager for temporarily supressing DEBUG level messages. Primarily used when loading a Qt graphical user interface using uic.

with ShutUpQT():
	uic.loadUi(join(dirname(__file__), 'dialog.ui'), self)

WidgetDisabler:

A context manager that disables every widget in a window.

DevilBox(QMessageBox):

Quick and dirty error message dialog.

if error:
	DevilBox('Oh boy, this is gonna be bad...')

Sub-modules:

menu_button module

Provides a pushbutton with an integrated drop-down menu.

Usage (inside a dialog created by QtDesigner):

menu_button = QtMenuButton(self)
self.layout().replaceWidget(self.menu_button_placeholder, menu_button)
self.menu_button_placeholder.deleteLater()
self.b_menu = menu_button

action = QAction('Do the first thing', self.b_menu)
action.triggered.connect(self.slot_first_thing)
self.b_menu.addAction(action)

action = QAction('Do the second thing', self.b_menu)
action.triggered.connect(self.slot_second_thing)
self.b_menu.addAction(action)

list_button module

Pushbutton with an integrated drop-down list containing text and data.

list_layouts module

"Collection" layouts which act like lists.

frame = QFrame()
layout = VListLayout()
frame.setLayout(layout)
for string in strings:
	layout.append(QLabel(string, frame))
for widget in layout:
	# do something ...
for widget in reversed(layout):
	# do something ...
print(len(layout))
item1 = layout[1]
item2 = layout[2]
item3 = layout[3]
layout.swap(item1, item2)
layout.remove(item3)

autofit module

Functions to abbreviate widget text to fit inside a widget's available space.

autofit

Applies the "autofit" effect on a QPushButton, QCheckBox, QRadioButton, or QLabel.

Usage:

label = QLabel(text, self)
autofit(label)

After applying the effect, when the widget's text is changed using "setText", or when the widget is resized, the text will be abrreviated if necessary to fit inside the available space.

Shortens the text to fit buttons, labels, etc. by eliminating first spaces, then vowels, then consonants and numbers, starting from the beginning and ending and moving towards the center of the text.

elide

Applies the "elide" effect on a QPushButton, QCheckBox, QRadioButton, or QLabel.

Usage:

label = QLabel(text, self)
elide(label)

After applying the effect, when the widget's text is changed using "setText", or when the widget is resized, the text will be abrreviated if necessary to fit inside the available space.

Shortens the text to fit buttons, labels, etc. by adding an elide mark "..."

info module

Provides a command-line tool which accepts a PyQT class name and provides a list of all class members or an import statement. By default, shows all public members of the given class.

usage: qtinfo [-h] [--import-statement] ClassName [ClassName ...]

positional arguments:
  ClassName             Class to inspect

optional arguments:
  -h, --help            show this help message and exit
  --import-statement, -i
                        Show import statement

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

soso_qt_extras-1.11.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soso_qt_extras-1.11.0-py2.py3-none-any.whl (28.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file soso_qt_extras-1.11.0.tar.gz.

File metadata

  • Download URL: soso_qt_extras-1.11.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for soso_qt_extras-1.11.0.tar.gz
Algorithm Hash digest
SHA256 b35c71ebbc721bc9e3c8b1fe2642ce89cfdaf88a0ce6017caf8809225c818eac
MD5 1bc69111d7e489889e2f51f6b72de0c0
BLAKE2b-256 5e76efda64999b5cbab05fc7d1f8f2d73f4425a1a1dc1a68e68f35b85bf0a356

See more details on using hashes here.

File details

Details for the file soso_qt_extras-1.11.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for soso_qt_extras-1.11.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5aefa1be4333ff760c5a2a3c7dd79283eab6e9d9b8b37e03341782d068c8bf82
MD5 cdb3694afc6bdf507de7a474af4bd481
BLAKE2b-256 bab2976e43382237bd1540fd6c5bcbc965ea346fd7467f956653c4661a024147

See more details on using hashes here.

Release history Release notifications | RSS feed

1.15.0

2 files

1.14.3

2 files

1.14.2

2 files

1.14.1

2 files

1.14.0

2 files

1.13.1

2 files

1.13.0

2 files

1.12.1

2 files

This release

1.11.0 This release

2 files

1.10.0

2 files

1.9.0

2 files

1.8.0

2 files

1.7.1

2 files

1.6.5

2 files

1.5.0

2 files

1.4.0

2 files

1.3.2

2 files

1.2.2

2 files

1.1.2

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page