[pyzo] 55/68: Better selection of default style (Qt5 drops cleanlooks, but has Fusion)
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Sep 28 09:47:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository pyzo.
commit 63855a881646b07509572cce9a7955f4e4034acd
Author: Almar Klein <almar.klein at gmail.com>
Date: Mon Sep 26 12:28:36 2016 +0200
Better selection of default style (Qt5 drops cleanlooks, but has Fusion)
---
pyzo/core/main.py | 26 +++++++++-----------------
pyzo/core/menu.py | 2 +-
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/pyzo/core/main.py b/pyzo/core/main.py
index c5ddc0b..cb0403d 100644
--- a/pyzo/core/main.py
+++ b/pyzo/core/main.py
@@ -19,6 +19,7 @@ from queue import Queue, Empty
import pyzo
from pyzo.core.icons import IconArtist
from pyzo.core import commandline
+from pyzo.util import qt
from pyzo.util.qt import QtCore, QtGui, QtWidgets
from pyzo.core.splash import SplashWidget
from pyzo.util import paths
@@ -292,7 +293,7 @@ class MainWindow(QtWidgets.QMainWindow):
If bool(stylename) evaluates to False will use the default style
for this system. Returns the QStyle instance.
"""
-
+
if stylename is None:
# Initialize
@@ -302,11 +303,13 @@ class MainWindow(QtWidgets.QMainWindow):
# Obtain default style name
pyzo.defaultQtStyleName = str(QtWidgets.qApp.style().objectName())
- # Other than gtk+ and mac, cleanlooks looks best (in my opinion)
+ # Other than gtk+ and mac, Fusion/Cleanlooks looks best (in my opinion)
if 'gtk' in pyzo.defaultQtStyleName.lower():
pass # Use default style
elif 'macintosh' in pyzo.defaultQtStyleName.lower():
pass # Use default style
+ elif qt.QT_VERSION > '5':
+ pyzo.defaultQtStyleName = 'Fusion'
else:
pyzo.defaultQtStyleName = 'Cleanlooks'
@@ -317,29 +320,18 @@ class MainWindow(QtWidgets.QMainWindow):
# Init
if not stylename:
stylename = pyzo.config.view.qtstyle
- useStandardStyle = False
- stylename2 = stylename
-
- # Handle special cleanlooks style
- if stylename.lower().startswith('cleanlooks'):
- stylename2 = stylename.rstrip('+')
- if stylename2 != stylename:
- useStandardStyle = True
# Check if this style exist, set to default otherwise
styleNames = [name.lower() for name in QtWidgets.QStyleFactory.keys()]
- if stylename2.lower() not in styleNames:
- stylename2 = pyzo.defaultQtStyleName
+ if stylename.lower() not in styleNames:
+ stylename = pyzo.defaultQtStyleName
# Try changing the style
- qstyle = QtWidgets.qApp.setStyle(stylename2)
+ qstyle = QtWidgets.qApp.setStyle(stylename)
# Set palette
if qstyle:
- if useStandardStyle:
- QtWidgets.qApp.setPalette(QtWidgets.QStyle.standardPalette(qstyle))
- else:
- QtWidgets.qApp.setPalette(QtWidgets.qApp.nativePalette)
+ QtWidgets.qApp.setPalette(QtWidgets.qApp.nativePalette)
# Done
return qstyle
diff --git a/pyzo/core/menu.py b/pyzo/core/menu.py
index c130f8e..9c2cb4e 100644
--- a/pyzo/core/menu.py
+++ b/pyzo/core/menu.py
@@ -726,7 +726,7 @@ class ViewMenu(Menu):
# Create qt theme menu
t = translate("menu", "Qt theme ::: The styling of the user interface widgets.")
self._qtThemeMenu = GeneralOptionsMenu(self, t, self._setQtTheme)
- styleNames = list(QtWidgets.QStyleFactory.keys()) + ['Cleanlooks+']
+ styleNames = list(QtWidgets.QStyleFactory.keys())
styleNames.sort()
titles = [name for name in styleNames]
styleNames = [name.lower() for name in styleNames]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyzo.git
More information about the debian-science-commits
mailing list