#!/usr/bin/env python """emano menu - closeDocument.py""" def closeDocument(editor, doc): if not doc in editor.documents: editor.statwin.notice('Error: document not found') return if len(editor.documents) == 1: message = 'There is only one tab open. Ctrl+Q to quit.' editor.statwin.notice(message, 1) return i = editor.documents.index(doc) editor.documents.remove(doc) if len(editor.documents): newdoc = editor.documents[max(0, i - 1)] editor.edit(newdoc) else: editor.new() if __name__=="__main__": print __doc__