Hiero的spreadsheet中添加tag属性列

时间:2021-10-26 03:04:01

Hiero在对剪辑线上的item进行管理的时候,往往会添加能多tag,而在管 理面板spreadsheet中却无法对tag进行查询,这是一件很麻烦的事,Hiero Development Guide中给出一个自定义spreadsheet的example,我拿来稍作修改,于是就可以对tag进行查询了,还是很给力的~

代码如下:
Talk is cheap,show you the code:
#####################################################################
import hiero.ui
import PySide.QtCore
import PySide.QtGui

_itemData = dict()

class CustomSpreadsheetColumns(object):

def numColumns(self):

return 1

def columnName(self, column):

if column == 0:
      return "Tags (VHQ)"

return ""

def getData(self, row, column, item):

if column == 0:
      taglist = []
      for tag in item.tags():
        taglist.append(tag.name())
      return ' '.join(taglist)

return None

def setData(self, row, column, item, data):

print "setData", (self, row, column, item, data)
    _itemData[item] = str(data)

def getTooltip(self, row, column, item):

return "Tooltip: "+str(row)+"/"+str(column)+": "+item.name()

def getFont(self, row, column, item):

return None

def getBackground(self, row, column, item):

return None

def getForeground(self, row, column, item):

return None

def getIcon(self, row, column, item):

return None

def getSizeHint(self, row, column, item):

if column == 0:
      return PySide.QtCore.QSize(250, 32)
    return None

def paintCell(self, row, column, item, painter, option):

return False

def createEditor(self, row, column, item, view):

return None

def setEditorData(self, row, column, item, editor):

print "setEditorData:", (self, row, column, item, editor)

return False

def setModelData(self, row, column, item, editor):

print "setModelData:", (self, row, column, item, editor)

return False

def dropMimeData(self, row, column, item, data, items):

print "dropMimeData", (self, row, column, item, data.formats(), items)
    return None

def indexChanged(self, index):

print "ComboBox index changed:", index

# Register our custom columns
hiero.ui.customColumn = CustomSpreadsheetColumns()