This commit is contained in:
恍兮惚兮 2024-05-21 12:45:02 +08:00
parent 08025c8ece
commit 9f0b592db0
7 changed files with 11 additions and 25 deletions

View File

@ -1,6 +1,6 @@
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QTextBrowser, QPlainTextEdit,
QAction, QAction,
QMenu, QMenu,
QHBoxLayout, QHBoxLayout,
@ -32,7 +32,7 @@ class edittext(closeashidewindow):
def setupUi(self): def setupUi(self):
self.setWindowIcon(qtawesome.icon("fa.edit")) self.setWindowIcon(qtawesome.icon("fa.edit"))
self.textOutput = QTextBrowser(self) self.textOutput = QPlainTextEdit(self)
self.textOutput.setContextMenuPolicy(Qt.CustomContextMenu) self.textOutput.setContextMenuPolicy(Qt.CustomContextMenu)
@ -42,7 +42,6 @@ class edittext(closeashidewindow):
self.textOutput.setUndoRedoEnabled(True) self.textOutput.setUndoRedoEnabled(True)
self.textOutput.setReadOnly(False) self.textOutput.setReadOnly(False)
self.textOutput.setObjectName("textOutput")
qv = QHBoxLayout() qv = QHBoxLayout()
w = QWidget() w = QWidget()

View File

@ -419,10 +419,6 @@ class postconfigdialog_(QDialog):
lb.setText(_TR(key)) lb.setText(_TR(key))
formLayout.addWidget(lb) formLayout.addWidget(lb)
# lines=QTextEdit(self)
# lines.setPlainText('\n'.join(configdict[key]))
# lines.textChanged.connect(lambda :configdict.__setitem__(key,lines.toPlainText().split('\n')))
# formLayout.addWidget(lines)
model = QStandardItemModel(len(configdict[key]), 1, self) model = QStandardItemModel(len(configdict[key]), 1, self)
row = 0 row = 0

View File

@ -2,7 +2,7 @@ import functools
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QHBoxLayout, QHBoxLayout,
QTextEdit, QPlainTextEdit,
QHBoxLayout, QHBoxLayout,
QWidget, QWidget,
QMenu, QMenu,
@ -79,8 +79,8 @@ def setTab7(self):
def getcomparelayout(self): def getcomparelayout(self):
layout = QHBoxLayout() layout = QHBoxLayout()
fromtext = QTextEdit() fromtext =QPlainTextEdit()
totext = QTextEdit() totext = QPlainTextEdit()
solvebutton = getcolorbutton( solvebutton = getcolorbutton(
globalconfig, globalconfig,
"", "",

View File

@ -8,7 +8,6 @@ from PyQt5.QtWidgets import (
QFormLayout, QFormLayout,
QSizePolicy, QSizePolicy,
QPushButton, QPushButton,
QTextEdit,
QTabWidget, QTabWidget,
QFileDialog, QFileDialog,
QTabBar, QTabBar,
@ -459,7 +458,7 @@ class AnkiWindow(QWidget):
self.viewimagelabel = QLabel() self.viewimagelabel = QLabel()
self.editpath.textChanged.connect(self.wrappedpixmap) self.editpath.textChanged.connect(self.wrappedpixmap)
self.example = QPlainTextEdit() self.example = QPlainTextEdit()
self.remarks = QTextEdit() self.remarks = QPlainTextEdit()
recordbtn1 = statusbutton(icons=["fa.microphone", "fa.stop"], colors=[""]) recordbtn1 = statusbutton(icons=["fa.microphone", "fa.stop"], colors=[""])
recordbtn1.statuschanged1.connect( recordbtn1.statuschanged1.connect(
functools.partial(self.startorendrecord, "1", self.audiopath) functools.partial(self.startorendrecord, "1", self.audiopath)

View File

@ -247,7 +247,6 @@ class Textbrowser:
self.jiaming_y_delta = 0 self.jiaming_y_delta = 0
self.setselectable() self.setselectable()
self.blockcount = 0 self.blockcount = 0
self.needdouble = False
self.iteryinyinglabelsave = {} self.iteryinyinglabelsave = {}
def setselectable(self): def setselectable(self):
@ -331,10 +330,6 @@ class Textbrowser:
self.textbrowser.insertPlainText(text) self.textbrowser.insertPlainText(text)
def deletebetween(self, p1, p2): def deletebetween(self, p1, p2):
if self.needdouble:
self.textcursorback.setPosition(p1, QTextCursor.MoveAnchor)
self.textcursorback.setPosition(p2, QTextCursor.KeepAnchor)
self.textcursorback.removeSelectedText()
self.textcursor.setPosition(p1, QTextCursor.MoveAnchor) self.textcursor.setPosition(p1, QTextCursor.MoveAnchor)
self.textcursor.setPosition(p2, QTextCursor.KeepAnchor) self.textcursor.setPosition(p2, QTextCursor.KeepAnchor)
self.textcursor.removeSelectedText() self.textcursor.removeSelectedText()

View File

@ -1,5 +1,4 @@
from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QPlainTextEdit, QAction, QMenu, QFileDialog
from PyQt5.QtWidgets import QTabWidget, QTextBrowser, QAction, QMenu, QFileDialog
from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtCore import Qt, pyqtSignal
import qtawesome, functools, winsharedutils import qtawesome, functools, winsharedutils
from gui.usefulwidget import closeashidewindow from gui.usefulwidget import closeashidewindow
@ -26,14 +25,13 @@ class transhist(closeashidewindow):
self.setWindowIcon(qtawesome.icon("fa.rotate-left")) self.setWindowIcon(qtawesome.icon("fa.rotate-left"))
def gettb(_type): def gettb(_type):
textOutput = QTextBrowser() textOutput = QPlainTextEdit()
textOutput.setContextMenuPolicy(Qt.CustomContextMenu) textOutput.setContextMenuPolicy(Qt.CustomContextMenu)
textOutput.customContextMenuRequested.connect( textOutput.customContextMenuRequested.connect(
functools.partial(self.showmenu, textOutput, _type) functools.partial(self.showmenu, textOutput, _type)
) )
textOutput.setUndoRedoEnabled(False) textOutput.setUndoRedoEnabled(False)
textOutput.setReadOnly(True) textOutput.setReadOnly(True)
textOutput.setObjectName("textOutput")
return textOutput return textOutput
self.textOutput = gettb(1) self.textOutput = gettb(1)
@ -76,14 +74,14 @@ class transhist(closeashidewindow):
def getnewsentence(self, sentence): def getnewsentence(self, sentence):
sentence = "<hr>" if globalconfig["hist_split"] else "\n" + sentence sentence = "\n" + sentence
if self.hiderawflag: if self.hiderawflag:
sentence = "" sentence = ""
self.textOutput.append(sentence) self.textOutput.appendPlainText(sentence)
def getnewtrans(self, api, sentence): def getnewtrans(self, api, sentence):
if self.hideapiflag: if self.hideapiflag:
res = sentence res = sentence
else: else:
res = api + " " + sentence res = api + " " + sentence
self.textOutput.append(res) self.textOutput.appendPlainText(res)

View File

@ -68,7 +68,6 @@
"arabic_reshaper": false "arabic_reshaper": false
}, },
"uselongtermcache": false, "uselongtermcache": false,
"hist_split": false,
"fixedheight": false, "fixedheight": false,
"showintab": true, "showintab": true,
"remove_useless_hook": false, "remove_useless_hook": false,