cola.qtutils – Miscellaneous Qt helpers
This module provides miscellaneous Qt utility functions.
-
cola.qtutils.SLOT(signal, *args, **opts)
Returns a callback that broadcasts a message over the notifier.
If the caller of SLOT() provides args or opts then those are
used instead of the ones provided by the invoker of the callback.
-
cola.qtutils.add_close_action(widget)
- Adds a Ctrl+w close action to a widget.
-
cola.qtutils.add_items(widget, items)
- Adds items to a widget.
-
cola.qtutils.cached_icon(key)
- Maintain a cache of standard icons and return cache entries.
-
cola.qtutils.center_on_screen(widget)
- Move widget to the center of the default screen
-
cola.qtutils.create_listwidget_item(text, filename)
- Creates a QListWidgetItem with text and the icon at filename.
-
cola.qtutils.create_treeitem(filename, staged=False, untracked=False, check=True)
- Given a filename, return a QListWidgetItem suitable
for adding to a QListWidget. “staged” and “untracked”
controls whether to use the appropriate icons.
-
cola.qtutils.create_treewidget_item(text, filename)
- Creates a QTreeWidgetItem with text and the icon at filename.
-
cola.qtutils.diff_font()
- Return the diff font string.
-
cola.qtutils.dir_icon()
- Return a standard icon for a directory.
-
cola.qtutils.file_icon()
- Return a standard icon for a file.
-
cola.qtutils.icon(basename)
- Given a basename returns a QIcon from the corresponding cola icon.
-
cola.qtutils.icon_file(filename, staged=False, untracked=False)
- Returns a file path representing a corresponding file path.
-
cola.qtutils.icon_for_file(filename, staged=False, untracked=False)
- Returns a QIcon for a particular file path.
-
cola.qtutils.information(title, message=None)
- Launches a QMessageBox information with the
provided title and message.
-
cola.qtutils.log(status, output)
- Sends messages to the log window.
-
cola.qtutils.logger()
-
cola.qtutils.open_dialog(parent, title, filename=None)
- Creates an Open File dialog and returns a filename.
-
cola.qtutils.opendir_dialog(parent, title, path)
- Prompts for a directory path
-
cola.qtutils.prompt(msg, title=None)
- Presents the user with an input widget and returns the input.
-
cola.qtutils.question(parent, title, message, default=True)
- Launches a QMessageBox question with the provided title and message.
Passing “default=False” will make “No” the default choice.
-
cola.qtutils.save_dialog(parent, title, filename='')
- Creates a Save File dialog and returns a filename.
-
cola.qtutils.selected_item(list_widget, items)
- Returns the selected item in a QListWidget.
-
cola.qtutils.selected_row(list_widget)
- Returns a(row_number, is_selected) tuple for a QListWidget.
-
cola.qtutils.selected_treeitem(tree_widget)
- Returns a(id_number, is_selected) for a QTreeWidget.
-
cola.qtutils.selection_list(listwidget, items)
- Returns an array of model items that correspond to
the selected QListWidget indices.
-
cola.qtutils.set_clipboard(text)
- Sets the copy/paste buffer to text.
-
cola.qtutils.set_diff_font(widget)
- Updates the diff font based on the configured value.
-
cola.qtutils.set_items(widget, items)
- Clear the existing widget contents and set the new items.
-
cola.qtutils.set_listwidget_strings(widget, items)
- Sets a list widget to the strings passed in items.
-
cola.qtutils.set_selected_item(widget, idx)
- Sets a the currently selected item to the item at index idx.
-
cola.qtutils.tr(txt)
- Translate a string into a local language.
-
cola.qtutils.tree_selection(treeitem, items)
- Returns model items that correspond to selected widget indices
-
cola.qtutils.update_file_icons(widget, items, staged=True, untracked=False, offset=0)
- Populate a QListWidget with custom icon items.