diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index d66aada0..e4b38079 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -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) diff --git a/LunaTranslator/LunaTranslator/myutils/hwnd.py b/LunaTranslator/LunaTranslator/myutils/hwnd.py index a06642c2..c0c6804f 100644 --- a/LunaTranslator/LunaTranslator/myutils/hwnd.py +++ b/LunaTranslator/LunaTranslator/myutils/hwnd.py @@ -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: