+class Tag(object):
+ """Set a bullet tag."""
+
+ def __init__(self, tag):
+ self.tag = tag
+
+ def __getstate__(self):
+ return dict(tag=self.tag)
+
+ def __setstate__(self, state):
+ self.__init__(state["tag"])
+
+ @classmethod
+ def FromXML(cls, doc, element):
+ """Construct using an ElementTree-style element."""
+ return cls(element.text)
+
+ def __call__(self, owner, action, params, rank, created):
+ owner.tags.add(self.tag)
+
+class Untag(object):
+ """Unset a bullet tag."""
+
+ def __init__(self, tag):
+ self.tag = tag
+
+ def __getstate__(self):
+ return dict(tag=self.tag)
+
+ def __setstate__(self, state):
+ self.__init__(state["tag"])
+
+ @classmethod
+ def FromXML(cls, doc, element):
+ """Construct using an ElementTree-style element."""
+ return cls(element.text)
+
+ def __call__(self, owner, action, params, rank, created):
+ try:
+ owner.tags.remove(self.tag)
+ except KeyError:
+ pass
+
+class Appearance(object):
+ """Set a bullet appearance."""
+
+ def __init__(self, appearance):
+ self.appearance = appearance
+
+ def __getstate__(self):
+ return dict(appearance=self.appearance)
+
+ def __setstate__(self, state):
+ self.__init__(state["appearance"])
+
+ @classmethod
+ def FromXML(cls, doc, element):
+ """Construct using an ElementTree-style element."""
+ return cls(element.text)
+
+ def __call__(self, owner, action, params, rank, created):
+ owner.apearance = self.appearance
+