Intercept light/dark modes transitions on MacOS.
This commit is contained in:
parent
412698c8bb
commit
d0b92349dd
@ -44,8 +44,9 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
self.codeBtn = QtGui.QPushButton('Run Edited Code')
|
self.codeBtn = QtGui.QPushButton('Run Edited Code')
|
||||||
self.codeLayout = QtGui.QGridLayout()
|
self.codeLayout = QtGui.QGridLayout()
|
||||||
self.ui.codeView.setLayout(self.codeLayout)
|
self.ui.codeView.setLayout(self.codeLayout)
|
||||||
#self.simulate_black_mode()
|
|
||||||
self.hl = PythonHighlighter(self.ui.codeView.document())
|
self.hl = PythonHighlighter(self.ui.codeView.document())
|
||||||
|
app = QtGui.QApplication.instance()
|
||||||
|
app.paletteChanged.connect(self.updateTheme)
|
||||||
self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
|
self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
|
||||||
self.codeLayout.addWidget(self.codeBtn, 1, 1)
|
self.codeLayout.addWidget(self.codeBtn, 1, 1)
|
||||||
self.codeBtn.hide()
|
self.codeBtn.hide()
|
||||||
@ -83,6 +84,9 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
app = QtGui.QApplication.instance()
|
app = QtGui.QApplication.instance()
|
||||||
app.dark_mode = True
|
app.dark_mode = True
|
||||||
|
|
||||||
|
def updateTheme(self):
|
||||||
|
self.hl = PythonHighlighter(self.ui.codeView.document())
|
||||||
|
|
||||||
def populateTree(self, root, examples):
|
def populateTree(self, root, examples):
|
||||||
for key, val in examples.items():
|
for key, val in examples.items():
|
||||||
item = QtGui.QTreeWidgetItem([key])
|
item = QtGui.QTreeWidgetItem([key])
|
||||||
|
Loading…
Reference in New Issue
Block a user