mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the OK and ERR background colors used in the edit metadata dialog a little paler to suit the Fusion theme
This commit is contained in:
parent
1baae866cc
commit
225d92e9d3
@ -38,6 +38,9 @@ from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile
|
|||||||
from calibre.gui2.languages import LanguagesEdit as LE
|
from calibre.gui2.languages import LanguagesEdit as LE
|
||||||
from calibre.db import SPOOL_SIZE
|
from calibre.db import SPOOL_SIZE
|
||||||
|
|
||||||
|
OK_COLOR = 'rgba(0, 255, 0, 15%)'
|
||||||
|
ERR_COLOR = 'rgba(255, 0, 0, 15%)'
|
||||||
|
|
||||||
def save_dialog(parent, title, msg, det_msg=''):
|
def save_dialog(parent, title, msg, det_msg=''):
|
||||||
d = QMessageBox(parent)
|
d = QMessageBox(parent)
|
||||||
d.setWindowTitle(title)
|
d.setWindowTitle(title)
|
||||||
@ -177,10 +180,7 @@ class TitleSortEdit(TitleEdit):
|
|||||||
def update_state(self, *args):
|
def update_state(self, *args):
|
||||||
ts = title_sort(self.title_edit.current_val, lang=self.book_lang)
|
ts = title_sort(self.title_edit.current_val, lang=self.book_lang)
|
||||||
normal = ts == self.current_val
|
normal = ts == self.current_val
|
||||||
if normal:
|
col = OK_COLOR if normal else ERR_COLOR
|
||||||
col = 'rgb(0, 255, 0, 20%)'
|
|
||||||
else:
|
|
||||||
col = 'rgb(255, 0, 0, 20%)'
|
|
||||||
self.setStyleSheet('QLineEdit { color: black; '
|
self.setStyleSheet('QLineEdit { color: black; '
|
||||||
'background-color: %s; }'%col)
|
'background-color: %s; }'%col)
|
||||||
tt = self.tooltips[0 if normal else 1]
|
tt = self.tooltips[0 if normal else 1]
|
||||||
@ -381,10 +381,7 @@ class AuthorSortEdit(EnLineEdit):
|
|||||||
au = self.db.author_sort_from_authors(string_to_authors(au))
|
au = self.db.author_sort_from_authors(string_to_authors(au))
|
||||||
|
|
||||||
normal = strcmp(au, self.current_val) == 0
|
normal = strcmp(au, self.current_val) == 0
|
||||||
if normal:
|
col = OK_COLOR if normal else ERR_COLOR
|
||||||
col = 'rgb(0, 255, 0, 20%)'
|
|
||||||
else:
|
|
||||||
col = 'rgb(255, 0, 0, 20%)'
|
|
||||||
self.setStyleSheet('QLineEdit { color: black; '
|
self.setStyleSheet('QLineEdit { color: black; '
|
||||||
'background-color: %s; }'%col)
|
'background-color: %s; }'%col)
|
||||||
tt = self.tooltips[0 if normal else 1]
|
tt = self.tooltips[0 if normal else 1]
|
||||||
@ -1322,10 +1319,10 @@ class IdentifiersEdit(QLineEdit): # {{{
|
|||||||
if not isbn:
|
if not isbn:
|
||||||
col = 'none'
|
col = 'none'
|
||||||
elif check_isbn(isbn) is not None:
|
elif check_isbn(isbn) is not None:
|
||||||
col = 'rgba(0,255,0,20%)'
|
col = OK_COLOR
|
||||||
extra = '\n\n'+_('This ISBN number is valid')
|
extra = '\n\n'+_('This ISBN number is valid')
|
||||||
else:
|
else:
|
||||||
col = 'rgba(255,0,0,20%)'
|
col = ERR_COLOR
|
||||||
extra = '\n\n' + _('This ISBN number is invalid')
|
extra = '\n\n' + _('This ISBN number is invalid')
|
||||||
self.setToolTip(tt+extra)
|
self.setToolTip(tt+extra)
|
||||||
self.setStyleSheet('QLineEdit { background-color: %s }'%col)
|
self.setStyleSheet('QLineEdit { background-color: %s }'%col)
|
||||||
@ -1384,10 +1381,10 @@ class ISBNDialog(QDialog): # {{{
|
|||||||
col = 'none'
|
col = 'none'
|
||||||
extra = ''
|
extra = ''
|
||||||
elif check_isbn(isbn) is not None:
|
elif check_isbn(isbn) is not None:
|
||||||
col = 'rgba(0,255,0,20%)'
|
col = OK_COLOR
|
||||||
extra = _('This ISBN number is valid')
|
extra = _('This ISBN number is valid')
|
||||||
else:
|
else:
|
||||||
col = 'rgba(255,0,0,20%)'
|
col = ERR_COLOR
|
||||||
extra = _('This ISBN number is invalid')
|
extra = _('This ISBN number is invalid')
|
||||||
self.line_edit.setToolTip(extra)
|
self.line_edit.setToolTip(extra)
|
||||||
self.line_edit.setStyleSheet('QLineEdit { background-color: %s }'%col)
|
self.line_edit.setStyleSheet('QLineEdit { background-color: %s }'%col)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user