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
9dbf8c4e
Commit
9dbf8c4e
authored
May 17, 2010
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made method private as it is only used internally
parent
d59cef51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
contacts.py
blink/contacts.py
+16
-16
No files found.
blink/contacts.py
View file @
9dbf8c4e
...
...
@@ -484,7 +484,7 @@ class ContactModel(QAbstractListModel):
# emulate beginResetModel/endResetModel for QT < 4.6
self
.
beginResetModel
=
Null
# or use self.modelAboutToBeReset.emit (it'll be emited twice though in that case)
self
.
endResetModel
=
self
.
reset
self
.
save_queue
=
EventQueue
(
self
.
store_contacts
,
name
=
'ContactsSavingThread'
)
self
.
save_queue
=
EventQueue
(
self
.
_
store_contacts
,
name
=
'ContactsSavingThread'
)
self
.
save_queue
.
start
()
self
.
bonjour_group
=
None
...
...
@@ -690,6 +690,21 @@ class ContactModel(QAbstractListModel):
self
.
endRemoveRows
()
return
items
def
_store_contacts
(
self
,
data
):
makedirs
(
ApplicationData
.
directory
)
filename
=
ApplicationData
.
get
(
'contacts'
)
tmp_filename
=
ApplicationData
.
get
(
'contacts.tmp'
)
bak_filename
=
ApplicationData
.
get
(
'contacts.bak'
)
file
=
open
(
tmp_filename
,
'wb'
)
file
.
write
(
data
)
file
.
close
()
try
:
os
.
rename
(
filename
,
bak_filename
)
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
os
.
rename
(
tmp_filename
,
filename
)
@
updates_contacts_db
def
addContact
(
self
,
contact
):
if
contact
in
self
.
items
:
...
...
@@ -809,21 +824,6 @@ class ContactModel(QAbstractListModel):
items
.
insert
(
position
,
group
)
self
.
save_queue
.
put
(
pickle
.
dumps
(
items
))
def
store_contacts
(
self
,
data
):
makedirs
(
ApplicationData
.
directory
)
filename
=
ApplicationData
.
get
(
'contacts'
)
tmp_filename
=
ApplicationData
.
get
(
'contacts.tmp'
)
bak_filename
=
ApplicationData
.
get
(
'contacts.bak'
)
file
=
open
(
tmp_filename
,
'wb'
)
file
.
write
(
data
)
file
.
close
()
try
:
os
.
rename
(
filename
,
bak_filename
)
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
os
.
rename
(
tmp_filename
,
filename
)
@
run_in_gui_thread
def
handle_notification
(
self
,
notification
):
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
...
...
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