<h1 align="center">
Credito
</h1>
<br/>
<div align="center">
## Credito is a program to make **instant** credits in any Python app.
`pip install credito`
<div align="center">
<a href="https://github.com/james-beans/credito">
<img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/james-beans/credito?style=for-the-badge&logo=Github">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/james-beans/credito?style=for-the-badge&logo=Github">
<img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues-closed/james-beans/credito?style=for-the-badge&logo=Github">
</a>
<br>
<a href="https://pypi.org/project/credito/"><img alt="Python Version" src="https://img.shields.io/pypi/pyversions/credito?style=for-the-badge&logo=Pypi&logoColor=white"></a>
<br>
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/badge/licence-GPLv3?style=for-the-badge&logo=GNU"></a>
</div>
</div>
<hr>
<div align="center">
# License
This project is licensed under the GNU General Public License v3.0 (GPLv3). See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.en.html) for details.
</div>
<hr>
<div align="left">
# Documentation
## Install with:
`pip3 install credito`
`pip install credito`
## Configure and Use `credito`:
## 1. Import and Configure the Module:
You can import `credito` from the `credito` package and configure it with the path to your custom `credits.cfg` file. If you don’t specify a path, the default `credits.cfg` file included in the package will be used.
```
from credito import Credito
# Create an instance of Credito
credito = Credito()
# If you put nothing in the brackets then it will
# automatically use the default credits.cfg file included in the package.
credito.config()
# Or,
# Configure with a custom credits.cfg file
credito.config('path/to/your/custom/credits.cfg')
```
## 2. Start the Handler:
To start listening for the key combination **(CTRL + O)** and display the credits, you can call the `handler` function.
```
credito.handler()
```
## 3. Run the Module:
To have `credito` run in the background and listen for the key combination, you can run it as a standalone script or integrate it into your application.
If running as a standalone script, you can simply execute:
```
python -m credito
```
Or, integrate it into your application by calling the `handler` function as shown above.
<hr>
</div>
<div align="left">
# How the Printing Works:
## 1. Configuration `(credito.config)`:
- When you call `credito.config("path/to/custom/credits.cfg")`, it loads the content of the `credits.cfg` file into memory by reading it and storing the content in the `self.credits` variable.
- If you don't pass a path to the `config` function, it will use the default `credits.cfg` file included in the package.
## 2. Keypress Handler(`handler`):
- When the `CTRL + O` key combination is detected by the `listen_for_keypress` function, it triggers the `handler()` function. The handler() function, in turn, calls `credito.show_credits()`.
## 3. Displaying Credits (`show_credits`):
- Inside `show_credits()`, the console is cleared using `os.system('cls' if os.name == 'nt' else 'clear')`, and then the content of `self.credits` (which contains the content from `credits.cfg`) is printed.
- The program pauses for 10 seconds (`time.sleep(10)`), allowing the user to see the credits, and then it optionally clears the screen again.
<hr>
<div align="left">
# Additional Notes
## Running in Background:
- The listen_for_keypress function runs in a separate thread, so the main program remains responsive. Make sure to handle this appropriately in your application.
## No cross platform:
- Don't ask me to add cross platform. I am way too busy to be doing that. It might work cross platform it's just I can't test it and it might not be reliable. Credito was made to work for **Windows** only. The example provided is tailored for Windows using `ctypes`. If you need cross-platform support, you may need to use different libraries or methods to handle global keypress events on other operating systems.
## Permissions:
- Capturing global keypresses might require administrative or elevated permissions depending on the system and environment.
## Credits printing:
- Credito will print everything in the `credits.cfg` file. The `credits.cfg` file is like a text document for Credito. Make sure the file has the content you want to display, and that it is correctly loaded into the config using the method shown in the documentation above. The Credits will allways be visible for 10 seconds, then either the console will clear again, or the terminal application will resume as normal.
## What is the default/auto config?
```
Thank you for using our application!
Credits:
- Developer: Your Name
- Support: support@example.com
Enjoy using our software!
```
- I chose this so it could be a template for easy testing. You are free to copy and change the default/auto config.
</div>
</div>
<hr>
<div align="left">
## Directory Structure:
```
credito/ - # Base directory
├── credito/ - # Main package folder
│ ├── __init__.py - # Initializes the package
│ ├── credito.py - # Contains the Credito class and logic
│ └── data/ - # Contains seperate info
│ └── credits.cfg - # Default credits file
├── tests/ - # Tests folder
│ ├── __init__.py - # Can be empty or contain shared fixtures
│ ├── conftest.py - # Global fixtures and hooks for tests
│ ├── test_credito.py - # Unit tests for Credito class
├── README.md - # Project description
├── setup.py - # Setup script for packaging
└── LICENSE - # Obviously just a license
```
</div>
<hr>
<div align="center">
âš¡ **Quote**<br> "Talk is cheap. Show me the code." <br> **-- Linus Torvalds --**
</div>
<br/>
Raw data
{
"_id": null,
"home_page": "https://github.com/james-beans/credito",
"name": "credito",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": null,
"author": "James-Beans",
"author_email": "hello@jamesdev.xyz",
"download_url": "https://files.pythonhosted.org/packages/ee/a0/6eff669bfd91fc905ae43706e8f10358f8b3c6d7d5886d5db8e53e15a6b4/credito-3.2.5.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">\r\n Credito\r\n</h1>\r\n\r\n<br/>\r\n\r\n<div align=\"center\">\r\n \r\n## Credito is a program to make **instant** credits in any Python app.\r\n`pip install credito`\r\n\r\n<div align=\"center\">\r\n<a href=\"https://github.com/james-beans/credito\">\r\n <img alt=\"GitHub Issues or Pull Requests\" src=\"https://img.shields.io/github/issues/james-beans/credito?style=for-the-badge&logo=Github\">\r\n <img alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/james-beans/credito?style=for-the-badge&logo=Github\">\r\n <img alt=\"GitHub Issues or Pull Requests\" src=\"https://img.shields.io/github/issues-closed/james-beans/credito?style=for-the-badge&logo=Github\">\r\n</a>\r\n <br>\r\n <a href=\"https://pypi.org/project/credito/\"><img alt=\"Python Version\" src=\"https://img.shields.io/pypi/pyversions/credito?style=for-the-badge&logo=Pypi&logoColor=white\"></a>\r\n <br>\r\n <a href=\"https://www.gnu.org/licenses/gpl-3.0.en.html\"><img alt=\"GitHub Issues or Pull Requests\" src=\"https://img.shields.io/badge/licence-GPLv3?style=for-the-badge&logo=GNU\"></a>\r\n</div>\r\n\r\n\r\n</div>\r\n \r\n<hr>\r\n<div align=\"center\">\r\n\r\n# License\r\nThis project is licensed under the GNU General Public License v3.0 (GPLv3). See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.en.html) for details.\r\n</div>\r\n<hr>\r\n\r\n<div align=\"left\">\r\n\r\n# Documentation\r\n## Install with:\r\n\r\n`pip3 install credito`\r\n`pip install credito`\r\n\r\n## Configure and Use `credito`:\r\n\r\n## 1. Import and Configure the Module:\r\n\r\nYou can import `credito` from the `credito` package and configure it with the path to your custom `credits.cfg` file. If you don\u00e2\u20ac\u2122t specify a path, the default `credits.cfg` file included in the package will be used.\r\n\r\n```\r\nfrom credito import Credito\r\n\r\n# Create an instance of Credito\r\ncredito = Credito()\r\n\r\n# If you put nothing in the brackets then it will\r\n# automatically use the default credits.cfg file included in the package.\r\ncredito.config()\r\n# Or,\r\n# Configure with a custom credits.cfg file\r\ncredito.config('path/to/your/custom/credits.cfg')\r\n```\r\n\r\n\r\n## 2. Start the Handler:\r\nTo start listening for the key combination **(CTRL + O)** and display the credits, you can call the `handler` function.\r\n```\r\ncredito.handler()\r\n```\r\n\r\n## 3. Run the Module:\r\nTo have `credito` run in the background and listen for the key combination, you can run it as a standalone script or integrate it into your application.\r\n\r\nIf running as a standalone script, you can simply execute:\r\n```\r\npython -m credito\r\n```\r\nOr, integrate it into your application by calling the `handler` function as shown above.\r\n\r\n<hr>\r\n</div>\r\n<div align=\"left\">\r\n\r\n# How the Printing Works:\r\n\r\n## 1. Configuration `(credito.config)`:\r\n- When you call `credito.config(\"path/to/custom/credits.cfg\")`, it loads the content of the `credits.cfg` file into memory by reading it and storing the content in the `self.credits` variable.\r\n- If you don't pass a path to the `config` function, it will use the default `credits.cfg` file included in the package.\r\n\r\n## 2. Keypress Handler(`handler`):\r\n- When the `CTRL + O` key combination is detected by the `listen_for_keypress` function, it triggers the `handler()` function. The handler() function, in turn, calls `credito.show_credits()`.\r\n\r\n## 3. Displaying Credits (`show_credits`):\r\n- Inside `show_credits()`, the console is cleared using `os.system('cls' if os.name == 'nt' else 'clear')`, and then the content of `self.credits` (which contains the content from `credits.cfg`) is printed.\r\n- The program pauses for 10 seconds (`time.sleep(10)`), allowing the user to see the credits, and then it optionally clears the screen again.\r\n\r\n<hr>\r\n\r\n<div align=\"left\">\r\n\r\n# Additional Notes\r\n\r\n## Running in Background:\r\n- The listen_for_keypress function runs in a separate thread, so the main program remains responsive. Make sure to handle this appropriately in your application.\r\n\r\n## No cross platform:\r\n- Don't ask me to add cross platform. I am way too busy to be doing that. It might work cross platform it's just I can't test it and it might not be reliable. Credito was made to work for **Windows** only. The example provided is tailored for Windows using `ctypes`. If you need cross-platform support, you may need to use different libraries or methods to handle global keypress events on other operating systems. \r\n\r\n## Permissions:\r\n- Capturing global keypresses might require administrative or elevated permissions depending on the system and environment.\r\n\r\n## Credits printing:\r\n- Credito will print everything in the `credits.cfg` file. The `credits.cfg` file is like a text document for Credito. Make sure the file has the content you want to display, and that it is correctly loaded into the config using the method shown in the documentation above. The Credits will allways be visible for 10 seconds, then either the console will clear again, or the terminal application will resume as normal.\r\n\r\n## What is the default/auto config?\r\n```\r\nThank you for using our application!\r\n\r\nCredits:\r\n- Developer: Your Name\r\n- Support: support@example.com\r\n\r\nEnjoy using our software!\r\n```\r\n\r\n- I chose this so it could be a template for easy testing. You are free to copy and change the default/auto config.\r\n\r\n\r\n</div>\r\n\r\n</div>\r\n\r\n<hr>\r\n\r\n<div align=\"left\">\r\n\r\n## Directory Structure:\r\n\r\n```\r\ncredito/ - # Base directory\r\n\u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac credito/ - # Main package folder\r\n\u00e2\u201d\u201a \u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac __init__.py - # Initializes the package\r\n\u00e2\u201d\u201a \u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac credito.py - # Contains the Credito class and logic\r\n\u00e2\u201d\u201a \u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac data/ - # Contains seperate info\r\n\u00e2\u201d\u201a \u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac credits.cfg - # Default credits file \r\n\u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac tests/ - # Tests folder\r\n\u00e2\u201d\u201a \u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac __init__.py - # Can be empty or contain shared fixtures\r\n\u00e2\u201d\u201a \u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac conftest.py - # Global fixtures and hooks for tests\r\n\u00e2\u201d\u201a \u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac test_credito.py - # Unit tests for Credito class\r\n\u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac README.md - # Project description\r\n\u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac setup.py - # Setup script for packaging\r\n\u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac LICENSE - # Obviously just a license\r\n```\r\n\r\n</div>\r\n\r\n<hr>\r\n\r\n<div align=\"center\">\r\n \r\n\u00e2\u0161\u00a1 **Quote**<br> \"Talk is cheap. Show me the code.\" <br> **-- Linus Torvalds --**\r\n\r\n</div>\r\n\r\n<br/>\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python module to display credits on pressing CTRL + O",
"version": "3.2.5",
"project_urls": {
"Homepage": "https://github.com/james-beans/credito"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a523324f9b0b862c90366e2aab469ae1f72079bfbd0c7a1788f82447c2e74dba",
"md5": "b3964b6269b7a3b82b1d06d85516b941",
"sha256": "0b10a4c7fa836126f1cac3f8673de9a95b3e996f4186d655985bd8b511eb3327"
},
"downloads": -1,
"filename": "credito-3.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b3964b6269b7a3b82b1d06d85516b941",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 18700,
"upload_time": "2024-09-08T21:45:35",
"upload_time_iso_8601": "2024-09-08T21:45:35.890675Z",
"url": "https://files.pythonhosted.org/packages/a5/23/324f9b0b862c90366e2aab469ae1f72079bfbd0c7a1788f82447c2e74dba/credito-3.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eea06eff669bfd91fc905ae43706e8f10358f8b3c6d7d5886d5db8e53e15a6b4",
"md5": "3f4dd9720c72e147d2e84b4fcfc3c27f",
"sha256": "ffb861a37a9f99878320330eceeed0069794e6bbfb5817d537b79eed9da8dffb"
},
"downloads": -1,
"filename": "credito-3.2.5.tar.gz",
"has_sig": false,
"md5_digest": "3f4dd9720c72e147d2e84b4fcfc3c27f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 17986,
"upload_time": "2024-09-08T21:45:37",
"upload_time_iso_8601": "2024-09-08T21:45:37.424913Z",
"url": "https://files.pythonhosted.org/packages/ee/a0/6eff669bfd91fc905ae43706e8f10358f8b3c6d7d5886d5db8e53e15a6b4/credito-3.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-08 21:45:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "james-beans",
"github_project": "credito",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "credito"
}