mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #313 from pypeclub/feature/235-Changed_context_pop-up_should_appear_in_the_middle
feature/235-Changed_context_pop-up_should_appear_in_the_middle
This commit is contained in:
commit
3defe2dc3f
1 changed files with 13 additions and 0 deletions
|
|
@ -52,6 +52,19 @@ def message(title=None, message=None, level="info", parent=None):
|
|||
app = parent
|
||||
if not app:
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
ex = Window(app, title, message, level)
|
||||
ex.show()
|
||||
|
||||
# Move widget to center of screen
|
||||
try:
|
||||
desktop_rect = QtWidgets.QApplication.desktop().availableGeometry(ex)
|
||||
center = desktop_rect.center()
|
||||
ex.move(
|
||||
center.x() - (ex.width() * 0.5),
|
||||
center.y() - (ex.height() * 0.5)
|
||||
)
|
||||
except Exception:
|
||||
# skip all possible issues that may happen feature is not crutial
|
||||
log.warning("Couldn't center message.", exc_info=True)
|
||||
# sys.exit(app.exec_())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue