Skip to content
This repository was archived by the owner on Nov 28, 2021. It is now read-only.

Commit 9b0ef54

Browse files
author
Cleo Menezes Jr
committed
bug fix:Crashed seconds after opening
1 parent 54eecfe commit 9b0ef54

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

main.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def apache_notify(self, status):
9393
elif 'inactive (dead)' in self.validate_apache():
9494
new_port = 'Inactive'
9595

96+
9697
if (self.current_port != new_port) and (new_port == "Active") and (a_status != 'restart'):
9798
subprocess.run('notify-send -i /Media/bitmap.png -u low "Apache Status" "Has been activated"', stdout=subprocess.PIPE, text=True, shell=True)
9899

@@ -138,7 +139,7 @@ def mysql_notify(self, status):
138139
elif (a_mysql == 'restart') and (new_port == "Active"):
139140
subprocess.run('notify-send -i /Media/bitmap.png -u low "MySQL Status" "Service restarted"', stdout=subprocess.PIPE, text=True, shell=True)
140141

141-
elif (a_mysql == 'restart') and (new_port == "Inactive"):
142+
elif (a_mysql == 'restart') and (new_port == "Inactive") and (a_mysql != 'Inactive'):
142143
subprocess.run('notify-send -i /Media/bitmap.png -u low "MySQL Status" "Could not restart"', stdout=subprocess.PIPE, text=True, shell=True)
143144

144145
else:
@@ -344,6 +345,7 @@ class CurrentServiceStatus(Handler):
344345
def __init__(self, *args):
345346
super().__init__()
346347

348+
347349
while True:
348350

349351
try:
@@ -427,18 +429,14 @@ def __init__(self, *args):
427429
self.ftpd_img_status.set_from_icon_name('emblem-important', 1)
428430

429431
self.ftp_port.set_text('Not found')
432+
sleep(10)
430433

431-
sleep(5)
432-
433-
main_thread = CurrentServiceStatus
434-
thread = threading.Thread(target=main_thread)
435-
thread.daemon = True
434+
thread = threading.Thread(target=CurrentServiceStatus, daemon=True)
436435
thread.start()
437436

438-
439437
builder.connect_signals(Handler())
440438
window = builder.get_object('main_window')
441439
window.show_all()
442440

443441
if __name__ == '__main__':
444-
Gtk.main()
442+
Gtk.main()

0 commit comments

Comments
 (0)