def do_something(): """ React to the Esc key, and return True iff something was done. """ editor = GPS.EditorBuffer.get(force=False, open=False) if editor: if aliases.is_in_alias_expansion(editor): aliases.exit_alias_expand(editor) return True if editor.has_slave_cursors(): editor.remove_all_slave_cursors() return True if GPS.Action("Cancel completion").execute_if_possible(): return True c = [ c for c in GPS.MDI.children() if (c.is_floating() and c.get_child().__class__ == GPS.GUI) ] if c: c[0].close() return True
def do_something(): """ React to the Esc key, and return True if something was done. """ editor = GPS.EditorBuffer.get(force=False, open=False) if editor: if GPS.Action("Cancel completion").execute_if_possible(): return True if aliases.is_in_alias_expansion(editor): aliases.exit_alias_expand(editor) return True if editor.has_slave_cursors(): editor.remove_all_slave_cursors() return True current_view = GPS.MDI.current() if current_view and current_view.is_floating(): try: window = current_view.get_child().pywidget().get_toplevel() if window.get_transient_for(): current_view.close() else: GPS.MDI.present_main_window() except Exception: return False return True return False
def do_something(): """ React to the Esc key, and return True iff something was done. """ editor = GPS.EditorBuffer.get(force=False, open=False) if editor: if aliases.is_in_alias_expansion(editor): aliases.exit_alias_expand(editor) return True if editor.has_slave_cursors(): editor.remove_all_slave_cursors() return True if GPS.Action("Cancel completion").execute_if_possible(): return True c = [c for c in GPS.MDI.children() if (c.is_floating() and c.get_child().__class__ == GPS.GUI)] if c: # Do this rather than c[0].close() to give the toplevel window # a chance to react to delete_event. c[0].get_child().pywidget().get_toplevel().close() return True