Exemple #1
0
    def __init__(self, parent=None):
        super(ModeListBControls, self).__init__(parent)

        self.grid.addWidget(QtWidgets.QLabel("mark"), 0, 0, 2, 1)

        self.buttons = []
        self.marks = ['einj', 'eext', 'pinj', 'pext', 'e2v4', 'p2v4', 'e2v2', 'p2v2']
        m_len = len(self.marks)
        rlen = 4
        crow = 0
        for ind in range(m_len):
            if ind == rlen:
                crow += 1
            btn = QtWidgets.QPushButton(self.marks[ind])
            btn.setStyleSheet("background-color: " + mode_colors[self.marks[ind]])
            btn.setFixedWidth(100)
            self.grid.addWidget(btn, crow, ind - crow * rlen + 1)
            self.buttons.append(btn)
            btn.clicked.connect(self.buttons_cb)

        hSpacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.grid.addItem(hSpacer, 0, rlen + 2)

        self.btn_archive = QtWidgets.QPushButton('Archive')
        self.grid.addWidget(self.btn_archive, 0, rlen + 3)
        self.btn_archive.setStyleSheet("background-color: red")
        self.btn_archive.setFixedWidth(110)
        self.btn_archive.clicked.connect(self.archive)

        self.btn_load = QtWidgets.QPushButton('Load')
        self.grid.addWidget(self.btn_load, 0, rlen + 4)
        self.btn_load.setFixedWidth(110)
        self.btn_load.clicked.connect(self.load)

        self.btn_zeros = QtWidgets.QPushButton('Zeros')
        self.grid.addWidget(self.btn_zeros, 1, rlen + 3)
        self.btn_zeros.setStyleSheet("background-color: yellow")
Exemple #2
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.modes_db = ModesDB()

        #filter controls
        self.grid_filter = QtWidgets.QGridLayout()
        self.grid.addLayout(self.grid_filter, 0, 0, 1, 1)

        self.grid_filter.addWidget(QtWidgets.QLabel("search"), 0, 0)

        self.filter_line = QtWidgets.QLineEdit()
        self.grid_filter.addWidget(self.filter_line, 0, 1, 1, 6)
        self.filter_line.editingFinished.connect(self.filter_cb)

        self.prev_b = QtWidgets.QPushButton("<<")
        self.grid_filter.addWidget(self.prev_b, 1, 0)
        self.prev_b.clicked.connect(self.prev_cb)

        self.nrows_box = PSpinBox()
        self.grid_filter.addWidget(self.nrows_box, 1, 1)
        self.nrows_box.done.connect(self.nrows_cb)

        self.grid_filter.addWidget(QtWidgets.QLabel("@"), 1, 2)

        self.startrow_box = PSpinBox()
        self.grid_filter.addWidget(self.startrow_box, 1, 3)
        self.startrow_box.done.connect(self.startrow_cb)

        self.grid_filter.addWidget(QtWidgets.QLabel("of"), 1, 4)

        self.maxrows_box = PSpinBox()
        self.grid_filter.addWidget(self.maxrows_box, 1, 5)
        self.maxrows_box.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.maxrows_box.setReadOnly(True)

        self.next_b = QtWidgets.QPushButton(">>")
        self.grid_filter.addWidget(self.next_b, 1, 6)
        self.next_b.clicked.connect(self.next_cb)

        # List
        self.listw = ModeList(db=self.modes_db)
        self.grid.addWidget(self.listw, 1, 0)
        self.listw.modeSelected.connect(self.mode_sel_cb)

        # Bottom controls
        self.grid_bottom = QtWidgets.QGridLayout()
        self.grid.addLayout(self.grid_bottom, 2, 0, 1, 1)

        self.grid_bottom.addWidget(QtWidgets.QLabel("mark"), 0, 0, 2, 1)

        self.buttons = []
        self.marks = ['einj', 'eext', 'pinj', 'pext', 'e2v4', 'p2v4', 'e2v2', 'p2v2']
        m_len = len(self.marks)
        rlen = 4
        crow = 0
        for ind in range(m_len):
            if ind == rlen:
                crow += 1
            btn = QtWidgets.QPushButton(self.marks[ind])
            btn.setStyleSheet("background-color: " + mode_colors[self.marks[ind]])
            btn.setFixedWidth(100)
            self.grid_bottom.addWidget(btn, crow, ind - crow * rlen + 1)
            self.buttons.append(btn)
            btn.clicked.connect(self.mark_buttons_cb)

        hSpacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.grid_bottom.addItem(hSpacer, 0, rlen + 2)

        self.btn_archive = QtWidgets.QPushButton('Archive')
        self.grid_bottom.addWidget(self.btn_archive, 0, rlen + 3)
        self.btn_archive.setStyleSheet("background-color: red")
        self.btn_archive.setFixedWidth(110)
        self.btn_archive.clicked.connect(self.btn_archive_cb)

        self.btn_load = QtWidgets.QPushButton('Load')
        self.grid_bottom.addWidget(self.btn_load, 0, rlen + 4)
        self.btn_load.setFixedWidth(110)
        self.btn_load.clicked.connect(self.btn_load_cb)

        self.btn_zeros = QtWidgets.QPushButton('Zeros')
        self.grid_bottom.addWidget(self.btn_zeros, 1, rlen + 3)
        self.btn_zeros.setStyleSheet("background-color: yellow")
        self.btn_zeros.clicked.connect(self.setZeros)

        # Save Block
        self.grid_save = QtWidgets.QGridLayout()
        self.grid.addLayout(self.grid_save, 3, 0, 1, 1)

        self.grid_save.addWidget(QtWidgets.QLabel("Comment:"), 0, 0)
        self.grid_save.addWidget(QtWidgets.QLabel("author:"), 1, 0)

        self.comment_line = QtWidgets.QLineEdit()
        self.grid_save.addWidget(self.comment_line, 0, 1)

        self.author_line = QtWidgets.QLineEdit()
        self.grid_save.addWidget(self.author_line, 1, 1)

        self.btn_save = QtWidgets.QPushButton('save')
        self.grid_save.addWidget(self.btn_save, 0, 2, 2, 1)
        self.btn_save.clicked.connect(self.btn_save_cb)

        self.nrows, self.maxrows, self.startrow, self.filter = 100, 0, 0, None
        self.update_modenum()
        self.nrows_box.setValue(self.nrows)

        self.selected_mode = None