From 9a5d35304fb8ed1c7340ce9cf010f4aa8b2f8a28 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Mon, 13 May 2024 18:26:34 +0800 Subject: [PATCH] Fix app crash log not saved Signed-off-by: Loren Eteval --- Furious/Widget/Application.py | 3 +++ Furious/Window/LogViewerWindow.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/Furious/Widget/Application.py b/Furious/Widget/Application.py index 701a973..f55cc0d 100644 --- a/Furious/Widget/Application.py +++ b/Furious/Widget/Application.py @@ -225,6 +225,9 @@ class Application(ApplicationFactory, SingletonApplication): ) logging.raiseExceptions = False + def log(self): + return self.logViewerWindowApp_.plainText() + def addCustomFont(self): fontFile = str(DATA_DIR / 'font' / 'CascadiaMono') fontName = 'Cascadia Mono' diff --git a/Furious/Window/LogViewerWindow.py b/Furious/Window/LogViewerWindow.py index fc24666..268786a 100644 --- a/Furious/Window/LogViewerWindow.py +++ b/Furious/Window/LogViewerWindow.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import annotations + from Furious.QtFramework import * from Furious.QtFramework import gettext as _ @@ -176,6 +178,9 @@ class LogViewerWindow(AppQMainWindow): self.menuBar().addMenu(self._editMenu) self.menuBar().addMenu(self._viewMenu) + def plainText(self) -> str: + return self.textBrowser.toPlainText() + def appendLine(self, line: str): self.textBrowser.appendLine(line)