summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2019-02-05 19:45:36 +0100
committerPapoteur <papoteur@mageia.org>2019-02-05 19:45:36 +0100
commit39da9160e12dc30ad1c37efa5d7d84977bb7b146 (patch)
treeb422cd6a5f01b35e5c72b90231978e11bf76b91f
parent708f51d4c078c5360d50c4e5995129891c3d551b (diff)
downloadmageiawelcome-39da9160e12dc30ad1c37efa5d7d84977bb7b146.tar
mageiawelcome-39da9160e12dc30ad1c37efa5d7d84977bb7b146.tar.gz
mageiawelcome-39da9160e12dc30ad1c37efa5d7d84977bb7b146.tar.bz2
mageiawelcome-39da9160e12dc30ad1c37efa5d7d84977bb7b146.tar.xz
mageiawelcome-39da9160e12dc30ad1c37efa5d7d84977bb7b146.zip
Center the window at launch
-rw-r--r--qml/mageiawelcome.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py
index c7a320d..3931e99 100644
--- a/qml/mageiawelcome.py
+++ b/qml/mageiawelcome.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-from PyQt5.QtGui import QGuiApplication, QIcon
+from PyQt5.QtGui import QGuiApplication, QIcon, QScreen
from PyQt5.QtQuick import QQuickView
from PyQt5.QtCore import QUrl, QLocale, QTranslator, QLibraryInfo, QVariant, QAbstractListModel, \
QModelIndex, Qt, QObject, pyqtSlot, pyqtSignal, QCoreApplication
@@ -165,6 +165,11 @@ if __name__ == '__main__':
view.setResizeMode(QQuickView.SizeRootObjectToView)
view.setTitle(app.translate('app',"Welcome to Mageia"))
app.setWindowIcon(QIcon("icons/32x32/apps/mageiawelcome.png"))
+ screen = app.primaryScreen()
+ defaultHeight = 700 * screen.devicePixelRatio()
+ defaultWidth = 1000 * screen.devicePixelRatio()
+ centerPoint = screen.availableGeometry().center()
+ view.setGeometry(centerPoint.x() -defaultWidth/2, centerPoint.y() - defaultHeight/2, defaultWidth,defaultHeight)
cb = Callbrowser()
la = Launcher()
us = username()