[bugfix] autoPickListWidget is directly attached to the main window and autoScrolls to the latest entry

This commit is contained in:
Sebastian Wehling-Benatelli 2015-11-26 05:17:26 +01:00
parent a2eb5868a7
commit 50a5586355
2 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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)