Fixed file lookup

This commit is contained in:
Abhorrent_Anger 2019-10-23 10:52:39 +03:00
parent ca7446be0e
commit c838987002
3 changed files with 21 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# EyeStrainReminder # 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: 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: 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: Or to remove:
``` ```
pip uninstall eyestrainreminder pip uninstall EyeStrainReminder
``` ```

View File

@ -2,12 +2,14 @@
import notify2 import notify2
from time import sleep from time import sleep
from playsound import playsound from playsound import playsound
import os
NAME = 'Eye Strain Reminder' NAME = 'Eye Strain Reminder'
MESSAGE = 'Friendly reminder to observe the 20-20-20 rule' MESSAGE = 'Friendly reminder to observe the 20-20-20 rule'
TIMEOUT = 20 TIMEOUT = 20
MILLISECOND = 1000 MILLISECOND = 1000
MINUTE = 60 MINUTE = 60
DIR = os.path.dirname(os.path.abspath(__file__))
def init(): def init():
print("Initializing EyeStrainReminder...") print("Initializing EyeStrainReminder...")
@ -17,7 +19,8 @@ def uninit():
notify2.uninit() notify2.uninit()
def wait(): def wait():
sleep(TIMEOUT*MINUTE) #sleep(TIMEOUT*MINUTE)
pass
def send_notification(): def send_notification():
print(MESSAGE) print(MESSAGE)
@ -25,10 +28,11 @@ def send_notification():
notification.set_timeout(TIMEOUT * MILLISECOND) notification.set_timeout(TIMEOUT * MILLISECOND)
notification.set_urgency(notify2.URGENCY_LOW) notification.set_urgency(notify2.URGENCY_LOW)
notification.show() notification.show()
playsound('files/default.wav')
playsound(f"{DIR}/files/default.wav")
sleep(TIMEOUT) sleep(TIMEOUT)
notification.close() notification.close()
playsound('files/default.wav') playsound(f"{DIR}/files/default.wav")
def main(): def main():
init() init()

View File

@ -1,17 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python
from setuptools import setup import setuptools
#from distutils.core import setup #from distutils.core import setup
setup(name='EyeStrainReminder', setuptools.setup(name='EyeStrainReminder',
version='1.0', version='1.0',
description='A small background tool to remind the user of the “20-20-20” rule.', description='A small background tool to remind the user of the “20-20-20” rule.',
author='Abhorrent Anger', author='Abhorrent Anger',
author_email='abhorrentanger@cock.li', author_email='abhorrentanger@cock.li',
url='https://git.pube.tk/abhorrent_anger/EyeStrainReminder', url='https://git.pube.tk/abhorrent_anger/EyeStrainReminder',
packages=['eyestrainreminder'], packages=['eyestrainreminder'],
package_data={'': ['files/*']},
include_package_data=True,
install_requires=[ install_requires=[
'notify2', 'notify2',
'playsound' 'playsound',
'pystray'
], ],
entry_points = { entry_points = {
'console_scripts': [ 'console_scripts': [