def callback_disable(n_id): global callback_dict handle_pixel = callback_dict.get(n_id, None) if not handle_pixel: return SpaceNodeEditor.draw_handler_remove(handle_pixel, 'WINDOW') del callback_dict[n_id] tag_redraw_all_nodeviews()
def callback_disable(n_id): # global callback_dict handle_pixel = callback_dict.get(n_id, None) if not handle_pixel: return SpaceNodeEditor.draw_handler_remove(handle_pixel, 'WINDOW') del callback_dict[n_id] tag_redraw_all_nodeviews()
def modal(self, context, event): context.area.tag_redraw() if event.shift and event.type == 'SLASH' and event.value == 'PRESS': self.current_string = self.current_string + '?' elif event.type in KEYBOARD and event.value == 'PRESS': if event.type in CAPS or event.type in remap_nums.keys() or event.type == 'SPACE': if event.type == 'SPACE': final_value = ' ' else: final_value = remap_nums.get(event.type, event.type.lower()) self.current_string = self.current_string + final_value elif event.type == 'BACK_SPACE': has_length = len(self.current_string) self.current_string = self.current_string[:-1] if has_length else '' elif event.type in {'UP_ARROW', 'DOWN_ARROW'}: self.new_direction = {'UP_ARROW': -1, 'DOWN_ARROW': 1}.get(event.type) self.current_index += self.new_direction flat_node_cats['list_return'] = results = return_search_results(self.current_string) if results and len(results): self.current_index %= len(results) elif event.type in {'LEFTMOUSE', 'RET'}: SpaceNodeEditor.draw_handler_remove(self._handle, 'WINDOW') if route_as_nodelookup(self, context): pass elif route_as_macro(self, context): pass elif route_as_websearch(self): pass print('completed') flat_node_cats['list_return'] = [] return {'FINISHED'} elif event.type in {'RIGHTMOUSE', 'ESC'}: SpaceNodeEditor.draw_handler_remove(self._handle, 'WINDOW') flat_node_cats['list_return'] = [] return {'CANCELLED'} return {'RUNNING_MODAL'}