core.py 895 B

12345678910111213141516171819202122232425262728293031
  1. from __future__ import annotations
  2. from PyQt6 import uic
  3. from PyQt6.QtWidgets import QPlainTextEdit, QWidget
  4. class MainWindowCoreMixin:
  5. def _load_tab_into_container(self, tab_ui_path: str, container_layout) -> QWidget:
  6. w = QWidget(self)
  7. uic.loadUi(tab_ui_path, w)
  8. container_layout.addWidget(w)
  9. return w
  10. def log(self, msg: str) -> None:
  11. try:
  12. self.scan.pteScanLog.appendPlainText(msg)
  13. except Exception:
  14. pass
  15. try:
  16. self.statusbar.showMessage(msg, 4000)
  17. except Exception:
  18. pass
  19. def spec_log(self, msg: str) -> None:
  20. if hasattr(self, "pteAnalysisLog") and isinstance(self.pteAnalysisLog, QPlainTextEdit):
  21. self.pteAnalysisLog.appendPlainText(msg)
  22. try:
  23. self.statusbar.showMessage(msg, 4000)
  24. except Exception:
  25. pass