# Adds Python functions/methods to the Windows context menu
## pip install shellextools
### Here are some examples:
https://github.com/hansalemaos/ripgrepgui
[![](https://i.ytimg.com/vi/54XZXw1KOvQ/oar2.jpg?sqp=-oaymwEaCJUDENAFSFXyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLAsTyJc2bHqxjyDSqz29y_VQpVQ2A)](https://www.youtube.com/shorts/54XZXw1KOvQ)
https://github.com/hansalemaos/rc_collage
[![](https://i.ytimg.com/vi/c9OouCauJ1Y/oar2.jpg?sqp=-oaymwEaCJUDENAFSFXyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLBa8cG36u-xxiLEfehP5JcSw_a89g)](https://www.youtube.com/shorts/c9OouCauJ1Y)
https://github.com/hansalemaos/rc_pictools
[![](https://i.ytimg.com/vi/EsSrjG5vNpY/oar2.jpg?sqp=-oaymwEaCJUDENAFSFXyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLDG3OahMcwdMtadJPwRe9lQvviQWA)](https://www.youtube.com/shorts/EsSrjG5vNpY)
[![](https://i.ytimg.com/vi/SPcOx8M4Wqo/oar2.jpg)](https://www.youtube.com/shorts/SPcOx8M4Wqo)
https://github.com/githubrobbi/Ultra-Fast-File-Search
## Create a pyw file
```python
from PIL import Image
from hackyargparser import add_sysargv
from shellextools import (
format_folder_drive_path_backslash,
add_multicommands_files,
change_file_extension,
)
import sys
@add_sysargv
def main(path: str = "", action: str = ""):
path = format_folder_drive_path_backslash(path)
img = Image.open(path)
if action == "convert2ico":
iconfi = change_file_extension(path=path, extension="ico")
img.resize((512, 512)).save(iconfi)
if action == "convert2gray":
iconfi = change_file_extension(path=path, prefix="gray_", extension="png")
img.convert("L").save(iconfi)
if action == "convert2bw":
iconfi = change_file_extension(path=path, prefix="bw_", extension="png")
img.convert("1").save(iconfi)
return 0
if __name__ == "__main__":
if len(sys.argv) == 1:
futurnameofcompiledexe = "pictools.exe"
multicommands = [
{
"mainmenuitem": "PicTools",
"submenu": "Convert to .ico",
"folderinprogramdata": "RCTools",
"filetypes": ["bmp", "png", "jpg", "jpeg"],
"additional_arguments": "--action convert2ico",
},
{
"mainmenuitem": "PicTools",
"submenu": "Convert to grayscale",
"folderinprogramdata": "RCTools",
"filetypes": ["bmp", "png", "jpg", "jpeg"],
"additional_arguments": "--action convert2gray",
},
{
"mainmenuitem": "PicTools",
"submenu": "Convert to bw",
"folderinprogramdata": "RCTools",
"filetypes": ["bmp", "png", "jpg", "jpeg"],
"additional_arguments": "--action convert2bw",
},
]
add_multicommands_files(multicommands, futurnameofcompiledexe)
else:
main()
```
## Compile it with nutika
```python
from nutikacompile import compile_with_nuitka
wholecommand = compile_with_nuitka(
pyfile=r"C:\ProgramData\anaconda3\envs\nu\pictools.pyw",
icon=r"C:\Users\hansc\Downloads\cova.jpg",
disable_console=True,
file_version="1.0.0.0",
onefile=True,
outputdir="c:\\nuitkapictoicon",
addfiles=[
],
delete_onefile_temp=False, # creates a permanent cache folder
needs_admin=True,
arguments2add="--msvc=14.3 --noinclude-numba-mode=nofollow",
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/shellextools",
"name": "shellextools",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Windows context menu,python,nutika",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/21/8d/ffce1dbd1ee779fca4990edf954f4882ec6da8bf34cc4ff0b3893a99d513/shellextools-0.15.tar.gz",
"platform": null,
"description": "# Adds Python functions/methods to the Windows context menu\r\n\r\n## pip install shellextools \r\n\r\n### Here are some examples:\r\n\r\n\r\n\r\nhttps://github.com/hansalemaos/ripgrepgui\r\n\r\n[![](https://i.ytimg.com/vi/54XZXw1KOvQ/oar2.jpg?sqp=-oaymwEaCJUDENAFSFXyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLAsTyJc2bHqxjyDSqz29y_VQpVQ2A)](https://www.youtube.com/shorts/54XZXw1KOvQ)\r\n\r\nhttps://github.com/hansalemaos/rc_collage\r\n\r\n[![](https://i.ytimg.com/vi/c9OouCauJ1Y/oar2.jpg?sqp=-oaymwEaCJUDENAFSFXyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLBa8cG36u-xxiLEfehP5JcSw_a89g)](https://www.youtube.com/shorts/c9OouCauJ1Y)\r\n\r\nhttps://github.com/hansalemaos/rc_pictools\r\n\r\n[![](https://i.ytimg.com/vi/EsSrjG5vNpY/oar2.jpg?sqp=-oaymwEaCJUDENAFSFXyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLDG3OahMcwdMtadJPwRe9lQvviQWA)](https://www.youtube.com/shorts/EsSrjG5vNpY)\r\n\r\n[![](https://i.ytimg.com/vi/SPcOx8M4Wqo/oar2.jpg)](https://www.youtube.com/shorts/SPcOx8M4Wqo)\r\n\r\nhttps://github.com/githubrobbi/Ultra-Fast-File-Search\r\n\r\n\r\n## Create a pyw file \r\n\r\n```python\r\nfrom PIL import Image\r\nfrom hackyargparser import add_sysargv\r\nfrom shellextools import (\r\n format_folder_drive_path_backslash,\r\n add_multicommands_files,\r\n change_file_extension,\r\n)\r\nimport sys\r\n\r\n\r\n@add_sysargv\r\ndef main(path: str = \"\", action: str = \"\"):\r\n path = format_folder_drive_path_backslash(path)\r\n img = Image.open(path)\r\n\r\n if action == \"convert2ico\":\r\n iconfi = change_file_extension(path=path, extension=\"ico\")\r\n img.resize((512, 512)).save(iconfi)\r\n if action == \"convert2gray\":\r\n iconfi = change_file_extension(path=path, prefix=\"gray_\", extension=\"png\")\r\n img.convert(\"L\").save(iconfi)\r\n if action == \"convert2bw\":\r\n iconfi = change_file_extension(path=path, prefix=\"bw_\", extension=\"png\")\r\n img.convert(\"1\").save(iconfi)\r\n return 0\r\n\r\n\r\nif __name__ == \"__main__\":\r\n if len(sys.argv) == 1:\r\n futurnameofcompiledexe = \"pictools.exe\"\r\n multicommands = [\r\n {\r\n \"mainmenuitem\": \"PicTools\",\r\n \"submenu\": \"Convert to .ico\",\r\n \"folderinprogramdata\": \"RCTools\",\r\n \"filetypes\": [\"bmp\", \"png\", \"jpg\", \"jpeg\"],\r\n \"additional_arguments\": \"--action convert2ico\",\r\n },\r\n {\r\n \"mainmenuitem\": \"PicTools\",\r\n \"submenu\": \"Convert to grayscale\",\r\n \"folderinprogramdata\": \"RCTools\",\r\n \"filetypes\": [\"bmp\", \"png\", \"jpg\", \"jpeg\"],\r\n \"additional_arguments\": \"--action convert2gray\",\r\n },\r\n {\r\n \"mainmenuitem\": \"PicTools\",\r\n \"submenu\": \"Convert to bw\",\r\n \"folderinprogramdata\": \"RCTools\",\r\n \"filetypes\": [\"bmp\", \"png\", \"jpg\", \"jpeg\"],\r\n \"additional_arguments\": \"--action convert2bw\",\r\n },\r\n ]\r\n add_multicommands_files(multicommands, futurnameofcompiledexe)\r\n else:\r\n main()\r\n\r\n\r\n\r\n```\r\n\r\n\r\n\r\n## Compile it with nutika \r\n\r\n```python\r\nfrom nutikacompile import compile_with_nuitka\r\n\r\nwholecommand = compile_with_nuitka(\r\n pyfile=r\"C:\\ProgramData\\anaconda3\\envs\\nu\\pictools.pyw\",\r\n icon=r\"C:\\Users\\hansc\\Downloads\\cova.jpg\",\r\n disable_console=True,\r\n file_version=\"1.0.0.0\",\r\n onefile=True,\r\n outputdir=\"c:\\\\nuitkapictoicon\",\r\n addfiles=[\r\n ],\r\n delete_onefile_temp=False, # creates a permanent cache folder\r\n needs_admin=True,\r\n arguments2add=\"--msvc=14.3 --noinclude-numba-mode=nofollow\",\r\n)\r\n\r\n\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Adds Python functions/methods to the Windows context menu",
"version": "0.15",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/shellextools"
},
"split_keywords": [
"windows context menu",
"python",
"nutika"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "05fa53d8ccbd3c4851e0a85072ea91e237612b7e208ef3de3b70e4746fd56f33",
"md5": "c22b0798c7bd5c0de14801a6be456b0e",
"sha256": "49bc6091779774d994bbadb0dbe046b5e5807f9436e2c7c1ce9bd56765c19788"
},
"downloads": -1,
"filename": "shellextools-0.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c22b0798c7bd5c0de14801a6be456b0e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 20933,
"upload_time": "2023-04-28T23:08:35",
"upload_time_iso_8601": "2023-04-28T23:08:35.623358Z",
"url": "https://files.pythonhosted.org/packages/05/fa/53d8ccbd3c4851e0a85072ea91e237612b7e208ef3de3b70e4746fd56f33/shellextools-0.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "218dffce1dbd1ee779fca4990edf954f4882ec6da8bf34cc4ff0b3893a99d513",
"md5": "20e8cf8ca0c4cfb0e951a1ae514f53c6",
"sha256": "d07bb93e2ede31bd9bb51b52ba653bd48a3eb90c48476cdc5c7e68406e54f482"
},
"downloads": -1,
"filename": "shellextools-0.15.tar.gz",
"has_sig": false,
"md5_digest": "20e8cf8ca0c4cfb0e951a1ae514f53c6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19224,
"upload_time": "2023-04-28T23:08:38",
"upload_time_iso_8601": "2023-04-28T23:08:38.057536Z",
"url": "https://files.pythonhosted.org/packages/21/8d/ffce1dbd1ee779fca4990edf954f4882ec6da8bf34cc4ff0b3893a99d513/shellextools-0.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-28 23:08:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "shellextools",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "amiadmin",
"specs": []
},
{
"name": "ctypestoast",
"specs": []
},
{
"name": "downloadunzip",
"specs": []
},
{
"name": "escape_windows_filepath",
"specs": []
},
{
"name": "flatten_any_dict_iterable_or_whatsoever",
"specs": []
},
{
"name": "flatten_everything",
"specs": []
},
{
"name": "hackyargparser",
"specs": []
},
{
"name": "isiter",
"specs": []
},
{
"name": "list_all_files_recursively",
"specs": []
},
{
"name": "lockexclusive",
"specs": []
},
{
"name": "ordered_set",
"specs": []
},
{
"name": "reggisearch",
"specs": []
},
{
"name": "tolerant_isinstance",
"specs": []
},
{
"name": "touchtouch",
"specs": []
}
],
"lcname": "shellextools"
}