UserFolder


NameUserFolder JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/legopitstop/UserFolder/
SummaryThis library allows you to write and save files to the users folder. Useful for when you convert this script to a onefile exe program.
upload_time2023-04-19 21:34:14
maintainer
docs_urlNone
authorLegopitstop
requires_python>=3.11
licenseMIT
keywords filemanagement user folder easy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # UserFolder

## What is this?

This is a simple library that allows you to read, write and create files within your own folder inside the user folder (`C:/User/USER/.python/PACKAGE_ID`)

## Features

- Automatically creates the directory.
- Read and write to files inside the User folder.
- Includes an uninstall function that will delete all files inside your directory.
- A function to open the directory or open the file that is inside the directory.

## Install

`pip install UserFolder`

## Requirements

| Name | Descirption |
|--|--|
| [`requests`](https://pypi.org/project/requests/) | **Requests** is a simple, yet elegant, HTTP library. |
| [`uuid`](https://pypi.org/project/uuid/) | UUID object and generation functions (Python 2.3 or higher) |

## License

MIT License


## Examples
Download needed assets

```Python
import UserFolder

user = UserFolder.User('com.legopitstop.example') # Create user folder

if user.exists('UserFolder-1.0.2')==False: # Check if folder already exists
    # Download ZIP
    user.download('https://github.com/legopitstop/UserFolder/archive/refs/tags/v1.0.2.zip', 'package.zip')
    # Unarchive ZIP
    user.unarchive('package.zip')


```

Universal config
```Python
import tkinter
import UserFolder
from UserFolder import dialog
from enum import Enum

user = UserFolder.User('com.legopitstop.example') # Create user folder

# Define values
class values(Enum):
    item1 = 'item1'
    item2 = 'item2'
    item3 = 'item3'
    item4 = 'item4'
    item5 = 'item5'

# Create config with section "metadata"
config = UserFolder.Config(section='metadata')

# Register options
config.registerItem('option1', 'value1', str, 'Option1', 'String config item')
config.registerItem('option2', True, bool, 'Option2', 'Boolean config item')
config.registerItem('option3', 1, int, 'Option3', 'Integer config item', from_=0, to=10)
config.registerItem('option4', 1.0, float, 'Option4', 'Float config item', from_=0.0, to=1.0)
config.registerItem('option5', 50, range, 'Option5', 'Range config item')
config.registerItem('option6', values.item1, values, 'Option6', 'Enum config item')

# Tkinter UI
root = tkinter.Tk()
root.title('Main Window')
root.minsize(500, 500)

# Open config dialog when pressed
tkinter.Button(root, text='Open ConfigDialog', command=lambda: dialog.ConfigDialog(parent=root)).pack()

# Open user folder when pressed
tkinter.Button(root, text='Open User Folder', command=user.show).pack()
root.mainloop()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/legopitstop/UserFolder/",
    "name": "UserFolder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "filemanagement,user folder,easy",
    "author": "Legopitstop",
    "author_email": "officiallegopitstop@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c0/6b/63aa22a81ab17a247e28958676e076bc161f89968a730f7dc82fa1dc6077/UserFolder-1.2.0.tar.gz",
    "platform": null,
    "description": "# UserFolder\r\n\r\n## What is this?\r\n\r\nThis is a simple library that allows you to read, write and create files within your own folder inside the user folder (`C:/User/USER/.python/PACKAGE_ID`)\r\n\r\n## Features\r\n\r\n- Automatically creates the directory.\r\n- Read and write to files inside the User folder.\r\n- Includes an uninstall function that will delete all files inside your directory.\r\n- A function to open the directory or open the file that is inside the directory.\r\n\r\n## Install\r\n\r\n`pip install UserFolder`\r\n\r\n## Requirements\r\n\r\n| Name | Descirption |\r\n|--|--|\r\n| [`requests`](https://pypi.org/project/requests/) | **Requests** is a simple, yet elegant, HTTP library. |\r\n| [`uuid`](https://pypi.org/project/uuid/) | UUID object and generation functions (Python 2.3 or higher) |\r\n\r\n## License\r\n\r\nMIT License\r\n\r\n\r\n## Examples\r\nDownload needed assets\r\n\r\n```Python\r\nimport UserFolder\r\n\r\nuser = UserFolder.User('com.legopitstop.example') # Create user folder\r\n\r\nif user.exists('UserFolder-1.0.2')==False: # Check if folder already exists\r\n    # Download ZIP\r\n    user.download('https://github.com/legopitstop/UserFolder/archive/refs/tags/v1.0.2.zip', 'package.zip')\r\n    # Unarchive ZIP\r\n    user.unarchive('package.zip')\r\n\r\n\r\n```\r\n\r\nUniversal config\r\n```Python\r\nimport tkinter\r\nimport UserFolder\r\nfrom UserFolder import dialog\r\nfrom enum import Enum\r\n\r\nuser = UserFolder.User('com.legopitstop.example') # Create user folder\r\n\r\n# Define values\r\nclass values(Enum):\r\n    item1 = 'item1'\r\n    item2 = 'item2'\r\n    item3 = 'item3'\r\n    item4 = 'item4'\r\n    item5 = 'item5'\r\n\r\n# Create config with section \"metadata\"\r\nconfig = UserFolder.Config(section='metadata')\r\n\r\n# Register options\r\nconfig.registerItem('option1', 'value1', str, 'Option1', 'String config item')\r\nconfig.registerItem('option2', True, bool, 'Option2', 'Boolean config item')\r\nconfig.registerItem('option3', 1, int, 'Option3', 'Integer config item', from_=0, to=10)\r\nconfig.registerItem('option4', 1.0, float, 'Option4', 'Float config item', from_=0.0, to=1.0)\r\nconfig.registerItem('option5', 50, range, 'Option5', 'Range config item')\r\nconfig.registerItem('option6', values.item1, values, 'Option6', 'Enum config item')\r\n\r\n# Tkinter UI\r\nroot = tkinter.Tk()\r\nroot.title('Main Window')\r\nroot.minsize(500, 500)\r\n\r\n# Open config dialog when pressed\r\ntkinter.Button(root, text='Open ConfigDialog', command=lambda: dialog.ConfigDialog(parent=root)).pack()\r\n\r\n# Open user folder when pressed\r\ntkinter.Button(root, text='Open User Folder', command=user.show).pack()\r\nroot.mainloop()\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This library allows you to write and save files to the users folder. Useful for when you convert this script to a onefile exe program.",
    "version": "1.2.0",
    "split_keywords": [
        "filemanagement",
        "user folder",
        "easy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c06b63aa22a81ab17a247e28958676e076bc161f89968a730f7dc82fa1dc6077",
                "md5": "ce5edfceedd4bdd269615e2ecf672243",
                "sha256": "e14e5617de0c4943bcc3c0293aa7d376d30d00ff3d336dc208a6c231b06dcf0a"
            },
            "downloads": -1,
            "filename": "UserFolder-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ce5edfceedd4bdd269615e2ecf672243",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 12951,
            "upload_time": "2023-04-19T21:34:14",
            "upload_time_iso_8601": "2023-04-19T21:34:14.297346Z",
            "url": "https://files.pythonhosted.org/packages/c0/6b/63aa22a81ab17a247e28958676e076bc161f89968a730f7dc82fa1dc6077/UserFolder-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-19 21:34:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "legopitstop",
    "github_project": "UserFolder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "userfolder"
}
        
Elapsed time: 0.06612s