コード例 #1
0
            def show_tb(parent):
                tbdialog = QDialog(parent=parent.parent())
                tbdialog.setModal(True)
                # this is about the minimum width to not get rewrap
                # and the minimum height to not have scrollbar
                tbdialog.resize(650, 270)
                tbdialog.setLayout(QVBoxLayout())

                text = QTextEdit()
                text.setHtml(notification.as_html())
                text.setReadOnly(True)
                btn = QPushButton('Enter Debugger')

                def _enter_debug_mode():
                    btn.setText(
                        'Now Debugging. Please quit debugger in console '
                        'to continue'
                    )
                    _debug_tb(notification.exception.__traceback__)
                    btn.setText('Enter Debugger')

                btn.clicked.connect(_enter_debug_mode)
                tbdialog.layout().addWidget(text)
                tbdialog.layout().addWidget(btn, 0, Qt.AlignRight)
                tbdialog.show()
コード例 #2
0
ファイル: qt_notification.py プロジェクト: jojoelfe/napari
            def show_tb(parent):
                tbdialog = QDialog(parent=parent.parent())
                tbdialog.setModal(True)
                # this is about the minimum width to not get rewrap
                # and the minimum height to not have scrollbar
                tbdialog.resize(650, 270)
                tbdialog.setLayout(QVBoxLayout())

                text = QTextEdit()
                theme = get_theme(
                    get_settings().appearance.theme, as_dict=False
                )
                _highlight = Pylighter(  # noqa: F841
                    text.document(), "python", theme.syntax_style
                )
                text.setText(notification.as_text())
                text.setReadOnly(True)
                btn = QPushButton(trans._('Enter Debugger'))

                def _enter_debug_mode():
                    btn.setText(
                        trans._(
                            'Now Debugging. Please quit debugger in console to continue'
                        )
                    )
                    _debug_tb(notification.exception.__traceback__)
                    btn.setText(trans._('Enter Debugger'))

                btn.clicked.connect(_enter_debug_mode)
                tbdialog.layout().addWidget(text)
                tbdialog.layout().addWidget(btn, 0, Qt.AlignRight)
                tbdialog.show()
コード例 #3
0
 def __show_qrcode(self) -> None:
     """Save to image file."""
     dlg = QDialog(self)
     dlg.setWindowTitle("Mechanism QR code")
     dlg.setModal(True)
     layout = QVBoxLayout(dlg)
     label = QLabel(dlg)
     layout.addWidget(label)
     label.setPixmap(self.image)
     dlg.setFixedSize(self.image.size())
     dlg.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     dlg.show()
コード例 #4
0
            def show_tb(parent):
                tbdialog = QDialog(parent=parent.parent())
                tbdialog.setModal(True)
                # this is about the minimum width to not get rewrap
                # and the minimum height to not have scrollbar
                tbdialog.resize(650, 270)
                tbdialog.setLayout(QVBoxLayout())

                text = QTextEdit()
                text.setHtml(notification.as_html())
                text.setReadOnly(True)
                tbdialog.layout().addWidget(text)
                tbdialog.show()