From 50a5586355016fb1df2c93bb38f0354d6f30d21d Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Thu, 26 Nov 2015 05:17:26 +0100 Subject: [PATCH] [bugfix] autoPickListWidget is directly attached to the main window and autoScrolls to the latest entry --- QtPyLoT.py | 20 ++++++++++++-------- pylot/core/util/thread.py | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index b82df799..ad102c9e 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -655,25 +655,28 @@ class MainWindow(QMainWindow): elif self.getLocflag() and not self.check4Loc(): self.setLocflag(False) + def addListItem(self, text): + self.listWidget.addItem(text) + self.listWidget.scrollToBottom() + def autoPick(self): - list = QListWidget() + self.listWidget = QListWidget() self.setDirty(True) logDockWidget = QDockWidget("AutoPickLog", self) logDockWidget.setObjectName("LogDockWidget") - logDockWidget.setAllowedAreas(Qt.LeftDockWidgetArea) - logDockWidget.setWidget(list) - logDockWidget.show() - logDockWidget.setFloating(False) - list.addItem('loading default values for local data ...') + logDockWidget.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) + logDockWidget.setWidget(self.listWidget) + self.addDockWidget(Qt.LeftDockWidgetArea, logDockWidget) + self.addListItem('loading default values for local data ...') autopick_parameter = AutoPickParameter('autoPyLoT_local.in') - list.addItem(str(autopick_parameter)) + self.addListItem(str(autopick_parameter)) # Create the worker thread and run it self.thread = AutoPickThread(parent=self, func=autopickevent, data=self.getData().getWFData(), param=autopick_parameter) - self.thread.message.connect(list.addItem) + self.thread.message.connect(self.addListItem) self.thread.start() self.drawPicks() @@ -773,6 +776,7 @@ class MainWindow(QMainWindow): if extlocpath is None or locroot is None: self.PyLoTprefs() + def check4Loc(self): return self.picksNum() > 4 diff --git a/pylot/core/util/thread.py b/pylot/core/util/thread.py index 7ce1513e..c0acb18d 100644 --- a/pylot/core/util/thread.py +++ b/pylot/core/util/thread.py @@ -21,7 +21,7 @@ class AutoPickThread(QThread): for station in picks: self.parent().addPicks(station, picks[station]) except AttributeError: - print picks + print(picks) def write(self, text): self.message.emit(text)