From c838987002ef6f192f9edec56cac3fde655af82f Mon Sep 17 00:00:00 2001 From: Abhorrent_Anger Date: Wed, 23 Oct 2019 10:52:39 +0300 Subject: [PATCH] Fixed file lookup --- README.md | 11 ++++++++--- eyestrainreminder/__main__.py | 10 +++++++--- setup.py | 9 ++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c2fe83c..9d42cfc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EyeStrainReminder -A small background tool to remind the user of the "20-20-20" rule. Uses system notifications and sound cues. +A small background tool to remind the user of the "20-20-20" rule. Uses system notifications and sound cues. Made primarily for GNU/Linux, but might work with other environments. First, you might need these packages: ``` @@ -9,9 +9,14 @@ sudo apt-get install python-gobject libnotify-bin python-gst-1.0 Second, just install the tool and required [Python modules](src/branch/master/setup.py) via: ``` -python setup.py install --user +cd EyeStrainReminder +pip install . --user +``` +Run it simply with, or preferably put it to run on boot as: +``` +$ eyestrainreminder ``` Or to remove: ``` -pip uninstall eyestrainreminder +pip uninstall EyeStrainReminder ``` \ No newline at end of file diff --git a/eyestrainreminder/__main__.py b/eyestrainreminder/__main__.py index ce60965..4362682 100755 --- a/eyestrainreminder/__main__.py +++ b/eyestrainreminder/__main__.py @@ -2,12 +2,14 @@ import notify2 from time import sleep from playsound import playsound +import os NAME = 'Eye Strain Reminder' MESSAGE = 'Friendly reminder to observe the 20-20-20 rule' TIMEOUT = 20 MILLISECOND = 1000 MINUTE = 60 +DIR = os.path.dirname(os.path.abspath(__file__)) def init(): print("Initializing EyeStrainReminder...") @@ -17,7 +19,8 @@ def uninit(): notify2.uninit() def wait(): - sleep(TIMEOUT*MINUTE) + #sleep(TIMEOUT*MINUTE) + pass def send_notification(): print(MESSAGE) @@ -25,10 +28,11 @@ def send_notification(): notification.set_timeout(TIMEOUT * MILLISECOND) notification.set_urgency(notify2.URGENCY_LOW) notification.show() - playsound('files/default.wav') + + playsound(f"{DIR}/files/default.wav") sleep(TIMEOUT) notification.close() - playsound('files/default.wav') + playsound(f"{DIR}/files/default.wav") def main(): init() diff --git a/setup.py b/setup.py index 4bf425c..747201b 100755 --- a/setup.py +++ b/setup.py @@ -1,17 +1,20 @@ #!/usr/bin/env python -from setuptools import setup +import setuptools #from distutils.core import setup -setup(name='EyeStrainReminder', +setuptools.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'], + package_data={'': ['files/*']}, + include_package_data=True, install_requires=[ 'notify2', - 'playsound' + 'playsound', + 'pystray' ], entry_points = { 'console_scripts': [