openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #04690
[Merge] lp:~trb143/openlp/bugs into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Fix 685317 with text entry filter
--
https://code.launchpad.net/~trb143/openlp/bugs/+merge/43009
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2010-09-30 05:04:43 +0000
+++ openlp/core/ui/generaltab.py 2010-12-07 20:51:14 +0000
@@ -23,6 +23,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
+import re
from PyQt4 import QtCore, QtGui
@@ -242,6 +243,7 @@
self.customXLayout.addWidget(self.customXLabel)
self.customXValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customXValueEdit.setObjectName(u'customXValueEdit')
+ self.customXValueEdit.setInputMask(u'99999')
self.customXLayout.addWidget(self.customXValueEdit)
self.customLayout.addLayout(self.customXLayout)
self.customYLayout = QtGui.QVBoxLayout()
@@ -254,6 +256,7 @@
self.customYLayout.addWidget(self.customYLabel)
self.customYValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customYValueEdit.setObjectName(u'customYValueEdit')
+ self.customYValueEdit.setInputMask(u'99999')
self.customYLayout.addWidget(self.customYValueEdit)
self.customLayout.addLayout(self.customYLayout)
self.customWidthLayout = QtGui.QVBoxLayout()
@@ -267,6 +270,7 @@
self.customWidthLayout.addWidget(self.customWidthLabel)
self.customWidthValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
+ self.customWidthValueEdit.setInputMask(u'99999')
self.customWidthLayout.addWidget(self.customWidthValueEdit)
self.customLayout.addLayout(self.customWidthLayout)
self.customHeightLayout = QtGui.QVBoxLayout()
@@ -279,6 +283,7 @@
self.customHeightLayout.addWidget(self.customHeightLabel)
self.customHeightValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
+ self.customHeightValueEdit.setInputMask(u'99999')
self.customHeightLayout.addWidget(self.customHeightValueEdit)
self.customLayout.addLayout(self.customHeightLayout)
self.displayLayout.addLayout(self.customLayout)
@@ -465,10 +470,10 @@
# Reset screens after initial definition
if self.overrideChanged:
self.screens.override[u'size'] = QtCore.QRect(
- int(self.customXValueEdit.text()),
- int(self.customYValueEdit.text()),
- int(self.customWidthValueEdit.text()),
- int(self.customHeightValueEdit.text()))
+ self._toInt(self.customXValueEdit.text()),
+ self._toInt(self.customYValueEdit.text()),
+ self._toInt(self.customWidthValueEdit.text()),
+ self._toInt(self.customHeightValueEdit.text()))
if self.overrideCheckBox.isChecked():
self.screens.set_override_display()
else:
@@ -487,3 +492,12 @@
self.customHeightValueEdit.setEnabled(checked)
self.customWidthValueEdit.setEnabled(checked)
self.overrideChanged = True
+
+ def _toInt(self, value):
+ """
+ Make sure a Int returns a value.
+ """
+ try:
+ return int(value)
+ except:
+ return 0
Follow ups