Older pyqt versions don't have is_dark_theme

This commit is contained in:
Jim Miller 2021-01-31 15:29:11 -06:00
parent f99810a1ca
commit 1c0d7f93f7
2 changed files with 4 additions and 2 deletions

View file

@ -1532,7 +1532,8 @@ class ViewLog(SizePersistedDialog):
error_msg=error_msg[:200]+" ..." error_msg=error_msg[:200]+" ..."
label = QLabel('%s: %s'%(lineno, error_msg)) label = QLabel('%s: %s'%(lineno, error_msg))
label.setWordWrap(True) label.setWordWrap(True)
if QApplication.instance().is_dark_theme: if( hasattr(QApplication.instance(),'is_dark_theme')
and QApplication.instance().is_dark_theme ):
label.setStyleSheet("QLabel { margin-left: 2em; color : aqua; } QLabel:hover { color: red; }"); label.setStyleSheet("QLabel { margin-left: 2em; color : aqua; } QLabel:hover { color: red; }");
else: else:
label.setStyleSheet("QLabel { margin-left: 2em; color : blue; } QLabel:hover { color: red; }"); label.setStyleSheet("QLabel { margin-left: 2em; color : blue; } QLabel:hover { color: red; }");

View file

@ -42,7 +42,8 @@ class IniHighlighter(QSyntaxHighlighter):
'comments':Qt.darkYellow 'comments':Qt.darkYellow
} }
try: try:
if QApplication.instance().is_dark_theme: if( hasattr(QApplication.instance(),'is_dark_theme')
and QApplication.instance().is_dark_theme ):
colors = { colors = {
'knownentries':Qt.green, 'knownentries':Qt.green,
'errors':Qt.red, 'errors':Qt.red,