Skip to content

Commit

Permalink
将Yasumi窗口置顶
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXnneHang committed Jul 15, 2024
1 parent ee27ce8 commit eb7bd84
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
30 changes: 21 additions & 9 deletions MainWindowUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def __init__(self):
self.example_img_path = self.src_config["example"]
self.animation_play_path = self.src_config["play"]
self.animation_work_path = self.src_config["work"]
self.animation_path = self.animation_play_path

self.animation_play_thread = None
self.animation_work_thread = None


# Init UI
self.initUI()
Expand Down Expand Up @@ -121,7 +124,7 @@ def initUI(self):
# path=self.example_img_path,
# Pos=self.animation_pos)

self.start_drawgif_task()




Expand All @@ -142,12 +145,21 @@ def Draw_Image(self,Label,Pos,path=None,frame=None):
q_img = QImage(rgb_image.data, w, h, bytes_per_line, QImage.Format_RGB888)
pixmap = QPixmap.fromImage(q_img)
Label.setPixmap(pixmap)
def start_drawgif_task(self):
if not self.animation_play_thread or not self.animation_play_thread.isRunning():
self.animation_play_thread = DrawAnimationThread()
self.animation_play_thread.setup(path=self.animation_play_path,
label=self.animation_label,
pos=self.animation_pos,
frame_speed=30)
self.animation_play_thread.start()
def start_drawgif_task(self,action):
if action == "play":
if not self.animation_play_thread or not self.animation_play_thread.isRunning():
self.animation_play_thread = DrawAnimationThread()
self.animation_play_thread.setup(path=self.animation_path,
label=self.animation_label,
pos=self.animation_pos,
frame_speed=30)
self.animation_play_thread.start()
elif action == "work":
if not self.animation_work_thread or not self.animation_work_thread.isRunning():
self.animation_work_thread = DrawAnimationThread()
self.animation_work_thread.setup(path=self.animation_path,
label=self.animation_label,
pos=self.animation_pos,
frame_speed=30)
self.animation_work_thread.start()

2 changes: 2 additions & 0 deletions yasumi_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ def updateTimer(self):
self.timeLabel.setText("End!")
self.timerRunning = False
self.yasumi = yasumiWindow()
self.yasumi.setWindowIcon(QIcon(mainWindow.src_config["icon"]))
self.yasumi.show()
self.change_animation(action="play")
self.closeYasumi.singleShot(5*60*1000,self.yasumi.close)
else:
self.timeRemaining = self.timeRemaining.addSecs(-1)
Expand Down
2 changes: 1 addition & 1 deletion yasumi_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initUI(self):
self.setStyleSheet("background-color: white;") # 设置背景色为白色

# 隐藏最小化,关闭等按键
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowMinimizeButtonHint)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowMinimizeButtonHint|Qt.WindowStaysOnTopHint)
self.animation_label = QLabel(self)
self.animation_label.setGeometry(QtCore.QRect(0 ,
0,
Expand Down

0 comments on commit eb7bd84

Please sign in to comment.