Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
infrastructure
Hackspace Device Info
Commits
e169c5e8
Commit
e169c5e8
authored
Jun 19, 2014
by
Markus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some problems with notification displaying
parent
ca5010ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
hc_data.py
hc_data.py
+1
-1
hc_main.py
hc_main.py
+14
-10
No files found.
hc_data.py
View file @
e169c5e8
...
...
@@ -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'
]
hc_main.py
View file @
e169c5e8
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment