Only prevent stripping of white space in S&R widget.

This commit is contained in:
John Schember 2011-03-12 12:21:19 -05:00
parent c82eebd09e
commit 89bc79eddd
2 changed files with 13 additions and 1 deletions

View File

@ -136,7 +136,7 @@ class Widget(QWidget):
return g.value()
elif isinstance(g, (QLineEdit, QTextEdit)):
func = getattr(g, 'toPlainText', getattr(g, 'text', None))()
ans = unicode(func)
ans = unicode(func).strip()
if not ans:
ans = None
return ans

View File

@ -6,6 +6,8 @@ __docformat__ = 'restructuredtext en'
import re
from PyQt4.Qt import QLineEdit, QTextEdit
from calibre.gui2.convert.search_and_replace_ui import Ui_Form
from calibre.gui2.convert import Widget
from calibre.gui2 import error_dialog
@ -72,3 +74,13 @@ class SearchAndReplaceWidget(Widget, Ui_Form):
_('Invalid regular expression: %s')%err, show=True)
return False
return True
def get_vaule(self, g):
if isinstance(g, (QLineEdit, QTextEdit)):
func = getattr(g, 'toPlainText', getattr(g, 'text', None))()
ans = unicode(func)
if not ans:
ans = None
return ans
else:
return Widget.get_value(self, g)