Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
ccff590a
Commit
ccff590a
authored
May 13, 2010
by
Luci Stanescu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ignore_contacts_db_updates decorator and made use of it
parent
596a5965
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
contacts.py
blink/contacts.py
+17
-1
No files found.
blink/contacts.py
View file @
ccff590a
...
...
@@ -29,7 +29,8 @@ from blink.resources import ApplicationData, Resources
from
blink.util
import
run_in_gui_thread
# Functions decorated with updates_contacts_db must only be called from the GUI thread.
# Functions decorated with updates_contacts_db or skip_contacts_db_update must
# only be called from the GUI thread.
#
@
decorator
def
updates_contacts_db
(
func
):
...
...
@@ -48,6 +49,17 @@ def updates_contacts_db(func):
return
wrapper
updates_contacts_db
.
counter
=
0
@
decorator
def
ignore_contacts_db_updates
(
func
):
@
preserve_signature
(
func
)
def
wrapper
(
*
args
,
**
kw
):
updates_contacts_db
.
counter
+=
1
try
:
return
func
(
*
args
,
**
kw
)
finally
:
updates_contacts_db
.
counter
-=
1
return
wrapper
class
ContactGroup
(
object
):
savable
=
True
...
...
@@ -764,11 +776,13 @@ class ContactModel(QAbstractListModel):
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
handler
(
notification
)
@
ignore_contacts_db_updates
def
_NH_BonjourAccountDidAddNeighbour
(
self
,
notification
):
display_name
=
'
%
s (
%
s)'
%
(
notification
.
data
.
display_name
,
notification
.
data
.
host
)
contact
=
BonjourNeighbour
(
self
.
bonjour_group
,
display_name
,
unicode
(
notification
.
data
.
uri
))
self
.
addContact
(
contact
)
@
ignore_contacts_db_updates
def
_NH_BonjourAccountDidRemoveNeighbour
(
self
,
notification
):
for
contact
in
(
c
for
c
in
self
.
items
[:]
if
type
(
c
)
is
BonjourNeighbour
):
if
contact
.
uri
==
unicode
(
notification
.
data
.
uri
):
...
...
@@ -784,6 +798,7 @@ class ContactModel(QAbstractListModel):
if
account
is
BonjourAccount
():
self
.
removeGroup
(
self
.
bonjour_group
)
@
ignore_contacts_db_updates
def
_NH_SIPAccountManagerDidStart
(
self
,
notification
):
if
not
BonjourAccount
()
.
enabled
and
self
.
bonjour_group
in
self
.
contact_groups
:
self
.
removeGroup
(
self
.
bonjour_group
)
...
...
@@ -798,6 +813,7 @@ class ContactModel(QAbstractListModel):
self
.
moveGroup
(
group
,
contact_groups
[
0
])
group
.
expand
()
@
ignore_contacts_db_updates
def
_NH_SIPAccountManagerDidChangeDefaultAccount
(
self
,
notification
):
account
=
notification
.
data
.
account
old_account
=
notification
.
data
.
old_account
...
...
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