Commit e169c5e8 authored by Markus's avatar Markus

fixed some problems with notification displaying

parent ca5010ec
......@@ -44,4 +44,4 @@ class Data(object):
self.json_string = self.var.read()
self.json_dict = json.loads(self.json_string.decode('ascii'))
self.device_count = self.json_dict['deviceCount']
self.users = self.json_dict['users']
\ No newline at end of file
self.users = self.json_dict['users']
......@@ -59,8 +59,8 @@ class Main(object):
}
#compare saved and fetched value
if (self.args.show_user and
cached_data_dict['device_count'] != self.data_interface.device_count):
if (cached_data_dict['device_count'] !=
self.data_interface.device_count):
self.header.count_changed = True
#diff saved and new recieved list
......@@ -102,19 +102,21 @@ class Main(object):
## print count
if self.args.printing:
if self.args.show_user:
print("HackHro Users: {} ".format(len(self.data_interface.users)))
print("HackHro Users: {} ".format(
len(self.data_interface.users)))
if self.user_left_list is not None:
if self.user_left_list:
print("Users left: ", flush=True, end="")
for user in user_left_list:
for user in self.user_left_list:
print(user['name'] + " ", flush=True)
if self.user_new_list is not None:
if self.user_new_list:
print("Users new: ", flush=True, end="")
for user in user_new_list:
for user in self.user_new_list:
print(user['name'] + " ", end="", flush=True)
else:
print("HackHro Devcies: ", self.data_interface.device_count, flush=True)
print("HackHro Devcies: ",
self.data_interface.device_count, flush=True)
# end of printing routine
#######################################################################
......@@ -124,13 +126,14 @@ class Main(object):
#######################################################################
# notification routine
if self.args.notify and self.header.count_changed:
###init dbus notifications
bus = dbus.SessionBus()
notif = bus.get_object(self.header.item, self.header.path)
notify = dbus.Interface(notif, self.header.interface)
notification_string = ""
if not self.args.show_user:
if self.args.show_user:
title = "HackSpace Users Changed"
if self.user_left_list is not None:
for user in self.user_left_list:
......@@ -171,6 +174,7 @@ class Main(object):
notification_string = "the user " +\
str(user['name']) +\
" just came in."
#create notification
notify.Notify(self.header.app_name,
0,
......@@ -182,7 +186,7 @@ class Main(object):
self.header.time)
else:
title = "HackSpace Devices Changed"
notification_string = str(device_count)
notification_string = str(self.data_interface.device_count)
#create notification
notify.Notify(self.header.app_name,
0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment