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
ae59a3de
Commit
ae59a3de
authored
Dec 05, 2013
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not schedule to the GUI thread when already in the GUI thread
parent
8f5fdf50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
util.py
blink/util.py
+11
-5
No files found.
blink/util.py
View file @
ae59a3de
...
...
@@ -3,7 +3,7 @@
__all__
=
[
'QSingleton'
,
'call_in_gui_thread'
,
'call_later'
,
'run_in_gui_thread'
]
from
PyQt4.QtCore
import
QObject
,
QTimer
from
PyQt4.QtCore
import
QObject
,
QT
hread
,
QT
imer
from
PyQt4.QtGui
import
QApplication
from
application.python.decorator
import
decorator
,
preserve_signature
from
application.python.types
import
Singleton
...
...
@@ -17,6 +17,9 @@ class QSingleton(Singleton, type(QObject)):
def
call_in_gui_thread
(
function
,
*
args
,
**
kw
):
application
=
QApplication
.
instance
()
if
application
.
thread
()
is
QThread
.
currentThread
():
function
(
*
args
,
**
kw
)
else
:
application
.
postEvent
(
application
,
CallFunctionEvent
(
function
,
args
,
kw
))
...
...
@@ -26,11 +29,14 @@ def call_later(interval, function, *args, **kw):
@
decorator
def
run_in_gui_thread
(
func
):
@
preserve_signature
(
func
)
def
run_in_gui_thread
(
func
tion
):
@
preserve_signature
(
func
tion
)
def
wrapper
(
*
args
,
**
kw
):
application
=
QApplication
.
instance
()
application
.
postEvent
(
application
,
CallFunctionEvent
(
func
,
args
,
kw
))
if
application
.
thread
()
is
QThread
.
currentThread
():
function
(
*
args
,
**
kw
)
else
:
application
.
postEvent
(
application
,
CallFunctionEvent
(
function
,
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