Skip to content

Commit

Permalink
Smart Printer v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smartlegionlab committed May 8, 2024
1 parent 1f9edf8 commit 9f1d9d6
Show file tree
Hide file tree
Showing 17 changed files with 503 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include LICENSE
include README.md
include requirements.txt
include tox.ini
include setup.cfg
include setup.py
global-exclude tests/*
global-exclude data/*
global-exclude requirements/*
130 changes: 129 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,130 @@
# smartprinter
Cross-platform smart printer for console applications.


***

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/smartprinter)](https://github.com/smartlegionlab/smartprinter/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/smartprinter?label=pypi%20downloads)](https://pypi.org/project/smartprinter/)
![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/smartprinter)
[![PyPI](https://img.shields.io/pypi/v/smartprinter)](https://pypi.org/project/smartprinter)
[![GitHub](https://img.shields.io/github/license/smartlegionlab/smartprinter)](https://github.com/smartlegionlab/smartprinter/blob/master/LICENSE)
[![PyPI - Format](https://img.shields.io/pypi/format/smartprinter)](https://pypi.org/project/smartprinter)

***

## Short Description:
___smartprinter___ - Cross-platform smart printer for console applications.

***

Author and developer: ___A.A Suvorov___

[![smartlegiondev@gmail.com](https://img.shields.io/static/v1?label=email:&message=smartlegiondev@gmail.com&color=blue)](mailto:smartlegiondev@gmail.com)

***

## Supported:

- Linux: All.
- Windows: 7/8/10.
- Termux (Android).

***

## Images:

![logo](https://github.com/smartlegionlab/smartprinter/raw/master/data/images/smartprinter.png)

***

## What's new?

### ___smartprinter v0.2.0___

***

## Description:

___smartprinter___ - Cross-platform smart printer for console applications.

Has several different objects for displaying to the console or generating a string:

- Normal output.
- Output with the ability to change the line color .
- Displaying a message inside the pager, with the ability to scroll up and down, exit the pager, and print the message
after being shown in a pager.
- output with the ability to print a message in the center of the console, regardless of changes in its width,
indented before and after the message, indented with the specified characters.

***

## Help:

### Install and use:

- `pip install -r requirements.txt`
- for tests: `pip install requirements/requirements-dev.txt`
- for test coverage: `pytest --cov --cov-report=html`

### Use:

- `pip3 install smartprinter`

```python
from smartprinter.printers import Printer, PrintersFactory

printer = Printer()
printer.base.echo('Text')
printer.click.echo('Text', show=True, color='green')
printer.smart.echo('Text', show=True, char='*')
printer.pager.echo('Text', show=True)

def_printer = PrintersFactory.get_base()
click_printer = PrintersFactory.get_click()
smart_printer = PrintersFactory.get_smart()
pager = PrintersFactory.get_pager()

```

or

```python
from smartprinter.printers import Printer

printer = Printer()
Printer.base.echo('Text')
Printer.click.echo('Text', show=True, color='green')
Printer.smart.echo('Text', show=True, char='*')
Printer.pager.echo('Text', show=True)

```

***

- Use [click](https://github.com/pallets/click) by [license](https://github.com/pallets/click/blob/main/LICENSE.rst)

***

## Disclaimer of liability:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

***

## Information:

--------------------------------------------------------
Licensed under the terms of the BSD 3-Clause License
(see LICENSE for details).
Copyright © 2018-2024, A.A Suvorov
All rights reserved.
--------------------------------------------------------
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-architect
Binary file added data/images/smartprinter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
click~=8.0.1
5 changes: 5 additions & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
click
pytest
pytest-cov
tox
build
3 changes: 3 additions & 0 deletions requirements/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pytest
tox
build
44 changes: 44 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[metadata]
name = smartprinter
version = attr: smartprinter.__version__
author = A.A Suvorov
author_email = smartlegiondev@gmail.com
description = 'Cross-platform smart printer for console applications.'
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/smartlegionlab
project_urls =
Documentation = https://github.com/smartlegionlab/smartprinter/blob/master/README.md
Release notes = https://github.com/smartlegionlab/smartprinter/releases
license = BSD 3-Clause License
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: End Users/Desktop
Intended Audience :: System Administrators
License :: OSI Approved :: BSD License
Natural Language :: English
Operating System :: OS Independent
Operating System :: Microsoft :: Windows
Operating System :: POSIX :: Linux
Programming Language :: Python :: 3 :: Only
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Utilities
keywords =
smart print
printer
smartlegionlab

[options]
python_requires = >=3.6
packages = find:
include_package_data = true
zip_safe = false
install_requires =
click ~= 8.0.1

[coverage:run]
omit =
venv/*
.pytest_cache
*__init__.py
11 changes: 11 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2024, A.A Suvorov
# All rights reserved.
# --------------------------------------------------------
from setuptools import setup, find_packages

setup(
packages=find_packages(exclude=("tests", "data", "requirements")),
)
8 changes: 8 additions & 0 deletions smartprinter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2024, A.A Suvorov
# All rights reserved.
# --------------------------------------------------------
"""Cross-platform smart printer for console applications."""
__version__ = '0.2.0'
32 changes: 32 additions & 0 deletions smartprinter/commons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2024, A.A Suvorov
# All rights reserved.
# --------------------------------------------------------
from smartprinter.printers import (
BasePrinter,
ClickPrinter,
PagerPrinter,
SmartPrinter
)


def def_print(text=''):
printer = BasePrinter()
return printer.echo(text)


def click_print(text='', show=True, color=None):
printer = ClickPrinter()
return printer.echo(text=text, show=show, color=color)


def pager_print(text='', show=True, color=None):
printer = PagerPrinter()
return printer.echo(text=text, show=show, color=color)


def smart_print(text='', char='-', show=True):
printer = SmartPrinter()
return printer.echo(text=text, char=char, show=show)
Loading

0 comments on commit 9f1d9d6

Please sign in to comment.