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
GitLab 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
a864da7e
Commit
a864da7e
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Member informations
parent
5c00507a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
res/ui/member.ui
+8
-1
8 additions, 1 deletion
res/ui/member.ui
src/sakia/gui/member.py
+54
-35
54 additions, 35 deletions
src/sakia/gui/member.py
with
62 additions
and
36 deletions
res/ui/member.ui
+
8
−
1
View file @
a864da7e
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Member informations
</string>
</property>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<item>
...
@@ -82,6 +82,13 @@ QGroupBox::title {
...
@@ -82,6 +82,13 @@ QGroupBox::title {
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"1"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_path"
>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
</layout>
</layout>
</widget>
</widget>
</item>
</item>
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/member.py
+
54
−
35
View file @
a864da7e
import
datetime
import
datetime
from
PyQt5.QtCore
import
QObject
,
QEvent
from
PyQt5.QtCore
import
QObject
,
QEvent
,
QLocale
,
QDateTime
from
PyQt5.QtWidgets
import
QDialog
,
QWidget
from
PyQt5.QtWidgets
import
QDialog
,
QWidget
from
..core.graph
import
WoTGraph
from
..core.graph
import
WoTGraph
...
@@ -37,11 +37,13 @@ class MemberDialog(QObject):
...
@@ -37,11 +37,13 @@ class MemberDialog(QObject):
self
.
community
=
community
self
.
community
=
community
self
.
account
=
account
self
.
account
=
account
self
.
identity
=
identity
self
.
identity
=
identity
self
.
refresh
()
@classmethod
@classmethod
def
open_dialog
(
cls
,
app
,
account
,
community
,
identity
):
def
open_dialog
(
cls
,
app
,
account
,
community
,
identity
):
return
cls
(
app
,
account
,
community
,
identity
,
QDialog
(),
Ui_MemberView
()).
exec
()
dialog
=
cls
(
app
,
account
,
community
,
identity
,
QDialog
(),
Ui_MemberView
())
dialog
.
refresh
()
dialog
.
refresh_path
()
dialog
.
exec
()
@classmethod
@classmethod
def
as_widget
(
cls
,
parent_widget
,
app
,
account
,
community
,
identity
):
def
as_widget
(
cls
,
parent_widget
,
app
,
account
,
community
,
identity
):
...
@@ -52,6 +54,7 @@ class MemberDialog(QObject):
...
@@ -52,6 +54,7 @@ class MemberDialog(QObject):
if
self
.
identity
:
if
self
.
identity
:
self
.
ui
.
busy
.
show
()
self
.
ui
.
busy
.
show
()
self
.
ui
.
label_uid
.
setText
(
self
.
identity
.
uid
)
self
.
ui
.
label_uid
.
setText
(
self
.
identity
.
uid
)
self
.
ui
.
label_properties
.
setText
(
""
)
try
:
try
:
join_date
=
await
self
.
identity
.
get_join_date
(
self
.
community
)
join_date
=
await
self
.
identity
.
get_join_date
(
self
.
community
)
except
MembershipNotFoundError
:
except
MembershipNotFoundError
:
...
@@ -62,26 +65,47 @@ class MemberDialog(QObject):
...
@@ -62,26 +65,47 @@ class MemberDialog(QObject):
else
:
else
:
join_date
=
datetime
.
datetime
.
fromtimestamp
(
join_date
).
strftime
(
"
%d/%m/%Y %I:%M
"
)
join_date
=
datetime
.
datetime
.
fromtimestamp
(
join_date
).
strftime
(
"
%d/%m/%Y %I:%M
"
)
# calculate path to account member
graph
=
WoTGraph
(
self
.
app
,
self
.
community
)
identity_selfcert
=
await
self
.
identity
.
selfcert
(
self
.
community
)
path
=
None
uid_publish_date
=
QLocale
.
toString
(
# if selected member is not the account member...
QLocale
(),
if
self
.
identity
.
pubkey
!=
self
.
account
.
pubkey
:
QDateTime
.
fromTime_t
(
identity_selfcert
.
timestamp
),
# add path from selected member to account member
QLocale
.
dateTimeFormat
(
QLocale
(),
QLocale
.
ShortFormat
)
account_identity
=
await
self
.
account
.
identity
(
self
.
community
)
)
path
=
await
graph
.
get_shortest_path_to_identity
(
self
.
identity
,
account_identity
)
text
=
self
.
tr
(
"""
text
=
self
.
tr
(
"""
<table cellpadding=
"
5
"
>
<table cellpadding=
"
5
"
>
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
<tr><td align=
"
right
"
><b>{:}</b></div></td><td>{:}</td></tr>
"""
).
format
(
"""
).
format
(
self
.
tr
(
'
Public key
'
),
self
.
tr
(
'
Public key
'
),
self
.
identity
.
pubkey
,
self
.
identity
.
pubkey
,
self
.
tr
(
'
UID Published on
'
),
uid_publish_date
,
self
.
tr
(
'
Join date
'
),
self
.
tr
(
'
Join date
'
),
join_date
join_date
)
)
# close html text
text
+=
"
</table>
"
# set text in label
self
.
ui
.
label_properties
.
setText
(
text
)
self
.
ui
.
busy
.
hide
()
@asyncify
async
def
refresh_path
(
self
):
text
=
""
self
.
ui
.
label_path
.
setText
(
""
)
# calculate path to account member
graph
=
WoTGraph
(
self
.
app
,
self
.
community
)
path
=
None
# if selected member is not the account member...
if
self
.
identity
.
pubkey
!=
self
.
account
.
pubkey
:
# add path from selected member to account member
account_identity
=
await
self
.
account
.
identity
(
self
.
community
)
path
=
await
graph
.
get_shortest_path_to_identity
(
self
.
identity
,
account_identity
)
if
path
:
if
path
:
distance
=
len
(
path
)
-
1
distance
=
len
(
path
)
-
1
...
@@ -105,12 +129,7 @@ class MemberDialog(QObject):
...
@@ -105,12 +129,7 @@ class MemberDialog(QObject):
.
format
(
''
,
.
format
(
''
,
self
.
account
.
name
)
self
.
account
.
name
)
index
+=
1
index
+=
1
# close html text
self
.
ui
.
label_path
.
setText
(
text
)
text
+=
"
</table>
"
# set text in label
self
.
ui
.
label_properties
.
setText
(
text
)
self
.
ui
.
busy
.
hide
()
def
eventFilter
(
self
,
source
,
event
):
def
eventFilter
(
self
,
source
,
event
):
if
event
.
type
()
==
QEvent
.
Resize
:
if
event
.
type
()
==
QEvent
.
Resize
:
...
...
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