12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <class name="Button">
- <relationships>
- <association name="parent" class="A"/>
- <inheritance class="MvKWidget" priority='0'/>
- <inheritance class="tk.Button" priority='1'/>
- </relationships>
- <constructor>
- <parameter name="constructor_parameters" type='dict' default='{}' />
- <super class="tk.Button">
- <parameter expr="constructor_parameters['parent']"/>
- <parameter expr="**(constructor_parameters['visual'].get_params())"/>
- </super>
- <super class="MvKWidget">
- </super>
- <body>
- self.event_parameters = constructor_parameters["event_parameters"]
- if "tooltip_text" in constructor_parameters:
- self.tooltip = ToolTip(self, constructor_parameters["tooltip_text"])
- else:
- self.tooltip = None
- self.visual = constructor_parameters["visual"]
- self.pack(**constructor_parameters.get('packing', {}))
- </body>
- </constructor>
- <destructor>
- <body>
- self.destroy()
- </body>
- </destructor>
- <scxml initial="main">
- <state id="main" initial='initializing'>
- <state id="initializing">
- <transition port='input' event="left-click" target='.' cond='tagorid == id(self)'>
- <parameter name='tagorid' type='int' default='None' />
- <raise event="button_pressed" scope="narrow" target="'parent'">
- <parameter expr="self.event_parameters" />
- </raise>
- </transition>
- <transition port='input' event="enter" target='.' cond='tagorid == id(self) and self.tooltip is not None'>
- <parameter name='tagorid' type='int' default='None' />
- <script>
- self.tooltip.showtip()
- </script>
- </transition>
- <transition port='input' event="leave" target='.' cond='tagorid == id(self) and self.tooltip is not None'>
- <parameter name='tagorid' type='int' default='None' />
- <script>
- self.tooltip.hidetip()
- </script>
- </transition>
- </state>
- </state>
- </scxml>
- </class>
|