This commit is contained in:
恍兮惚兮 2024-05-29 13:43:37 +08:00
parent dab708894e
commit 7670fb498d
2 changed files with 4 additions and 22 deletions

View File

@ -112,24 +112,6 @@ class statusbutton(QPushButton):
self.seticon()
class autoremovelineedit(QLineEdit):
def check(self):
last = self.text()
if os.path.exists(last) and os.path.isfile(last):
norm_dir1 = os.path.normpath(last)
norm_dir2 = os.path.normpath(os.path.abspath("./cache"))
if norm_dir1.startswith(norm_dir2):
os.remove(last)
def setText(self, s):
self.check()
super().setText(s)
def clear(self):
self.check()
super().clear()
class AnkiWindow(QWidget):
__ocrsettext = pyqtSignal(str)
refreshhtml = pyqtSignal()
@ -489,11 +471,11 @@ class AnkiWindow(QWidget):
cropbutton = QPushButton(qtawesome.icon("fa.crop"), "")
cropbutton.clicked.connect(self.crop)
self.audiopath = autoremovelineedit()
self.audiopath = QLineEdit()
self.audiopath.setReadOnly(True)
self.audiopath_sentence = autoremovelineedit()
self.audiopath_sentence = QLineEdit()
self.audiopath_sentence.setReadOnly(True)
self.editpath = autoremovelineedit()
self.editpath = QLineEdit()
self.editpath.setReadOnly(True)
self.viewimagelabel = QLabel()
self.editpath.textChanged.connect(self.wrappedpixmap)

View File

@ -235,7 +235,7 @@ def screenshot(x1, y1, x2, y2, hwnd=None):
if hwnd:
_r = QApplication.instance().devicePixelRatio()
_dpi = windows.GetDpiForWindow(hwnd)
x1, y1, x2, y2 = (int(_ * 96 / _dpi / _r) for _ in (x1, y1, x2, y2))
x1, y1, x2, y2 = (int(_ * _dpi / 96 / _r) for _ in (x1, y1, x2, y2))
bs = winsharedutils.gdi_screenshot(x1, y1, x2, y2, hwnd)
pixmap = QPixmap()
if bs: