コード例 #1
0
class ResultsWindow(ChildToolWindow):
    def __init__(self, tool_instance, title, text="", **kwargs):
        super().__init__(tool_instance, title, statusbar=False, **kwargs)

        self._build_ui()

        self.results.setText(text)

    def _build_ui(self):
        layout = QVBoxLayout()

        self.results = QTextBrowser()
        font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
        self.results.setFont(font)
        layout.insertWidget(0, self.results, 1)

        self.ui_area.setLayout(layout)

        self.manage(None)
コード例 #2
0
class JobOutput(ChildToolWindow):
    def __init__(self, tool_instance, title, file=None, **kwargs):
        super().__init__(tool_instance, title, statusbar=False, **kwargs)

        self._build_ui()

        with open(file, "r") as f:
            lines = f.readlines()

        self.text.setText("".join(lines))

    def _build_ui(self):
        layout = QGridLayout()

        self.text = QTextBrowser()
        font = QFontDatabase.systemFont(QFontDatabase.FixedFont)
        self.text.setFont(font)
        layout.addWidget(self.text, 0, 0)

        self.ui_area.setLayout(layout)
        self.manage(None)