dip.toolkits.qt4

This module contains the implementation of the Qt4 toolkit.

Toolkit

class dip.toolkits.qt4.Toolkit

Base class: BaseToolkit

The Toolkit class implements the toolkit that uses the Qt4 GUI library.

view_type_to_declarative_factory_map = Tuple()
A map of declarative factories to view types.
action(parent)

Create an action.

Parameter:parent – is the optional parent view.
Returns:the action which will be a QAction.
application(argv, **properties)

Create a singleton application.

Parameters:
  • argv – is the sequence of command line arguments.
  • **properties – are the keyword arguments used as toolkit specific property names and values that are used to configure the application.
Returns:

the application. Repeated calls must return the same application.

call_after(callable, after)

Call a callable after a delay.

Parameters:
  • callable – is the callable.
  • after – is the delay in milliseconds. If it is zero then the callable is called in the next iteration of the event loop.
check_box(parent)

Create an editor based on a check box.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QCheckBox.
close_action()

Create an action to handle closing an object.

Returns:the action.
combo_box(parent)

Create an editor based on a combo box.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QComboBox.
declarative_factory_for_view(view)

Get an EditorFactory type object that will create a factory that creates views of a particular type.

Parameter:view – is the view.
Returns:the EditorFactory sub-class.
designer_load(ui_file_name)

Load a file containing a user interface design.

Parameter:ui_file_name – is the name of the file.
Returns:an opaque object that will be passed to designer_view().
designer_view(design, parent)

Create a view from a previously loaded user interface design.

Parameters:
  • design – is an opaque object returned by a previous call to designer_load().
  • parent – is the optional parent view.
Returns:

the view.

dialog(parent)

Create a dialog view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QDialog.
displayable(view)

Return a view that can be displayed as a top-level window.

Parameter:view – is the view to be displayed.
Returns:the view, possibly wrapped so that it can be displayed.
dock(parent)

Create a dock view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QDockWidget.
filesystem_location_editor(parent)

Create an editor that implements a filesystem file/directory location editor.

Parameter:parent – is the optional parent view.
Returns:the editor. Any factory properties will be applied to an internal QLineEdit.
find_view(root, id)

Find the view with a particular identifier.

Parameters:
  • root – is the root view to begin the search.
  • id – is the identifier of the view to search for.
Returns:

the view. An exception will be raised if the view could not be found.

float_spin_box(parent)

Create an editor for floats based on a spin box.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QDoubleSpinBox.
form(parent)

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

Parameter:parent – is the optional parent view.
Returns:the layout which will be an instance of QFormLayout.
get_open_file(window_title, directory='', filter='', parent=None)

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

Parameters:
  • window_title – is the window title, typically used as the title of a dialog.
  • directory – is the name of an optional initial directory or file.
  • filter – is the optional file filter.
  • parent – is the optional parent view.
Returns:

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

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

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

Parameters:
  • window_title – is the window title, typically used as the title of a dialog.
  • directory – is the name of an optional initial directory or file.
  • filter – is the optional file filter.
  • parent – is the optional parent view.
Returns:

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

group_box(parent)

Create a group box view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QGroupBox.
h_box(parent)

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

Parameter:parent – is the optional parent view.
Returns:the layout which will be an instance of QHBoxLayout.
information(window_title, text, parent)

Display a informational message to the user.

Parameters:
  • window_title – is the window title, typically used as the title of a dialog.
  • text – is the text of the message.
  • parent – is the optional parent view.
label(parent)

Create an editor for displaying a string.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QLabel.
line_editor(parent)

Create an editor based on a line editor.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QLineEdit.
list_editor(parent)

Create an editor for a list.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of DipListEditor. Any factory properties will be applied to an internal QTreeWidget.
main_window(parent)

Create a main window view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QMainWindow.
menu(parent)

Create a menu.

Parameter:parent – is the optional parent view.
Returns:the menu which will be an instance of QMenu.
menu_bar(parent)

Create a menu bar.

Parameter:parent – is the optional parent view.
Returns:the menu bar which will be an instance of QMenuBar.
message_area(parent)

Create a message area.

Parameter:parent – is the optional parent view.
Returns:the message area which will be an instance of QLabel.
new_action()

Create an action to handle creating a new object.

Returns:the action.
open_action()

Create an action to handle opening an object.

Returns:the action.
option_list(parent)

Create an editor used to select from a sequence of options.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QListWidget.
push_button(parent)

Create an editor based on a push button.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QPushButton.
question(window_title, text, parent, detail, buttons)

Ask the user a question.

Parameters:
  • window_title – is the window title, typically used as the title of a dialog.
  • text – is the text of the question.
  • parent – is the optional parent view.
  • detail – is the optional additional detail.
  • buttons – is the sequence of buttons to display. Possible buttons are ‘yes’, ‘no’, ‘cancel’, ‘save’ and ‘discard’. The first in the sequence is used as the default.
Returns:

The button that was pressed.

quit_action()

Create an action to handle quitting the application.

Returns:the action.
radio_buttons(parent)

Create an editor that implements a set of radio buttons.

Parameter:parent – is the optional parent view.
Returns:the editor. Any factory properties will be applied to each of the buttons.
save_action()

Create an action to handle saving an object.

Returns:the action.
save_as_action()

Create an action to handle saving an object under a new name.

Returns:the action.
spin_box(parent)

Create an editor based on a spin box.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QSpinBox.
splitter(parent)

Create a splitter view to contain a number of items.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QSplitter.
storage_location_editor(parent)

Create an editor that implements a storage location editor.

Parameter:parent – is the optional parent view.
Returns:the editor. Any factory properties will be applied to an internal QLineEdit.
tab_bar(parent)

Create a tab bar view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QTabWidget.
table_editor(parent)

Create an editor for a table.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of DipTableEditor. Any factory properties will be applied to an internal QTableWidget.
text_editor(parent)

Create an editor based on a text editor.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QTextEdit.
tool_button(parent)

Create an editor based on a tool button.

Parameter:parent – is the optional parent view.
Returns:the editor which will be an instance of QToolButton.
v_box(parent)

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

Parameter:parent – is the optional parent view.
Returns:the layout which will be an instance of QVBoxLayout.
view_stack(parent)

Create a layout to contain a stack of items such that only one is visible at a time.

Parameter:parent – is the optional parent view.
Returns:the layout which will be an instance of QStackedLayout.
warning(window_title, text, parent, detail)

Display a warning message to the user.

Parameters:
  • window_title – is the window title, typically used as the title of a dialog.
  • text – is the text of the warning.
  • parent – is the optional parent view.
  • detail – is the optional additional detail.
whats_this_action()

Create an action to handle “What’s This?”.

Returns:the action.
wizard(parent)

Create a wizard view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QWizard.
wizard_page(parent)

Create a wizard page view.

Parameter:parent – is the optional parent view.
Returns:the view which will be an instance of QWizardPage.

Table Of Contents

Previous topic

dip.toolkits

Next topic

dip.ui

This Page