Beispiel #1
0
    def init_ui(self):
        master_layout = QVBoxLayout()

        inner_layout = self.inner_layout()
        master_layout.addLayout(inner_layout)

        btn_layout = QHBoxLayout()
        btn_layout.addWidget(self.cancel_btn)
        btn_layout.addWidget(self.ok_btn)
        master_layout.addLayout(btn_layout)

        self.setLayout(master_layout)

        self.setWindowTitle(self.TITLE)
Beispiel #2
0
    def init_ui(self) -> Optional[QBoxLayout]:
        super().init_ui()
        self.setWindowModality(Qt.WindowModal)

        master_layout = QVBoxLayout(self)

        self.print_widget = QGroupBox('current value:')
        print_master_layout = QVBoxLayout(self.print_widget)

        print_layout = QHBoxLayout()
        print_master_layout.addLayout(print_layout)

        self.print_edit = QPlainTextEdit()
        self.print_edit.setReadOnly(True)
        print_layout.addWidget(self.print_edit)

        print_extras_layout = QGridLayout()

        self.print_combo = QComboBox()
        file_button = QPushButton('to file...')
        file_button.clicked.connect(self.save_file)
        print_extras_layout.addWidget(file_button, 0, 0)
        print_extras_layout.addWidget(self.print_combo, 1, 0)

        print_layout.addLayout(print_extras_layout)

        master_layout.addWidget(self.print_widget)

        self.clone_button = QPushButton('🡇')
        self.clone_button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        self.clone_button.clicked.connect(self._clone_btn_clicked)
        master_layout.addWidget(self.clone_button)

        self.parse_widget = QGroupBox('set value:')
        parse_master_layout = QVBoxLayout(self.parse_widget)

        parse_layout = QHBoxLayout()
        parse_master_layout.addLayout(parse_layout)

        self.parse_edit = self._ShiftEnterIgnoringPlainTextEdit()
        self.parse_edit.textChanged.connect(self.change_value)
        self.print_combo.activated.connect(self.update_print)
        parse_layout.addWidget(self.parse_edit)

        parse_extras_layout = QGridLayout()

        self.parse_combo = QComboBox()
        self.parse_combo.activated.connect(self.change_value)
        parse_extras_layout.addWidget(self.parse_combo, 0, 0)

        if self.indicator_label:
            parse_extras_layout.addWidget(self.indicator_label, 0, 1)

        file_button = QPushButton('from file...')
        file_button.clicked.connect(self.load_file)
        parse_extras_layout.addWidget(file_button, 1, 0, 1, 2)

        self.apply_button = QPushButton('apply')
        self.apply_button.clicked.connect(self.apply_parse)
        parse_extras_layout.addWidget(self.apply_button, 2, 0)

        self.ok_button = QPushButton('OK')
        self.ok_button.clicked.connect(self.commit_parse)
        parse_extras_layout.addWidget(self.ok_button, 2, 1)

        parse_layout.addLayout(parse_extras_layout)

        master_layout.addWidget(self.parse_widget)

        self.font_button = QPushButton('font...')
        self.font_button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        self.font_button.clicked.connect(self._choose_font)
        master_layout.addWidget(self.font_button)

        self.on_change.connect(self._on_value_change)

        return master_layout