aboutsummaryrefslogtreecommitdiff
path: root/lib/dirwin.py
diff options
context:
space:
mode:
authorSkip Montanaro <[email protected]>2021-02-16 14:40:46 -0600
committerSkip Montanaro <[email protected]>2021-02-16 14:40:46 -0600
commita19a216bc60160c162e616145ef091dd18ce4e61 (patch)
treefa4bdff21f9b04a125c84a2bfab8a1c738359e15 /lib/dirwin.py
downloadpython-0.9.1-patched-QoL-a19a216bc60160c162e616145ef091dd18ce4e61.tar.xz
python-0.9.1-patched-QoL-a19a216bc60160c162e616145ef091dd18ce4e61.zip
Python 0.9.1 as posted in alt.sources
Diffstat (limited to 'lib/dirwin.py')
-rw-r--r--lib/dirwin.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/dirwin.py b/lib/dirwin.py
new file mode 100644
index 0000000..76e0b5e
--- /dev/null
+++ b/lib/dirwin.py
@@ -0,0 +1,29 @@
+# Module 'dirwin'
+
+# Directory windows, a subclass of listwin
+
+import gwin
+import listwin
+import anywin
+import path
+import dircache
+
+def action(w, string, i, detail):
+ (h, v), clicks, button, mask = detail
+ if clicks = 2:
+ name = path.cat(w.name, string)
+ try:
+ w2 = anywin.open(name)
+ w2.parent = w
+ except posix.error, why:
+ stdwin.message('Can\'t open ' + name + ': ' + why[1])
+
+def open(name):
+ name = path.cat(name, '')
+ list = dircache.opendir(name)[:]
+ list.sort()
+ dircache.annotate(name, list)
+ w = listwin.open(name, list)
+ w.name = name
+ w.action = action
+ return w