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
0a3b7127
Commit
0a3b7127
authored
Dec 13, 2010
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed AuxiliaryThread and replaced it with threads from sipsimple
parent
371f0925
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
44 deletions
+10
-44
__init__.py
blink/__init__.py
+0
-23
accounts.py
blink/accounts.py
+3
-2
contacts.py
blink/contacts.py
+3
-3
preferences.py
blink/preferences.py
+3
-2
util.py
blink/util.py
+1
-14
No files found.
blink/__init__.py
View file @
0a3b7127
...
...
@@ -13,7 +13,6 @@ import sys
from
collections
import
defaultdict
import
cjson
from
PyQt4.QtCore
import
QThread
from
PyQt4.QtGui
import
QApplication
from
application
import
log
from
application.notification
import
IObserver
,
NotificationCenter
...
...
@@ -40,26 +39,6 @@ from blink.update import UpdateManager
from
blink.util
import
QSingleton
,
run_in_gui_thread
class
AuxiliaryThread
(
QThread
):
def
__init__
(
self
,
parent
=
None
):
super
(
AuxiliaryThread
,
self
)
.
__init__
(
parent
)
self
.
moveToThread
(
self
)
def
run
(
self
):
self
.
exec_
()
def
customEvent
(
self
,
event
):
handler
=
getattr
(
self
,
'_EH_
%
s'
%
event
.
name
,
Null
)
handler
(
event
)
def
_EH_CallFunctionEvent
(
self
,
event
):
try
:
event
.
function
(
*
event
.
args
,
**
event
.
kw
)
except
:
log
.
error
(
'Exception occured while calling function
%
s in the auxiliary thread'
%
event
.
function
.
__name__
)
log
.
err
()
class
Blink
(
QApplication
):
__metaclass__
=
QSingleton
...
...
@@ -68,7 +47,6 @@ class Blink(QApplication):
def
__init__
(
self
):
super
(
Blink
,
self
)
.
__init__
(
sys
.
argv
)
self
.
application
=
SIPApplication
()
self
.
auxiliary_thread
=
AuxiliaryThread
()
self
.
first_run
=
False
self
.
main_window
=
MainWindow
()
...
...
@@ -85,7 +63,6 @@ class Blink(QApplication):
def
run
(
self
):
from
blink.util
import
call_in_gui_thread
as
call_later
call_later
(
self
.
_initialize_sipsimple
)
# initialize sipsimple after the qt event loop is started
self
.
auxiliary_thread
.
start
()
self
.
exec_
()
self
.
update_manager
.
shutdown
()
self
.
application
.
stop
()
...
...
blink/accounts.py
View file @
0a3b7127
...
...
@@ -26,11 +26,12 @@ from zope.interface import implements
from
sipsimple.account
import
Account
,
AccountExists
,
AccountManager
,
BonjourAccount
from
sipsimple.configuration.settings
import
SIPSimpleSettings
from
sipsimple.threading
import
run_in_thread
from
sipsimple.util
import
user_info
from
blink.resources
import
Resources
from
blink.widgets.labels
import
Status
from
blink.util
import
QSingleton
,
call_in_gui_thread
,
run_in_
auxiliary_thread
,
run_in_
gui_thread
from
blink.util
import
QSingleton
,
call_in_gui_thread
,
run_in_gui_thread
class
AccountInfo
(
object
):
...
...
@@ -415,7 +416,7 @@ class AddAccountDialog(base_class, ui_class):
self
.
verify_password
=
u''
self
.
email_address
=
u''
@
run_in_
auxiliary_thread
@
run_in_
thread
(
'network-io'
)
def
_create_sip_account
(
self
,
username
,
password
,
email_address
,
display_name
,
timezone
=
None
):
red
=
'#cc0000'
if
timezone
is
None
and
sys
.
platform
!=
'win32'
:
...
...
blink/contacts.py
View file @
0a3b7127
...
...
@@ -32,14 +32,14 @@ from zope.interface import implements
from
sipsimple.account
import
AccountManager
,
BonjourAccount
from
sipsimple.configuration.settings
import
SIPSimpleSettings
from
sipsimple.threading
import
run_in_twisted_thread
from
sipsimple.threading
import
run_in_t
hread
,
run_in_t
wisted_thread
from
sipsimple.threading.green
import
run_in_green_thread
from
sipsimple.util
import
makedirs
from
blink.configuration.datatypes
import
AuthorizationToken
,
InvalidToken
from
blink.resources
import
ApplicationData
,
Resources
,
IconCache
from
blink.sessions
import
SessionManager
from
blink.util
import
QSingleton
,
call_in_gui_thread
,
call_later
,
run_in_
auxiliary_thread
,
run_in_
gui_thread
from
blink.util
import
QSingleton
,
call_in_gui_thread
,
call_later
,
run_in_gui_thread
from
blink.widgets.buttons
import
SwitchViewButton
from
blink.widgets.labels
import
Status
...
...
@@ -1188,7 +1188,7 @@ class ContactModel(QAbstractListModel):
self
.
endRemoveRows
()
return
items
@
run_in_
auxiliary_thread
@
run_in_
thread
(
'file-io'
)
def
_store_contacts
(
self
,
data
):
makedirs
(
ApplicationData
.
directory
)
filename
=
ApplicationData
.
get
(
'contacts'
)
...
...
blink/preferences.py
View file @
0a3b7127
...
...
@@ -24,12 +24,13 @@ from sipsimple.application import SIPApplication
from
sipsimple.configuration
import
DefaultValue
from
sipsimple.configuration.datatypes
import
MSRPRelayAddress
,
PortRange
,
SIPProxyAddress
from
sipsimple.configuration.settings
import
SIPSimpleSettings
from
sipsimple.threading
import
run_in_thread
from
sipsimple.util
import
limit
from
blink.accounts
import
AddAccountDialog
from
blink.resources
import
ApplicationData
,
Resources
from
blink.logging
import
LogManager
from
blink.util
import
QSingleton
,
call_in_gui_thread
,
run_in_
auxiliary_thread
,
run_in_
gui_thread
from
blink.util
import
QSingleton
,
call_in_gui_thread
,
run_in_gui_thread
...
...
@@ -1148,7 +1149,7 @@ class PreferencesWindow(base_class, ui_class):
settings
.
logs
.
pjsip_level
=
value
settings
.
save
()
@
run_in_
auxiliary_thread
@
run_in_
thread
(
'file-io'
)
def
_SH_ClearLogFilesButtonClicked
(
self
):
log_manager
=
LogManager
()
log_manager
.
stop
()
...
...
blink/util.py
View file @
0a3b7127
# Copyright (C) 2010 AG Projects. See LICENSE for details.
#
__all__
=
[
'QSingleton'
,
'call_in_gui_thread'
,
'call_later'
,
'run_in_gui_thread'
,
'call_in_auxiliary_thread'
,
'run_in_auxiliary_thread'
]
__all__
=
[
'QSingleton'
,
'call_in_gui_thread'
,
'call_later'
,
'run_in_gui_thread'
]
from
PyQt4.QtCore
import
QObject
,
QTimer
from
PyQt4.QtGui
import
QApplication
...
...
@@ -34,16 +34,3 @@ def run_in_gui_thread(func):
return
wrapper
def
call_in_auxiliary_thread
(
function
,
*
args
,
**
kw
):
application
=
QApplication
.
instance
()
application
.
postEvent
(
application
.
auxiliary_thread
,
CallFunctionEvent
(
function
,
args
,
kw
))
def
run_in_auxiliary_thread
(
func
):
@
preserve_signature
(
func
)
def
wrapper
(
*
args
,
**
kw
):
application
=
QApplication
.
instance
()
application
.
postEvent
(
application
.
auxiliary_thread
,
CallFunctionEvent
(
func
,
args
,
kw
))
return
wrapper
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