label.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <class name="Label">
  2. <relationships>
  3. <association name="parent" class="A" min="1" max="1" />
  4. <inheritance class="SCCDWidget" priority='0'/>
  5. <inheritance class="tk.Label" priority='1'/>
  6. </relationships>
  7. <constructor>
  8. <parameter name="constructor_parameters" type="dict" default="{}" />
  9. <super class="tk.Label">
  10. <parameter expr="constructor_parameters['parent']"/>
  11. <parameter expr="**({'text': constructor_parameters['text'], 'bg': 'white'})"/>
  12. </super>
  13. <super class="SCCDWidget">
  14. </super>
  15. </constructor>
  16. <destructor>
  17. <body>
  18. self.destroy()
  19. </body>
  20. </destructor>
  21. <method name="set_text">
  22. <parameter name="text" type="str" />
  23. <body>
  24. self.config(text=text)
  25. </body>
  26. </method>
  27. <scxml initial="root">
  28. <state id="root" initial="initializing">
  29. <state id="initializing">
  30. <transition target="../ready">
  31. <raise event="tk_widget" scope="narrow" target="'parent'">
  32. <parameter expr="self"/>
  33. </raise>
  34. </transition>
  35. </state>
  36. <state id="ready">
  37. <transition port='input' event="left-click" target='.' cond='tagorid == id(self)'>
  38. <parameter name='tagorid' type='int' default='None' />
  39. <raise event="label_pressed" scope="narrow" target="'parent'">
  40. <parameter expr="self.cget('text')" />
  41. </raise>
  42. </transition>
  43. <transition event="highlight" target=".">
  44. <script>
  45. self.config(bg="yellow")
  46. </script>
  47. </transition>
  48. <transition event="unhighlight" target=".">
  49. <script>
  50. self.config(bg="white")
  51. </script>
  52. </transition>
  53. </state>
  54. </state>
  55. </scxml>
  56. </class>