mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
...
This commit is contained in:
parent
dab708894e
commit
7670fb498d
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user