items.views#
Base views used to show bookmark
,
asset
, and file
items.
The view uses ItemModel
for getting the item data,
ItemDelegate
to paint the items.
BaseItemView
is a customised QListView widget augmented by
InlineIconView
(adds inline icon functionality),
and ThreadedItemView
that implement threading related functionality.
Classes:
|
The base view of all subsequent item views. |
|
Widget used to define the appearance of an item being dragged. |
|
Widgets responsible for drawing an overlay. |
|
An indicator widget drawn on top of the list widgets to signal if a model has filters set or if it requires a refresh. |
|
Adds multi-toggle and clickable in-line icons to |
|
A utility class used to start a drag operation. |
|
This stacked widget contains the main bookmark, asset, file and favourite item views. |
|
Widget responsible for indicating files are being loaded. |
|
Extends the |
|
Context menu associated with thumbnail actions. |
- class bookmarks.items.views.BaseItemView(icon='icon_bw', parent=None)[source]#
Bases:
QTableView
The base view of all subsequent item views.
Miscellaneous:
alias of
NotImplementedError
alias of
NotImplementedError
Classes:
Methods:
activate
(index)This method is called in response to a user action and is used to mark an item active.
Returns the visibility of the inline icon buttons.
contextMenuEvent
(event)Custom context menu event.
Delays getting the saved selection from the user settings file.
Delays saving the current item selection to the user settings file to reduce the number of file writes.
dragMoveEvent
(event)Drag move events checks source validity against available drop actions.
dropEvent
(event)Event handler.
eventFilter
(widget, event)Event filter handler.
Returns an informative hint text.
Returns the model class associated with this view.
Returns an informative string to indicate if the list has hidden items.
Restore the previous state of the inline icon buttons.
Add a model to the view.
keyPressEvent
(event)Key press event handler.
key_down
()Custom action on down arrow key-press.
Custom key action
Custom key action.
key_tab
()Custom key action
key_up
()Custom action to perform when the up arrow is pressed on the keyboard.
mouseDoubleClickEvent
(event)Custom doubleclick event.
mousePressEvent
(event)Deselect the current index when clicked on an empty space.
mouseReleaseEvent
(event)Event handler.
paint_hint
(widget, event)Paints the hint message.
paint_loading
(widget, event)Paints the hint message.
paint_status_message
(widget, event)Displays a visual hint for the user to indicate if the list has hidden items.
Slot used to repaint all currently visible items.
reset_row_layout
(*args, **kwargs)Re-initializes the rows to apply size and row height changes.
resizeEvent
(event)Event handler.
Slot called to reselect a previously saved selection.
Saves the current selection to the user settings file.
select_item
(v[, role])Select an item in the viewer.
set_buttons_hidden
(val)Sets the visibility of the inline icon buttons.
set_row_size
(v)Sets the row size.
showEvent
(event)Show event handler.
show_item
(v[, role, update, limit])Show an item in the viewer.
startDrag
(supported_actions)Drag action start.
toggle_item_flag
(index, flag[, state, ...])Sets the index's filter flag value based on the passed state.
update
(index)This slot is used by all threads to repaint/update the given index after it's thumbnail or file information has been loaded.
wheelEvent
(event)Custom wheel event responsible for scrolling the list.
Attributes:
customContextMenuRequested
(*args, **kwargs)Emitted when the user shift+right-clicks on the view.
interruptRequested
(*args, **kwargs)Called when the user requests model data load by pressing the ESC key.
resized
(*args, **kwargs)Signals window size change
- ContextMenu#
alias of
NotImplementedError
- Delegate#
alias of
NotImplementedError
- ThumbnailContextMenu#
alias of
ThumbnailsContextMenu
Methods:setup
()Creates the context menu.
- activate(index)[source]#
This method is called in response to a user action and is used to mark an item active.
Returns the visibility of the inline icon buttons.
- delay_save_selection()[source]#
Delays saving the current item selection to the user settings file to reduce the number of file writes.
- dragMoveEvent(event)[source]#
Drag move events checks source validity against available drop actions.
- get_status_string()[source]#
Returns an informative string to indicate if the list has hidden items.
Restore the previous state of the inline icon buttons.
- init_model()[source]#
Add a model to the view.
The ItemModel subclasses are wrapped in a QSortFilterProxyModel. All the necessary internal signal-slot connections needed for the proxy, model and the view to communicate are made here.
- keyPressEvent(event)[source]#
Key press event handler.
We’re defining the default behaviour of the list-items here, including defining the actions needed to navigate the list using keyboard presses.
- key_down()[source]#
Custom action on down arrow key-press.
We’re implementing a continuous scroll: when reaching the last item in the list, we’ll jump to the beginning, and vice-versa.
- key_up()[source]#
Custom action to perform when the up arrow is pressed on the keyboard.
We’re implementing a continuous scroll: when reaching the last item in the list, we’ll jump to the beginning, and vice-versa.
- mouseDoubleClickEvent(event)[source]#
Custom doubleclick event.
A double click can activate an item, or it can trigger an edit event. As each item is associated with multiple editors we have to inspect the double click location before deciding what action to take.
- paint_status_message(widget, event)[source]#
Displays a visual hint for the user to indicate if the list has hidden items.
- reset_row_layout(*args, **kwargs)[source]#
Re-initializes the rows to apply size and row height changes.
Sets the visibility of the inline icon buttons.
- show_item(v, role=QtCore.Qt.DisplayRole, update=True, limit=10000)[source]#
Show an item in the viewer.
- Parameters:
v (any) – A value to match.
role (QtCore.Qt.ItemRole) – An item data role.
update (bool) – Refreshes the model if True (the default).
limit (int) – Maximum item search number.
- toggle_item_flag(index, flag, state=None, commit_now=True)[source]#
Sets the index’s filter flag value based on the passed state.
We’re using the method to mark items archived, or favourite and save the changes to the database and the user settings file.
- Parameters:
index (QModelIndex) – Model index.
flag (int) – A filter flag, e.g.
MarkedAsArchived
.state (bool) – Pass an explicit state value. Defaults to None.
commit_now (bool) – When True, commits database values immediately.
- Returns:
The key used to find and match items.
- Return type:
str
- update(index)[source]#
This slot is used by all threads to repaint/update the given index after it’s thumbnail or file information has been loaded.
An actual repaint event will only trigger if the index is visible in the view.
- customContextMenuRequested(*args, **kwargs)#
Emitted when the user shift+right-clicks on the view. Use this to show DCC specific context menus.
- interruptRequested(*args, **kwargs)#
Called when the user requests model data load by pressing the ESC key.
- resized(*args, **kwargs)#
Signals window size change
- class bookmarks.items.views.DragPixmapFactory(pixmap, text, parent=None)[source]#
Bases:
QWidget
Widget used to define the appearance of an item being dragged.
Methods:
paintEvent
(event)Event handler.
pixmap
(pixmap, text)Returns the widget as a rendered pixmap.
- class bookmarks.items.views.DropIndicatorWidget(parent=None)[source]#
Bases:
QWidget
Widgets responsible for drawing an overlay.
Methods:
paintEvent
(event)Event handler.
show
()Shows and sets the size of the widget.
- class bookmarks.items.views.FilterOnOverlayWidget(parent=None)[source]#
Bases:
ProgressWidget
An indicator widget drawn on top of the list widgets to signal if a model has filters set or if it requires a refresh.
Methods:
paintEvent
(event)Event handler.
paint_filter_indicator
(painter)Paints the filter indicator.
paint_needs_refresh
(painter)Paints the data status indicator.
showEvent
(event)Event handler.
- class bookmarks.items.views.InlineIconView(icon='bw_icon', parent=None)[source]#
Bases:
BaseItemView
Adds multi-toggle and clickable in-line icons to
BaseItemView
.Methods:
add_item_action
(index)Action to execute when the add item icon is clicked.
clickable_rectangle_event
(event)Handle mouse press & release events on an item's interactive rectangle.
edit_item_action
(index)Action to execute when the edit item icon is clicked.
enterEvent
(event)Event handler.
Inline buttons count.
leaveEvent
(event)Event handler.
mouseMoveEvent
(event)InlineIconView
's mouse move event is responsible for handling the multi-toggle operations and repainting the current index under the mouse.mousePressEvent
(event)The InlineIconView's mousePressEvent initiates multi-row flag toggling.
mouseReleaseEvent
(event)Concludes InlineIconView's multi-item toggle operation, and resets the associated variables.
Resets the multi-toggle state.
- clickable_rectangle_event(event)[source]#
Handle mouse press & release events on an item’s interactive rectangle.
The clickable rectangles are defined by and stored by the item delegate. See
get_clickable_rectangles()
.We’re implementing filtering by reacting to clicks on item labels:
shift
modifier will add a _positive_ filter and hide all items not containing the clicked rectangle’s text content.The
alt
andcontrol
modifiers will add a negative filter and hide all items containing the clicked rectangle’s text content.
- mouseMoveEvent(event)[source]#
InlineIconView
’s mouse move event is responsible for handling the multi-toggle operations and repainting the current index under the mouse.
- mousePressEvent(event)[source]#
The InlineIconView’s mousePressEvent initiates multi-row flag toggling.
This event is responsible for setting
multi_toggle_pos
, the start position of the toggle,multi_toggle_state
&multi_toggle_flag
the modes of the toggle, based on the state of the state and location of the clicked item.
- class bookmarks.items.views.ItemDrag(index, widget)[source]#
Bases:
QDrag
A utility class used to start a drag operation.
- class bookmarks.items.views.ListsWidget(parent=None)[source]#
Bases:
QStackedWidget
This stacked widget contains the main bookmark, asset, file and favourite item views.
Methods:
setCurrentIndex
(idx)Sets the current index of the
ListsWidget
.showEvent
(event)Event handler.
- class bookmarks.items.views.ProgressWidget(parent=None)[source]#
Bases:
QWidget
Widget responsible for indicating files are being loaded.
Methods:
mousePressEvent
(event)Event handler.
paintEvent
(event)Event handler.
set_message
(text)Sets the message to be displayed when saving the widget.
showEvent
(event)Event handler.
- class bookmarks.items.views.ThreadedItemView(icon='bw_icon', parent=None)[source]#
Bases:
InlineIconView
Extends the
InlineIconView
with the methods used to interface with threads.Methods:
init_model
(*args, **kwargs)The methods responsible for connecting the associated item model with the view.
Starts and connects the threads.
queue_visible_indexes
(**kwargs)Function wrapper.
Process a repaint request.
save_visible_rows
(*args, **kwargs)Cache the currently visible rows.
start_delayed_queue_timer
(*args, **kwargs)Starts the delayed queue timer.
update_row
(ref)Queues an update request by the threads for later processing.
- init_model(*args, **kwargs)[source]#
The methods responsible for connecting the associated item model with the view.
- queue_visible_indexes(**kwargs)#
Function wrapper.