← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~floft/openlp/hidecursor into lp:openlp

 

Floft has proposed merging lp:~floft/openlp/hidecursor into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~floft/openlp/hidecursor/+merge/46429

I added a setting to hide the mouse cursor when moved over the display screen.
-- 
https://code.launchpad.net/~floft/openlp/hidecursor/+merge/46429
Your team OpenLP Core is requested to review the proposed merge of lp:~floft/openlp/hidecursor into lp:openlp.
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py	2011-01-07 13:43:03 +0000
+++ openlp/core/ui/generaltab.py	2011-01-16 22:43:53 +0000
@@ -213,6 +213,14 @@
         self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
         self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3)
         self.rightLayout.addWidget(self.displayGroupBox)
+        self.hideMouseGroupBox = QtGui.QGroupBox(self.rightColumn)
+        self.hideMouseGroupBox.setObjectName(u'hideMouseGroupBox')
+        self.hideMouseLayout = QtGui.QVBoxLayout(self.hideMouseGroupBox)
+        self.hideMouseLayout.setObjectName(u'hideMouseLayout')
+        self.hideMouseCheckBox = QtGui.QCheckBox(self.hideMouseGroupBox)
+        self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
+        self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
+        self.rightLayout.addWidget(self.hideMouseGroupBox)
         self.rightLayout.addStretch()
         # Signals and slots
         QtCore.QObject.connect(self.overrideCheckBox,
@@ -287,6 +295,10 @@
         self.customHeightLabel.setText(
             translate('OpenLP.GeneralTab', 'Height'))
         self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
+        self.hideMouseGroupBox.setTitle(translate('OpenLP.GeneralTab',
+            'Mouse Cursor'))
+        self.hideMouseCheckBox.setText(translate('OpenLP.GeneralTab',
+            'Hide the Mouse Cursor'))
 
     def load(self):
         """
@@ -341,6 +353,8 @@
         self.customWidthValueEdit.setText(
             settings.value(u'width', QtCore.QVariant(
             self.screens.current[u'size'].width())).toString())
+        self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse',
+            QtCore.QVariant(False)).toBool())
         settings.endGroup()
         self.customXValueEdit.setEnabled(self.overrideCheckBox.isChecked())
         self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
@@ -385,6 +399,8 @@
             QtCore.QVariant(self.customWidthValueEdit.text()))
         settings.setValue(u'override position',
             QtCore.QVariant(self.overrideCheckBox.isChecked()))
+        settings.setValue(u'hide mouse',
+            QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
         settings.endGroup()
         self.screens.display = self.displayOnMonitorCheck.isChecked()
         # Monitor Number has changed.

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-01-14 18:58:47 +0000
+++ openlp/core/ui/maindisplay.py	2011-01-16 22:43:53 +0000
@@ -117,6 +117,8 @@
             QtCore.QObject.connect(Receiver.get_receiver(),
                 QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
 
+        self.generalSettingsSection = u'general'
+
     def retranslateUi(self):
         """
         Setup the interface translation strings.
@@ -205,6 +207,8 @@
             Receiver.send_message(u'openlp_process_events')
         self.frame.evaluateJavaScript(u'show_text("%s")' % \
             slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
+        
+        self.hideMouseCursor()
         return self.preview()
 
     def alert(self, text):
@@ -270,6 +274,7 @@
         else:
             js = u'show_image("");'
         self.frame.evaluateJavaScript(js)
+        self.hideMouseCursor()
 
     def resetImage(self):
         """
@@ -359,6 +364,8 @@
             self.webView.setVisible(False)
             self.videoWidget.setVisible(True)
             self.audio.setVolume(vol)
+
+        self.hideMouseCursor()
         return self.preview()
 
     def isLoaded(self):
@@ -474,6 +481,19 @@
         self.hideMode = None
         # Trigger actions when display is active again
         Receiver.send_message(u'maindisplay_active')
+    
+    def hideMouseCursor(self):
+        """
+        Hide the mouse cursor if enabled in settings
+        """
+        settings = QtCore.QSettings()
+        if settings.value(u'%s/hide mouse' % self.generalSettingsSection,
+            QtCore.QVariant(False)).toBool():
+            self.setCursor(QtCore.Qt.BlankCursor)
+            self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
+        else:
+            self.setCursor(QtCore.Qt.ArrowCursor)
+            self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
 
 class AudioPlayer(QtCore.QObject):
     """


Follow ups