Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
e6b921ea
Commit
e6b921ea
authored
Feb 15, 2018
by
Maxime Perrotin
Browse files
React on click
parent
63608c12
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/test_msc_streaming.py
View file @
e6b921ea
...
...
@@ -14,16 +14,18 @@
import
sys
import
signal
import
time
from
PySide.QtGui
import
QGraphicsView
,
QApplication
from
PySide.QtCore
import
Qt
from
PySide.QtCore
import
Qt
,
QTimer
from
mscStreamingScene
import
MscStreamingScene
def
test_msc
():
''' Create an MSC Scene and add items to check if streaming is ok '''
app
=
QApplication
(
sys
.
argv
)
global
next_y
,
counter
app
=
QApplication
(
sys
.
argv
)
msc_scene
=
MscStreamingScene
()
msc_view
=
QGraphicsView
(
msc_scene
)
...
...
@@ -41,16 +43,41 @@ def test_msc():
msc_view
.
show
()
item
=
msc_scene
.
addMessage
(
gui_instance
,
taste_instance
,
next_y
,
"Hello World ({})"
.
format
(
counter
))
item
.
show
()
msc_scene
.
visible_items
.
append
(
item
)
counter
+=
1
next_y
+=
increase_factor
def
add_item
(
item
):
''' Add item to the scene and update next y position '''
global
next_y
,
counter
item
.
show
()
msc_scene
.
visible_items
.
append
(
item
)
counter
+=
1
next_y
+=
increase_factor
def
click
(
_
):
''' Called when user clicks on the scene '''
item
=
msc_scene
.
addMessage
(
gui_instance
,
taste_instance
,
next_y
,
"Ping({})"
.
format
(
counter
))
add_item
(
item
)
item
=
msc_scene
.
addMessage
(
taste_instance
,
gui_instance
,
next_y
,
"Pong({})"
.
format
(
counter
))
add_item
(
item
)
msc_scene
.
mousePressEvent
=
click
# for _ in xrange (10):
# item = msc_scene.addMessage(gui_instance,
# taste_instance,
# next_y,
# "Ping({})".format(counter))
# add_item(item)
# item = msc_scene.addMessage(taste_instance,
# gui_instance,
# next_y,
# "Pong({})".format(counter))
# add_item(item)
app
.
exec_
()
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment