command: where the actual stuff happens

Command objects encapsulate a change to the underlying model of your application. For instance you may have a Command class to change the project’s name, and an instance of this for each actual name change. Once instantiated it must be actually run by using the History run method.

Base and generic commands

class pyqtcmd.command.Command[source]

Command objects encapsulate a change to the document/project/etc’s state. You should provide an __str__ method for logging purposes.

do()[source]

Override this to implement the change

label()[source]

Provide a description of the command, to be used in menu items and tooltips

redo()[source]

Override this to implement the change redo (calls do() by default)

undo()[source]

Override this to implement the change undo

class pyqtcmd.command.CompositeCommand(label=None)[source]

A Command that groups several other commands together.

add_command(cmd)[source]

Adds a new command to the chain. Commands will be run in order, and undone in reverse order.

do()[source]

Override this to implement the change

label()[source]

Provide a description of the command, to be used in menu items and tooltips

undo()[source]

Override this to implement the change undo

class pyqtcmd.command.UpdateStateCommand(target, **state)[source]

A Command that updates an object’s state through its __getstate__/__setstate__ special methods

do()[source]

Override this to implement the change

undo()[source]

Override this to implement the change undo