Commit ae9d8bce authored by Maxime Perrotin's avatar Maxime Perrotin

Make sure last item put on the MSC is visible

Automatic scroll up when streaming
parent e6b921ea
......@@ -70,6 +70,7 @@ class MscStreamingScene(MscGraphBasicMSCScene):
rst = super(MscStreamingScene, self).addMessage2(graphMsg)
self.streamingControl(rst)
rst.ensureVisible()
return rst
......@@ -79,6 +80,7 @@ class MscStreamingScene(MscGraphBasicMSCScene):
y = y - self.globalDiff
rst = super(MscStreamingScene, self).addCondition(instance, y, label)
self.streamingControl(rst)
rst.ensureVisible()
return rst
......@@ -88,6 +90,7 @@ class MscStreamingScene(MscGraphBasicMSCScene):
pos = instance.mapFromScene(0, y)
rst = super(MscStreamingScene, self).addTimer(instance, pos, label)
self.streamingControl(rst)
rst.ensureVisible()
return rst
......@@ -118,6 +121,7 @@ class MscStreamingScene(MscGraphBasicMSCScene):
y = y - self.globalDiff
rst = super(MscStreamingScene, self).addProcedure(instance, y, label)
self.streamingControl(rst)
rst.ensureVisible()
return rst
......@@ -136,8 +140,9 @@ class MscStreamingScene(MscGraphBasicMSCScene):
def streamingControl(self, element):
''' Scroll up in streaming mode '''
#self.visible_items.append(element)
_ = element
if len(self.visible_items) > self.max_items:
#print "stream up"
item = self.visible_items.popleft()
firstY = item.pos().y()
self.removeGenericItem(item)
......
......@@ -64,20 +64,10 @@ def test_msc():
next_y,
"Pong({})".format(counter))
add_item(item)
print "next y = ", next_y
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_()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment