metamodelling_toolbar.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <class name="MetamodellingToolbar">
  2. <relationships>
  3. <inheritance class="Toolbar"/>
  4. <association name="buttons" class="Button"/>
  5. <association name="parent" class="A"/>
  6. </relationships>
  7. <constructor>
  8. <parameter name="parent"/>
  9. <super class="Toolbar">
  10. <parameter expr="parent"/>
  11. </super>
  12. <body>
  13. self.to_create = ["verify", "custom_MM", "conf_bottom", "upload_ALC", "upload_MVC"]
  14. self.button_info = {"verify": "Verify if the current model conforms to the current metamodel.",
  15. "custom_MM": "TODO",
  16. "conf_bottom": "TODO",
  17. "upload_ALC": "TODO",
  18. "upload_MVC": "TODO",
  19. }
  20. self.buttons = {}
  21. </body>
  22. </constructor>
  23. <destructor>
  24. <super class="Toolbar"/>
  25. </destructor>
  26. <scxml initial="init">
  27. <state id="init" initial="init_buttons">
  28. <onexit>
  29. <raise event="tk_widget" scope="narrow" target="'parent'">
  30. <parameter expr="self"/>
  31. </raise>
  32. </onexit>
  33. <state id="init_buttons">
  34. <onentry>
  35. <raise event="create_instance" scope="cd">
  36. <parameter expr="'buttons'"/>
  37. <parameter expr="'Button'"/>
  38. <parameter expr="{'parent': self, 'visual': ImageVisual('icons/%s.png' % self.to_create[0]), 'tooltip_text': self.button_info[self.to_create[0]], 'event_parameters': self.to_create[0]}"/>
  39. </raise>
  40. </onentry>
  41. <transition event="instance_created" target="../pack_button">
  42. <parameter name="association_name"/>
  43. <raise event="start_instance" scope="cd">
  44. <parameter expr="association_name"/>
  45. </raise>
  46. <script>
  47. self.buttons[self.to_create[0]] = association_name
  48. self.to_create.pop(0)
  49. </script>
  50. </transition>
  51. </state>
  52. <state id="pack_button">
  53. <transition event="tk_widget" target="../next_button">
  54. <parameter name="tk_elem"/>
  55. <script>
  56. tk_elem.pack(side=tk.LEFT)
  57. </script>
  58. </transition>
  59. </state>
  60. <state id="next_button">
  61. <transition cond="len(self.to_create) == 0" target="../../root"/>
  62. <transition cond="len(self.to_create) > 0" target="../init_buttons"/>
  63. </state>
  64. </state>
  65. <state id="root">
  66. <transition event="button_pressed" cond="event_name == 'verify'" target=".">
  67. <parameter name="event_name"/>
  68. <raise event="verify" scope="narrow" target="'parent'"/>
  69. </transition>
  70. <transition event="close" target="../closing"/>
  71. </state>
  72. <state id="closing">
  73. <onentry>
  74. <raise event="delete_instance" scope="cd">
  75. <parameter expr="self.buttons.popitem()[1]"/>
  76. </raise>
  77. </onentry>
  78. <transition event="instance_deleted" cond="len(self.buttons) > 0" target="../closing"/>
  79. <transition event="instance_deleted" cond="len(self.buttons) == 0" target="../close"/>
  80. </state>
  81. <state id="close">
  82. <onentry>
  83. <raise event="close_window" scope="narrow" target="'parent'"/>
  84. </onentry>
  85. </state>
  86. </scxml>
  87. </class>