mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Search box: use system default colr as normal background instead of white
This commit is contained in:
parent
4bdd6e6011
commit
b9806d254d
@ -36,6 +36,7 @@ class SearchBox2(QComboBox):
|
|||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QComboBox.__init__(self, parent)
|
QComboBox.__init__(self, parent)
|
||||||
|
self.normal_background = 'rgb(255, 255, 255, 0%)'
|
||||||
self.line_edit = SearchLineEdit(self)
|
self.line_edit = SearchLineEdit(self)
|
||||||
self.setLineEdit(self.line_edit)
|
self.setLineEdit(self.line_edit)
|
||||||
self.connect(self.line_edit, SIGNAL('key_pressed(PyQt_PyObject)'),
|
self.connect(self.line_edit, SIGNAL('key_pressed(PyQt_PyObject)'),
|
||||||
@ -62,14 +63,18 @@ class SearchBox2(QComboBox):
|
|||||||
|
|
||||||
def normalize_state(self):
|
def normalize_state(self):
|
||||||
self.setEditText('')
|
self.setEditText('')
|
||||||
self.line_edit.setStyleSheet('QLineEdit { color: black; background-color: white; }')
|
self.line_edit.setStyleSheet(
|
||||||
|
'QLineEdit { color: black; background-color: %s; }' %
|
||||||
|
self.normal_background)
|
||||||
self.help_state = False
|
self.help_state = False
|
||||||
|
|
||||||
def clear_to_help(self):
|
def clear_to_help(self):
|
||||||
self.setEditText(self.help_text)
|
self.setEditText(self.help_text)
|
||||||
self.line_edit.home(False)
|
self.line_edit.home(False)
|
||||||
self.help_state = True
|
self.help_state = True
|
||||||
self.line_edit.setStyleSheet('QLineEdit { color: gray; background-color: white; }')
|
self.line_edit.setStyleSheet(
|
||||||
|
'QLineEdit { color: gray; background-color: %s; }' %
|
||||||
|
self.normal_background)
|
||||||
self.emit(SIGNAL('cleared()'))
|
self.emit(SIGNAL('cleared()'))
|
||||||
|
|
||||||
def text(self):
|
def text(self):
|
||||||
@ -84,7 +89,7 @@ class SearchBox2(QComboBox):
|
|||||||
return self.clear_to_help()
|
return self.clear_to_help()
|
||||||
col = 'rgba(0,255,0,20%)' if ok else 'rgb(255,0,0,20%)'
|
col = 'rgba(0,255,0,20%)' if ok else 'rgb(255,0,0,20%)'
|
||||||
if not self.colorize:
|
if not self.colorize:
|
||||||
col = 'white'
|
col = self.normal_background
|
||||||
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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user