• Hiero的spreadsheet中添加tag属性列


    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()

  • 相关阅读:
    字符串时间+8个小时
    Django的field字段与参数介绍
    celery+Django
    二分查找
    排序算法
    socket套接字
    网络七层协议简述
    ORM操作mysql数据库多表的增删改查
    ORM操作mysql数据库
    Django框架静态文件配置和URL解析
  • 原文地址:https://www.cnblogs.com/hksac/p/4867999.html
Copyright © 2020-2023  润新知