From 8585ea3e1f62915e2d23e2779fee68105ae9d59f Mon Sep 17 00:00:00 2001 From: Abhorrent_Anger Date: Tue, 22 Oct 2019 14:43:20 +0300 Subject: [PATCH] Setup --- README.md | 10 ++++++++++ eyestrainreminder/__init__.py | 1 + main.py => eyestrainreminder/main.py | 9 +++++++-- requirements.txt | 2 ++ setup.py | 17 +++++++++++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 eyestrainreminder/__init__.py rename main.py => eyestrainreminder/main.py (88%) create mode 100644 requirements.txt create mode 100755 setup.py diff --git a/README.md b/README.md index 1347702..a19a372 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,18 @@ A small background tool to remind the user of the "20-20-20" rule. Uses system notifications and sound cues. +First, you might need these packages: ``` sudo apt-get install python-gobject libnotify-bin python-gst-1.0 pip3 install notify2 playsound --user +``` + +Second, just install the required [Python modules](src/branch/master/setup.py) via: +``` +python setup.py install --user +``` +Or to remove: +``` +pip remove eyestrainreminder ``` \ No newline at end of file diff --git a/eyestrainreminder/__init__.py b/eyestrainreminder/__init__.py new file mode 100644 index 0000000..c313e3a --- /dev/null +++ b/eyestrainreminder/__init__.py @@ -0,0 +1 @@ +from .main import * \ No newline at end of file diff --git a/main.py b/eyestrainreminder/main.py similarity index 88% rename from main.py rename to eyestrainreminder/main.py index 69a3587..ce60965 100755 --- a/main.py +++ b/eyestrainreminder/main.py @@ -10,6 +10,7 @@ MILLISECOND = 1000 MINUTE = 60 def init(): + print("Initializing EyeStrainReminder...") notify2.init(NAME) def uninit(): @@ -19,6 +20,7 @@ def wait(): sleep(TIMEOUT*MINUTE) def send_notification(): + print(MESSAGE) notification = notify2.Notification(NAME, MESSAGE, "notification-device-eject") notification.set_timeout(TIMEOUT * MILLISECOND) notification.set_urgency(notify2.URGENCY_LOW) @@ -28,9 +30,12 @@ def send_notification(): notification.close() playsound('files/default.wav') -if __name__ == '__main__': +def main(): init() while 1: wait() send_notification() - uninit() \ No newline at end of file + uninit() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..120ce4c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +notify2>=0.3.1 +playsound>=1.2.2 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..4efd880 --- /dev/null +++ b/setup.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +from setuptools import setup +#from distutils.core import setup + +setup(name='EyeStrainReminder', + version='1.0', + description='A small background tool to remind the user of the “20-20-20” rule.', + author='Abhorrent Anger', + author_email='abhorrentanger@cock.li', + url='https://git.pube.tk/abhorrent_anger/EyeStrainReminder', + packages=['eyestrainreminder'], + entry_points = { + 'console_scripts': [ + 'eyestrainreminder = eyestrainreminder.main:main' + ] + }, +) \ No newline at end of file