mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix bug #5856
This commit is contained in:
parent
b393dbf62d
commit
544b4648e1
@ -90,14 +90,18 @@ class SearchBox2(QComboBox):
|
|||||||
self.help_text = help_text
|
self.help_text = help_text
|
||||||
self.colorize = colorize
|
self.colorize = colorize
|
||||||
self.clear_to_help()
|
self.clear_to_help()
|
||||||
self.connect(self, SIGNAL('editTextChanged(QString)'), self.text_edited_slot)
|
|
||||||
|
|
||||||
def normalize_state(self):
|
def normalize_state(self):
|
||||||
self.setEditText('')
|
if self.help_state:
|
||||||
self.line_edit.setStyleSheet(
|
self.setEditText('')
|
||||||
'QLineEdit { color: black; background-color: %s; }' %
|
self.line_edit.setStyleSheet(
|
||||||
self.normal_background)
|
'QLineEdit { color: black; background-color: %s; }' %
|
||||||
self.help_state = False
|
self.normal_background)
|
||||||
|
self.help_state = False
|
||||||
|
else:
|
||||||
|
self.line_edit.setStyleSheet(
|
||||||
|
'QLineEdit { color: black; background-color: %s; }' %
|
||||||
|
self.normal_background)
|
||||||
|
|
||||||
def clear_to_help(self):
|
def clear_to_help(self):
|
||||||
if self.help_state:
|
if self.help_state:
|
||||||
@ -131,17 +135,15 @@ class SearchBox2(QComboBox):
|
|||||||
self.line_edit.setStyleSheet('QLineEdit { color: black; background-color: %s; }' % col)
|
self.line_edit.setStyleSheet('QLineEdit { color: black; background-color: %s; }' % col)
|
||||||
|
|
||||||
def key_pressed(self, event):
|
def key_pressed(self, event):
|
||||||
if self.help_state:
|
self.normalize_state()
|
||||||
self.normalize_state()
|
|
||||||
if not self.as_you_type:
|
if not self.as_you_type:
|
||||||
if event.key() in (Qt.Key_Return, Qt.Key_Enter):
|
if event.key() in (Qt.Key_Return, Qt.Key_Enter):
|
||||||
self.do_search()
|
self.do_search()
|
||||||
|
else:
|
||||||
|
self.timer = self.startTimer(self.__class__.INTERVAL)
|
||||||
|
|
||||||
def mouse_released(self, event):
|
def mouse_released(self, event):
|
||||||
if self.help_state:
|
self.normalize_state()
|
||||||
self.normalize_state()
|
|
||||||
|
|
||||||
def text_edited_slot(self, text):
|
|
||||||
if self.as_you_type:
|
if self.as_you_type:
|
||||||
self.timer = self.startTimer(self.__class__.INTERVAL)
|
self.timer = self.startTimer(self.__class__.INTERVAL)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user