Mercurial > cpython-lru_cache-weakref
annotate Lib/stdwin/dirwin.py @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 7259e96a04a9 |
| children |
| rev | line source |
|---|---|
| 5 | 1 # Module 'dirwin' |
| 2 | |
| 3 # Directory windows, a subclass of listwin | |
| 4 | |
| 776 | 5 import os |
| 5 | 6 import gwin |
| 7 import listwin | |
| 8 import anywin | |
| 9 import dircache | |
| 10 | |
| 11 def action(w, string, i, detail): | |
| 12 (h, v), clicks, button, mask = detail | |
| 559 | 13 if clicks == 2: |
| 776 | 14 name = os.path.join(w.name, string) |
| 5 | 15 try: |
|
19
71ac0e37236a
Set 'parent' field of new created subwindows so wdiff can implement
Guido van Rossum <guido@python.org>
parents:
5
diff
changeset
|
16 w2 = anywin.open(name) |
|
71ac0e37236a
Set 'parent' field of new created subwindows so wdiff can implement
Guido van Rossum <guido@python.org>
parents:
5
diff
changeset
|
17 w2.parent = w |
| 776 | 18 except os.error, why: |
| 5 | 19 stdwin.message('Can\'t open ' + name + ': ' + why[1]) |
| 20 | |
| 21 def open(name): | |
| 776 | 22 name = os.path.join(name, '') |
| 5 | 23 list = dircache.opendir(name)[:] |
| 24 list.sort() | |
| 25 dircache.annotate(name, list) | |
| 26 w = listwin.open(name, list) | |
| 27 w.name = name | |
| 28 w.action = action | |
| 29 return w |
