(self, type, widget, widgetinst)
| 188 | return handler |
| 189 | |
| 190 | def __init__(self, type, widget, widgetinst): |
| 191 | self.type = type |
| 192 | self.typename = _types[type][0] |
| 193 | self.widget = widget |
| 194 | self.widgetinst = widgetinst |
| 195 | self.bindedfuncs = {None: [[] for s in _states]} |
| 196 | self.handlerids = [] |
| 197 | # we don't want to change the lists of functions while a handler is |
| 198 | # running - it will mess up the loop and anyway, we usually want the |
| 199 | # change to happen from the next event. So we have a list of functions |
| 200 | # for the handler to run after it finishes calling the binded functions. |
| 201 | # It calls them only once. |
| 202 | # ishandlerrunning is a list. An empty one means no, otherwise - yes. |
| 203 | # this is done so that it would be mutable. |
| 204 | self.ishandlerrunning = [] |
| 205 | self.doafterhandler = [] |
| 206 | for s in _states: |
| 207 | lists = [self.bindedfuncs[None][i] for i in _state_subsets[s]] |
| 208 | handler = self.__create_handler(lists, type, _state_codes[s]) |
| 209 | seq = '<'+_state_names[s]+self.typename+'>' |
| 210 | self.handlerids.append((seq, self.widget.bind(self.widgetinst, |
| 211 | seq, handler))) |
| 212 | |
| 213 | def bind(self, triplet, func): |
| 214 | if triplet[2] not in self.bindedfuncs: |
nothing calls this directly
no test coverage detected