#!/usr/bin/env python """emano - chooseDocument.py""" def chooseDocument(editor): if not editor.documents: editor.statwin.notice('Error: No files to choose from') return editor.itemwin.reset() titles = {} for doc in editor.documents: title = doc.getTitle() if titles.has_key(title): titles[title] += 1 title += ' [%s]' % titles[title] else: titles[title] = 1 def edit(doc=doc): editor.edit(doc) editor.statwin.default() args = (' * ' + title, (edit, None)) kargs = {'default': (doc is editor.doc)} editor.itemwin.append(*args, **kargs) editor.setFocus(editor.itemwin) editor.itemwin.draw() if __name__=="__main__": print __doc__