Example #1
0
    def realize(self):
        """This function is part of initialization where it handles
           ModuleAgent creation and wiring and subclass view placement.
        """
        # Create and wire the Agent into the Boxfish tree
        self.agent = self.agent_type(self.parent_frame.agent, self.parent_frame.agent.datatree)
        self.agent.module_scene = self.scene_type(self.agent_type, self.display_name)
        self.parent_frame.agent.registerChild(self.agent)

        # Create and place the module-specific view elements
        self.view = self.createView()
        self.centralWidget = QWidget()

        layout = QGridLayout()
        if isinstance(self.parent(), BFDockWidget):
            layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2)

        # TODO: Replace magic number with not-magic constant
        layout.addWidget(self.view, 100, 0, 1, 2)  # Add view at bottom
        layout.setRowStretch(100, 5)  # view has most row stretch

        left, top, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setLayout(layout)

        self.setCentralWidget(self.centralWidget)

        # Tab Dialog stuff
        self.enable_tab_dialog = True
        self.dialog = list()
Example #2
0
    def realize(self):
        """This function is part of initialization where it handles
           ModuleAgent creation and wiring and subclass view placement.
        """
        # Create and wire the Agent into the Boxfish tree
        self.agent = self.agent_type(self.parent_frame.agent,
                                     self.parent_frame.agent.datatree)
        self.agent.module_scene = self.scene_type(self.agent_type,
                                                  self.display_name)
        self.parent_frame.agent.registerChild(self.agent)

        # Create and place the module-specific view elements
        self.view = self.createView()
        self.centralWidget = QWidget()

        layout = QGridLayout()
        if isinstance(self.parent(), BFDockWidget):
            layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2)

        # TODO: Replace magic number with not-magic constant
        layout.addWidget(self.view, 100, 0, 1, 2)  # Add view at bottom
        layout.setRowStretch(100, 5)  # view has most row stretch

        left, top, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setLayout(layout)

        self.setCentralWidget(self.centralWidget)

        # Tab Dialog stuff
        self.enable_tab_dialog = True
        self.dialog = list()