-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
from neosent.sheetwriter import * | ||
from sys import argv, exit | ||
from sys import exit | ||
import pkg_resources | ||
import click | ||
|
||
@click.group(invoke_without_command=True) | ||
@click.option('--set-res', 'res', default=(3840, 2160), show_default=True, type=(int, int), | ||
metavar='<height width>', help="the sheet's height and width") # Needs to be converted into (1280x720) | ||
@click.option('--set-font', 'font', default="data/OpenSansEmoji.ttf", | ||
metavar='<font_path>', help='the font used') | ||
@click.option('--set-bg', 'bg', default=(8, 8, 8), type=(int, int, int), | ||
metavar='<R G B>', help='set the background color') # Needs to be converted to (0, 0, 0) before being consumed | ||
@click.option('--set-fg', 'fg', default=(248, 248, 242), type=(int, int, int), | ||
metavar='<R G B>', help='set the foreground color') # Idem | ||
@click.option('--set-font-size', 'font_size', default=240, show_default=True, type=int, | ||
metavar='<size>', help='set the font size') | ||
@click.argument('filename', type=click.Path(exists=True)) | ||
def cli(res, font, bg, fg, font_size, filename): | ||
font_path = '' | ||
if font == 'data/OpenSansEmoji.ttf': | ||
font_path = pkg_resources.resource_filename(__name__, font) | ||
else: | ||
font_path = font | ||
|
||
def main(): | ||
font_path = pkg_resources.resource_filename(__name__, 'data/OpenSansEmoji.ttf') | ||
sheet = SheetWriter((1280, 720), (0, 0, 0), '/usr/share/fonts/gnu-free/FreeSans.ttf') | ||
sheet = SheetWriter(res, bg, fg, font_path, font_size, filename) | ||
sheet.create_sheet() | ||
print(res, font, bg, fg, filename) | ||
exit(0) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,22 +13,22 @@ def read(fname): | |
|
||
setup( | ||
name='NeoSent', | ||
version='0.1', | ||
version='0.8', | ||
url='https://github.com/RaphGL/NeoSent', | ||
author='RaphGL', | ||
author_email='[email protected]', | ||
description='Suckful Sent', | ||
long_description=read('README.md'), | ||
packages=find_namespace_packages(), | ||
install_requires=['pillow'], | ||
install_requires=['pillow', 'click'], | ||
classifiers=[ | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
], | ||
entry_points={ | ||
'console_scripts': [ | ||
'neosent = neosent.main:main', | ||
'neosent = neosent.main:cli', | ||
], | ||
}, | ||
include_package_data=True, | ||
|