File: dirwin.py

package info (click to toggle)
python 1.5.1-7
  • links: PTS
  • area: main
  • in suites: slink
  • size: 11,616 kB
  • ctags: 32,701
  • sloc: ansic: 90,293; python: 74,171; makefile: 2,449; lisp: 2,097; sh: 702
file content (29 lines) | stat: -rwxr-xr-x 590 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Module 'dirwin'

# Directory windows, a subclass of listwin

import os
import gwin
import listwin
import anywin
import dircache

def action(w, string, i, detail):
	(h, v), clicks, button, mask = detail
	if clicks == 2:
		name = os.path.join(w.name, string)
		try:
			w2 = anywin.open(name)
			w2.parent = w
		except os.error, why:
			stdwin.message('Can\'t open ' + name + ': ' + why[1])

def open(name):
	name = os.path.join(name, '')
	list = dircache.opendir(name)[:]
	list.sort()
	dircache.annotate(name, list)
	w = listwin.open(name, list)
	w.name = name
	w.action = action
	return w