draftutils.todo.ToDo Class Reference
Static Public Member Functions | |
| def | delay (f, arg) |
| def | delayAfter (f, arg) |
| def | delayCommit (cl) |
| def | doTasks () |
Static Public Attributes | |
| list | afteritinerary = [] |
| list | commitlist = [] |
| list | itinerary = [] |
Detailed Description
A static class that delays execution of functions.
It calls `QtCore.QTimer.singleShot(0, doTasks)`
where `doTasks` is a static method which executes
the commands stored in the list attributes.
Attributes
----------
itinerary: list of tuples
Each tuple is of the form `(name, arg)`.
The `name` is a reference (pointer) to a function,
and `arg` is the corresponding argument that is passed
to that function.
It then tries executing the function with the argument,
if available, or without it, if not available.
::
name(arg)
name()
commitlist: list of tuples
Each tuple is of the form `(name, command_list)`.
The `name` is a string identifier or description of the commands
that will be run, and `command_list` is a list of strings
that indicate the Python instructions that will be executed,
or a reference to a single function that will be executed.
If `command_list` is a list, the program opens a transaction,
then runs all commands in the list in sequence,
and finally commits the transaction.
::
command_list = ["command1", "command2", "..."]
App.activeDocument().openTransaction(name)
Gui.doCommand("command1")
Gui.doCommand("command2")
Gui.doCommand("...")
App.activeDocument().commitTransaction()
If `command_list` is a reference to a function
the function is executed directly.
::
command_list = function
App.activeDocument().openTransaction(name)
function()
App.activeDocument().commitTransaction()
afteritinerary: list of tuples
Each tuple is of the form `(name, arg)`.
This list is used just like `itinerary`.
Lists
-----
The lists contain tuples. Each tuple contains a `name` which is just
a string to identify the operation, and a `command_list` which is
a list of strings, each string an individual Python instruction.
Member Function Documentation
◆ delay()
|
static |
Add the function and argument to the itinerary list.
Schedule geometry manipulation that would crash Coin if done
in the event callback.
If the `itinerary` list is empty, it will call
`QtCore.QTimer.singleShot(0, ToDo.doTasks)`
to execute the commands in the other lists.
Finally, it will build the tuple `(f, arg)`
and append it to the `itinerary` list.
Parameters
----------
f: function reference
A reference (pointer) to a Python command
which can be executed directly.
::
f()
arg: argument reference
A reference (pointer) to the argument to the `f` function.
::
f(arg)
◆ delayAfter()
|
static |
Add the function and argument to the afteritinerary list. Schedule geometry manipulation that would crash Coin if done in the event callback. Works the same as `delay`. If the `afteritinerary` list is empty, it will call `QtCore.QTimer.singleShot(0, ToDo.doTasks)` to execute the commands in the other lists. Finally, it will build the tuple `(f, arg)` and append it to the `afteritinerary` list.
◆ delayCommit()
|
static |
Execute the other lists, and add to the commit list.
Schedule geometry manipulation that would crash Coin if done
in the event callback.
First it calls
`QtCore.QTimer.singleShot(0, ToDo.doTasks)`
to execute the commands in all lists.
Then the `cl` list is assigned as the new commit list.
Parameters
----------
cl: list of tuples
Each tuple is of the form `(name, command_list)`.
The `name` is a string identifier or description of the commands
that will be run, and `command_list` is a list of strings
that indicate the Python instructions that will be executed.
See the attributes of the `ToDo` class for more information.
◆ doTasks()
|
static |
Execute the commands stored in the lists. The lists are `itinerary`, `commitlist` and `afteritinerary`.
Member Data Documentation
◆ afteritinerary
|
static |
◆ commitlist
|
static |
◆ itinerary
|
static |
The documentation for this class was generated from the following file:
- src/Mod/Draft/draftutils/todo.py
1.8.17