← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/bug-1047995 into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/bug-1047995 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1047995 in OpenLP: "Inconvenient focus in Song Editor when adding authors"
  https://bugs.launchpad.net/openlp/+bug/1047995

For more details, see:
https://code.launchpad.net/~googol/openlp/bug-1047995/+merge/147606

Hello,

- fixed bug 1047995 (Inconvenient focus in Song Editor when adding authors) by reimplementing the keyPressEvent


http://ci.openlp.org/view/Specific%20Branch/job/OpenLP-Pull_and_Run_Functional_Tests/40/
-- 
https://code.launchpad.net/~googol/openlp/bug-1047995/+merge/147606
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-1047995 into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2013-02-06 21:43:18 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2013-02-11 08:37:36 +0000
@@ -116,6 +116,23 @@
         self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
         self.whitespace = re.compile(r'\W+', re.UNICODE)
 
+    def keyPressEvent(self, event):
+        """
+        Reimplement the keyPressEvent to react on Return/Enter keys. When some combo boxes have focus we do not want
+        dialog's default action be triggered but instead our own.
+
+        ``event``
+            A QtGui.QKeyEvent event.
+        """
+        if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
+            if self.authorsComboBox.hasFocus() and self.authorsComboBox.currentText():
+                self.onAuthorAddButtonClicked()
+                return
+            if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText():
+                self.onTopicAddButtonClicked()
+                return
+        QtGui.QDialog.keyPressEvent(self, event)
+
     def initialise(self):
         """
         Set up the form for when it is displayed.


Follow ups