Compare commits

..

No commits in common. "master" and "v0.1.1" have entirely different histories.

7 changed files with 9 additions and 164 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
.mypy_cache
__pycache__
*.egg-info
dist

98
poetry.lock generated
View File

@ -1,12 +1,3 @@
[[package]]
category = "main"
description = "Python wrapper for loading Jason Hood's ANSICON"
marker = "platform_system == \"Windows\""
name = "ansicon"
optional = false
python-versions = "*"
version = "1.89.0"
[[package]]
category = "dev"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
@ -58,19 +49,6 @@ typed-ast = ">=1.4.0"
[package.extras]
d = ["aiohttp (>=3.3.2)", "aiohttp-cors"]
[[package]]
category = "main"
description = "Easy, practical library for making terminal apps, by providing an elegant, well-documented interface to Colors, Keyboard input, and screen Positioning capabilities."
name = "blessed"
optional = false
python-versions = "*"
version = "1.17.2"
[package.dependencies]
jinxed = ">=0.5.4"
six = ">=1.9.0"
wcwidth = ">=0.1.4"
[[package]]
category = "main"
description = "Composable command line interface toolkit"
@ -110,33 +88,6 @@ mccabe = ">=0.6.0,<0.7.0"
pycodestyle = ">=2.5.0,<2.6.0"
pyflakes = ">=2.1.0,<2.2.0"
[[package]]
category = "main"
description = "Read metadata from Python packages"
name = "importlib-metadata"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
version = "1.6.0"
[package.dependencies]
zipp = ">=0.5"
[package.extras]
docs = ["sphinx", "rst.linker"]
testing = ["packaging", "importlib-resources"]
[[package]]
category = "main"
description = "Jinxed Terminal Library"
marker = "platform_system == \"Windows\""
name = "jinxed"
optional = false
python-versions = "*"
version = "1.0.0"
[package.dependencies]
ansicon = "*"
[[package]]
category = "dev"
description = "McCabe checker, plugin for flake8"
@ -262,14 +213,6 @@ wcwidth = "*"
checkqa-mypy = ["mypy (v0.761)"]
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"]
[[package]]
category = "main"
description = "PyXDG contains implementations of freedesktop.org standards in python."
name = "pyxdg"
optional = false
python-versions = "*"
version = "0.26"
[[package]]
category = "dev"
description = "Alternative regular expression module, to replace re."
@ -279,7 +222,7 @@ python-versions = "*"
version = "2020.1.8"
[[package]]
category = "main"
category = "dev"
description = "Python 2 and 3 compatibility utilities"
name = "six"
optional = false
@ -311,34 +254,18 @@ python-versions = "*"
version = "3.7.4.1"
[[package]]
category = "main"
category = "dev"
description = "Measures number of Terminal column cells of wide-character codes"
name = "wcwidth"
optional = false
python-versions = "*"
version = "0.1.8"
[[package]]
category = "main"
description = "Backport of pathlib-compatible object wrapper for zip files"
name = "zipp"
optional = false
python-versions = ">=3.6"
version = "3.1.0"
[package.extras]
docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
testing = ["jaraco.itertools", "func-timeout"]
[metadata]
content-hash = "ea66303a3dcb7b3b41a3a0e9d189c6d49b57d574ccc152fa83c9225a3ac3f845"
content-hash = "5ee688461f1b2ba8350b7b41c0576dc2f5657754268b7226cfeac73975b2f26e"
python-versions = "^3.8"
[metadata.files]
ansicon = [
{file = "ansicon-1.89.0-py2.py3-none-any.whl", hash = "sha256:f1def52d17f65c2c9682cf8370c03f541f410c1752d6a14029f97318e4b9dfec"},
{file = "ansicon-1.89.0.tar.gz", hash = "sha256:e4d039def5768a47e4afec8e89e83ec3ae5a26bf00ad851f914d1240b444d2b1"},
]
appdirs = [
{file = "appdirs-1.4.3-py2.py3-none-any.whl", hash = "sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e"},
{file = "appdirs-1.4.3.tar.gz", hash = "sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92"},
@ -355,9 +282,6 @@ black = [
{file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"},
{file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"},
]
blessed = [
{file = "blessed-1.17.2-py2.py3-none-any.whl", hash = "sha256:401e6116c2e34f6c11dd9f5f24e820afd4a4892d2904fcdc8f0b70c618eb099f"},
]
click = [
{file = "Click-7.0-py2.py3-none-any.whl", hash = "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13"},
{file = "Click-7.0.tar.gz", hash = "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"},
@ -374,14 +298,6 @@ flake8 = [
{file = "flake8-3.7.9-py2.py3-none-any.whl", hash = "sha256:49356e766643ad15072a789a20915d3c91dc89fd313ccd71802303fd67e4deca"},
{file = "flake8-3.7.9.tar.gz", hash = "sha256:45681a117ecc81e870cbf1262835ae4af5e7a8b08e40b944a8a6e6b895914cfb"},
]
importlib-metadata = [
{file = "importlib_metadata-1.6.0-py2.py3-none-any.whl", hash = "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f"},
{file = "importlib_metadata-1.6.0.tar.gz", hash = "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e"},
]
jinxed = [
{file = "jinxed-1.0.0-py2.py3-none-any.whl", hash = "sha256:79ceb7097ba9d905000905173554092e81fe31aebb107b9566a15767dfdc3a82"},
{file = "jinxed-1.0.0.tar.gz", hash = "sha256:094d0e1c92b8bcf324d1fb4dceaa82cb79e4524790caf524eca0499807a0fbd8"},
]
mccabe = [
{file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"},
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
@ -442,10 +358,6 @@ pytest = [
{file = "pytest-5.3.5-py3-none-any.whl", hash = "sha256:ff615c761e25eb25df19edddc0b970302d2a9091fbce0e7213298d85fb61fef6"},
{file = "pytest-5.3.5.tar.gz", hash = "sha256:0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d"},
]
pyxdg = [
{file = "pyxdg-0.26-py2.py3-none-any.whl", hash = "sha256:1948ff8e2db02156c0cccd2529b43c0cff56ebaa71f5f021bbd755bc1419190e"},
{file = "pyxdg-0.26.tar.gz", hash = "sha256:fe2928d3f532ed32b39c32a482b54136fe766d19936afc96c8f00645f9da1a06"},
]
regex = [
{file = "regex-2020.1.8-cp27-cp27m-win32.whl", hash = "sha256:4e8f02d3d72ca94efc8396f8036c0d3bcc812aefc28ec70f35bb888c74a25161"},
{file = "regex-2020.1.8-cp27-cp27m-win_amd64.whl", hash = "sha256:e6c02171d62ed6972ca8631f6f34fa3281d51db8b326ee397b9c83093a6b7242"},
@ -510,7 +422,3 @@ wcwidth = [
{file = "wcwidth-0.1.8-py2.py3-none-any.whl", hash = "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603"},
{file = "wcwidth-0.1.8.tar.gz", hash = "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"},
]
zipp = [
{file = "zipp-3.1.0-py3-none-any.whl", hash = "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b"},
{file = "zipp-3.1.0.tar.gz", hash = "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"},
]

View File

@ -1,3 +0,0 @@
from importlib_metadata import version
__version__ = version(__package__)

View File

@ -1,20 +0,0 @@
from pathlib import Path
from xdg import BaseDirectory
import typing
class Dirs:
def __init__(self):
self.conf_dir = Path(BaseDirectory.xdg_config_home).joinpath("pomme")
self.hooks_dirs: typing.Dict[str, Path] = dict()
self.hooks_dirs["after"] = Path(
BaseDirectory.xdg_config_home
).joinpath("pomme/hooks/after")
if not self.conf_dir.is_dir():
self.conf_dir.mkdir(parents=True)
print("Configuration directory created: {}".format(self.conf_dir))
for name, path in self.hooks_dirs.items():
if not path.is_dir():
path.mkdir(parents=True)
print("Hooks directory created {}".format(path))

View File

@ -1,18 +0,0 @@
import os
from pomme.dirs import Dirs
class Hooks():
def __init__(self):
self.dirs = Dirs()
def after(self):
script_list = self.dirs.hooks_dirs["after"].iterdir()
for script in script_list:
if not os.access(script, os.X_OK):
print("{} isn't an executable file".format(script))
elif script.is_file():
os.system(script)
else:
print("Recursion is not implemented")

View File

@ -5,12 +5,7 @@ import os
import sched
import time
from blessed import Terminal # type: ignore
from pomme.timer import Timer
from pomme.hooks import Hooks
from pomme import __version__
file_path = os.path.dirname(__file__)
config = toml.load(os.path.join(file_path, "config.toml"))
@ -18,7 +13,6 @@ config = toml.load(os.path.join(file_path, "config.toml"))
database_location = config['database']['location']
timer = Timer(database_location)
term = Terminal()
@click.command()
@ -41,10 +35,8 @@ def start(duration: str) -> None:
print("timer start")
timer.start(duration)
run_tui_timer()
def run_tui_timer() -> None:
# TODO: abstract this behavior in a function/class besause it's awefull
# TODO: add the stopping condition
s = sched.scheduler(time.time, time.sleep)
s.enter(1, 1, print_time, (s,))
s.run()
@ -54,27 +46,17 @@ def print_time(s) -> None:
"""
:param s: sheduler
"""
hooks = Hooks()
print(term.home + term.clear)
if timer.running():
print(timer.remaining())
else:
print("timer finished")
hooks.after()
return
s.enter(1, 1, print_time, (s,))
@click.group(invoke_without_command=True)
@click.option('-v', '--version', is_flag=True)
def pomme(version) -> None:
""" Pomme timer management system """
context = click.get_current_context()
if version:
print("Pomme version {}".format(__version__))
return
elif not context.invoked_subcommand:
print(context.get_help())
@click.group()
def pomme() -> None:
""" main command """
pass

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pomme"
version = "0.1.3"
version = "0.1.1"
description = "proof of concept for pomme timer"
authors = ["koalp <koalp@alpaga.dev>"]
license = "GPL-3.0-or-later"
@ -9,9 +9,6 @@ license = "GPL-3.0-or-later"
python = "^3.8"
click = "^7.0"
toml = "^0.10.0"
blessed = "^1.5"
pyxdg = "^0.26"
importlib_metadata = "^1.5.0"
[tool.poetry.dev-dependencies]
mypy = "^0.761"