Changing the document manager and the application object to work with the TabManager class makes them unable to work with the vanilla PyQt QWorkspace class. We will have to wrap this one in a class of our own that sports the same functions as the TabManager class. Fortunately, this is not an onerous exercise.
""" workspace.py - MDI workspace class for the mdi framework copyright: (C) 2001, Boudewijn Rempt email: boud@rempt.xs4all.nl """ from qt import * from resources import TRUE, FALSE class WorkSpace(QWorkspace): def __init__(self, *args): apply(QWorkspace.__init__,(self, ) + args) def addView(self, view): pass def removeView(self, view): pass def canCascade(self): return TRUE def canTile(self): return TRUE
That didn't hurt, did it? We added a mere four functions to the interface for our view managers. Adding and removing a view from a workspace doesn't need our active intervention, so we can simply add stubs for addView and removeView. And a workspace can both cascade and tile, so canCascade() and canTile() return TRUE.
The other functions we had to define in TabManager, like cascade() or windowList are part of QWorkspace — and we don't need to reimplement them.