Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove globals #4

Merged
merged 1 commit into from
Aug 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import sys
import threading

from subprocess import Popen
from pgi.repository import Notify, GdkPixbuf
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from subprocess import Popen

# in minutes
round_time = 5
Expand All @@ -20,9 +20,6 @@

class PythonPatternHandler(PatternMatchingEventHandler):
"""Handles the python file changes"""
global notification
global red
global green
patterns = ['*.py']
ignore_directories = True
last_time = time.time()
Expand Down Expand Up @@ -51,25 +48,21 @@ def on_modified(self, event):
else:
notification.update('NOT OK TO TALK', '', 'r.jpg')
notification.set_image_from_pixbuf(red)
notification.set_timeout(5*60*1000)
notification.set_timeout(5 * 60 * 1000)
notification.show()


def dojo_timer(e):
"""Wait the defined and then shows notification and waits
for replace
"""
global notification
global round_time
global red
global green
while True:
notification.update('Time Up', '', '')
notification.set_timeout(15*1000)
notification.set_timeout(15 * 1000)
notification.show()
print("\033c")
input('Press Enter when replaced')
time.sleep(round_time*60)
time.sleep(round_time * 60)


if __name__ == "__main__":
Expand Down