Example #1
0
    def create_base_tab(self, tab):

        self.base = Base()

        # List of (unit, label)-pairs to build our grid from.
        bases = (2, 3, 5, 8, 10, 12, 16, 20, 32, 36, 60, 64)
        units = [(i, str(i)) for i in bases]

        grid, self.base_edits = self.create_grid(units, 6)
        colors = self.create_color_layout()

        # Patch it all together in a vertical layout.
        layout = QtGui.QVBoxLayout(tab)
        layout.addLayout(colors)
        layout.addLayout(grid)

        # Set the text alignment for the LineEdits and connect edits to actions.
        for i in self.base_edits.values():
            i.setAlignment(QtCore.Qt.AlignRight)
            i.textEdited[str].connect(self.base_text_changed)
            i.textEdited[str].connect(self.update_base_edits)