def switchTheme(self) -> None:
if self.darkRadio.isChecked():
newtheme = 'dark'
else:
newtheme = 'light'
if newtheme != self.parent.theme:
# noinspection PyArgumentList
mbox = QMessageBox(icon=QMessageBox.NoIcon, windowTitle='Restart required', minimumWidth=500,
textFormat=Qt.RichText, objectName='genericdialog')
mbox.setWindowFlags(Qt.Dialog | Qt.WindowCloseButtonHint)
mbox.setText('''
<style>
h1 {
color: %s;
font-family: "Futura-Light", sans-serif;
font-weight: 400;
}
p { font-size: 15px; }
</style>
<h1>Warning</h1>
<p>The application needs to be restarted in order to switch themes. Attempts will be made to reopen
media files and add back all clip times from your clip index.</p>
<p>Would you like to restart and switch themes now?</p>'''
% ('#C681D5' if self.parent.theme == 'dark' else '#642C68'))
mbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
mbox.setDefaultButton(QMessageBox.Yes)
response = mbox.exec_()
if response == QMessageBox.Yes:
self.parent.settings.setValue('theme', newtheme)
self.parent.parent.theme = newtheme
self.parent.parent.parent.reboot()
else:
self.darkRadio.setChecked(True) if newtheme == 'light' else self.lightRadio.setChecked(True)
评论列表
文章目录