mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Add close button (WIP) to journal
This commit is contained in:
parent
8443907f74
commit
bdb307fba9
2 changed files with 10 additions and 1 deletions
BIN
journal/unix/images/close.png
Normal file
BIN
journal/unix/images/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 465 B |
|
|
@ -49,6 +49,9 @@ class AnimationTimer(QThread):
|
|||
|
||||
class Journal(QWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.app = kwargs['app']
|
||||
del kwargs['app']
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.mousedown = False
|
||||
|
|
@ -57,6 +60,9 @@ class Journal(QWidget):
|
|||
self.label = QLabel(self)
|
||||
self.change_image('default_en')
|
||||
|
||||
self.close_label = QLabel(self)
|
||||
self.close_label.setPixmap(QPixmap(os.path.join(base_path, 'images', 'close.png')))
|
||||
|
||||
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
|
||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
self.setMouseTracking(True)
|
||||
|
|
@ -70,6 +76,9 @@ class Journal(QWidget):
|
|||
self.mousedown = True
|
||||
self.mousedownpos = event.pos()
|
||||
|
||||
if self.mousedownpos.x() <= 24 and self.mousedownpos.y() < 24:
|
||||
self.app.quit()
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
self.mousedown = False
|
||||
|
||||
|
|
@ -142,7 +151,7 @@ if __name__ == '__main__':
|
|||
|
||||
else:
|
||||
# Author's Journal mode
|
||||
journal = Journal()
|
||||
journal = Journal(app = app)
|
||||
save_path = os.path.join(documents_path, 'Oneshot', 'save_progress.oneshot')
|
||||
if os.path.exists(save_path):
|
||||
with open(save_path, 'rb') as save:
|
||||
|
|
|
|||
Loading…
Reference in a new issue