Commit 60034039 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix streaming issue

parent ae9d8bce
...@@ -34,6 +34,7 @@ LICENSE: LGPL - see LICENSE file ...@@ -34,6 +34,7 @@ LICENSE: LGPL - see LICENSE file
CHANGELOG: CHANGELOG:
1.6.0 - Fix autoscrolling in MSC streaming scenes
1.5.8 - Fix in Scenario.py used in MSCtoPython handlers 1.5.8 - Fix in Scenario.py used in MSCtoPython handlers
1.5.7 - No change - 1st version in TASTEv4 1.5.7 - No change - 1st version in TASTEv4
1.5.6 - Add support for taste-msc-editor 1.5.6 - Add support for taste-msc-editor
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
__author__ = "Maxime Perrotin" __author__ = "Maxime Perrotin"
__license__ = "LGPLv3" __license__ = "LGPLv3"
__version__ = "1.5.8" __version__ = "1.6.0"
__url__ = "http://taste.tuxfamily.org" __url__ = "http://taste.tuxfamily.org"
import sys import sys
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Tool main entry point (when used standalone) Tool main entry point (when used standalone)
Copyright (c) 2012-2015 European Space Agency Copyright (c) 2012-2018 European Space Agency
Designed and implemented by Maxime Perrotin Designed and implemented by Maxime Perrotin
...@@ -29,6 +29,7 @@ import time ...@@ -29,6 +29,7 @@ import time
from functools import partial from functools import partial
from ctypes import CDLL, create_string_buffer from ctypes import CDLL, create_string_buffer
logging.basicConfig()
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
terminal_formatter = logging.Formatter( terminal_formatter = logging.Formatter(
fmt="%(levelname)s - %(name)s: %(message)s") fmt="%(levelname)s - %(name)s: %(message)s")
......
...@@ -69,6 +69,8 @@ class MscStreamingScene(MscGraphBasicMSCScene): ...@@ -69,6 +69,8 @@ class MscStreamingScene(MscGraphBasicMSCScene):
y=y - self.globalDiff, data=coreMsg) y=y - self.globalDiff, data=coreMsg)
rst = super(MscStreamingScene, self).addMessage2(graphMsg) rst = super(MscStreamingScene, self).addMessage2(graphMsg)
self.visible_items.append (rst)
rst.show()
self.streamingControl(rst) self.streamingControl(rst)
rst.ensureVisible() rst.ensureVisible()
return rst return rst
...@@ -142,15 +144,16 @@ class MscStreamingScene(MscGraphBasicMSCScene): ...@@ -142,15 +144,16 @@ class MscStreamingScene(MscGraphBasicMSCScene):
''' Scroll up in streaming mode ''' ''' Scroll up in streaming mode '''
_ = element _ = element
if len(self.visible_items) > self.max_items: if len(self.visible_items) > self.max_items:
#print "stream up"
item = self.visible_items.popleft() item = self.visible_items.popleft()
firstY = item.pos().y() firstY = item.y()
self.removeGenericItem(item) item.hide()
#self.removeGenericItem(item)
while len(self.visible_items) > self.max_items: while len(self.visible_items) > self.max_items:
item = self.visible_items.popleft() item = self.visible_items.popleft()
self.removeGenericItem(item) #self.removeGenericItem(item)
item.hide()
diff = self.visible_items[0].pos().y() - firstY diff = self.visible_items[0].y() - firstY
self.globalDiff = self.globalDiff + diff self.globalDiff = self.globalDiff + diff
map(lambda msg: msg.setPos(msg.pos().x(), msg.pos().y() - diff), map(lambda msg: msg.setPos(msg.x(), msg.y() - diff),
self.visible_items) self.visible_items)
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import sys import sys
import signal import signal
import time import time
import logging
from PySide.QtGui import QGraphicsView, QApplication from PySide.QtGui import QGraphicsView, QApplication
from PySide.QtCore import Qt, QTimer from PySide.QtCore import Qt, QTimer
...@@ -46,8 +47,6 @@ def test_msc(): ...@@ -46,8 +47,6 @@ def test_msc():
def add_item(item): def add_item(item):
''' Add item to the scene and update next y position ''' ''' Add item to the scene and update next y position '''
global next_y, counter global next_y, counter
item.show()
msc_scene.visible_items.append(item)
counter += 1 counter += 1
next_y += increase_factor next_y += increase_factor
...@@ -64,15 +63,17 @@ def test_msc(): ...@@ -64,15 +63,17 @@ def test_msc():
next_y, next_y,
"Pong({})".format(counter)) "Pong({})".format(counter))
add_item(item) add_item(item)
print "next y = ", next_y
msc_scene.mousePressEvent = click msc_scene.mousePressEvent = click
msc_scene.setLimit(15)
app.exec_() app.exec_()
if __name__ == '__main__': if __name__ == '__main__':
# Exit app on Ctrl-C # Exit app on Ctrl-C
logging.basicConfig()
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
sys.exit(test_msc()) sys.exit(test_msc())
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