Skip to content

Commit

Permalink
properly fix #24 using try/catch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
VainlyStrain committed Sep 25, 2021
1 parent 921cacb commit ca5fad3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
10 changes: 8 additions & 2 deletions Vailyn
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ import sys

if adv_li:
import setproctitle
import notify2
try:
import notify2
except ModuleNotFoundError:
pass


# initialize colorama
Expand All @@ -67,7 +70,10 @@ if __name__ == "__main__":

if variables.adv_li and DESKTOP_NOTIFY:
# initialize notifications
notify2.init("Vailyn")
try:
notify2.init("Vailyn")
except NameError:
pass

# set global variables and determine
# main method
Expand Down
20 changes: 13 additions & 7 deletions core/methods/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
from core.variables import SEPARATOR

if variables.adv_li and DESKTOP_NOTIFY:
import notify2
try:
import notify2
except ModuleNotFoundError:
pass


def notify(message):
Expand All @@ -48,10 +51,13 @@ def notify(message):
"tid.png",
])

notification = notify2.Notification(
"Vailyn",
message=message,
icon=icon,
)
try:
notification = notify2.Notification(
"Vailyn",
message=message,
icon=icon,
)

notification.show()
notification.show()
except NameError:
pass

0 comments on commit ca5fad3

Please sign in to comment.