Hi Justin,
here's the code I've used. I attempted to try your
suggestion but haven't got any luck getting it to work. Really appreciate
your help. Thanks again for the time spent !
class PoseListView(QtGui.QListWidget):
def __init__(self, parent=None):
super(PoseListView, self).__init__(parent)
self._parent = parent
# Grid/View settings
self.setViewMode(QtGui.QListView.IconMode)
self.setGridSize(QtCore.QSize(40, 80))
self.setSpacing(10)
self.setMinimumWidth(self.sizeHintForColumn(0))
self.setMouseTracking(True)
self.setStyleSheet("item:hover{background: qlineargradient(x1: 0,
y1: 0, x2: 0, y2: 1,\
stop: 0 #FAFBFE, stop: 1 #DCDEF1);}"
)
for i in range(3):
item = PoseWidget(self)
self.addItem(item)
item.setSizeHint(QtCore.QSize(40, 60))
class PoseWidget(QtGui.QListWidgetItem):
def __init__(self, id, *args, **kwargs):
super(PoseWidget, self).__init__()
self.pose = kwargs.get('pose', None)
# Item settings
self._id = id
self.setText('')
flags = QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled |
QtCore.Qt.ItemIsDragEnabled
self.setFlags(flags)
project_root = cmds.workspace(q=True, rootDirectory=True)
map_dir = os.path.join(project_root, 'data', 'pose_library')
image_path = '{0}{1}'.format(map_dir,'/test.jpg')
pic = QtGui.QPixmap(image_path)
self.setBackground(QtGui.QBrush(image_path))
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/d2c1ad93-893a-4408-8068-9eae3d2a1566%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.