class ContainerPage(QStackedWidget): """Fades between Items View and Details Page""" def __init__(self, startWidget, parent=None): super(ContainerPage, self).__init__(parent) self.detailsPage = DetailsPage(self) self.addWidget(startWidget) self.addWidget(self.detailsPage) # CONNECT WEB VIEW BUTTONS backBtnCallback = partial(self.setCurrentIndex, 0) self.detailsPage.backBtn.clicked.connect(backBtnCallback) def setCurrentIndex(self, index): self.faderWidget = FaderWidget(self.currentWidget(), self.widget(index)) QStackedWidget.setCurrentIndex(self, index) def showDetailsPage(self, item, html): """ Show the details page for item. Item is a dictionary containing the db query result for the requested tool. """ self.detailsPage.setTitle( "<big><b>%s</b></big> <small>written by %s</small>" % (item["filetitle"], item["fileauthor"]) ) self.detailsPage.setHtml(html) self.setCurrentIndex(1) def showToolsPage(self): self.setCurrentIndex(0)
def __init__(self, startWidget, parent=None): super(ContainerPage, self).__init__(parent) self.detailsPage = DetailsPage(self) self.addWidget(startWidget) self.addWidget(self.detailsPage) # CONNECT WEB VIEW BUTTONS backBtnCallback = partial(self.setCurrentIndex, 0) self.detailsPage.backBtn.clicked.connect(backBtnCallback)