Skip to content
This repository has been archived by the owner on Jul 26, 2020. It is now read-only.

Commit

Permalink
📄 Logging System added!
Browse files Browse the repository at this point in the history
This logging system may be used for support.
  • Loading branch information
heyitsrobert committed Dec 31, 2019
1 parent 22c3395 commit 29ffe3d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
23 changes: 11 additions & 12 deletions files/app.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import time
import time
import random
import ctypes # An included library with Python install.
from datetime import date

file = open('latest.txt', 'w') # open log file
import ctypes
from datetime import datetime

def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)

def logFile(content):
log = open("timerlogs.txt", "a")
log.write("{}\n".format(content))
log.close()

def bReminder():
time.sleep(random.randrange(1200, 1800, 3))
print('| User has recieved the dialog box, awaiting response.')
file.write('BackReminders dialog box has appeared.')
logFile("| User has recieved the dialog box, awaiting response.")
Mbox('BackReminder', 'I think its time to have a stretch, can be a long one, can be a short one. A little stretch helps out a lot with your back!', 0)
file.write('BackReminders dialog box has been closed by the user, new timer starting.')
print('| User has recieved and confirmed the dialog box, a new timer may start.\n')
logFile("| User has recieved and confirmed the dialog box, a new timer may start.\n.")


file.write('Successful load..')
file.write('User confirmed dialong box.')

logFile("\n\nBackReminder has launched up!\nCurrent Time and Date: {}\n//////////////\n\n".format(datetime.now()))
print('Welcome to Back Reminder.\nThe use of this is to remind you every 20-30 minutes to stretch out your back.\n\nYou may minimize this tab, as a popup will remind you!\nThis console will just be used for logging!\n\n=--- BackReminder ---=')

bReminder()
Expand Down Expand Up @@ -106,4 +106,3 @@ def bReminder():
Mbox('BackReminder', 'You managed to stretch out 80 times, that is insane! Please restart the program to continue. Reminders have stopped until a restart of the program happens.', 0)
print('| BackReminder has ran out, please restart the program to continue.\n')

file.close() # close log file
12 changes: 11 additions & 1 deletion files/gui.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import tkinter
import webbrowser
import os
from datetime import datetime

print('This is the GUI console, do not close unless the GUI is actually closed.\nClose the program using the GUI.')

new = 1
url = "http://heyitsrobert.rf.gd/launcher"

def logFile(content):
log = open("guilogs.txt", "a")
log.write("{}\n".format(content))
log.close()
def openweb():
webbrowser.open(url,new=new)
logFile("| Opened the website!")
def poweroff():
logFile("| Attempt of powering BackReminder off. An error will show if failed, if not, success.")
try:
os.system('TASKKILL /F /IM Python.exe')
except Exception as e:
tkinter.messagebox.showinfo("BackReminder", "Failed to close BackReminder, please close them manually.")
logFile("| Failed to close BackReminder, please close the all tabs manually.")
tkinter.messagebox.showinfo("BackReminder", "Failed to close BackReminder, please close all tabs manually.")

logFile("\n\nBackReminder GUI has launched up!\nCurrent Time and Date: {}\n//////////////\n\n".format(datetime.now()))

window = tkinter.Tk()
window.geometry("310x375")
Expand Down
9 changes: 8 additions & 1 deletion files/startup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import os
from datetime import datetime

def logFile(content):
log = open("startuplogs.txt", "a")
log.write("{}\n".format(content))
log.close()

os.startfile("app.py")
os.startfile("gui.py")
os.close("startup.py")
logFile("\n\nBackReminder has loaded all modules correctly!\nCurrent Time and Date: {}\n//////////////\n\n".format(datetime.now()))
os.close("startup.py")

0 comments on commit 29ffe3d

Please sign in to comment.