← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~patrick-zakweb/openlp/bug-936281 into lp:openlp

 

mohij has proposed merging lp:~patrick-zakweb/openlp/bug-936281 into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~patrick-zakweb/openlp/bug-936281/+merge/133998

- Made fix configurable in advanced menu.
- Corrected " -> '
- Removed check for similarity of colors since it makes no sense when the option is configurable.
- Fixed a bug related to mix up of color systems.

Example screenshots:
ftp://ftp.gmerlin.de/pub/upload/without_fix_linux.png
ftp://ftp.gmerlin.de/pub/upload/with_fix_linux.png
ftp://ftp.gmerlin.de/pub/upload/without_fix_win.png
ftp://ftp.gmerlin.de/pub/upload/with_fix_win.png

On linux there is barely a difference noticeable, on windows the difference is obvious.

This partially fixes bug #936281.
Tested on Kubuntu 12.04 and Windows XP SP3.
-- 
https://code.launchpad.net/~patrick-zakweb/openlp/bug-936281/+merge/133998
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py	2012-11-11 21:16:14 +0000
+++ openlp/core/__init__.py	2012-11-12 22:28:20 +0000
@@ -60,7 +60,7 @@
 
 
 log = logging.getLogger()
-application_stylesheet = u"""
+nt_repair_stylesheet = u"""
 QMainWindow::separator
 {
   border: none;
@@ -128,8 +128,36 @@
             if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
                 Settings().setValue(u'general/has run wizard',
                     QtCore.QVariant(True))
+        # Correct stylesheet bugs
+        application_stylesheet = u''
+        stylesheet_fix = Settings().value(
+            u'advanced/stylesheet fix', QtCore.QVariant(False)).toBool()
+        if stylesheet_fix:
+            inactive_selected_color = self.palette().color(
+                QtGui.QPalette.Inactive, QtGui.QPalette.Highlight)
+            alternate_base_color = self.palette().color(QtGui.QPalette.Active,
+                QtGui.QPalette.AlternateBase)
+            base_color = self.palette().color(QtGui.QPalette.Active,
+                QtGui.QPalette.Base)
+            hue,  saturation,  value,  alpha = alternate_base_color.getHslF()
+            if base_color.lightness() < inactive_selected_color.lightness():
+                value = inactive_selected_color.lightnessF() - 0.2
+                if value < 0.0:
+                    value = 0.0
+            else:
+                value = inactive_selected_color.lightnessF() + 0.2
+                if value > 1.0:
+                    value = 1.0
+            alternate_base_color.setHslF(hue,  saturation,  value,  alpha)
+            alternate_background_repair_stylesheet = \
+            u'* {alternate-background-color: ' + \
+            alternate_base_color.name() + ';}\n'
+            application_stylesheet += alternate_background_repair_stylesheet
         if os.name == u'nt':
+            application_stylesheet += nt_repair_stylesheet
+        if application_stylesheet:
             self.setStyleSheet(application_stylesheet)
+        # show the splashscreen
         show_splash = Settings().value(
             u'general/show splash', QtCore.QVariant(True)).toBool()
         if show_splash:

=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py	2012-11-11 21:16:14 +0000
+++ openlp/core/ui/advancedtab.py	2012-11-12 22:28:20 +0000
@@ -284,14 +284,18 @@
         self.nextItemRadioButton.setObjectName(u'nextItemRadioButton')
         self.slideLayout.addWidget(self.nextItemRadioButton)
         self.rightLayout.addWidget(self.slideGroupBox)
-        self.x11GroupBox = QtGui.QGroupBox(self.leftColumn)
-        self.x11GroupBox.setObjectName(u'x11GroupBox')
-        self.x11Layout = QtGui.QVBoxLayout(self.x11GroupBox)
-        self.x11Layout.setObjectName(u'x11Layout')
-        self.x11BypassCheckBox = QtGui.QCheckBox(self.x11GroupBox)
+        # Workarounds
+        self.workaroundGroupBox = QtGui.QGroupBox(self.leftColumn)
+        self.workaroundGroupBox.setObjectName(u'workaroundGroupBox')
+        self.workaroundLayout = QtGui.QVBoxLayout(self.workaroundGroupBox)
+        self.workaroundLayout.setObjectName(u'workaroundLayout')
+        self.x11BypassCheckBox = QtGui.QCheckBox(self.workaroundGroupBox)
         self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox')
-        self.x11Layout.addWidget(self.x11BypassCheckBox)
-        self.rightLayout.addWidget(self.x11GroupBox)
+        self.workaroundLayout.addWidget(self.x11BypassCheckBox)
+        self.stylesheetFixCheckBox = QtGui.QCheckBox(self.workaroundGroupBox)
+        self.stylesheetFixCheckBox.setObjectName(u'stylesheetFixCheckBox')
+        self.workaroundLayout.addWidget(self.stylesheetFixCheckBox)
+        self.rightLayout.addWidget(self.workaroundGroupBox)
         self.rightLayout.addStretch()
         self.shouldUpdateServiceNameExample = False
         QtCore.QObject.connect(self.serviceNameCheckBox,
@@ -316,6 +320,8 @@
             QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
         QtCore.QObject.connect(self.x11BypassCheckBox,
             QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
+        QtCore.QObject.connect(self.stylesheetFixCheckBox,
+            QtCore.SIGNAL(u'toggled(bool)'), self.onStylesheetFixCheckBoxToggled)
         QtCore.QObject.connect(self.dataDirectoryBrowseButton,
             QtCore.SIGNAL(u'clicked()'),
             self.onDataDirectoryBrowseButtonClicked)
@@ -433,9 +439,11 @@
             translate('OpenLP.AdvancedTab',
             '<strong>WARNING:</strong> New data directory location contains '
             'OpenLP data files.  These files WILL be replaced during a copy.'))
-        self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11'))
+        self.workaroundGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Workarounds'))
         self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab',
             'Bypass X11 Window Manager'))
+        self.stylesheetFixCheckBox.setText(translate('OpenLP.AdvancedTab',
+            'Increase list background contrast'))
         # Slide Limits
         self.slideGroupBox.setTitle(
             translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
@@ -501,6 +509,14 @@
                 os.environ.get(u'GNOME_DESKTOP_SESSION_ID'))
         self.x11BypassCheckBox.setChecked(settings.value(
             u'x11 bypass wm', QtCore.QVariant(x11_bypass_default)).toBool())
+        # Fix for bug #936281.
+        stylesheet_fix_default = False
+        # Prevent the dialog displayed by the stylesheetFixCheckBox to display.
+        signalsBlocked = self.stylesheetFixCheckBox.blockSignals(True)
+        self.stylesheetFixCheckBox.setChecked(settings.value(
+            u'stylesheet fix', QtCore.QVariant(
+            stylesheet_fix_default)).toBool())
+        self.stylesheetFixCheckBox.blockSignals(signalsBlocked)
         self.defaultColor = settings.value(u'default color',
             QtCore.QVariant(u'#ffffff')).toString()
         self.defaultFileEdit.setText(settings.value(u'default image',
@@ -593,6 +609,8 @@
             QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
         settings.setValue(u'x11 bypass wm',
             QtCore.QVariant(self.x11BypassCheckBox.isChecked()))
+        settings.setValue(u'stylesheet fix',
+            QtCore.QVariant(self.stylesheetFixCheckBox.isChecked()))
         settings.setValue(u'default color', self.defaultColor)
         settings.setValue(u'default image', self.defaultFileEdit.text())
         settings.setValue(u'slide limits', QtCore.QVariant(self.slide_limits))
@@ -797,6 +815,12 @@
             The state of the check box (boolean).
         """
         self.displayChanged = True
+        
+    def onStylesheetFixCheckBoxToggled(self, checked):
+        QtGui.QMessageBox.information(self,
+            translate('OpenLP.AdvancedTab', 'Restart Required'),
+            translate('OpenLP.AdvancedTab',
+                'The change will take effect when OpenLP is restarted.'))
 
     def onEndSlideButtonClicked(self):
         self.slide_limits = SlideLimits.End
@@ -806,3 +830,4 @@
 
     def onnextItemButtonClicked(self):
         self.slide_limits = SlideLimits.Next
+


Follow ups