Schnittstelle
Installation
pip install schnittstelle
Import
# completer
from schnittstelle import Completer, CompleterStyle, RunnableCompleter
# loader
from schnittstelle import Loader, LoaderStyle, RunnableLoader
# decorators
from schnittstelle import decorators
Completer
[✓] complete
[X] fail
While completer is drawing to print
use
completer.print('string to print')
-
with
statementRecommended
with Completer(message='Dummy bar') as completer: # code pass
The object will auto complete when on exiting
with
statementYou may also exit using
completer.complete
orcompleter.fail()
from schnittstelle import decorators @decorators.Completer(message='foo bar') def foo(s): # code
Everytime the function is called Completer will appear
In case of exception it is caught and runs the fail method of completer
Using this method you're not able to access completer class itself
completer = Completer().init() # code completer.complete() # or completer.fail()
Exit the completer using
completer.complete
orcompleter.fail()
Not recommended
def foo(s): # code runnable = RunnableCompleter(foo, message='foo bar') runnable.run('foo')
All arguments go into run method
In case of exception it is caught and runs the fail method of completer
Using this method you're not able to access completer class itself
-
-
Takes in class CompleterStyle
default
default settingsprefix
character before char
default: [
postfix
character after char
default: ]
success
color of character when successful
default: GREEN
error
color of character when unsuccessful
default: RED
info
color of character in info messages
default: BLUE
-
Loader
This is the progress bar
class of package
[== ] Dummy bar
While the progress bar is in progress to print
use
loader.print('string to print')
-
with
statementRecommended
with Loader(message='Dummy bar') as loader: # code pass
The bar will auto complete when on exiting
with
statementYou may also exit using
loader.complete
orloader.fail()
from schnittstelle import decorators @decorators.Loader(message='foo bar') def foo(s): # code
Everytime the function is called loader will appear
In case of exception it is caught and runs the fail method of loader
Using this method you're not able to access loader class itself
loader = Loader().init() # code loader.complete() # or loader.fail()
Exit the progress bar using
loader.complete
orloader.fail()
Not recommended
def foo(s): # code runnable = RunnableLoader(foo, message='foo bar') runnable.run('foo')
All arguments go into run method
In case of exception it is caught and runs the fail method of loader
Using this method you're not able to access loader class itself
-
To change the configurations at runtime use
loader.brush.[configuration]
syntaxconfigurations need to be passed into class initiator as keyword arguments
-
value
Current value of progress
If this value is less than 0, the progress bar is
indeterminate
-
total
Total progress for the bar
-
message
Message label to display on progress bar
In the above example it is Dummy bar
-
frequency
Number of refreshes per second
This will determine the
speed
of the progress bar as wellIf frequency is too low, progress bar might not show progress as intended
default
is 20 refreshes per sec -
Takes in class LoaderStyle
default
default settingsascii
only containing ascii charswidth
width of the progress bar
default: 5
cursor_width
Fill width of indeterminate progress bar
default: 3
fill
Fill indicator charactor
default: FULL_BLOCK
empty
empty indicator charactor
default: SPACE
prefix
character before progress bar
default: [
postfix
character after progress bar
default: ]
-