summaryrefslogtreecommitdiffstats
path: root/examples3/dirview.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples3/dirview.py')
-rwxr-xr-xexamples3/dirview.py128
1 files changed, 64 insertions, 64 deletions
diff --git a/examples3/dirview.py b/examples3/dirview.py
index eb5393e..1783d51 100755
--- a/examples3/dirview.py
+++ b/examples3/dirview.py
@@ -6,7 +6,7 @@
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
** Some corrections by M. Biermaier (http://www.office-m.at)
**
-** This file is part of an example program for Qt. This example
+** This file is part of an example program for TQt. This example
** program may be used, distributed and modified without limitation.
**
***************************************************************************"""
@@ -136,9 +136,9 @@ folderClosed = None
folderOpened = None
fileNormal = None
-class FileItem( QListViewItem ) :
- def __init__( self, parent=None, s1=QString.null, s2=QString.null ):
- QListViewItem.__init__( self, parent, s1, s2 )
+class FileItem( TQListViewItem ) :
+ def __init__( self, parent=None, s1=TQString.null, s2=TQString.null ):
+ TQListViewItem.__init__( self, parent, s1, s2 )
self.pix = None
def setPixmap( self, p ) :
@@ -153,22 +153,22 @@ class FileItem( QListViewItem ) :
else : return self.pix;
# Class Directory
-class Directory( QListViewItem ) :
- def __init__( self, parent=None, filename=QString.null, col2=QString.null ):
- QListViewItem.__init__( self, parent, filename, col2 )
+class Directory( TQListViewItem ) :
+ def __init__( self, parent=None, filename=TQString.null, col2=TQString.null ):
+ TQListViewItem.__init__( self, parent, filename, col2 )
self.pix = None
global folderLocked, folderClosed, folderOpened, fileNormal
self.showDirsOnly = False
- if isinstance(parent, QListView):
+ if isinstance(parent, TQListView):
self.p = None
self.showDirsOnly = parent.showDirsOnly()
- self.f = QFile( QString('/') )
+ self.f = TQFile( TQString('/') )
else:
self.p = parent
self.showDirsOnly = parent.showDirsOnly
- self.f = QFile( QString(filename) )
+ self.f = TQFile( TQString(filename) )
- self.readable = QDir( self.fullName() ).isReadable()
+ self.readable = TQDir( self.fullName() ).isReadable()
if not self.readable : self.setPixmap( folderLocked )
else : self.setPixmap( folderClosed )
@@ -188,8 +188,8 @@ class Directory( QListViewItem ) :
else : self.setPixmap( folderClosed )
if o and not self.childCount() :
- s = QString( self.fullName() )
- thisDir = QDir( s )
+ s = TQString( self.fullName() )
+ thisDir = TQDir( s )
if not thisDir.isReadable() :
self.readable = False
self.setExpandable( False )
@@ -198,7 +198,7 @@ class Directory( QListViewItem ) :
self.listView().setUpdatesEnabled( False )
files = thisDir.entryInfoList()
if files :
- fi = QFileInfo()
+ fi = TQFileInfo()
for it in files:
fi = it
if str(fi.fileName()) == "." or str(fi.fileName()) == ".." :
@@ -214,14 +214,14 @@ class Directory( QListViewItem ) :
item.setPixmap( fileNormal )
self.listView().setUpdatesEnabled( True )
- QListViewItem.setOpen( self, o )
+ TQListViewItem.setOpen( self, o )
def setup( self ):
self.setExpandable( True )
- QListViewItem.setup( self )
+ TQListViewItem.setup( self )
def fullName( self ):
- s = QString()
+ s = TQString()
if self.p :
s = self.p.fullName()
s.append( self.f.name() )
@@ -237,27 +237,27 @@ class Directory( QListViewItem ) :
# Class DirectoryView
-class DirectoryView( QListView ):
+class DirectoryView( TQListView ):
def __init__( self, parent=None, name=None, sdo=False ):
- QListView.__init__( self, parent, name )
+ TQListView.__init__( self, parent, name )
self.dirsOnly = sdo
self.oldCurrent = 0
self.dropItem = 0
- self.presspos = QPoint(0,0)
+ self.presspos = TQPoint(0,0)
self.mousePressed = False
- global folderLocked, folderClosed, folderOpened, fileNormal #= QPixmap()
+ global folderLocked, folderClosed, folderOpened, fileNormal #= TQPixmap()
self.autoopenTime = 750
- self.autoopen_timer = QTimer( self )
+ self.autoopen_timer = TQTimer( self )
if not folderLocked :
- folderLocked = QPixmap( folder_locked )
- folderClosed = QPixmap( folder_closed_xpm )
- folderOpened = QPixmap( folder_open_xpm )
- fileNormal = QPixmap( pix_file )
+ folderLocked = TQPixmap( folder_locked )
+ folderClosed = TQPixmap( folder_closed_xpm )
+ folderOpened = TQPixmap( folder_open_xpm )
+ fileNormal = TQPixmap( pix_file )
- self.connect( self, SIGNAL("doubleClicked(QListViewItem *)"),
+ self.connect( self, SIGNAL("doubleClicked(TQListViewItem *)"),
self.slotFolderSelected )
- self.connect( self, SIGNAL("returnPressed(QListViewItem *)"),
+ self.connect( self, SIGNAL("returnPressed(TQListViewItem *)"),
self.slotFolderSelected )
self.setAcceptDrops( True )
@@ -272,7 +272,7 @@ class DirectoryView( QListView ):
if not i or not self.showDirsOnly():
return
dir = i
- self.emit( PYSIGNAL("folderSelected(const QString &)"), (dir.fullName(), ) )
+ self.emit( PYSIGNAL("folderSelected(const TQString &)"), (dir.fullName(), ) )
def openFolder( self ):
self.autoopen_timer.stop()
@@ -281,7 +281,7 @@ class DirectoryView( QListView ):
self.dropItem.repaint()
def contentsDragEnterEvent( self, e ):
- if not QUriDrag.canDecode(e) :
+ if not TQUriDrag.canDecode(e) :
e.ignore()
return
self.oldCurrent = self.currentItem()
@@ -291,7 +291,7 @@ class DirectoryView( QListView ):
self.autoopen_timer.start( self.autoopenTime )
def contentsDragMoveEvent( self, e ) :
- if not QUriDrag.canDecode(e) :
+ if not TQUriDrag.canDecode(e) :
e.ignore()
return
vp = self.contentsToViewport( e.pos() )
@@ -304,11 +304,11 @@ class DirectoryView( QListView ):
self.dropItem = i
self.autoopen_timer.start( self.autoopenTime )
- if e.action() == QDropEvent.Copy:
+ if e.action() == TQDropEvent.Copy:
pass
- elif e.action() == QDropEvent.Move:
+ elif e.action() == TQDropEvent.Move:
e.acceptAction()
- elif e.action() == QDropEvent.Link:
+ elif e.action() == TQDropEvent.Link:
e.acceptAction()
else:
pass
@@ -317,7 +317,7 @@ class DirectoryView( QListView ):
self.autoopen_timer.stop()
self.dropItem = 0
- def contentsDragLeaveEvent( self, QDragLeaveEvent ) :
+ def contentsDragLeaveEvent( self, TQDragLeaveEvent ) :
self.autoopen_timer.stop()
self.dropItem = 0
@@ -326,23 +326,23 @@ class DirectoryView( QListView ):
def contentsDropEvent( self, e ):
self.autoopen_timer.stop()
- if not QUriDrag.canDecode(e) :
+ if not TQUriDrag.canDecode(e) :
e.ignore()
return
item = self.itemAt( self.contentsToViewport(e.pos()) )
if item :
- lst = QStringList()
- QUriDrag.decodeLocalFiles( e, lst )
- if e.action() == QDropEvent.Copy:
- s = QString("Copy")
- elif e.action() == QDropEvent.Move:
- s = QString("Move")
+ lst = TQStringList()
+ TQUriDrag.decodeLocalFiles( e, lst )
+ if e.action() == TQDropEvent.Copy:
+ s = TQString("Copy")
+ elif e.action() == TQDropEvent.Move:
+ s = TQString("Move")
e.acceptAction()
- elif e.action() == QDropEvent.Link:
- s = QString("Link")
+ elif e.action() == TQDropEvent.Link:
+ s = TQString("Link")
e.acceptAction()
else:
- s = QString("Unknown")
+ s = TQString("Unknown")
s += "\n\n"
e.accept()
@@ -353,12 +353,12 @@ class DirectoryView( QListView ):
s += "\nTo\n\n "
s += self.fullPath(item)
- QMessageBox.information( self, "Drop target", s, "Not implemented" )
+ TQMessageBox.information( self, "Drop target", s, "Not implemented" )
else :
e.ignore()
def fullPath( self, item ):
- fullpath = QString( item.text(0) )
+ fullpath = TQString( item.text(0) )
item = item.parent()
while item:
newpath = item.text(0)
@@ -373,8 +373,8 @@ class DirectoryView( QListView ):
return fullpath
def contentsMousePressEvent( self, e ) :
- QListView.contentsMousePressEvent( self, e )
- p = QPoint( self.contentsToViewport( e.pos() ) )
+ TQListView.contentsMousePressEvent( self, e )
+ p = TQPoint( self.contentsToViewport( e.pos() ) )
i = self.itemAt( p )
if i :
# if the user clicked into the root decoration of the item, don't try to start a drag!
@@ -387,30 +387,30 @@ class DirectoryView( QListView ):
self.mousePressed = True
def contentsMouseMoveEvent( self, e ):
- offset = QPoint( self.presspos.x() - e.pos().x(),
+ offset = TQPoint( self.presspos.x() - e.pos().x(),
self.presspos.y() - e.pos().y() )
- if self.mousePressed and (offset).manhattanLength() > QApplication.startDragDistance() :
+ if self.mousePressed and (offset).manhattanLength() > TQApplication.startDragDistance() :
self.mousePressed = False
item = self.itemAt( self.contentsToViewport(self.presspos) )
if item :
source = self.fullPath(item)
- if QFile.exists(source) :
- ud = QUriDrag(self.viewport())
- ud.setFileNames( QStringList (source) )
+ if TQFile.exists(source) :
+ ud = TQUriDrag(self.viewport())
+ ud.setFileNames( TQStringList (source) )
if ud.drag() :
- QMessageBox.information( self, "Drag source",
- QString("Delete ")+source, "Not implemented" )
+ TQMessageBox.information( self, "Drag source",
+ TQString("Delete ")+source, "Not implemented" )
- def contentsMouseReleaseEvent( self, QMouseEvent ):
+ def contentsMouseReleaseEvent( self, TQMouseEvent ):
self.mousePressed = False
def setDir( self, s ):
- it = QListViewItem( self )
+ it = TQListViewItem( self )
it.setOpen(False)
- thisDir = QDir( s )
- it = QListViewItem( self )
+ thisDir = TQDir( s )
+ it = TQListViewItem( self )
it.setOpen(False)
- lst = QStringList( QStringList.split( "/", s ) )
+ lst = TQStringList( TQStringList.split( "/", s ) )
listview2 = []
listview2.extend( lst )
@@ -425,14 +425,14 @@ class DirectoryView( QListView ):
self.setCurrentItem( item )
def main( args ):
- a = QApplication( args )
+ a = TQApplication( args )
mw = DirectoryView()
mw.addColumn( "Name" )
mw.addColumn( "Type" )
mw.setTreeStepSize( 20 )
- roots = QDir.drives()
+ roots = TQDir.drives()
if roots :
for it in roots:
fi = it
@@ -441,7 +441,7 @@ def main( args ):
root.setOpen( True ) # be interesting
mw.resize( 400, 400 )
- mw.setCaption( "Qt Example - Directory Browser" )
+ mw.setCaption( "TQt Example - Directory Browser" )
mw.setAllColumnsShowFocus( True )
a.setMainWidget( mw )
mw.show()