timeview icon indicating copy to clipboard operation
timeview copied to clipboard

put all state in a single object

Open lxkain opened this issue 8 years ago • 2 comments

This is a meta-tag, for version 2.0. Low priority for now.

I am observing that many times fixing a bug or introducing a new feature breaks code elsewhere. Having all the state in one object will pave the way for writing unit tests, but also for saving state between sessions, and also undo.

For example, we can test programmatically whether the zoom function does what it purports to do, by setting up a particular state scenario, then executing the zoom function, then checking whether that panel's xrange is now the desired range, and do this from a bunch of random ranges.

Alternatively, look into QT undo framework:

link to summary of Qt Undo http://doc.qt.io/qt-5/qundo.html

As long as the application only uses command objects to change the state of the document, it is possible to undo a sequence of commands by traversing the stack downwards and calling undo on each command in turn.

link to Qt undo framework example: http://doc.qt.io/qt-5/qtwidgets-tools-undoframework-example.html

also here is a stack overflow on a related issue with pyside code and using qstandarditem

https://stackoverflow.com/questions/29527610/how-to-undo-edit-of-qstandarditem-in-pyside-pyqt

lxkain avatar Dec 12 '17 15:12 lxkain

would we want a total application state, or would we want a display-pane state

in other words, you can only undo the operations in a given display panel, if you want to do an operation in a different display panel, you have to select that other one?

lxkain avatar Dec 12 '17 15:12 lxkain

I believe global undo/redo is the way to go.

lxkain avatar Feb 19 '18 19:02 lxkain