global_object
global_object
GlobalObject
GlobalObject is the assimilated knowledge of EasyScience.
Every class based on EasyScience gets brought
into the collective.
Source code in src/easyscience/global_object/global_object.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
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
Source code in src/easyscience/global_object/global_object.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
instantiate_stack()
The undo/redo stack references the collective. Hence it has to be imported after initialization.
:return: None :rtype: noneType
Source code in src/easyscience/global_object/global_object.py
35 36 37 38 39 40 41 42 43 44 | |
hugger
hugger
PatcherFactory
Bases: Hugger
Source code in src/easyscience/global_object/hugger/hugger.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
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 ObjBase class. Note that all high level EasyScience objects should be built from
ObjBase.
Source code in src/easyscience/global_object/hugger/property.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
logger
Logger
Source code in src/easyscience/global_object/logger.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
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
Source code in src/easyscience/global_object/logger.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
map
Map
Source code in src/easyscience/global_object/map.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
__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
Source code in src/easyscience/global_object/map.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
edges()
Returns the edges of a map.
Source code in src/easyscience/global_object/map.py
105 106 107 | |
find_all_paths(start_vertex, end_vertex, path=[])
Find all paths from start_vertex to end_vertex in map.
Source code in src/easyscience/global_object/map.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
find_isolated_vertices()
Returns a list of isolated vertices.
Source code in src/easyscience/global_object/map.py
224 225 226 227 228 229 230 | |
find_path(start_vertex, end_vertex, path=[])
Find a path from start_vertex to end_vertex in map.
Source code in src/easyscience/global_object/map.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
is_connected(vertices_encountered=None, start_vertex=None)
Determines if the map is connected.
Source code in src/easyscience/global_object/map.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
is_known(vertex)
Check if a vertex is known in the map.
All objects should have a 'unique_name' attribute.
Source code in src/easyscience/global_object/map.py
142 143 144 145 146 147 | |
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:
Source code in src/easyscience/global_object/map.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
vertices()
Returns the vertices of a map.
Uses a retry loop to handle RuntimeError that can occur when the WeakValueDictionary is modified during iteration (e.g., by garbage collection).
Source code in src/easyscience/global_object/map.py
91 92 93 94 95 96 97 98 99 100 101 102 103 | |
undo_redo
CommandHolder
A holder for one or more commands which are added to the stack.
Source code in src/easyscience/global_object/undo_redo.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
NotarizedDict
Bases: UserDict
A simple dict drop in for EasyScience group classes.
This is used as it wraps the get/set methods
Source code in src/easyscience/global_object/undo_redo.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
PropertyStack
Bases: UndoCommand
Stack operator for when a property setter is wrapped.
Source code in src/easyscience/global_object/undo_redo.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
UndoCommand
The Command interface pattern.
Source code in src/easyscience/global_object/undo_redo.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
redo()
abstractmethod
Redo implementation which should be overwritten.
Source code in src/easyscience/global_object/undo_redo.py
31 32 33 | |
undo()
abstractmethod
Undo implementation which should be overwritten.
Source code in src/easyscience/global_object/undo_redo.py
27 28 29 | |
UndoStack
Implement a version of QUndoStack without the QT.
Source code in src/easyscience/global_object/undo_redo.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
beginMacro(text)
Start a bulk update i.e. multiple commands under one undo/redo command.
Source code in src/easyscience/global_object/undo_redo.py
253 254 255 256 257 258 259 260 261 | |
canRedo()
Can we redo a command?
Source code in src/easyscience/global_object/undo_redo.py
275 276 277 | |
canUndo()
Can the last command be undone?
Source code in src/easyscience/global_object/undo_redo.py
271 272 273 | |
clear()
Remove any commands on the stack and reset the state.
Source code in src/easyscience/global_object/undo_redo.py
212 213 214 215 216 | |
endMacro()
End a bulk update i.e. multiple commands under one undo/redo command.
Source code in src/easyscience/global_object/undo_redo.py
263 264 265 266 267 268 269 | |
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
Source code in src/easyscience/global_object/undo_redo.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
push(command)
Add a command to the history stack.
Source code in src/easyscience/global_object/undo_redo.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
redo()
Redo the last undo command on the stack.
Source code in src/easyscience/global_object/undo_redo.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
redoText()
Text associated with a redo item.
Source code in src/easyscience/global_object/undo_redo.py
279 280 281 282 283 284 | |
undo()
Undo the last change to the stack.
Source code in src/easyscience/global_object/undo_redo.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
undoText()
Text associated with a undo item.
Source code in src/easyscience/global_object/undo_redo.py
286 287 288 289 290 291 | |
property_stack(arg, begin_macro=False)
Decorate a property setter with undo/redo functionality
This decorator can be used as:
@property_stack def func() ....
or
@property_stack("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}
Source code in src/easyscience/global_object/undo_redo.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |