MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / DebugTextDialog

Class DebugTextDialog

deeplabcut/gui/dialogs/debug_dialog.py:86–201  ·  view source on GitHub ↗

Minimal, application-agnostic debug text viewer. This widget only knows how to: - fetch text from a callable - display it read-only - copy it to clipboard - refresh it on demand It intentionally knows nothing about: - recorder internals - DLC main window intern

Source from the content-addressed store, hash-verified

84
85
86class DebugTextDialog(QDialog):
87 """
88 Minimal, application-agnostic debug text viewer.
89
90 This widget only knows how to:
91 - fetch text from a callable
92 - display it read-only
93 - copy it to clipboard
94 - refresh it on demand
95
96 It intentionally knows nothing about:
97 - recorder internals
98 - DLC main window internals
99 - environment/report formatting
100 """
101
102 def __init__(
103 self,
104 *,
105 title: str,
106 text_provider: Callable[[], str],
107 parent: QWidget | None = None,
108 initial_hint: str = "Read-only diagnostic output",
109 ) -> None:
110 super().__init__(parent=parent)
111 self.setWindowTitle(title)
112 self.setModal(False)
113 self.resize(950, 700)
114
115 self._text_provider = text_provider
116
117 self._build_ui(initial_hint=initial_hint)
118
119 def update_content(
120 self,
121 *,
122 title: str | None = None,
123 text_provider: Callable[[], str] | None = None,
124 hint: str | None = None,
125 ) -> None:
126 """Update dialog metadata when reusing an existing instance."""
127 if title is not None:
128 self.setWindowTitle(title)
129 if text_provider is not None:
130 self._text_provider = text_provider
131 if hint is not None:
132 self._hint_label.setText(hint)
133
134 def _build_ui(self, *, initial_hint: str) -> None:
135 layout = QVBoxLayout(self)
136
137 self._hint_label = QLabel(initial_hint, self)
138 self._hint_label.setTextInteractionFlags(Qt.TextSelectableByMouse)
139 layout.addWidget(self._hint_label)
140
141 self._text_edit = QPlainTextEdit(self)
142 self._text_edit.setReadOnly(True)
143 self._text_edit.setLineWrapMode(QPlainTextEdit.NoWrap)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected