class Collections(QWidget): """Just a widget contains a sub tab widget.""" def __init__(self, parent: MainWindowBase): """Create two widget page and using main window to make their parent.""" super(Collections, self).__init__(parent) layout = QVBoxLayout(self) self.tab_widget = QTabWidget(self) layout.addWidget(self.tab_widget) self.setWindowIcon(QIcon(QPixmap(":/icons/collections.png"))) self.structure_widget = StructureWidget(parent) self.configure_widget = ConfigureWidget( self.structure_widget.add_collection, parent) self.tab_widget.addTab(self.structure_widget, self.structure_widget.windowIcon(), "Structures") self.tab_widget.addTab(self.configure_widget, self.configure_widget.windowIcon(), "Configuration") self.structure_widget.configure_button.clicked.connect( lambda: self.tab_widget.setCurrentIndex(1)) self.structure_widget.layout_sender.connect( self.configure_widget.set_graph) def clear(self): """Clear the sub-widgets.""" self.structure_widget.clear() self.configure_widget.clear() def collect_data(self) -> List[Tuple[Tuple[int, int], ...]]: """Return collections to database.""" return [tuple(G.edges) for G in self.structure_widget.collections] def triangle_data(self) -> Dict[str, Dict[str, Any]]: """Return profiles to database.""" return self.configure_widget.collections
def __init__(self, parent=None): super(Collections, self).__init__(parent) layout = QVBoxLayout(self) tabWidget = QTabWidget(self) layout.addWidget(tabWidget) self.setWindowIcon(QIcon(QPixmap(":/icons/collections.png"))) self.CollectionsStructure = CollectionsStructure(parent) self.CollectionsTriangularIteration = CollectionsTriangularIteration( parent) self.CollectionsTriangularIteration.addToCollection = self.CollectionsStructure.addCollection tabWidget.addTab(self.CollectionsStructure, self.CollectionsStructure.windowIcon(), "Structure") tabWidget.addTab(self.CollectionsTriangularIteration, self.CollectionsTriangularIteration.windowIcon(), "Triangular iteration") self.CollectionsStructure.triangle_button.clicked.connect( lambda: tabWidget.setCurrentIndex(1)) self.CollectionsStructure.layout_sender.connect( self.CollectionsTriangularIteration.setGraph)
def __init__(self, parent: QWidget): """Create two widget page and using main window to make their parent.""" super(Collections, self).__init__(parent) layout = QVBoxLayout(self) tab_widget = QTabWidget(self) layout.addWidget(tab_widget) self.setWindowIcon(QIcon(QPixmap(":/icons/collections.png"))) self.StructureWidget = StructureWidget(parent) self.TriangularIterationWidget = TriangularIterationWidget( self.StructureWidget.addCollection, parent) tab_widget.addTab(self.StructureWidget, self.StructureWidget.windowIcon(), "Structures") tab_widget.addTab(self.TriangularIterationWidget, self.TriangularIterationWidget.windowIcon(), "Triangular iteration") self.StructureWidget.triangle_button.clicked.connect( lambda: tab_widget.setCurrentIndex(1)) self.StructureWidget.layout_sender.connect( self.TriangularIterationWidget.setGraph)