Position the close button on right for Linux and macOS
This commit is contained in:
parent
23f53431c2
commit
870c9fc72c
|
|
@ -16,6 +16,9 @@ else:
|
||||||
pipe_path = '/tmp/oneshot-pipe'
|
pipe_path = '/tmp/oneshot-pipe'
|
||||||
documents_path = os.path.expanduser('~/Documents')
|
documents_path = os.path.expanduser('~/Documents')
|
||||||
|
|
||||||
|
left_close = False
|
||||||
|
if sys.platform == "darwin": left_close = True
|
||||||
|
|
||||||
try: base_path = sys._MEIPASS
|
try: base_path = sys._MEIPASS
|
||||||
except AttributeError: base_path = os.path.abspath('.')
|
except AttributeError: base_path = os.path.abspath('.')
|
||||||
|
|
||||||
|
|
@ -62,6 +65,7 @@ class Journal(QWidget):
|
||||||
|
|
||||||
self.close_label = QLabel(self)
|
self.close_label = QLabel(self)
|
||||||
self.close_label.setPixmap(QPixmap(os.path.join(base_path, 'images', 'close.png')))
|
self.close_label.setPixmap(QPixmap(os.path.join(base_path, 'images', 'close.png')))
|
||||||
|
if not left_close: self.close_label.move(776, 0) # X = 800-24
|
||||||
|
|
||||||
if "linux" in sys.platform: self.setWindowFlags(Qt.FramelessWindowHint)
|
if "linux" in sys.platform: self.setWindowFlags(Qt.FramelessWindowHint)
|
||||||
else: self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
else: self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
|
||||||
|
|
@ -77,7 +81,7 @@ class Journal(QWidget):
|
||||||
self.mousedown = True
|
self.mousedown = True
|
||||||
self.mousedownpos = event.pos()
|
self.mousedownpos = event.pos()
|
||||||
|
|
||||||
if self.mousedownpos.x() <= 24 and self.mousedownpos.y() < 24:
|
if ((left_close and self.mousedownpos.x() <= 24) or (not left_close and self.mousedownpos.x() >= 776)) and self.mousedownpos.y() < 24:
|
||||||
self.app.quit()
|
self.app.quit()
|
||||||
|
|
||||||
def mouseReleaseEvent(self, event):
|
def mouseReleaseEvent(self, event):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue