some pick plotting issues solved; replotting main window if picks have been changed, otherwise just plot additional/deleted picks
This commit is contained in:
@@ -240,7 +240,7 @@ class PickDlg(QDialog):
|
||||
home_icon = QIcon()
|
||||
home_icon.addPixmap(QPixmap(':/icons/zoom_0.png'))
|
||||
del_icon = QIcon()
|
||||
del_icon.addPixmap(QPixmap(':/icon/delete.png'))
|
||||
del_icon.addPixmap(QPixmap(':/icons/delete.png'))
|
||||
|
||||
# create actions
|
||||
self.filterAction = createAction(parent=self, text='Filter',
|
||||
@@ -275,6 +275,8 @@ class PickDlg(QDialog):
|
||||
_dialtoolbar.addAction(self.zoomAction)
|
||||
_dialtoolbar.addSeparator()
|
||||
_dialtoolbar.addAction(self.resetZoomAction)
|
||||
_dialtoolbar.addSeparator()
|
||||
_dialtoolbar.addAction(self.resetPicksAction)
|
||||
|
||||
# layout the innermost widget
|
||||
_innerlayout = QVBoxLayout()
|
||||
@@ -376,7 +378,7 @@ class PickDlg(QDialog):
|
||||
traceIDs = []
|
||||
for channel in channels:
|
||||
channel = channel.upper()
|
||||
for traceID, channelID in plotDict.iteritems():
|
||||
for traceID, channelID in plotDict.items():
|
||||
if channelID[1].upper().endswith(channel):
|
||||
traceIDs.append(traceID)
|
||||
return traceIDs
|
||||
@@ -427,6 +429,13 @@ class PickDlg(QDialog):
|
||||
def getPicks(self):
|
||||
return self.picks
|
||||
|
||||
def resetPicks(self):
|
||||
self.picks = {}
|
||||
|
||||
def delPicks(self):
|
||||
self.resetPicks()
|
||||
self.resetPlot()
|
||||
|
||||
def setIniPick(self, gui_event):
|
||||
|
||||
trace_number = round(gui_event.ydata)
|
||||
@@ -677,8 +686,21 @@ class PickDlg(QDialog):
|
||||
zoomx=self.getXLims(),
|
||||
zoomy=self.getYLims())
|
||||
self.setPlotLabels()
|
||||
self.drawPicks()
|
||||
self.draw()
|
||||
|
||||
def resetPlot(self):
|
||||
self.updateCurrentLimits()
|
||||
data = self.getWFData().copy()
|
||||
title = self.getPlotWidget().getAxes().get_title()
|
||||
self.getPlotWidget().plotWFData(wfdata=data, title=title,
|
||||
zoomx=self.getXLims(),
|
||||
zoomy=self.getYLims())
|
||||
self.setPlotLabels()
|
||||
self.drawPicks()
|
||||
self.draw()
|
||||
|
||||
|
||||
def setPlotLabels(self):
|
||||
|
||||
# get channel labels
|
||||
@@ -716,7 +738,7 @@ class PickDlg(QDialog):
|
||||
else:
|
||||
# deal with something that should never happen
|
||||
scale_factor = 1
|
||||
print gui_event.button
|
||||
print(gui_event.button)
|
||||
|
||||
new_xlim = gui_event.xdata - \
|
||||
scale_factor * (gui_event.xdata - self.getXLims())
|
||||
@@ -747,7 +769,7 @@ class PickDlg(QDialog):
|
||||
def apply(self):
|
||||
picks = self.getPicks()
|
||||
for pick in picks:
|
||||
print pick, picks[pick]
|
||||
print(pick, picks[pick])
|
||||
|
||||
def accept(self):
|
||||
self.apply()
|
||||
|
||||
Reference in New Issue
Block a user