editor.base#

Contains BasePropertyEditor and its required attributes and methods.

The property editor’s layout is defined by a previously specified SECTIONS dictionary. This contains the sections, rows and editor widget definitions - plus linkage information needed to associate the widget with a bookmark database columns or user setting keys.

BasePropertyEditor is relatively flexible and has a number of abstract methods that need implementing in subclasses depending on the desired functionality. See, BasePropertyEditor.db_source(), BasePropertyEditor.init_data() and BasePropertyEditor.save_changes().

Classes:

BasePropertyEditor(sections, server, job, root)

Base class for constructing a property editor widget.

Functions:

add_section(icon, label, parent[, color])

Adds a new section with an icon and a title.

class bookmarks.editor.base.BasePropertyEditor(sections, server, job, root, asset=None, db_table=None, buttons=('Save', 'Cancel'), alignment=QtCore.Qt.AlignRight, fallback_thumb='placeholder', hide_thumbnail_editor=False, parent=None)[source]#

Bases: QDialog

Base class for constructing a property editor widget.

Parameters:
  • sections (dict) – The data needed to construct the ui layout.

  • server (str or None) – server path segment.

  • job (str or None) – job path segment.

  • root (str or None) – root path segment.

  • asset (str or None) – asset path segment.

  • db_table (str or None) – An optional name of a bookmark database table. When not None, the editor will load and save data to the database. Defaults to None.

  • buttons (tuple) – Button labels. Defaults to (‘Save’, ‘Cancel’).

  • alignment (int) – Text alignment. Defaults to QtCore.Qt.AlignRight.

  • fallback_thumb (str) – An image name. Defaults to ‘placeholder’.

Methods:

add_section_header_button(name, widget)

Add a header button to help reveal the given section widget.

changeEvent(event)

Change event handler.

closeEvent(event)

Close event.

data_changed(key, _type, editor, v)

Signal called when the user changes a value in the editor.

db_source()

A file path to use as the source of database values.

done(result)

Finish editing the item.

hideEvent(event)

Hide event handler.

init_data()

Initializes data.

init_db_data()

Method will load data from the bookmark database.

load_saved_user_settings(keys)

Utility method will load user setting values and apply them to the corresponding editors.

save_changed_data_to_db()

This will save changed data to the bookmark database.

save_changes()

Perform save actions and/or data saving.

scroll_to_section(widget)

Slot used to scroll to a section when a section header is clicked.

showEvent(event)

Show event handler.

sizeHint()

Returns a size hint.

update_changed_database_value(table, source, ...)

Slot responsible updating the gui when a database value has changed.

url1_button_clicked()

Url1 button action.

url2_button_clicked()

Url2 button action.

Attributes:

itemCreated(*args, **kwargs)

Signal the editor created an item

thumbnailUpdated(*args, **kwargs)

Signal emitted when the item's thumbnail was updated

add_section_header_button(name, widget)[source]#

Add a header button to help reveal the given section widget.

changeEvent(event)[source]#

Change event handler.

closeEvent(event)[source]#

Close event.

data_changed(key, _type, editor, v)[source]#

Signal called when the user changes a value in the editor.

Parameters:
  • key (str) – The database key.

  • _type (type) – The data type.

  • editor (QWidget) – The editor widget.

  • v (object) – The changed value.

db_source()[source]#

A file path to use as the source of database values.

Returns:

The database source file.

Return type:

str

done(result)[source]#

Finish editing the item.

hideEvent(event)[source]#

Hide event handler.

init_data()[source]#

Initializes data.

init_db_data()[source]#

Method will load data from the bookmark database.

To be able to load data, the db_table, server, job and root values must have all been specified when the class was initialized.

Call this method from init_data() when the widget is associated with a bookmark database.

load_saved_user_settings(keys)[source]#

Utility method will load user setting values and apply them to the corresponding editors.

Parameters:

keys (tuple) – A list of editor keys that save their current value in the user settings file.

save_changed_data_to_db()[source]#

This will save changed data to the bookmark database.

To be able to save data, the _db_table, server, job and root values must have all been specified.

Call this method from save_data() when the editor is used to edit database values.

save_changes()[source]#

Perform save actions and/or data saving.

scroll_to_section(widget)[source]#

Slot used to scroll to a section when a section header is clicked.

showEvent(event)[source]#

Show event handler.

sizeHint()[source]#

Returns a size hint.

update_changed_database_value(table, source, key, value)[source]#

Slot responsible updating the gui when a database value has changed.

Parameters:
  • table (str) – Name of the db table.

  • source (str) – Source file path.

  • key (str) – Database key.

  • value (object) – The new database value.

url1_button_clicked()[source]#

Url1 button action.

url2_button_clicked()[source]#

Url2 button action.

itemCreated(*args, **kwargs)#

Signal the editor created an item

thumbnailUpdated(*args, **kwargs)#

Signal emitted when the item’s thumbnail was updated

bookmarks.editor.base.add_section(icon, label, parent, color=None)[source]#

Adds a new section with an icon and a title.

Parameters:
  • icon (str) – The name of a rsc image.

  • label (str) – The name of the section.

  • parent (QWidget) – A widget to add the section to.

  • color (QColor, optional) – The color of the icon. Defaults to None.

Returns:

A widget to add editors to.

Return type:

QWidget