def __init__(self, parent = None): super(ThemeEditorDialog, self).__init__(parent) self.styles = settings.splitElements(settings.currentCss) self.currentItem = None self.resize(600, 600) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinMaxButtonsHint) self.setWindowTitle("Edit Theme") layout = QtGui.QVBoxLayout() hlayout = QtGui.QHBoxLayout() buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) self.list = QtGui.QListWidget() self.list.addItems(self.styles.keys()) self.list.sortItems(True) self.list.itemSelectionChanged.connect(self.selectionChanged) layout.addWidget(self.list) self.editor = TextEditorWidget() layout.addWidget(self.editor) resetButton = QtGui.QPushButton() resetButton.setText("Reset default values") resetButton.clicked.connect(self.resetDefaultValues) hlayout.addWidget(resetButton) hlayout.addWidget(buttonBox) layout.addLayout(hlayout) self.setLayout(layout) buttonBox.accepted.connect(self.okPressed) buttonBox.rejected.connect(self.cancelPressed)
def __init__(self, parent=None): super(ThemeEditorDialog, self).__init__(parent) self.styles = settings.splitElements(settings.currentCss) self.currentItem = None self.resize(600, 600) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinMaxButtonsHint) self.setWindowTitle("Edit Theme") layout = QtGui.QVBoxLayout() hlayout = QtGui.QHBoxLayout() buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) self.list = QtGui.QListWidget() self.list.addItems(self.styles.keys()) self.list.sortItems(True) self.list.itemSelectionChanged.connect(self.selectionChanged) layout.addWidget(self.list) self.editor = TextEditorWidget() layout.addWidget(self.editor) resetButton = QtGui.QPushButton() resetButton.setText("Reset default values") resetButton.clicked.connect(self.resetDefaultValues) hlayout.addWidget(resetButton) hlayout.addWidget(buttonBox) layout.addLayout(hlayout) self.setLayout(layout) buttonBox.accepted.connect(self.okPressed) buttonBox.rejected.connect(self.cancelPressed)
def resetDefaultValues(self): settings.currentCss = settings.themes[settings.currentTheme] self.styles = settings.splitElements(settings.currentCss) self.editor.setText(self.styles[self.currentItem.text()])