mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
smooth
This commit is contained in:
parent
b01c0c1980
commit
e996c2f40b
@ -255,7 +255,6 @@ class TranslatorWindow(resizableframeless):
|
|||||||
hidesignal = pyqtSignal()
|
hidesignal = pyqtSignal()
|
||||||
muteprocessignal = pyqtSignal()
|
muteprocessignal = pyqtSignal()
|
||||||
ocr_once_signal = pyqtSignal()
|
ocr_once_signal = pyqtSignal()
|
||||||
resizesignal = pyqtSignal(QSize)
|
|
||||||
move_signal = pyqtSignal(QPoint)
|
move_signal = pyqtSignal(QPoint)
|
||||||
closesignal = pyqtSignal()
|
closesignal = pyqtSignal()
|
||||||
hotkeyuse_selectprocsignal = pyqtSignal()
|
hotkeyuse_selectprocsignal = pyqtSignal()
|
||||||
@ -447,7 +446,6 @@ class TranslatorWindow(resizableframeless):
|
|||||||
self.hidesignal.emit()
|
self.hidesignal.emit()
|
||||||
self.autohidestart = False
|
self.autohidestart = False
|
||||||
|
|
||||||
|
|
||||||
def showhideui(self):
|
def showhideui(self):
|
||||||
if self._move_drag:
|
if self._move_drag:
|
||||||
return
|
return
|
||||||
@ -909,7 +907,6 @@ class TranslatorWindow(resizableframeless):
|
|||||||
|
|
||||||
self.muteprocessignal.connect(self.muteprocessfuntion)
|
self.muteprocessignal.connect(self.muteprocessfuntion)
|
||||||
self.toolbarhidedelaysignal.connect(self.toolbarhidedelay)
|
self.toolbarhidedelaysignal.connect(self.toolbarhidedelay)
|
||||||
self.resizesignal.connect(self.resize)
|
|
||||||
self.move_signal.connect(self.move)
|
self.move_signal.connect(self.move)
|
||||||
self.closesignal.connect(self.close)
|
self.closesignal.connect(self.close)
|
||||||
self.changeshowhiderawsig.connect(self.changeshowhideraw)
|
self.changeshowhiderawsig.connect(self.changeshowhideraw)
|
||||||
@ -940,6 +937,9 @@ class TranslatorWindow(resizableframeless):
|
|||||||
self.titlebar.setObjectName("titlebar")
|
self.titlebar.setObjectName("titlebar")
|
||||||
self.titlebar.setMouseTracking(True)
|
self.titlebar.setMouseTracking(True)
|
||||||
self.addbuttons()
|
self.addbuttons()
|
||||||
|
self.smooth_resizer = QVariantAnimation(self)
|
||||||
|
self.smooth_resizer.setDuration(500)
|
||||||
|
self.smooth_resizer.valueChanged.connect(self.smooth_resizing)
|
||||||
self.translate_text = Textbrowser(self)
|
self.translate_text = Textbrowser(self)
|
||||||
self.translate_text.move(0, 0)
|
self.translate_text.move(0, 0)
|
||||||
self.translate_text.contentsChanged.connect(self.textAreaChanged)
|
self.translate_text.contentsChanged.connect(self.textAreaChanged)
|
||||||
@ -1200,6 +1200,9 @@ class TranslatorWindow(resizableframeless):
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def smooth_resizing(self, value):
|
||||||
|
self.resize(QSize(self.width(), value))
|
||||||
|
|
||||||
def textAreaChanged(self, size: QSize):
|
def textAreaChanged(self, size: QSize):
|
||||||
|
|
||||||
if self.translate_text.cleared:
|
if self.translate_text.cleared:
|
||||||
@ -1209,19 +1212,13 @@ class TranslatorWindow(resizableframeless):
|
|||||||
limit = min(size.height(), self.screen().geometry().height())
|
limit = min(size.height(), self.screen().geometry().height())
|
||||||
newHeight = limit + self.dynamicextraheight()
|
newHeight = limit + self.dynamicextraheight()
|
||||||
size = QSize(self.width(), newHeight)
|
size = QSize(self.width(), newHeight)
|
||||||
self.autoresizesig = uuid.uuid4()
|
self.smooth_resizer.stop()
|
||||||
if newHeight > self.height():
|
if newHeight > self.height():
|
||||||
self.resize(size)
|
self.resize(size)
|
||||||
else:
|
else:
|
||||||
self.delaymaybeshrink(size, self.autoresizesig)
|
self.smooth_resizer.setStartValue(self.height())
|
||||||
|
self.smooth_resizer.setEndValue(newHeight)
|
||||||
@threader
|
self.smooth_resizer.start()
|
||||||
def delaymaybeshrink(self, size: QSize, sig):
|
|
||||||
|
|
||||||
time.sleep(0.1)
|
|
||||||
if sig != self.autoresizesig:
|
|
||||||
return
|
|
||||||
self.resizesignal.emit(size)
|
|
||||||
|
|
||||||
def clickRange(self, auto):
|
def clickRange(self, auto):
|
||||||
if globalconfig["sourcestatus2"]["ocr"]["use"] == False:
|
if globalconfig["sourcestatus2"]["ocr"]["use"] == False:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user