Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
4ad1b525
Commit
4ad1b525
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Timestamping of notifications (
#213
)
parent
96dca79e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cutecoin/core/app.py
+13
-1
13 additions, 1 deletion
src/cutecoin/core/app.py
src/cutecoin/gui/community_view.py
+12
-10
12 additions, 10 deletions
src/cutecoin/gui/community_view.py
with
25 additions
and
11 deletions
src/cutecoin/core/app.py
+
13
−
1
View file @
4ad1b525
...
@@ -12,6 +12,7 @@ import json
...
@@ -12,6 +12,7 @@ import json
import
datetime
import
datetime
import
asyncio
import
asyncio
import
aiohttp
import
aiohttp
import
time
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
,
pyqtSlot
,
\
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
,
pyqtSlot
,
\
QUrl
,
QTranslator
,
QCoreApplication
,
QLocale
QUrl
,
QTranslator
,
QCoreApplication
,
QLocale
...
@@ -69,6 +70,18 @@ class Application(QObject):
...
@@ -69,6 +70,18 @@ class Application(QObject):
'
international_system_of_units
'
:
True
'
international_system_of_units
'
:
True
}
}
self
.
notifications
=
{
'
membership_expire_soon
'
:
(
self
.
tr
(
"
Warning : Your membership is expiring soon.
"
),
0
),
'
warning_certifications
'
:
(
self
.
tr
(
"
Warning : Your could miss certifications soon.
"
),
0
)
}
@classmethod
@classmethod
def
startup
(
cls
,
argv
,
qapp
,
loop
):
def
startup
(
cls
,
argv
,
qapp
,
loop
):
config
.
parse_arguments
(
argv
)
config
.
parse_arguments
(
argv
)
...
@@ -296,7 +309,6 @@ class Application(QObject):
...
@@ -296,7 +309,6 @@ class Application(QObject):
"""
"""
Load the preferences.
Load the preferences.
"""
"""
try
:
try
:
preferences_path
=
os
.
path
.
join
(
config
.
parameters
[
'
home
'
],
preferences_path
=
os
.
path
.
join
(
config
.
parameters
[
'
home
'
],
'
preferences
'
)
'
preferences
'
)
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/community_view.py
+
12
−
10
View file @
4ad1b525
...
@@ -6,6 +6,7 @@ Created on 2 févr. 2014
...
@@ -6,6 +6,7 @@ Created on 2 févr. 2014
import
logging
import
logging
import
asyncio
import
asyncio
import
time
from
PyQt5.QtWidgets
import
QWidget
,
QMessageBox
,
QDialog
,
QPushButton
,
QTabBar
,
QAction
from
PyQt5.QtWidgets
import
QWidget
,
QMessageBox
,
QDialog
,
QPushButton
,
QTabBar
,
QAction
from
PyQt5.QtCore
import
pyqtSlot
,
QDateTime
,
QLocale
,
QEvent
from
PyQt5.QtCore
import
pyqtSlot
,
QDateTime
,
QLocale
,
QEvent
...
@@ -42,11 +43,6 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
...
@@ -42,11 +43,6 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
self
.
status_label
=
status_label
self
.
status_label
=
status_label
self
.
status_info
=
[]
self
.
status_info
=
[]
self
.
status_infotext
=
{
'
membership_expire_soon
'
:
self
.
tr
(
"
Warning : Your membership is expiring soon.
"
),
'
warning_certifications
'
:
self
.
tr
(
"
Warning : Your could miss certifications soon.
"
)
}
super
().
setupUi
(
self
)
super
().
setupUi
(
self
)
...
@@ -165,21 +161,27 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
...
@@ -165,21 +161,27 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
if
will_expire_soon
:
if
will_expire_soon
:
days
=
int
(
expiration_time
/
3600
/
24
)
days
=
int
(
expiration_time
/
3600
/
24
)
if
days
>
0
:
if
days
>
0
:
self
.
status_info
.
append
(
'
membership_expire_soon
'
)
if
'
membership_expire_soon
'
not
in
self
.
status_info
:
self
.
status_info
.
append
(
'
membership_expire_soon
'
)
if
self
.
app
.
preferences
[
'
notifications
'
]:
if
self
.
app
.
preferences
[
'
notifications
'
]
and
\
self
.
app
.
notifications
[
'
membership_expire_soon
'
][
1
]
<
time
.
time
()
+
24
*
3600
:
toast
.
display
(
self
.
tr
(
"
Membership expiration
"
),
toast
.
display
(
self
.
tr
(
"
Membership expiration
"
),
self
.
tr
(
"
<b>Warning : Membership expiration in {0} days</b>
"
).
format
(
days
))
self
.
tr
(
"
<b>Warning : Membership expiration in {0} days</b>
"
).
format
(
days
))
self
.
app
.
notifications
[
'
membership_expire_soon
'
][
1
]
=
time
.
time
()
certifiers_of
=
yield
from
person
.
unique_valid_certifiers_of
(
self
.
app
.
identities_registry
,
certifiers_of
=
yield
from
person
.
unique_valid_certifiers_of
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
)
if
len
(
certifiers_of
)
<
parameters
[
'
sigQty
'
]:
if
len
(
certifiers_of
)
<
parameters
[
'
sigQty
'
]:
self
.
status_info
.
append
(
'
warning_certifications
'
)
if
'
warning_certifications
'
not
in
self
.
status_info
:
if
self
.
app
.
preferences
[
'
notifications
'
]:
self
.
status_info
.
append
(
'
warning_certifications
'
)
if
self
.
app
.
preferences
[
'
notifications
'
]
and
\
self
.
app
.
notifications
[
'
warning_certifications
'
][
1
]
<
time
.
time
()
+
24
*
3600
:
toast
.
display
(
self
.
tr
(
"
Certifications number
"
),
toast
.
display
(
self
.
tr
(
"
Certifications number
"
),
self
.
tr
(
"
<b>Warning : You are certified by only {0} persons, need {1}</b>
"
)
self
.
tr
(
"
<b>Warning : You are certified by only {0} persons, need {1}</b>
"
)
.
format
(
len
(
certifiers_of
),
.
format
(
len
(
certifiers_of
),
parameters
[
'
sigQty
'
]))
parameters
[
'
sigQty
'
]))
self
.
app
.
notifications
[
'
warning_certifications
'
][
1
]
=
time
.
time
()
except
MembershipNotFoundError
as
e
:
except
MembershipNotFoundError
as
e
:
pass
pass
...
@@ -235,7 +237,7 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
...
@@ -235,7 +237,7 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
else
:
else
:
icon
=
'
<img src=
"
:/icons/disconnected
"
width=
"
12
"
height=
"
12
"
/>
'
icon
=
'
<img src=
"
:/icons/disconnected
"
width=
"
12
"
height=
"
12
"
/>
'
status_infotext
=
"
-
"
.
join
([
self
.
status_infotext
[
info
]
for
info
in
self
.
status_info
])
status_infotext
=
"
-
"
.
join
([
self
.
app
.
notifications
[
info
]
[
0
]
for
info
in
self
.
status_info
])
label_text
=
"
{0}{1}
"
.
format
(
icon
,
text
)
label_text
=
"
{0}{1}
"
.
format
(
icon
,
text
)
if
status_infotext
!=
""
:
if
status_infotext
!=
""
:
label_text
+=
"
- {0}
"
.
format
(
status_infotext
)
label_text
+=
"
- {0}
"
.
format
(
status_infotext
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment