diff options
Diffstat (limited to 'qml/mageiawelcome.py')
-rw-r--r-- | qml/mageiawelcome.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/qml/mageiawelcome.py b/qml/mageiawelcome.py index f19a49f..415c70f 100644 --- a/qml/mageiawelcome.py +++ b/qml/mageiawelcome.py @@ -43,6 +43,15 @@ class ConfList(QAbstractListModel): desktop = get_desktop_name2(os.getenv("XDG_CURRENT_DESKTOP")) if desktop == 'unknown': desktop = os.getenv("XDG_CURRENT_DESKTOP") + self.screen_factor = 0.0 + if desktop == 'Gnome Wayland': + from gi.repository.Gio import Settings + gso = Settings.new("org.gnome.desktop.interface") + val = gso.get_uint("scaling-factor") + if val == 0: + self.screen_factor = 1.0 + else: + self.screen_factor = float(val) # Search active network connections net = QNetworkConfigurationManager() @@ -68,6 +77,15 @@ class ConfList(QAbstractListModel): else: self.configuration.append({'name': translate('ConfList',"You have no network connection")}) + def factor(self, app): + ''' + Determine screen factor + Can be specific for Gnome Wayland + ''' + if self.screen_factor == 0 : + screen = app.primaryScreen() + self.screen_factor = screen.devicePixelRatio() + return self.screen_factor def data(self, index, role=Qt.DisplayRole): row = index.row() @@ -165,11 +183,6 @@ if __name__ == '__main__': view.setResizeMode(QQuickView.SizeRootObjectToView) view.setTitle(app.translate('app',"Welcome to Mageia")) app.setWindowIcon(QIcon("/usr/share/mageiawelcome/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() @@ -177,6 +190,12 @@ if __name__ == '__main__': cl = ConfList() nr = Norun() sc = nr.startupcheck() + factor = cl.factor(app) + screen = app.primaryScreen() + defaultHeight = 700 * factor + defaultWidth = 1000 * factor + centerPoint = screen.availableGeometry().center() + view.setGeometry(centerPoint.x() -defaultWidth/2, centerPoint.y() - defaultHeight/2, defaultWidth,defaultHeight) view.rootContext().setContextProperty('link', cb) view.rootContext().setContextProperty('launch', la) view.rootContext().setContextProperty('user', us) |