mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
...
This commit is contained in:
parent
ef52227523
commit
9d5955ec58
@ -103,10 +103,10 @@ class edittext(closeashidewindow):
|
|||||||
class edittrans(QMainWindow):
|
class edittrans(QMainWindow):
|
||||||
rssignal = pyqtSignal(QSize)
|
rssignal = pyqtSignal(QSize)
|
||||||
mvsignal = pyqtSignal(QPoint)
|
mvsignal = pyqtSignal(QPoint)
|
||||||
|
swsignal = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent, Qt.FramelessWindowHint)
|
super().__init__(parent, Qt.FramelessWindowHint)
|
||||||
self.setupUi()
|
|
||||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
self.setStyleSheet(
|
self.setStyleSheet(
|
||||||
"background-color: rgba(%s, %s, %s, %s)"
|
"background-color: rgba(%s, %s, %s, %s)"
|
||||||
@ -117,21 +117,30 @@ class edittrans(QMainWindow):
|
|||||||
globalconfig["transparent"],
|
globalconfig["transparent"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
self.setupUi()
|
||||||
|
|
||||||
self.rssignal.connect(self.resize)
|
self.rssignal.connect(self.resize)
|
||||||
self.mvsignal.connect(self.move)
|
self.mvsignal.connect(self.move)
|
||||||
|
self.swsignal.connect(self.show)
|
||||||
self.trykeeppos()
|
self.trykeeppos()
|
||||||
|
|
||||||
def trykeeppos(self):
|
def trykeeppos(self):
|
||||||
self.followhwnd = gobject.baseobject.textsource.hwnd
|
self.followhwnd = gobject.baseobject.textsource.hwnd
|
||||||
|
rect = windows.GetWindowRect(self.followhwnd)
|
||||||
|
if rect is None:
|
||||||
|
raise
|
||||||
self.follow()
|
self.follow()
|
||||||
self.show()
|
|
||||||
|
|
||||||
@threader
|
@threader
|
||||||
def follow(self):
|
def follow(self):
|
||||||
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
rect = windows.GetWindowRect(self.followhwnd)
|
rect = windows.GetWindowRect(self.followhwnd)
|
||||||
self.mvsignal.emit((QPoint(rect[0], rect[3])) / self.devicePixelRatioF())
|
self.mvsignal.emit((QPoint(rect[0], rect[3])) / self.devicePixelRatioF())
|
||||||
self.rssignal.emit((QSize(rect[2] - rect[0], 1)) / self.devicePixelRatioF())
|
self.rssignal.emit((QSize(rect[2] - rect[0], 1)) / self.devicePixelRatioF())
|
||||||
|
if i == 0:
|
||||||
|
self.swsignal.emit()
|
||||||
|
i += 1
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user