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.10.0.tar.gz (26.8 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.10.0-py2.py3-none-any.whl (28.1 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: soso_qt_extras-1.10.0.tar.gz
  • Upload date:
  • Size: 26.8 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.10.0.tar.gz
Algorithm Hash digest
SHA256 896967707675fdd84fb72f7a783e35ca39d1d6c40f7c3b40fdc190120306e5f6
MD5 a63835de393f4fe95270b205fae9f9e5
BLAKE2b-256 7ff20d008938792f1cf88fb42188affe0239a9124f73922f997ebc6a220e6d7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for soso_qt_extras-1.10.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a7c9b56ae11934d225b8f9ff0b75f59273146d8d7145723cefb6c0b61aa60a83
MD5 df1e7ca479e195672b3c9cbea106a7cf
BLAKE2b-256 9386df3bdef404140ffa449cb2ab4850ca33ff9f0e3361604bdd71edf574388f

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

1.11.0

2 files

This release

1.10.0 This release

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