aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authortassaron2017-08-20 22:04:57 -0400
committertassaron2017-08-20 22:04:57 -0400
commit9d9c4076ac1dfccdd1a753d137d87bcf5f179e3b (patch)
tree5349355724a72edf06b2451f13721f72106bb284 /src/gui
parent6bf8a553d6170e0ca6e7d2002e46ae327a6e5e81 (diff)
added undo button to GUI
with icons that theoretically should look ok cross-platform
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/actions.py14
-rw-r--r--src/gui/mainwindow.py36
-rw-r--r--src/gui/mainwindow.ui7
3 files changed, 50 insertions, 7 deletions
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
@@ -111,6 +111,13 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
+ <widget class="QPushButton" name="pushButton_undo">
+ <property name="text">
+ <string>Undo</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>