Skip to main content

A console ui interface

Project description

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')
  • Use

    with statement

    Recommended

      with Completer(message='Dummy bar') as completer:
        # code
        pass
    

    The object will auto complete when on exiting with statement

    You may also exit using completer.complete or completer.fail()

    Decorator
    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

    Inline
    completer = Completer().init()
    
    # code
    
    completer.complete() # or completer.fail()
    

    Exit the completer using completer.complete or completer.fail()

    Runnable

    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

  • Configuration

    • style

      Takes in class CompleterStyle

      CompleterStyle
      Static Constuctors

      default default settings

      Attributes

      prefix

      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')
  • Use

    with statement

    Recommended

      with Loader(message='Dummy bar') as loader:
        # code
        pass
    

    The bar will auto complete when on exiting with statement

    You may also exit using loader.complete or loader.fail()

    Decorator
    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

    Inline
    loader = Loader().init()
    
    # code
    
    loader.complete() # or loader.fail()
    

    Exit the progress bar using loader.complete or loader.fail()

    Runnable

    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

  • Configurations

    To change the configurations at runtime use loader.brush.[configuration] syntax

    configurations 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 well

      If frequency is too low, progress bar might not show progress as intended

      default is 20 refreshes per sec

    • style

      Takes in class LoaderStyle

      LoaderStyle
      Static Constuctors

      default default settings

      ascii only containing ascii chars

      Attributes

      width

      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: ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schnittstelle-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

schnittstelle-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file schnittstelle-0.1.0.tar.gz.

File metadata

  • Download URL: schnittstelle-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for schnittstelle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 12a90f360d63f9cbed239ab3cfde6edbb936f00238a00c4a869ed9034c7e2dcf
MD5 b7248f323f5d84a3a8f4a2f8642bbac6
BLAKE2b-256 1b9a539f5dbbe426a1184b27ceccdfc05fd8dc44c2eb32a96ff0a8a5fe9e1cf4

See more details on using hashes here.

File details

Details for the file schnittstelle-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: schnittstelle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for schnittstelle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d6b0e535d48559162f9b3431ce6db0e4004a59dbf3aee4ab61640c439c60ab5
MD5 635ab6c17013a929a00c045af109ab11
BLAKE2b-256 90d300fe6cfe8623e59d1a36a5025800cad230b253f35c2ff023847ce278f938

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page