mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Dark mode: Fix colors in remove all formats except dialog
This commit is contained in:
		
							parent
							
								
									52dff55b41
								
							
						
					
					
						commit
						09eaa46360
					
				@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PyQt5.Qt import QVBoxLayout, QDialog, QLabel, QDialogButtonBox, Qt, \
 | 
					from PyQt5.Qt import QVBoxLayout, QDialog, QLabel, QDialogButtonBox, Qt, \
 | 
				
			||||||
        QAbstractListModel, QListView, QSize
 | 
					        QAbstractListModel, QListView, QSize, QApplication
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from calibre.gui2 import file_icon_provider
 | 
					from calibre.gui2 import file_icon_provider
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -63,9 +63,11 @@ class SelectFormats(QDialog):
 | 
				
			|||||||
        self.fview.doubleClicked.connect(self.double_clicked,
 | 
					        self.fview.doubleClicked.connect(self.double_clicked,
 | 
				
			||||||
                type=Qt.QueuedConnection)
 | 
					                type=Qt.QueuedConnection)
 | 
				
			||||||
        if exclude:
 | 
					        if exclude:
 | 
				
			||||||
            self.fview.setStyleSheet('''
 | 
					            if QApplication.instance().is_dark_theme:
 | 
				
			||||||
                    QListView { background-color: #FAE7B5}
 | 
					                sheet = 'background-color: #DAA520; color: black'
 | 
				
			||||||
                    ''')
 | 
					            else:
 | 
				
			||||||
 | 
					                sheet = 'background-color: #fae7b5'
 | 
				
			||||||
 | 
					            self.fview.setStyleSheet('QListView { %s }' % sheet)
 | 
				
			||||||
        self._l.addWidget(self.fview)
 | 
					        self._l.addWidget(self.fview)
 | 
				
			||||||
        self.fview.setModel(self.formats)
 | 
					        self.fview.setModel(self.formats)
 | 
				
			||||||
        self.fview.setSelectionMode(self.fview.SingleSelection if single else
 | 
					        self.fview.setSelectionMode(self.fview.SingleSelection if single else
 | 
				
			||||||
@ -93,8 +95,8 @@ class SelectFormats(QDialog):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
    from PyQt5.Qt import QApplication
 | 
					    from calibre.gui2 import Application
 | 
				
			||||||
    app = QApplication([])
 | 
					    app = Application([])
 | 
				
			||||||
    d = SelectFormats(['epub', 'lrf', 'lit', 'mobi'], 'Choose a format')
 | 
					    d = SelectFormats(['epub', 'lrf', 'lit', 'mobi'], 'Choose a format')
 | 
				
			||||||
    d.exec_()
 | 
					    d.exec_()
 | 
				
			||||||
    print(d.selected_formats)
 | 
					    print(d.selected_formats)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user