Skip to content

Instantly share code, notes, and snippets.

@davidlatwe
Created August 23, 2019 19:29
Show Gist options
  • Save davidlatwe/ce142680d7245ba5982f4b9099d5cb34 to your computer and use it in GitHub Desktop.
Save davidlatwe/ce142680d7245ba5982f4b9099d5cb34 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8
import os
import pyblish.api
import pyblish_qml
import pyblish_qml.settings
class CreateInstances(pyblish.api.ContextPlugin):
"""Create instance"""
order = pyblish.api.CollectorOrder - 0.1
def process(self, context):
instance = context.create_instance("Dummy")
instance.data["family"] = "dummy"
class UnicodeError(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder + 0
def process(self, instance):
raise Exception(u"錯誤")
class NormalError(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder + 0.01
def process(self, instance):
raise Exception("Error")
class UnicodeInfo(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder + 0.1
def process(self, instance):
self.log.info(u"哈囉")
class NormalInfo(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder + 0.11
def process(self, instance):
self.log.info(u"Hello")
class UnicodeData(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder + 0.2
def process(self, instance):
instance.data["name"] = u"ö"
class ProcessUnicodeData(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder + 0.21
def process(self, instance):
assert instance.data["name"] == u"ö"
self.log.info("I have got '%s'" % u"ö")
if __name__ == "__main__":
os.environ["PYBLISH_QML_PYTHON_EXECUTABLE"] = "C:/Python36_64/python.exe"
pyblish.api.deregister_all_plugins()
pyblish.api.deregister_all_paths()
pyblish.api.register_plugin(CreateInstances)
pyblish.api.register_plugin(UnicodeInfo)
pyblish.api.register_plugin(NormalInfo)
pyblish.api.register_plugin(UnicodeError)
pyblish.api.register_plugin(NormalError)
pyblish.api.register_plugin(UnicodeData)
pyblish.api.register_plugin(ProcessUnicodeData)
pyblish_qml.show()
while True:
# Keep server running
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment