diff --git a/.gitignore b/.gitignore index 68bc17f..12905c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +# extra stuff + +*.DS_Store +.vscode/ +experimental/ +notes.md +variables + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/README.md b/README.md index 1d559c9..2806c27 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # esoteric-time Esoteric Clock -Right now this just tells you whether the Age of Aquarius is dawning or not. I'll merge it with the [osam-clock](https://github.com/panzertime/osam-clock) at some point. +This is a little toy that tells you the time using an [osam-clock](https://github.com/panzertime/osam-clock) and also lets you know when the Age of Aquarius occurs. diff --git a/hammond_aquarius.mp3 b/hammond_aquarius.mp3 new file mode 100644 index 0000000..08775a5 Binary files /dev/null and b/hammond_aquarius.mp3 differ diff --git a/py2app/esoteric_time/__init__.py b/py2app/esoteric_time/__init__.py index b4c4d67..e2cc52e 100644 --- a/py2app/esoteric_time/__init__.py +++ b/py2app/esoteric_time/__init__.py @@ -1,4 +1,4 @@ from .application import * -from .astrologer import * +from .astrology import * from .mechanics import * from .presentations import * \ No newline at end of file diff --git a/py2app/esoteric_time/application.py b/py2app/esoteric_time/application.py index ccee603..70affe2 100644 --- a/py2app/esoteric_time/application.py +++ b/py2app/esoteric_time/application.py @@ -42,7 +42,7 @@ def run(): root.title = "O.S. Anno Mundi" root.resizable(False,False) root.wm_attributes("-topmost", True) - print("made root") + # print("made root") mainFrame = tk.Frame(root, padx=5, pady=5) mainFrame.pack() @@ -51,27 +51,24 @@ def run(): calendarFrame.pack(fill="x") calendar = OsamCalendar(calendarFrame) calendar.pack() - print("made calendar") + # print("made calendar") astrologyFrame = tk.Frame(mainFrame, relief="groove", borderwidth=2) astrologyFrame.pack(fill="x") astrologer = Astrologer(astrologyFrame) astrologer.pack() - print("made astrologer") + # print("made astrologer") calendar.write() - print("wrote calendar") + # print("wrote calendar") astrologer.augur() - print("augured") + # print("augured") menubar = tk.Menu(root) Timemenu = tk.Menu(menubar, tearoff=0) Timemenu.add_command(label="Simulate Aquarius", command=lambda: astrologer.dawnAquarius()) + Timemenu.add_checkbutton(label="Hammond Party", command=lambda: astrologer.getHip()) menubar.add_cascade(label="Time", menu=Timemenu) root.config(menu=menubar) root.mainloop() - - print("main loop started") - - diff --git a/py2app/esoteric_time/astrologer.py b/py2app/esoteric_time/astrology.py similarity index 100% rename from py2app/esoteric_time/astrologer.py rename to py2app/esoteric_time/astrology.py diff --git a/py2app/esoteric_time/hammond_aquarius.mp3 b/py2app/esoteric_time/hammond_aquarius.mp3 new file mode 100644 index 0000000..08775a5 Binary files /dev/null and b/py2app/esoteric_time/hammond_aquarius.mp3 differ diff --git a/py2app/esoteric_time/presentations.py b/py2app/esoteric_time/presentations.py index 8fad186..abd6d47 100644 --- a/py2app/esoteric_time/presentations.py +++ b/py2app/esoteric_time/presentations.py @@ -5,7 +5,7 @@ from playsound import playsound -from . import astrologer +from . import astrology from . import * def romanize(input): @@ -34,14 +34,14 @@ def __init__(self, master=None): self.contents.set(self.getDate()) def write(self): - print("writing Calendar") + # print("writing Calendar") self.config(textvariable=self.contents) self.contents.set(self.getDate()) self.after(1000, self.write) - print("wrote Calendar") + # print("wrote Calendar") def getDate(self): - print("getting Date") + # print("getting Date") julian = datetime.today() - timedelta(days = 13) year = julian.year + 5508 @@ -49,7 +49,7 @@ def getDate(self): year += 1 date_string = str(julian.day) + " / " + romanize(julian.month) + " / " + str(year) time_string = str(julian.hour - 12 if julian.hour > 12 else (12 if julian.hour == 0 else julian.hour)) + " : " + str(julian.minute).zfill(2) + " : " + str(julian.second).zfill(2) + (" PM" if julian.hour > 11 else " AM") - print("got Date") + # print("got Date") return date_string + "\n" + time_string class Astrologer(tk.Frame): @@ -89,11 +89,12 @@ def __init__(self, master=None): self.philosophyCounter = 0 self.isAquarius = False + self.uncool = True self.aquariusFrame.pack_forget() def dawnAquarius(self): - print("DAWN CALLED") + # print("DAWN CALLED") self.aquariusFrame.pack() self.isAquarius = True @@ -102,43 +103,46 @@ def dawnAquarius(self): # Thread(target=playsound, args=[sound]).start() # does seem to work with py2app: - sound = environ["RESOURCEPATH"] + "/aquarius.mp3" + sound = environ["RESOURCEPATH"] + ("/aquarius.mp3" if self.uncool else "/hammond_aquarius.mp3") Thread(target=playsound, args=[sound]).start() # does not work right: #path = Path(resources.files(package="esoteric_time")).parents[2] / 'aquarius.mp3' - #print(str(path)) + # print(str(path)) #Thread(target=playsound, args=[str(path)]).start() self.waxEloquent() - print("waxed eloquent") + # print("waxed eloquent") def sunsetAquarius(self): self.aquariusFrame.pack_forget() self.isAquarius = False def waxEloquent(self): - print("waxing eloquent") + # print("waxing eloquent") if self.philosophyCounter == 3: self.philosophyCounter = 0 - line = astrologer.PHILOSOPHY[self.philosophyCounter] + line = astrology.PHILOSOPHY[self.philosophyCounter] self.aquariusPhilosophy.configure(text=line) self.philosophyCounter += 1 if self.isAquarius: self.after(2500, self.waxEloquent) def augur(self): - alignment = astrologer.alignmentToAngular(astrologer.computeCurrentAlignment()) - print(str(alignment)) + alignment = astrology.alignmentToAngular(astrology.computeCurrentAlignment()) + # print(str(alignment)) self.moonHouseBox.config(state="normal") self.moonHouse.set(romanize(alignment.moonHouse)) self.moonHouseBox.config(state="readonly") self.planetaryAngleBox.config(state="normal") self.planetaryAngle.set(angleFormat(alignment.jupiterMarsAngle)) self.planetaryAngleBox.config(state="readonly") - if (not self.isAquarius) and astrologer.isMomentAquarian(alignment): - print("DAWNING IN AUGUR") + if (not self.isAquarius) and astrology.isMomentAquarian(alignment): + # print("DAWNING IN AUGUR") self.dawnAquarius() - elif self.isAquarius and (not astrologer.isMomentAquarian(alignment)): - print("SUNSET IN AUGUR") + elif self.isAquarius and (not astrology.isMomentAquarian(alignment)): + # print("SUNSET IN AUGUR") self.sunsetAquarius() self.after(60000, self.augur) + + def getHip(self): + self.uncool = not self.uncool diff --git a/py2app/setup.py b/py2app/setup.py index a5e4f3f..2bebd3f 100644 --- a/py2app/setup.py +++ b/py2app/setup.py @@ -8,7 +8,7 @@ from setuptools import setup APP = ['myApp.py'] -DATA_FILES = ['esoteric_time/aquarius.mp3'] +DATA_FILES = ['esoteric_time/aquarius.mp3', 'esoteric_time/hammond_aquarius.mp3'] OPTIONS = { 'iconfile': 'digital-clock.icns' } diff --git a/src/__init__.py b/src/__init__.py index b4c4d67..e2cc52e 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,4 +1,4 @@ from .application import * -from .astrologer import * +from .astrology import * from .mechanics import * from .presentations import * \ No newline at end of file diff --git a/src/application.py b/src/application.py index ccee603..70affe2 100644 --- a/src/application.py +++ b/src/application.py @@ -42,7 +42,7 @@ def run(): root.title = "O.S. Anno Mundi" root.resizable(False,False) root.wm_attributes("-topmost", True) - print("made root") + # print("made root") mainFrame = tk.Frame(root, padx=5, pady=5) mainFrame.pack() @@ -51,27 +51,24 @@ def run(): calendarFrame.pack(fill="x") calendar = OsamCalendar(calendarFrame) calendar.pack() - print("made calendar") + # print("made calendar") astrologyFrame = tk.Frame(mainFrame, relief="groove", borderwidth=2) astrologyFrame.pack(fill="x") astrologer = Astrologer(astrologyFrame) astrologer.pack() - print("made astrologer") + # print("made astrologer") calendar.write() - print("wrote calendar") + # print("wrote calendar") astrologer.augur() - print("augured") + # print("augured") menubar = tk.Menu(root) Timemenu = tk.Menu(menubar, tearoff=0) Timemenu.add_command(label="Simulate Aquarius", command=lambda: astrologer.dawnAquarius()) + Timemenu.add_checkbutton(label="Hammond Party", command=lambda: astrologer.getHip()) menubar.add_cascade(label="Time", menu=Timemenu) root.config(menu=menubar) root.mainloop() - - print("main loop started") - - diff --git a/src/aquarius.mp3 b/src/aquarius.mp3 new file mode 100644 index 0000000..c316735 Binary files /dev/null and b/src/aquarius.mp3 differ diff --git a/src/astrologer.py b/src/astrology.py similarity index 100% rename from src/astrologer.py rename to src/astrology.py diff --git a/src/hammond_aquarius.mp3 b/src/hammond_aquarius.mp3 new file mode 100644 index 0000000..08775a5 Binary files /dev/null and b/src/hammond_aquarius.mp3 differ diff --git a/src/presentations.py b/src/presentations.py index 8fad186..abd6d47 100644 --- a/src/presentations.py +++ b/src/presentations.py @@ -5,7 +5,7 @@ from playsound import playsound -from . import astrologer +from . import astrology from . import * def romanize(input): @@ -34,14 +34,14 @@ def __init__(self, master=None): self.contents.set(self.getDate()) def write(self): - print("writing Calendar") + # print("writing Calendar") self.config(textvariable=self.contents) self.contents.set(self.getDate()) self.after(1000, self.write) - print("wrote Calendar") + # print("wrote Calendar") def getDate(self): - print("getting Date") + # print("getting Date") julian = datetime.today() - timedelta(days = 13) year = julian.year + 5508 @@ -49,7 +49,7 @@ def getDate(self): year += 1 date_string = str(julian.day) + " / " + romanize(julian.month) + " / " + str(year) time_string = str(julian.hour - 12 if julian.hour > 12 else (12 if julian.hour == 0 else julian.hour)) + " : " + str(julian.minute).zfill(2) + " : " + str(julian.second).zfill(2) + (" PM" if julian.hour > 11 else " AM") - print("got Date") + # print("got Date") return date_string + "\n" + time_string class Astrologer(tk.Frame): @@ -89,11 +89,12 @@ def __init__(self, master=None): self.philosophyCounter = 0 self.isAquarius = False + self.uncool = True self.aquariusFrame.pack_forget() def dawnAquarius(self): - print("DAWN CALLED") + # print("DAWN CALLED") self.aquariusFrame.pack() self.isAquarius = True @@ -102,43 +103,46 @@ def dawnAquarius(self): # Thread(target=playsound, args=[sound]).start() # does seem to work with py2app: - sound = environ["RESOURCEPATH"] + "/aquarius.mp3" + sound = environ["RESOURCEPATH"] + ("/aquarius.mp3" if self.uncool else "/hammond_aquarius.mp3") Thread(target=playsound, args=[sound]).start() # does not work right: #path = Path(resources.files(package="esoteric_time")).parents[2] / 'aquarius.mp3' - #print(str(path)) + # print(str(path)) #Thread(target=playsound, args=[str(path)]).start() self.waxEloquent() - print("waxed eloquent") + # print("waxed eloquent") def sunsetAquarius(self): self.aquariusFrame.pack_forget() self.isAquarius = False def waxEloquent(self): - print("waxing eloquent") + # print("waxing eloquent") if self.philosophyCounter == 3: self.philosophyCounter = 0 - line = astrologer.PHILOSOPHY[self.philosophyCounter] + line = astrology.PHILOSOPHY[self.philosophyCounter] self.aquariusPhilosophy.configure(text=line) self.philosophyCounter += 1 if self.isAquarius: self.after(2500, self.waxEloquent) def augur(self): - alignment = astrologer.alignmentToAngular(astrologer.computeCurrentAlignment()) - print(str(alignment)) + alignment = astrology.alignmentToAngular(astrology.computeCurrentAlignment()) + # print(str(alignment)) self.moonHouseBox.config(state="normal") self.moonHouse.set(romanize(alignment.moonHouse)) self.moonHouseBox.config(state="readonly") self.planetaryAngleBox.config(state="normal") self.planetaryAngle.set(angleFormat(alignment.jupiterMarsAngle)) self.planetaryAngleBox.config(state="readonly") - if (not self.isAquarius) and astrologer.isMomentAquarian(alignment): - print("DAWNING IN AUGUR") + if (not self.isAquarius) and astrology.isMomentAquarian(alignment): + # print("DAWNING IN AUGUR") self.dawnAquarius() - elif self.isAquarius and (not astrologer.isMomentAquarian(alignment)): - print("SUNSET IN AUGUR") + elif self.isAquarius and (not astrology.isMomentAquarian(alignment)): + # print("SUNSET IN AUGUR") self.sunsetAquarius() self.after(60000, self.augur) + + def getHip(self): + self.uncool = not self.uncool