dip.ui.toolkits.qt

This module contains the implementation of the Qt toolkit.

QtToolkit

class dip.ui.toolkits.qt.QtToolkit

Base class: BaseToolkit

The QtToolkit class implements the toolkit that uses the Qt GUI library.

add_icon = Instance(QIcon)
The icon used to add an item to a collection.
browse_icon = Instance(QIcon)
The icon used to open a dialog to browse the file system.
down_icon = Instance(QIcon)
The icon used to move an item down in a collection.
remove_icon = Instance(QIcon)
The icon used to remove an item from a collection.
up_icon = Instance(QIcon)
The icon used to move an item up in a collection.
add_button(factory, parent)

Create a button to add an item to a collection.

Parameters:
  • factory – is the factory creating the button.
  • parent – is the optional parent widget.
Returns:

the button which will be a QAbstractButton.

browse_button()

Create a button to initiate browsing the file system.

Returns:the button which will be a QAbstractButton.
check_box(factory, attribute_type, parent)

Create an editor based on a check box.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QCheckBox. Any factory properties will be applied to the check box.

combo_box(factory, attribute_type, parent)

Create an editor based on a combo box.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QComboBox. Any factory properties will be applied to the combo box.

dialog(factory, content, parent)

Create a dialog view.

Parameters:
  • factory – is the factory creating the view.
  • content – is the content of the dialog and is either a QLayout or a QWidget.
  • parent – is the optional parent widget.
Returns:

the view which will be an instance of QDialog.

down_button(factory, parent)

Create a button to move an item in a collection down.

Parameters:
  • factory – is the factory creating the button.
  • parent – is the optional parent widget.
Returns:

the button which will be a QAbstractButton.

editor_for_widget(widget_type)

Return an EditorFactory type object that will create an editor factory that creates editors of a particular type.

Parameter:widget_type – is the type of the widget.
Returns:the type object.
file_selector(factory, attribute_type, parent)

Create an editor that implements a file/directory selector.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor. Any factory properties will be applied to an internal QLineEdit.

float_spin_box(factory, attribute_type, parent)

Create an editor for floats based on a spin box.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QDoubleSpinBox. Any factory properties will be applied to the spin box.

form(factory, items)

Create a view to contain a number of items arranged as a form.

Parameters:
  • factory – is the optional factory creating the view.
  • items – is a sequence of 2-tuple label and field pairs. A label may be None. A field may be a QLayout or a QWidget.
Returns:

the view which will be an instance of QFormLayout.

get_directory(directory='', parent=None)

Get the name of an existing directory from the user.

Parameters:
  • directory – is the name of an optional initial directory.
  • parent – is the optional parent widget.
Returns:

the name of the directory or an empty string if there was none.

get_open_file(directory='', filter='', parent=None)

Get the name of a file to open from the user.

Parameters:
  • directory – is the name of an optional initial directory or file.
  • filter – is the optional file filter.
  • parent – is the optional parent widget.
Returns:

the name of the file to open or an empty string if there was none.

get_open_files(directory='', filter='', parent=None)

Get a list of names of files to open from the user.

Parameters:
  • directory – is the name of an optional initial directory or file.
  • filter – is the optional file filter.
  • parent – is the optional parent widget.
Returns:

the list of names.

get_save_file(directory='', filter='', parent=None)

Get the name of a file to save from the user.

Parameters:
  • directory – is the name of an optional initial directory or file.
  • filter – is the optional file filter.
  • parent – is the optional parent widget.
Returns:

the name of the file to save or an empty string if there was none.

group_box(factory, content, parent)

Create a group box view.

Parameters:
  • factory – is the factory creating the view.
  • content – is the content of the view and is either a QLayout or a QWidget.
  • parent – is the optional parent widget.
Returns:

the view.

h_box(factory, items)

Create a view to contain a number of items arranged horizontally.

Parameters:
  • factory – is the factory creating the view.
  • items – is a sequence of QLayout, QWidget and Stretch instances.
Returns:

the view which will be an instance of QHBoxLayout.

information(title, text, parent=None)

Display a informational message to the user.

Parameters:
  • title – is the title, typically used as the title of a dialog.
  • text – is the text of the message.
  • parent – is the optional parent widget.
line_edit(factory, attribute_type, parent)

Create an editor based on a line editor.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QLineEdit. Any factory properties will be applied to the line editor.

list_widget(factory, attribute_type, parent)

Create an editor for a list.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QListWidget.

menu(title, parent)

Create a menu.

Parameters:
  • title – is the menu’s title.
  • parent – is the menu’s parent.
Returns:

the menu which will be an instance of QMenu.

menu_bar()

Create a menu bar.

Returns:the menu bar which will be an instance of QMenuBar.
message_area(factory, parent)

Create a message area.

Parameters:
  • factory – is the factory creating the message area.
  • parent – is the optional parent widget.
Returns:

the message area which will be an instance of QLabel.

push_button(factory, attribute_type, parent)

Create an editor based on a push button.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QPushButton. Any factory properties will be applied to the button.

question(title, text, parent=None, default_no=True)

Ask the user a question with a yes or no answer.

Parameters:
  • title – is the title, typically used as the title of a dialog.
  • text – is the text of the question.
  • parent – is the optional parent widget.
  • default_no – is True if the default answer to the question is “no”.
Returns:

True if the answer was “yes”.

radio_buttons(factory, attribute_type, parent)

Create an editor that implements a set of radio buttons.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor. Any factory properties will be applied to each of the buttons.

remove_button(factory, parent)

Create a button to remove an item from a collection.

Parameters:
  • factory – is the factory creating the editor.
  • parent – is the optional parent widget.
Returns:

the button which will be a QAbstractButton.

spin_box(factory, attribute_type, parent)

Create an editor based on a spin box.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QSpinBox. Any factory properties will be applied to the spin box.

splitter(factory, items)

Create a splitter view to contain a number of items.

Parameters:
  • factory – is the factory creating the view.
  • items – is a sequence of QLayout or QWidget instances.
Returns:

the view which will be an instance of QSplitter.

table_widget(factory, attribute_type, parent)

Create an editor for a table.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QTableWidget.

text_edit(factory, attribute_type, parent)

Create an editor based on a text editor.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QTextEdit. Any factory properties will be applied to the text editor.

tool_button(factory, attribute_type, parent)

Create an editor based on a tool button.

Parameters:
  • factory – is the factory creating the editor.
  • attribute_type – is the attribute type.
  • parent – is the parent widget.
Returns:

the editor which will be an instance of QToolButton. Any factory properties will be applied to the button.

up_button(factory, parent)

Create a button to move an item in a collection up.

Parameters:
  • factory – is the factory creating the editor.
  • parent – is the optional parent widget.
Returns:

the button which will be a QAbstractButton.

v_box(factory, items)

Create a view to contain a number of items arranged vertically.

Parameters:
  • factory – is the factory creating the view.
  • items – is a sequence of QLayout, QWidget and Stretch instances.
Returns:

the view which will be an instance of QVBoxLayout.

warning(title, text, parent=None, detail='')

Display a warning message to the user.

Parameters:
  • title – is the title, typically used as the title of a dialog.
  • text – is the text of the warning.
  • parent – is the optional parent widget.
  • detail – is the optional additional detail.
wizard(factory, pages, parent)

Create a wizard view.

Parameters:
  • factory – is the factory creating the view.
  • pages – is the list of wizard pages.
  • parent – is the optional parent widget.
Returns:

the view.

wizard_page(factory, content, parent)

Create a wizard page view.

Parameters:
  • factory – is the factory creating the view.
  • content – is the content of the view and is either a QLayout or a QWidget.
  • parent – is the optional parent widget.
Returns:

the view.

Table Of Contents

Previous topic

dip.ui.plugins

This Page