diff --git a/py/LunaTranslator/gui/transhist.py b/py/LunaTranslator/gui/transhist.py index 62693449..014a6d52 100644 --- a/py/LunaTranslator/gui/transhist.py +++ b/py/LunaTranslator/gui/transhist.py @@ -35,11 +35,18 @@ class transhist(closeashidewindow): ) textOutput.setUndoRedoEnabled(False) textOutput.setReadOnly(True) - self.textOutput = textOutput + self.setf() self.setCentralWidget(self.textOutput) - - + def setf(self): + key = "histfont" + fontstring = globalconfig.get(key, "") + if fontstring: + _f = QFont() + _f.fromString(fontstring) + _style = "font-size:{}pt;".format(_f.pointSize()) + _style += 'font-family:"{}";'.format(_f.family()) + self.textOutput.setStyleSheet(_style) def showmenu(self, tb, p): menu = QMenu(self) qingkong = LAction("清空") @@ -55,12 +62,14 @@ class transhist(closeashidewindow): hidetime.setCheckable(True) hidetime.setChecked(not self.hidetime) scrolltoend = LAction("滚动到最后") + font = LAction("字体") if len(self.textOutput.textCursor().selectedText()): menu.addAction(copy) menu.addSeparator() menu.addAction(qingkong) menu.addAction(baocun) menu.addAction(scrolltoend) + menu.addAction(font) menu.addSeparator() menu.addAction(hideshowraw) menu.addAction(hideshowapi) @@ -80,6 +89,16 @@ class transhist(closeashidewindow): elif action == hideshowraw: self.hiderawflag = not self.hiderawflag self.refresh() + elif action == font: + f = QFont() + cur = globalconfig.get("histfont") + if cur: + f.fromString(cur) + font, ok = QFontDialog.getFont(f, self) + if ok: + _s = font.toString() + globalconfig["histfont"] = _s + self.setf() elif action == hidetime: self.hidetime = not self.hidetime self.refresh() diff --git a/py/files/LunaTranslator_qss b/py/files/LunaTranslator_qss index 8ec34b62..fcd8313f 160000 --- a/py/files/LunaTranslator_qss +++ b/py/files/LunaTranslator_qss @@ -1 +1 @@ -Subproject commit 8ec34b620b26ba79e33e7004f2b9183c3b8077a4 +Subproject commit fcd8313f123f0d9c26e91bf7dc97771ef15ea063 diff --git a/py/files/defaultconfig/static_data.json b/py/files/defaultconfig/static_data.json index 2cab9efb..01c699ec 100644 --- a/py/files/defaultconfig/static_data.json +++ b/py/files/defaultconfig/static_data.json @@ -5,21 +5,9 @@ "file": "PyQtDarkTheme/dark.py", "name": "PyQtDarkTheme" }, - { - "file": "QDarkStyleSheet/dark.py", - "name": "QDarkStyleSheet" - }, { "file": "QTWin11/dark.py", "name": "QTWin11" - }, - { - "file": "QtVSCodeStyle/dark.py", - "name": "QtVSCodeStyle Dark" - }, - { - "file": "qt_material/dark.py", - "name": "qt-material" } ], "light": [ @@ -27,21 +15,9 @@ "file": "PyQtDarkTheme/light.py", "name": "PyQtDarkTheme" }, - { - "file": "QDarkStyleSheet/light.py", - "name": "QDarkStyleSheet" - }, { "file": "QTWin11/light.py", "name": "QTWin11" - }, - { - "file": "QtVSCodeStyle/light.py", - "name": "QtVSCodeStyle Light" - }, - { - "file": "qt_material/light.py", - "name": "qt-material" } ] },