easyscience.global_object
global_object
GlobalObject
GlobalObject is the assimilated knowledge of EasyScience
. Every class based on EasyScience
gets brought
into the collective.
generate_unique_name(name_prefix)
Generate a generic unique name for the object using the class name and a global iterator.
Names are in the format name_prefix_0
, name_prefix_1
, name_prefix_2
, etc.
:param name_prefix: The prefix to be used for the name
instantiate_stack()
The undo/redo stack references the collective. Hence it has to be imported after initialization.
:return: None :rtype: noneType
hugger
hugger
PatcherFactory
Bases: Hugger
property
LoggedProperty
Bases: property
Pump up python properties. In this case we can see who has called this property and
then do something if a criteria is met. In this case if the caller is not a member of
the BaseObj
class. Note that all high level EasyScience
objects should be built from
BaseObj
.
logger
Logger
getLogger(logger_name, color='32', defaults=True)
Create a logger :param color: :param logger_name: logger name. Usually name on creation :param defaults: Do you want to associate any current file loggers with this logger :return: A logger
map
Map
__generate_edges()
A static method generating the edges of the map. Edges are represented as sets with one (a loop back to the vertex) or two vertices
edges()
returns the edges of a map
find_all_paths(start_vertex, end_vertex, path=[])
find all paths from start_vertex to end_vertex in map
find_isolated_vertices()
returns a list of isolated vertices.
find_path(start_vertex, end_vertex, path=[])
find a path from start_vertex to end_vertex in map
is_connected(vertices_encountered=None, start_vertex=None)
determines if the map is connected
reverse_route(end_vertex, start_vertex=None)
In this case we have an object and want to know the connections to get to another in reverse. We might not know the start_object. In which case we follow the shortest path to a base vertex. :param end_obj: :type end_obj: :param start_obj: :type start_obj: :return: :rtype:
vertices()
returns the vertices of a map
undo_redo
CommandHolder
A holder for one or more commands which are added to the stack
NotarizedDict
Bases: UserDict
A simple dict drop in for EasyScience group classes. This is used as it wraps the get/set methods
PropertyStack
UndoCommand
The Command interface pattern
redo()
abstractmethod
Redo implementation which should be overwritten
undo()
abstractmethod
Undo implementation which should be overwritten
UndoStack
Implement a version of QUndoStack without the QT
beginMacro(text)
Start a bulk update i.e. multiple commands under one undo/redo command
canRedo()
Can we redo a command?
canUndo()
Can the last command be undone?
clear()
Remove any commands on the stack and reset the state
endMacro()
End a bulk update i.e. multiple commands under one undo/redo command
pop()
!! WARNING - TO BE USED WITH EXTREME CAUTION !! !! THIS IS PROBABLY NOT THE FN YOU'RE LOOKING FOR, IT CAN BREAK A LOT OF STUFF !! Sometimes you really don't want the last command. Remove it from the stack
:return: None :rtype: None
push(command)
Add a command to the history stack
redo()
Redo the last undo
command on the stack
redoText()
Text associated with a redo item.
undo()
Undo the last change to the stack
undoText()
Text associated with a undo item.
property_stack_deco(arg, begin_macro=False)
Decorate a property
setter with undo/redo functionality
This decorator can be used as:
@property_stack_deco def func() ....
or
@property_stack_deco("This is the undo/redo text) def func() ....
In the latter case the argument is a string which might be evaluated. The possible markups for this string are;
obj
- The thing being operated on
func
- The function being called
name
- The name of the function being called.
old_value
- The pre-set value
new_value
- The post-set value
An example would be Function {name}: Set from {old_value} to {new_value}