#!/usr/bin/env python3

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class StackedWidget(QWidget):
    def __init__(self, parent=None):
        super(StackedWidget, self).__init__(parent)
        self.scroll_pos = {}
        self.current_widget = None
        self.widgets = set()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        
    def addWidget(self, w):
        self.widgets.add(w)
        self.layout.addWidget(w)
        self.current_widget = w
        self.showCurrentWidget()
        self.scroll_pos[w] = 0
        
    def removeWidget(self, w):
        self.widgets.remove(w)
        self.layout.removeWidget(w)
        del self.scroll_pos[w]
        
    def currentWidget(self):
        return self.current_widget
    
    def setCurrentWidget(self, w):
        self.current_widget = w
        self.showCurrentWidget()
        
    def showCurrentWidget(self):
        if self.count() > 0:
            for widget in self.widgets:
                widget.hide()
            self.current_widget.show()
            self.updateGeometry()
            
    def sizeHint(self):
        if self.count() > 0:
            return self.current_widget.minimumSizeHint()
        else:
            return QWidget.sizeHint(self)
        
    def setScrollPosition(self, w, pos):
        self.scroll_pos[w] = pos
        
    def getScrollPosition(self, w):
        return self.scroll_pos[w]
    
    def count(self):
        return len(self.widgets)
        
039ba936eefc912e7377c2ccc8b5b90ef22ab15a
<mask token>


class StackedWidget(QWidget):

    def __init__(self, parent=None):
        super(StackedWidget, self).__init__(parent)
        self.scroll_pos = {}
        self.current_widget = None
        self.widgets = set()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

    def addWidget(self, w):
        self.widgets.add(w)
        self.layout.addWidget(w)
        self.current_widget = w
        self.showCurrentWidget()
        self.scroll_pos[w] = 0
    <mask token>
    <mask token>
    <mask token>

    def showCurrentWidget(self):
        if self.count() > 0:
            for widget in self.widgets:
                widget.hide()
            self.current_widget.show()
            self.updateGeometry()

    def sizeHint(self):
        if self.count() > 0:
            return self.current_widget.minimumSizeHint()
        else:
            return QWidget.sizeHint(self)

    def setScrollPosition(self, w, pos):
        self.scroll_pos[w] = pos
    <mask token>

    def count(self):
        return len(self.widgets)

<mask token>


class StackedWidget(QWidget):

    def __init__(self, parent=None):
        super(StackedWidget, self).__init__(parent)
        self.scroll_pos = {}
        self.current_widget = None
        self.widgets = set()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

    def addWidget(self, w):
        self.widgets.add(w)
        self.layout.addWidget(w)
        self.current_widget = w
        self.showCurrentWidget()
        self.scroll_pos[w] = 0
    <mask token>
    <mask token>

    def setCurrentWidget(self, w):
        self.current_widget = w
        self.showCurrentWidget()

    def showCurrentWidget(self):
        if self.count() > 0:
            for widget in self.widgets:
                widget.hide()
            self.current_widget.show()
            self.updateGeometry()

    def sizeHint(self):
        if self.count() > 0:
            return self.current_widget.minimumSizeHint()
        else:
            return QWidget.sizeHint(self)

    def setScrollPosition(self, w, pos):
        self.scroll_pos[w] = pos
    <mask token>

    def count(self):
        return len(self.widgets)

<mask token>


class StackedWidget(QWidget):

    def __init__(self, parent=None):
        super(StackedWidget, self).__init__(parent)
        self.scroll_pos = {}
        self.current_widget = None
        self.widgets = set()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

    def addWidget(self, w):
        self.widgets.add(w)
        self.layout.addWidget(w)
        self.current_widget = w
        self.showCurrentWidget()
        self.scroll_pos[w] = 0

    def removeWidget(self, w):
        self.widgets.remove(w)
        self.layout.removeWidget(w)
        del self.scroll_pos[w]
    <mask token>

    def setCurrentWidget(self, w):
        self.current_widget = w
        self.showCurrentWidget()

    def showCurrentWidget(self):
        if self.count() > 0:
            for widget in self.widgets:
                widget.hide()
            self.current_widget.show()
            self.updateGeometry()

    def sizeHint(self):
        if self.count() > 0:
            return self.current_widget.minimumSizeHint()
        else:
            return QWidget.sizeHint(self)

    def setScrollPosition(self, w, pos):
        self.scroll_pos[w] = pos

    def getScrollPosition(self, w):
        return self.scroll_pos[w]

    def count(self):
        return len(self.widgets)

from PyQt4.QtCore import *
from PyQt4.QtGui import *


class StackedWidget(QWidget):

    def __init__(self, parent=None):
        super(StackedWidget, self).__init__(parent)
        self.scroll_pos = {}
        self.current_widget = None
        self.widgets = set()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

    def addWidget(self, w):
        self.widgets.add(w)
        self.layout.addWidget(w)
        self.current_widget = w
        self.showCurrentWidget()
        self.scroll_pos[w] = 0

    def removeWidget(self, w):
        self.widgets.remove(w)
        self.layout.removeWidget(w)
        del self.scroll_pos[w]

    def currentWidget(self):
        return self.current_widget

    def setCurrentWidget(self, w):
        self.current_widget = w
        self.showCurrentWidget()

    def showCurrentWidget(self):
        if self.count() > 0:
            for widget in self.widgets:
                widget.hide()
            self.current_widget.show()
            self.updateGeometry()

    def sizeHint(self):
        if self.count() > 0:
            return self.current_widget.minimumSizeHint()
        else:
            return QWidget.sizeHint(self)

    def setScrollPosition(self, w, pos):
        self.scroll_pos[w] = pos

    def getScrollPosition(self, w):
        return self.scroll_pos[w]

    def count(self):
        return len(self.widgets)

#!/usr/bin/env python3

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class StackedWidget(QWidget):
    def __init__(self, parent=None):
        super(StackedWidget, self).__init__(parent)
        self.scroll_pos = {}
        self.current_widget = None
        self.widgets = set()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        
    def addWidget(self, w):
        self.widgets.add(w)
        self.layout.addWidget(w)
        self.current_widget = w
        self.showCurrentWidget()
        self.scroll_pos[w] = 0
        
    def removeWidget(self, w):
        self.widgets.remove(w)
        self.layout.removeWidget(w)
        del self.scroll_pos[w]
        
    def currentWidget(self):
        return self.current_widget
    
    def setCurrentWidget(self, w):
        self.current_widget = w
        self.showCurrentWidget()
        
    def showCurrentWidget(self):
        if self.count() > 0:
            for widget in self.widgets:
                widget.hide()
            self.current_widget.show()
            self.updateGeometry()
            
    def sizeHint(self):
        if self.count() > 0:
            return self.current_widget.minimumSizeHint()
        else:
            return QWidget.sizeHint(self)
        
    def setScrollPosition(self, w, pos):
        self.scroll_pos[w] = pos
        
    def getScrollPosition(self, w):
        return self.scroll_pos[w]
    
    def count(self):
        return len(self.widgets)
        