diff --git a/src/component.py b/src/component.py index 1f55a19..35fc717 100644 --- a/src/component.py +++ b/src/component.py @@ -823,7 +823,7 @@ class ComponentUpdate(QtWidgets.QUndoCommand): '''Command object for making a component action undoable''' def __init__(self, parent, oldWidgetVals, modifiedVals): super().__init__( - 'Changed %s component #%s' % ( + 'change %s component #%s' % ( parent.name, parent.compPos ) ) diff --git a/src/gui/actions.py b/src/gui/actions.py index ebd9702..8e867b9 100644 --- a/src/gui/actions.py +++ b/src/gui/actions.py @@ -15,7 +15,7 @@ from core import Core class AddComponent(QUndoCommand): def __init__(self, parent, compI, moduleI): super().__init__( - "New %s component" % + "create new %s component" % parent.core.modules[moduleI].Component.name ) self.parent = parent @@ -39,7 +39,7 @@ class AddComponent(QUndoCommand): class RemoveComponent(QUndoCommand): def __init__(self, parent, selectedRows): - super().__init__('Remove component') + super().__init__('remove component') self.parent = parent componentList = self.parent.window.listWidget_componentList self.selectedRows = [ @@ -63,7 +63,7 @@ class RemoveComponent(QUndoCommand): class MoveComponent(QUndoCommand): def __init__(self, parent, row, newRow, tag): - super().__init__("Move component %s" % tag) + super().__init__("move component %s" % tag) self.parent = parent self.row = row self.newRow = newRow @@ -107,7 +107,7 @@ class MoveComponent(QUndoCommand): class ClearPreset(QUndoCommand): def __init__(self, parent, compI): - super().__init__("Clear preset") + super().__init__("clear preset") self.parent = parent self.compI = compI self.component = self.parent.core.selectedComponents[compI] @@ -125,7 +125,7 @@ class ClearPreset(QUndoCommand): class OpenPreset(QUndoCommand): def __init__(self, parent, presetName, compI): - super().__init__("Open %s preset" % presetName) + super().__init__("open %s preset" % presetName) self.parent = parent self.presetName = presetName self.compI = compI @@ -145,7 +145,7 @@ class OpenPreset(QUndoCommand): class RenamePreset(QUndoCommand): def __init__(self, parent, path, oldName, newName): - super().__init__('Rename preset') + super().__init__('rename preset') self.parent = parent self.path = path self.oldName = oldName @@ -167,7 +167,7 @@ class DeletePreset(QUndoCommand): ) self.store = self.parent.core.getPreset(self.path) self.presetName = self.store['preset'] - super().__init__('Delete %s preset (%s)' % (self.presetName, compName)) + super().__init__('delete %s preset (%s)' % (self.presetName, compName)) self.loadedPresets = [ i for i, comp in enumerate(self.parent.core.selectedComponents) if self.presetName == str(comp.currentPreset) diff --git a/src/gui/mainwindow.py b/src/gui/mainwindow.py index 2841896..3b204b7 100644 --- a/src/gui/mainwindow.py +++ b/src/gui/mainwindow.py @@ -100,6 +100,42 @@ class MainWindow(QtWidgets.QMainWindow): self.window.installEventFilter(self) componentList = self.window.listWidget_componentList + style = window.pushButton_undo.style() + undoButton = window.pushButton_undo + undoButton.setIcon( + style.standardIcon(QtWidgets.QStyle.SP_FileDialogBack) + ) + undoButton.clicked.connect(self.undoStack.undo) + undoButton.setEnabled(False) + self.undoStack.cleanChanged.connect( + lambda change: undoButton.setEnabled(self.undoStack.count()) + ) + self.undoMenu = QMenu() + self.undoMenu.addAction( + self.undoStack.createUndoAction(self) + ) + self.undoMenu.addAction( + self.undoStack.createRedoAction(self) + ) + action = self.undoMenu.addAction('Show History...') + action.triggered.connect( + lambda _: self.showUndoStack() + ) + undoButton.setMenu(self.undoMenu) + + style = window.pushButton_listMoveUp.style() + window.pushButton_listMoveUp.setIcon( + style.standardIcon(QtWidgets.QStyle.SP_ArrowUp) + ) + style = window.pushButton_listMoveDown.style() + window.pushButton_listMoveDown.setIcon( + style.standardIcon(QtWidgets.QStyle.SP_ArrowDown) + ) + style = window.pushButton_removeComponent.style() + window.pushButton_removeComponent.setIcon( + style.standardIcon(QtWidgets.QStyle.SP_DialogDiscardButton) + ) + if sys.platform == 'darwin': log.debug( 'Darwin detected: showing progress label below progress bar') diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index b43d375..cd8454d 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -110,6 +110,13 @@ QLayout::SetMinimumSize + + + + Undo + + +