mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
timer
This commit is contained in:
parent
f7384a43aa
commit
531253a5fa
@ -102,17 +102,11 @@ class edittext(saveposwindow):
|
|||||||
|
|
||||||
@Singleton_close
|
@Singleton_close
|
||||||
class edittrans(QMainWindow):
|
class edittrans(QMainWindow):
|
||||||
rssignal = pyqtSignal(QSize)
|
|
||||||
mvsignal = pyqtSignal(QPoint)
|
|
||||||
swsignal = pyqtSignal()
|
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent, Qt.WindowType.FramelessWindowHint)
|
super().__init__(parent, Qt.WindowType.FramelessWindowHint)
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
|
self.idx = 0
|
||||||
self.rssignal.connect(self.resize)
|
|
||||||
self.mvsignal.connect(self.move)
|
|
||||||
self.swsignal.connect(self.show)
|
|
||||||
self.trykeeppos()
|
self.trykeeppos()
|
||||||
|
|
||||||
def trykeeppos(self):
|
def trykeeppos(self):
|
||||||
@ -120,19 +114,20 @@ class edittrans(QMainWindow):
|
|||||||
rect = windows.GetWindowRect(self.followhwnd)
|
rect = windows.GetWindowRect(self.followhwnd)
|
||||||
if rect is None:
|
if rect is None:
|
||||||
raise
|
raise
|
||||||
self.follow()
|
t = QTimer(self)
|
||||||
|
t.setInterval(100)
|
||||||
|
t.timeout.connect(self.follow)
|
||||||
|
t.start(0)
|
||||||
|
|
||||||
@threader
|
|
||||||
def follow(self):
|
def follow(self):
|
||||||
i = 0
|
rect = windows.GetWindowRect(self.followhwnd)
|
||||||
while True:
|
if rect is None:
|
||||||
rect = windows.GetWindowRect(self.followhwnd)
|
return
|
||||||
self.mvsignal.emit((QPoint(rect[0], rect[3])) / self.devicePixelRatioF())
|
self.move((QPoint(rect[0], rect[3])) / self.devicePixelRatioF())
|
||||||
self.rssignal.emit((QSize(rect[2] - rect[0], 1)) / self.devicePixelRatioF())
|
self.resize((QSize(rect[2] - rect[0], 1)) / self.devicePixelRatioF())
|
||||||
if i == 0:
|
if self.idx == 0:
|
||||||
self.swsignal.emit()
|
self.show()
|
||||||
i += 1
|
self.idx += 1
|
||||||
time.sleep(0.3)
|
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setWindowIcon(qtawesome.icon("fa.edit"))
|
self.setWindowIcon(qtawesome.icon("fa.edit"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user