Beispiel #1
0
 def setText(self, text):
     """
     Set the label text.
     :type text: str
     """
     match = RE_FACET.match(text)
     if match:
         self.labelA.setText((Facet.forValue(match.group("facet")) or Facet.length).value)
         self.labelB.setText('"{0}"'.format(match.group("value")))
         self.updateNode()
     else:
         # USE THE OLD VALUE-RESTRICTION PATTERN
         match = RE_VALUE_RESTRICTION.match(text)
         if match:
             self.labelA.setText((Facet.forValue(match.group("facet")) or Facet.length).value)
             self.labelB.setText('"{0}"'.format(match.group("value")))
             self.updateNode()
Beispiel #2
0
 def facet(self):
     """
     Returns the facet associated with this node.
     :rtype: Facet
     """
     return Facet.forValue(self.labelA.text())