TaskManager with context resolution
Project description
Developing
Install extras:
python -m pip install .[test] .[lint]
Testing
Ideas
Parallel States
To model a parallel substate, for example you have a MenuMachine and only in the specific menu SFTPState it is possible to change the SFTPState. The SFTPState would be a substate which lives indipendently (parallel) from the main MenuMachine state, however it can only be changed when being when the MenuMachine is in the SFTPMenu state.
It could look something like:
class SFTPMenu(MenuMachine): def enable_sftp(self) -> Prallel(SFTPEnabled): pass def disable_sftp(self) -> Prallel(SFTPDisabled): pass
calling enable_sftp or disable_sftp would not change the main menu state, which would still be in SFTPMenu but the substate would change.
The object carrying the state would probably have multiple attribs, like menustate and sftpstate.
Automatic Transitions
I created this module for automatic transitions, it however only works transparently if there is only one transitions to each state, my current solution is:
class MyState(MyMachine): def transition_which_is_not_normal_path(self): self.state(MyState,NewState)
which works but is not transparent, better would be something like:
class MyState(MyMachine): def transition_which_is_not_normal_path(self) -> NoAutoTrans(NewState): self.state(MyState,NewState)
And to have an easier auto transition it would be great to maybe set some key in the Machine to do auto transitions if possible and then:
MyState(stateobj)
would automaticallly transition if it wouldn’t be in the correct state.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file taskcontext-0.1.0.tar.gz
.
File metadata
- Download URL: taskcontext-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0058e6966bdd571f5fc132209efe93ccb67f999af53401c918a96a7687724a7a |
|
MD5 | 59727f378aee15414eacc18332eaaae2 |
|
BLAKE2b-256 | bd7eae1d67b130b327a4702d347d5f235b5ae24ec05b0cc48a804d05326a2d0e |