Imageview¶
Items¶
- class ItemSignals(*args: Any, **kwargs: Any)¶
Bases:
WorkerSignals
- class ThreadedIcon(*args: Any, **kwargs: Any)¶
Bases:
QRunnable
- finished(state)¶
- isFinished()¶
- isRunning()¶
- run()¶
- class BaseItem(name=None, description=None, iconPath=None, filePath='', toolTip='', thumbnail='')¶
Bases:
object
- fileNameExt()¶
- setFilePath(path)¶
Breaks the path into data that the class can use
- Parameters:
path –
- Returns:
- fullPath()¶
- thumbnailExists()¶
- property thumbnail¶
Returns the expected thumbnail. If it doesn’t exist just use an empty one
- Returns:
- thumbnailLookPath()¶
The location to look for the thumbnail. Replace this thumbnail in the returned path to change its thumbnail
- Returns:
- description()¶
- iconLoaded()¶
- tags()¶
- websites()¶
- creators()¶
- hasTag(tag)¶
- hasAnyTags(tags)¶
- serialize()¶
- class TreeItem(*args: Any, **kwargs: Any)¶
Bases:
QStandardItem
- backgroundColor = 70¶
- backgroundColorSelected = 50¶
- backgroundColorHover = 50¶
- textColorSelected = 255¶
- textColor = 255¶
- textBGColor = 0¶
- borderColorSelected = 0¶
- borderColorHover = 0¶
- borderColor = 0¶
- backgroundColorIcon = 50¶
- initColors()¶
- updateTheme(event=None)¶
Update the theme
- Returns:
- Return type:
- item()¶
- itemText()¶
- applyFromImage(image)¶
- Parameters:
image (
QtGui.QImage
) –
- setIconPath(iconPath)¶
- pixmap()¶
- Returns:
- Return type:
QtGui.QPixmap
- toolTip()¶
- isEditable(*args, **kwargs)¶
- sizeHint()¶
Size Hint
- Returns:
- Return type:
- font(index)¶
- textAlignment(index)¶
- iconAlignment(index)¶
- isSelected(option)¶
- isMouseOver(option)¶
Is mouse over
- Parameters:
option –
- Returns:
- Return type:
- setBorderWidth(width)¶
- paint(painter, option, index)¶
Paint the item
- Parameters:
painter –
option –
index –
- Returns:
- Return type:
- iconRect(option)¶
Icon rect
- Parameters:
option –
- Returns:
- Return type:
Model¶
- class MultipleFilterProxyModel(*args: Any, **kwargs: Any)¶
Bases:
QSortFilterProxyModel
- filterAcceptsRow(sourceRow, sourceParent)¶
- class ThumbnailDelegate(*args: Any, **kwargs: Any)¶
Bases:
QStyledItemDelegate
- sizeHint(option, index)¶
- paint(painter, options, index)¶
- class ItemModel(*args: Any, **kwargs: Any)¶
Bases:
QStandardItemModel
Main Data Model for the thumbnail widget, this is the main class to handle data access between the core and the view
- chunkCount = 20¶
- reset()¶
- loadData(chunkCount=0)¶
Intended to be overridden by subclasses, This method should deal with loading a chunk of the items to display. Use self.loadedCount and self.chunkCount variable to determine the amount to load
- Example:
- if len(self.currentFilesList) < self.loadedCount:
filesToLoad = self.mylist
- else:
filesToLoad = self.mylist[self.loadedCount: self.loadedCount + self.chunkCount]
- Return type:
None
- data(index, role)¶
- Returns:
- Return type:
- doubleClickEvent(modelIndex, item)¶
- class FileModel(*args: Any, **kwargs: Any)¶
Bases:
ItemModel
- setDirectories(directories, refresh=True)¶
Used to set or change the directory
- setActiveDirectories(directories, refresh=True)¶
- property activeDirectories¶
- Returns:
- Return type:
list[DirectoryPath]
- setDirectory(directory, refresh=True)¶
Set a single directory. Clears all directories
- Parameters:
directory –
refresh –
- Returns:
- refreshList()¶
Refreshes the icon list if contents have been modified, does not change the root directory
- refreshModelData()¶
Refreshes the model’s data
- clear()¶
Clears the images and data from the model, usually used while refreshing
- itemTexts()¶
Get all the item texts and put them into a generator
- Returns:
- Return type:
- indexFromText(text)¶
Get Item from text
- Parameters:
text –
- Returns:
- Return type:
- doubleClickEvent(modelIndex, item)¶
Gets called by the listview when an item is doubleclicked
- Parameters:
modelIndex (QtCore.QModelIndex) –
item (
TreeItem
) –
- Returns:
The current image with it’s name and file extension
- Return type:
- createItem(item)¶
Custom wrapper Method to create a ::class`items.TreeItem`, add it to the model items and class appendRow()
- Parameters:
- Returns:
- Return type:
TreeItem
- lazyLoadFilter(chunkCount=0)¶
Breaks up the lists self.currentFilesList, self.fileNameList, self.toolTipList for lazy loading.
Can be overridden, usually to choose if the display names should have extensions or not Default is no extensions on display names
- Return type:
list[
items.TreeItem
]
- onSelectionChanged(modelIndex, item)¶
Gets called by the listview when an item is changed, eg left click or rightclick :param modelIndex: :type modelIndex: QtCore.QModelIndex :param item: :type item: TreeItem
- closeEvent(event)¶
Closes the model
- Parameters:
event –
- class MiniBrowserFileModel(*args: Any, **kwargs: Any)¶
Bases:
FileModel
- preference()¶
- setUniformItemSizes(enabled)¶
Set uniform item sizes
Make the items square if true, if false it will keep the images original aspect ratio for the items
- Parameters:
enabled –
- Returns:
- Return type:
- updateFromPrefs(updateItems=True)¶
Gets the updated preference information and updates the model’s items
- Parameters:
updateItems –
- Returns:
- refreshAssetFolders()¶
Refresh asset folders
- Returns:
- setItemIconFromImage(item, image)¶
Custom method that gets called by the thread
- Parameters:
item (
TreeItem
) –image (QtGui.QImage) – The Loaded QImage
- loadData(chunkCount=0)¶
Overridden method that prepares the images for loading and viewing.
Is filtered first via self.lazyLoadFilter()
From base class documentation:
Lazy loading happens either on first class initialization and any time the vertical bar hits the max value, we then grab the current the new file chunk by files[self.loadedCount: loadedCount + self.chunkCount] that way we are only loading a small amount at a time. Since this is an example of how to use the method , you can approach it in any way you wish but for each item you add you must initialize a item.BaseItem() or custom subclass and a item.treeItem or subclass which handles the qt side of the data per item
- loadItemThreaded(qItem, start=False)¶
- loadItems(itemsToLoad)¶
- updateItems()¶
Populate and adds to list of self.fileItems.
self.fileItems is updated here, change this list if you’d like to change how it is added to the ui. EG sorting
File items have all the information on the items before building into the ui
- createItemFromFileAndDirectory(directory, filePath, loadImage=False)¶
Creates a QItem and base data Item from the directory and filePath . If loadImage is true then the image will be loaded on a separate thread and displayed when ready.
- generateItem(directory, file)¶
Creates a base item that will be added to the fileItems list. Which in turn will be added into the UI.
Override this if you want to customize the BaseItem. Do this to customize things such as the thumbnail
If none is returned, the item with the file won’t be added. Useful to filter certain files based on the file name. eg. exclude based on prefixes
- Return type:
items.BaseItem
- refreshModelData()¶
Refreshes the model’s data
Thumbnail¶
Directorypopup¶
- class DirectoryTitleBar(*args: Any, **kwargs: Any)¶
Bases:
TitleBar
- setTitleStyle(style)¶
Set title style for directory popup title bar
- Parameters:
style –
- Returns:
- class DirectoryPopup(*args: Any, **kwargs: Any)¶
Bases:
ZooWindow
- property browserPreference¶
- property mouseReleased¶
- initUi()¶
- setAnchorWidget(widget)¶
- windowEvents(event)¶
Window events from the event filter
- Parameters:
event –
- Returns:
- onNewCategory()¶
- onNewDirectory()¶
New button pressed
- Returns:
- deleteButtonClicked()¶
Delete button clicked
- Returns:
- show(reattach=True)¶
Move to widget’s position on show
- Returns:
- moveAttached(windowPos=None, offset=(0, 0))¶
Move while attached to window
- Parameters:
windowPos – parent window position
offset –
- Returns:
- moveLeftOfParent()¶
Move popup left of the parent widget
- Returns:
- setActiveItems(directories, categories)¶
Set active directories
- reset()¶
- class FolderTreeModel(*args: Any, **kwargs: Any)¶
Bases:
TreeModel
- onAliasRenamed(topLeft, bottomRight, role)¶
- Parameters:
topLeft –
bottomRight –
role –
- Returns:
- Return type:
- reload()¶
Hard reloads the model, we do this by the modelReset slot, the reason why we do this instead of insertRows() is because we expect that the tree structure has already been rebuilt with its children so by calling insertRows we would in turn create duplicates.
- saveToPreferences()¶
- class CategoryFolder(*args: Any, **kwargs: Any)¶
Bases:
BaseDataSource
Category folder within the tree
- mimeData(qIndex)¶
- dropMimeData(items, action)¶
- Parameters:
items (list[value]) – the column index
- folderId()¶
- customRoles(index)¶
- dataByRole(index, role)¶
- data(index)¶
The text for this node or column. index parameter with a value of 0 is the first column.
- icon(index)¶
The icon for the index.
- Parameters:
index (int) – The column index for the item.
- Return type:
QtGui.QIcon
- columnCount()¶
- setData(index, value)¶
Sets the text value of this node at the specified column
- class FolderItem(*args: Any, **kwargs: Any)¶
Bases:
CategoryFolder
A filesystem folder within the tree.
- toolTip(index)¶
The tooltip for the index.
- folderId()¶
- data(index)¶
The text for this node or column. index parameter with a value of 0 is the first column.
- setData(index, value)¶
Sets the text value of this node at the specified column
Infoembedwindow¶
- class ExtensionLabel(*args: Any, **kwargs: Any)¶
Bases:
Label
- setText(text)¶
Sets the label width depending on text todo: maybe put this in label or in pyqt module
- Parameters:
text –
- Returns:
- Return type:
- class InfoEmbedWindow(*args: Any, **kwargs: Any)¶
Bases:
EmbeddedWindow
- initUi()¶
Initialize Ui
- Returns:
- property miniBrowser¶
- Returns:
- Return type:
zoo.libs.pyqt.extended.imageview.thumbnail.minibrowser.MiniBrowser
- connections()¶
Connections
- Returns:
- setModel(model)¶
Set the parent’s model so we can get the information
- Parameters:
model –
- Returns:
- Return type:
- model()¶
Returns the thumbnailview model related to this info embed window
- Returns:
- Return type:
- cancelClicked()¶
Cancel clicked
- rename()¶
Rename the zoo file and its dependencies
- saveMetaData(event=None)¶
Save the meta data to
- Parameters:
event (zoo.libs.pyqt.extended.combobox.ComboItemChangedEvent) – Event with all the values related to the change.
- revert(updateUi=False)¶
Revert back to original settings
- Parameters:
updateUi –
- Returns:
- selectionChanged(image, item)¶
Selection Changed
- Parameters:
image –
item (
items.BaseItem
) –
- Returns:
Minibrowser¶
- class MiniBrowserThumbnail(*args: Any, **kwargs: Any)¶
Bases:
ThumbnailWidget
- mousePressEvent(event)¶
Mouse press event. Activates the virtual slider if virtual slider exists
- Parameters:
event –
- Returns:
- mouseMoveEvent(event)¶
Mouse move event.
Runs the virtual slider code.
- Parameters:
event –
- Returns:
- mouseReleaseEvent(event)¶
Mouse release event
Runs the virtual slider release code
- Parameters:
event –
- Returns:
- class MiniBrowser(*args: Any, **kwargs: Any)¶
Bases:
QWidget
- infoEmbedWindow: InfoEmbedWindow = None¶
- thumbWidget: ThumbnailWidget = None¶
- infoButton: ExtendedButton = None¶
- searchWidget: ThumbnailSearchWidget = None¶
- SNAPTYPE_NEW = 0¶
- SNAPTYPE_EDIT = 1¶
- uniformIcons = True¶
- setSliderSettings(directions=1, minValue=None, maxValue=None, numType=<class 'float'>, step=10, pixelRange=None, slowSpeed=0.01, speed=0.1, fastSpeed=1, slowSpeedXY=(None, None), speedXY=(None, None), fastSpeedXY=(None, None), minValueXY=(None, None), maxValueXY=(None, None), mouseButton=MockExt.QtCore.Qt.MiddleButton, slowModifier=MockExt.QtCore.Qt.ControlModifier, fastModifier=MockExt.QtCore.Qt.ShiftModifier)¶
Set the virtual slider settings
- Parameters:
directions (int) – Can be VirtualSlider.Horizontal, Vertical, DirectionClamp, Both
minValue – The minimum value that gets returned when the signal is fired. None means not limited.
minValue – float
maxValue (float) – The maximum value that gets returned when the signal is fired. None means not limited.
numType (float or int) – The num type that gets returned in the value. Returns float by default, but can return int.
step (int) – The step in pixels when dragging. A step of 10 means that it will fire a signal every 10 pixels
pixelRange (int) – Pixel range where the mouse can move. If 100 is given it will move between -100 and 100.
speed (float) – The speed of how fast the value will go up or down. 0.1 means the value will go up 0.1 per step
slowSpeed (float) – The slow speed, for when Ctrl (or whatever slowModifier is set to) is pressed
fastSpeed (float) – The slow speed, for when Shift (or whatever shiftModifier is set to) is pressed
speedXY (tuple(float or None, float or None)) – The XY speed. This will override the speed. If any value is none, it will just use the speed arg
slowSpeedXY (tuple(float or None, float or None)) – The slow speed XY. This will override the slowSpeed.
fastSpeedXY (tuple(float or None, float or None)) – The fast speed XY. This will override the fastSpeed.
minValueXY (tuple(float or None, float or None)) – The minimum value returned for value if it’s moving on the x-axis. Will override minValue
maxValueXY (tuple(float or None, float or None)) – The maximum value returned for value if it’s moving on the x-axis. Will override minValue
mouseButton (QtCore.Qt.MouseButton) – The mouse button that needs to be pressed to activate the slider. Default MiddleButton.
slowModifier (QtCore.Qt.KeyboardModifier) – The keyboard modifier for slow
fastModifier (QtCore.Qt.KeyboardModifier) – The keyboard modifier for fast
- Returns:
- initUi()¶
Initialize UI
- Returns:
- Return type:
- property sliderChanged¶
- property sliderReleased¶
- property sliderPressed¶
- newSnapshotWidget()¶
Create a new snapshot widget
- connections()¶
Connections
- Returns:
- Return type:
- browseSelected()¶
Opens a windows/osx/linux file browser with the model asset directory path
- property filterMenu¶
- topBar()¶
Top Bar
- Returns:
- Return type:
- selectDirectoriesPopup()¶
Select directories popup
- Returns:
- updateDirectoryPopup()¶
- Returns:
- updateUniformIcons(taggedAction)¶
Update the uniform icons
- Parameters:
taggedAction (TaggedAction) –
- Returns:
- Return type:
- setSnapshotType(snapType)¶
- Parameters:
snapType (MiniBrowser.SNAPTYPE_NEW or MiniBrowser.SNAPTYPE_EDIT) –
- Returns:
- Return type:
- snapshotSaved(pixmap)¶
Refresh thumbs on snapshot saved
- Returns:
- Return type:
- setSnapshotActive(active)¶
Helper function to set snapshot
- Parameters:
active –
- Returns:
- Return type:
- displaySavePopup(message='Save to Location:', title='Save Location', buttonA='Save', buttonIconA='save', directories=None)¶
Display save Popup
- Parameters:
message –
title –
buttonA –
buttonIconA –
- Returns:
- onSearchChanged(text, tag)¶
Set the filter on search changed
- Parameters:
text –
tag –
- Returns:
- Return type:
- newImageName()¶
Generate a new name
- Returns:
- Return type:
- setFixedHeight(h, save=False)¶
Sets the fixed height of the widget
- Parameters:
h –
save – save this height as a default when switching between infoembedwindows
- Returns:
- Return type:
- itemFilePath()¶
Gets the current filepath from the currently selected items metadata
- Returns:
- Return type:
- itemDependencyPath(create=False)¶
Get dependency folder
- Returns:
- Return type:
- directories()¶
Get the directory
- Returns:
- Return type:
- activeDirectories()¶
- itemFileName()¶
Gets the current file name from the currently selected item’s metadata
- Returns:
- Return type:
- itemFileExt()¶
- Returns:
- Return type:
basestring
- setModel(model)¶
- Parameters:
- Returns:
- Return type:
- itemSelected(name, item)¶
Item selected
- Parameters:
- Returns:
- Return type:
- currentItem()¶
Returns the currently active item
- Returns:
- Return type:
- model()¶
- refreshThumbs(scrollToItemName=-1)¶
Refreshes the GUI
- Returns:
- Return type:
- toggleInfoVisibility()¶
Toggles the vis of the Information tags section
- Returns:
- Return type:
- refreshListView()¶
Refresh List View Make sure the icons resize correctly
- Returns:
- Return type:
- invisibleRootItem()¶
Get the invisible root item of the thumbwidget
- Returns:
- Return type:
- iconSize()¶
- setIconSize(size)¶
- setPersistentFilter(text, tags)¶
- filter(text, tag=None)¶
Filter the text by the tag type (description, tags, creator, websites etc)
- Parameters:
text –
tag –
- Returns:
- setColumns(col)¶
Reset columns to default
- Parameters:
col –
- Returns:
- Return type:
- setIconMinMax(size)¶
Sets the min and max icon size
- updateToolset(delayed=False)¶
Update the toolset widget if it exists
- Parameters:
delayed –
- Returns:
- Return type:
- resizeEvent(event)¶
- newItemFromClipboard()¶
Create new item from clipboard
- Returns:
- Return type:
- getSaveDirectory()¶
Get the save directory either from user or preferences
- Returns:
- Return type:
str or None
- property applyAction¶
- property createAction¶
- property renameAction¶
- property deleteAction¶
- property browseAction¶
- property setDirectoryAction¶
- property refreshAction¶
- property uniformIconAction¶
- property selectDirectoriesAction¶
- class ThumbnailSearchWidget(*args: Any, **kwargs: Any)¶
Bases:
QWidget
- onSearchChanged(text)¶
On Search Changed
- Parameters:
text –
- Returns:
- Return type:
- filterMenuData()¶
- onActionTriggered(action, mouseMenu)¶
- setSearchText(text)¶
Set the text of the search edit
- Parameters:
text –
- Returns:
- Return type:
- state()¶
Get the state of the widget
- Returns:
- Return type:
- setState(state)¶
Set the state of the widget
- Parameters:
state –
- Returns:
- Return type:
- class DotsMenu(*args: Any, **kwargs: Any)¶
Bases:
IconMenuButton
- APPLY_ACTION = 0¶
- CREATE_ACTION = 1¶
- RENAME_ACTION = 2¶
- DELETE_ACTION = 3¶
- BROWSE_ACTION = 4¶
- SETDIRECTORY_ACTION = 5¶
- REFRESH_ACTION = 6¶
- UNIFORMICON_ACTION = 7¶
- SNAPSHOT_ACTION = 8¶
- SNAPSHOTNEW_ACTION = 9¶
- CREATE_THUMBNAIL_ACTION = 10¶
- NEWFROMCLIPBOARD_ACTION = 11¶
- DIRECTORYPOPUP_ACTION = 12¶
- initUi()¶
Initialise the ui
- Returns:
- Return type:
- parent()¶
- Returns:
- Return type:
- uniformActionClicked(action)¶
Uniform action clicked
- Parameters:
action (TaggedAction) –
- Returns:
- Return type:
- snapshotMenuClicked()¶
On snapshot clicked
- Returns:
- Return type:
- newItemSnapshotMenuClicked()¶
- setActionActive(actionId, active)¶
- setCreateActive(active)¶
Show/Hide create/new menu item
- Parameters:
active (bool) –
- Returns:
- Return type:
- setRenameActive(active)¶
Show/Hide rename menu item
- Parameters:
active (bool) –
- Returns:
- Return type:
- setDeleteActive(active)¶
Show/Hide delete menu item
- Parameters:
active (bool) –
- Returns:
- Return type:
- setSnapshotActive(active)¶
Show/Hide snapshot menu item
- Parameters:
active (bool) –
- Returns:
- Return type:
- setSnapshotEnabled(enabled)¶
Set enabled
- Parameters:
enabled –
- Returns:
- Return type:
- setFromClipboardActive(active)¶
Show/Hide delete menu item
- Parameters:
active (bool) –
- Returns:
- Return type:
- setFromSnapShotActive(active)¶
Show/Hide delete menu item
- Parameters:
active (bool) –
- Returns:
- Return type:
- setCreateThumbnailActive(active)¶
- setDirectoryActive(active)¶
Thumbnailwidget¶
- class ThumbnailWidget(*args: Any, **kwargs: Any)¶
Bases:
ListView
- defaultMinIconSize = 20¶
- defaultMaxIconSize = 512¶
- initUi()¶
Initialize the ui
- Returns:
- connections()¶
- mouseDoubleClickEvent(event)¶
- wheelEvent(event)¶
Overridden to deal with scaling the listview.
- resizeEvent(event)¶
- Parameters:
event (QtGui.QResizeEvent) –
- keyPressEvent(event)¶
- verticalSliderReleased()¶
- state()¶
Returns useful settings to copy from one list view behaviour to another
- Returns:
- Return type:
- setState(state, scrollTo=False)¶
Set the state of the listview with the new settings provided from ThumbListView.state()
- Parameters:
state (dict) –
- Returns:
- Return type:
- currentIndexInt()¶
Get the current index of the selected item
- Returns:
- Return type:
- setPersistentFilter(text, tags)¶
- filter(text, tag=None)¶
Filter by list by tag type
- Parameters:
text –
tag –
- visibleItems(pre=0, post=0)¶
Gets visible items
Set extra to 1 or more if you want extra indices at the beginning and at the end. It will only return valid indices.
- setItemByText(text)¶
Set the item by the text of the item
- Parameters:
text –
- Returns:
- Return type:
- setUniformItemSizes(enable)¶
Show the items as uniform sizes (squares) or whatever aspect ratio it originally was.
- Parameters:
enable –
- Returns:
- setIconSize(size)¶
- setColumns(col, refresh=False)¶
Set number of columns based on current size of the widget
- Parameters:
col –
- Returns:
- Return type:
- refresh()¶
Refresh so the icons show properly
- Returns:
- Return type:
- rootModel()¶
- setModel(dataModel)¶
Set the Model
- Parameters:
dataModel –
- Returns:
- Return type:
- invisibleRootItem()¶
- onSelectionChanged()¶
- paginationLoadNextItems()¶
Simple method to call the models loadData method when the vertical slider hits the max value, useful to load the next page of data on the model.
- Returns:
- Return type:
Models¶
Mayafilemodel¶
- class MayaFileModel(*args: Any, **kwargs: Any)¶
Bases:
SuffixFilterModel
- updateItems()¶
Updates self.fileItems
Suffixfiltermodel¶
- class SuffixFilterModel(*args: Any, **kwargs: Any)¶
Bases:
MiniBrowserFileModel
- updateItems()¶
Updates self.fileItems
- checkFileImage(filePath)¶
Checks the the jpg or png exists for the filePath.
- Parameters:
filePath – File path with the extension excluded.
- Returns:
Zooscenemodel¶
- class ZooSceneModel(*args: Any, **kwargs: Any)¶
Bases:
MiniBrowserFileModel
- updateItems()¶
Populate and adds to list of self.fileItems.
self.fileItems is updated here, change this list if you’d like to change how it is added to the ui. EG sorting
File items have all the information on the items before building into the ui
- checkFileImage(filePath)¶
Checks the jpg or png exists for the filePath.
- Parameters:
filePath – File path with the extension excluded.
- Returns: