calculate window geometry does not retun tray position but middle of parent screen or active screen

This commit is contained in:
iLLiCiTiT 2019-08-21 16:29:21 +02:00
parent ae3496ceea
commit a0726d8bcc

View file

@ -124,6 +124,26 @@ class Popup2(Popup):
fix = self.widgets["show"]
fix.setText("Fix")
def calculate_window_geometry(self):
"""Respond to status changes
On creation, align window with screen bottom right.
"""
parent_widget = self.parent()
app = QtWidgets.QApplication.instance()
if parent_widget:
screen = app.desktop().screenNumber(parent_widget)
else:
screen = app.desktop().screenNumber(app.desktop().cursor().pos())
center_point = app.desktop().screenGeometry(screen).center()
frame_geo = self.frameGeometry()
frame_geo.moveCenter(center_point)
return frame_geo
@contextlib.contextmanager
def application():