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
75c50934
Commit
75c50934
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug in members columns
parent
42297f41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cutecoin/models/members.py
+13
-7
13 additions, 7 deletions
src/cutecoin/models/members.py
with
13 additions
and
7 deletions
src/cutecoin/models/members.py
+
13
−
7
View file @
75c50934
...
...
@@ -32,7 +32,7 @@ class MembersFilterProxyModel(QSortFilterProxyModel):
def
data
(
self
,
index
,
role
):
source_index
=
self
.
mapToSource
(
index
)
source_data
=
self
.
sourceModel
().
data
(
source_index
,
role
)
expiration_col
=
self
.
sourceModel
().
columns
.
index
(
'
E
xpiration
'
)
expiration_col
=
self
.
sourceModel
().
columns
_ids
.
index
(
'
e
xpiration
'
)
expiration_index
=
self
.
sourceModel
().
index
(
source_index
.
row
(),
expiration_col
)
expiration_data
=
self
.
sourceModel
().
data
(
expiration_index
,
Qt
.
DisplayRole
)
current_time
=
QDateTime
().
currentDateTime
().
toMSecsSinceEpoch
()
...
...
@@ -41,13 +41,13 @@ class MembersFilterProxyModel(QSortFilterProxyModel):
#logging.debug("{0} > {1}".format(current_time, expiration_data))
will_expire_soon
=
(
current_time
>
expiration_data
*
1000
-
warning_expiration_time
*
1000
)
if
role
==
Qt
.
DisplayRole
:
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
Join date
'
):
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
_ids
.
index
(
'
renew
'
):
date
=
QDateTime
.
fromTime_t
(
source_data
)
return
date
.
date
()
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
E
xpiration
'
):
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
_ids
.
index
(
'
e
xpiration
'
):
date
=
QDateTime
.
fromTime_t
(
source_data
)
return
date
.
date
()
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
.
index
(
'
P
ubkey
'
):
if
source_index
.
column
()
==
self
.
sourceModel
().
columns
_ids
.
index
(
'
p
ubkey
'
):
return
"
pub:{0}
"
.
format
(
source_data
[:
5
])
if
role
==
Qt
.
ForegroundRole
:
...
...
@@ -68,7 +68,12 @@ class MembersTableModel(QAbstractTableModel):
'''
super
().
__init__
(
parent
)
self
.
community
=
community
self
.
columns
=
(
'
UID
'
,
'
Pubkey
'
,
'
Last renew date
'
,
'
Expiration
'
)
self
.
columns_titles
=
{
'
uid
'
:
'
UID
'
,
'
pubkey
'
:
'
Pubkey
'
,
'
renew
'
:
'
Last renew date
'
,
'
expiration
'
:
'
Expiration
'
}
self
.
columns_ids
=
(
'
uid
'
,
'
pubkey
'
,
'
renew
'
,
'
expiration
'
)
@property
def
pubkeys
(
self
):
...
...
@@ -78,11 +83,12 @@ class MembersTableModel(QAbstractTableModel):
return
len
(
self
.
pubkeys
)
def
columnCount
(
self
,
parent
):
return
len
(
self
.
columns
)
return
len
(
self
.
columns
_ids
)
def
headerData
(
self
,
section
,
orientation
,
role
):
if
role
==
Qt
.
DisplayRole
:
return
self
.
columns
[
section
]
id
=
self
.
columns_ids
[
section
]
return
self
.
columns_titles
[
id
]
def
member_data
(
self
,
pubkey
):
person
=
Person
.
lookup
(
pubkey
,
self
.
community
)
...
...
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