summaryrefslogtreecommitdiffstats
path: root/examples2/dirview.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples2/dirview.py')
-rwxr-xr-xexamples2/dirview.py76
1 files changed, 0 insertions, 76 deletions
diff --git a/examples2/dirview.py b/examples2/dirview.py
deleted file mode 100755
index ef8bcd7..0000000
--- a/examples2/dirview.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-from python_tqt.qt import *
-
-class Directory(TQListViewItem):
- def __init__(self, parent, name=None):
- TQListViewItem.__init__(*(self,parent))
- if isinstance(parent, TQListView):
- self.p = None
- self.f = '/'
- else:
- self.p = parent
- self.f = name
- self.c = []
- self.readable = 1
-
- def setOpen(self, o):
- if o and not self.childCount():
- s = self.fullName()
- thisDir = TQDir(s)
- if not thisDir.isReadable():
- self.readable = 0
- return
-
- files = thisDir.entryInfoList()
- if files:
- for f in files:
- fileName = str(f.fileName())
- if fileName == '.' or fileName == '..':
- continue
- elif f.isSymLink():
- d = TQListViewItem(self, fileName, 'Symbolic Link')
- elif f.isDir():
- d = Directory(self, fileName)
- else:
- if f.isFile():
- s = 'File'
- else:
- s = 'Special'
- d = TQListViewItem(self, fileName, s)
- self.c.append(d)
-
- TQListViewItem.setOpen(self, o)
-
- def setup(self):
- self.setExpandable(1)
- TQListViewItem.setup(self)
-
- def fullName(self):
- if self.p:
- s = self.p.fullName() + self.f + '/'
- else:
- s = '/'
- return s
-
- def text(self, column):
- if column == 0:
- return self.f
- elif self.readable:
- return 'Directory'
- else:
- return 'Unreadable Directory'
-
-a = TQApplication(sys.argv)
-mw = TQListView()
-a.setMainWidget(mw)
-mw.setCaption('Directory Browser')
-mw.addColumn('Name')
-mw.addColumn('Type')
-mw.resize(400, 400)
-mw.setTreeStepSize(20)
-root = Directory(mw)
-root.setOpen(1)
-mw.show()
-a.exec_loop()