mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
implemented single selection asset widget SingleSelectAssetsWidget
This commit is contained in:
parent
b92eebdae7
commit
48405b4da8
1 changed files with 18 additions and 0 deletions
|
|
@ -605,3 +605,21 @@ class AssetsWidget(QtWidgets.QWidget):
|
|||
self._view.expand(self._proxy.parent(index))
|
||||
selection_model.select(index, mode)
|
||||
self._view.setCurrentIndex(valid_indexes[0])
|
||||
|
||||
|
||||
class SingleSelectAssetsWidget(AssetsWidget):
|
||||
def get_selected_asset_id(self):
|
||||
"""Return the asset item of the current selection."""
|
||||
selection_model = self._view.selectionModel()
|
||||
indexes = selection_model.selectedRows()
|
||||
for index in indexes:
|
||||
return index.data(ASSET_ID_ROLE)
|
||||
return None
|
||||
|
||||
def get_selected_asset_name(self):
|
||||
"""Return the asset document of the current selection."""
|
||||
selection_model = self._view.selectionModel()
|
||||
indexes = selection_model.selectedRows()
|
||||
for index in indexes:
|
||||
return index.data(ASSET_NAME_ROLE)
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue