slcan_cli.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:gui_tool 作者: UAVCAN 项目源码 文件源码
def __init__(self, parent, cli_iface):
        super(CLIWidget, self).__init__(parent)

        self._cli_iface = cli_iface

        self._command_line = CommitableComboBoxWithHistory(self)
        self._command_line.setToolTip('Enter the command here')
        self._command_line.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self._command_line.setFont(get_monospace_font())
        self._command_line.on_commit = self._do_execute

        self._command_line_completer = QCompleter()
        self._command_line_completer.setCaseSensitivity(Qt.CaseSensitive)
        self._command_line_completer.setModel(self._command_line.model())

        self._command_line.setCompleter(self._command_line_completer)

        self._execute_button = make_icon_button('flash', 'Execute command', self, on_clicked=self._do_execute)

        self._response_box = QPlainTextEdit(self)
        self._response_box.setToolTip('Command output will be printed here')
        self._response_box.setReadOnly(True)
        self._response_box.setLineWrapMode(QPlainTextEdit.NoWrap)
        self._response_box.setFont(get_monospace_font())
        self._response_box.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        try:
            self._log_viewer.setPlaceholderText('Command output will be printed here')
        except AttributeError:      # Old PyQt
            pass

        layout = QVBoxLayout(self)

        controls_layout = QHBoxLayout(self)
        controls_layout.addWidget(self._command_line, 1)
        controls_layout.addWidget(self._execute_button)

        layout.addLayout(controls_layout)
        layout.addWidget(self._response_box, 1)
        self.setLayout(layout)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号