corrected for some python 3 compatibility issues; added a new delete picks button to the picking window
This commit is contained in:
parent
b391f5e082
commit
33164d4d1f
@ -3,6 +3,7 @@
|
|||||||
<file>icons/pylot.ico</file>
|
<file>icons/pylot.ico</file>
|
||||||
<file>icons/pylot.png</file>
|
<file>icons/pylot.png</file>
|
||||||
<file>icons/printer.png</file>
|
<file>icons/printer.png</file>
|
||||||
|
<file>icons/delete.png</file>
|
||||||
<file>icons/key_E.png</file>
|
<file>icons/key_E.png</file>
|
||||||
<file>icons/key_N.png</file>
|
<file>icons/key_N.png</file>
|
||||||
<file>icons/key_P.png</file>
|
<file>icons/key_P.png</file>
|
||||||
|
BIN
icons/delete.png
Executable file
BIN
icons/delete.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
File diff suppressed because one or more lines are too long
@ -45,7 +45,7 @@ class AutoPickParameter(object):
|
|||||||
self.__filename = fnin
|
self.__filename = fnin
|
||||||
parFileCont = {}
|
parFileCont = {}
|
||||||
# read from parsed arguments alternatively
|
# read from parsed arguments alternatively
|
||||||
for key, val in kwargs.iteritems():
|
for key, val in kwargs.items():
|
||||||
parFileCont[key] = val
|
parFileCont[key] = val
|
||||||
|
|
||||||
if self.__filename is not None:
|
if self.__filename is not None:
|
||||||
@ -57,7 +57,7 @@ class AutoPickParameter(object):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
parspl = line.split('\t')[:2]
|
parspl = line.split('\t')[:2]
|
||||||
parFileCont[parspl[0].strip()] = parspl[1]
|
parFileCont[parspl[0].strip()] = parspl[1]
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self._printParameterError(e)
|
self._printParameterError(e)
|
||||||
inputFile.seek(0)
|
inputFile.seek(0)
|
||||||
lines = inputFile.readlines()
|
lines = inputFile.readlines()
|
||||||
@ -65,7 +65,7 @@ class AutoPickParameter(object):
|
|||||||
if not line.startswith(('#', '%', '\n', ' ')):
|
if not line.startswith(('#', '%', '\n', ' ')):
|
||||||
parspl = line.split('#')[:2]
|
parspl = line.split('#')[:2]
|
||||||
parFileCont[parspl[1].strip()] = parspl[0].strip()
|
parFileCont[parspl[1].strip()] = parspl[0].strip()
|
||||||
for key, value in parFileCont.iteritems():
|
for key, value in parFileCont.items():
|
||||||
try:
|
try:
|
||||||
val = int(value)
|
val = int(value)
|
||||||
except:
|
except:
|
||||||
@ -121,7 +121,7 @@ class AutoPickParameter(object):
|
|||||||
return len(self.__parameter.keys())
|
return len(self.__parameter.keys())
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
for key, value in self.__parameter.iteritems():
|
for key, value in self.__parameter.items():
|
||||||
yield key, value
|
yield key, value
|
||||||
|
|
||||||
def hasParam(self, parameter):
|
def hasParam(self, parameter):
|
||||||
@ -134,22 +134,22 @@ class AutoPickParameter(object):
|
|||||||
for param in args:
|
for param in args:
|
||||||
try:
|
try:
|
||||||
return self.__getitem__(param)
|
return self.__getitem__(param)
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
self._printParameterError(e)
|
self._printParameterError(e)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
try:
|
try:
|
||||||
return self.__getitem__(args)
|
return self.__getitem__(args)
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
self._printParameterError(e)
|
self._printParameterError(e)
|
||||||
|
|
||||||
def setParam(self, **kwargs):
|
def setParam(self, **kwargs):
|
||||||
for param, value in kwargs.iteritems():
|
for param, value in kwargs.items():
|
||||||
self.__setitem__(param, value)
|
self.__setitem__(param, value)
|
||||||
print self
|
print(self)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _printParameterError(errmsg):
|
def _printParameterError(errmsg):
|
||||||
print 'ParameterError:\n non-existent parameter %s' % errmsg
|
print('ParameterError:\n non-existent parameter %s' % errmsg)
|
||||||
|
|
||||||
def export2File(self, fnout):
|
def export2File(self, fnout):
|
||||||
fid_out = open(fnout, 'w')
|
fid_out = open(fnout, 'w')
|
||||||
|
@ -187,7 +187,7 @@ class PickDlg(QDialog):
|
|||||||
try:
|
try:
|
||||||
data = parent.getData().getWFData().copy()
|
data = parent.getData().getWFData().copy()
|
||||||
self.data = data.select(station=station)
|
self.data = data.select(station=station)
|
||||||
except AttributeError, e:
|
except AttributeError as e:
|
||||||
errmsg = 'You either have to put in a data or an appropriate ' \
|
errmsg = 'You either have to put in a data or an appropriate ' \
|
||||||
'parent (PyLoT MainWindow) object: {0}'.format(e)
|
'parent (PyLoT MainWindow) object: {0}'.format(e)
|
||||||
raise Exception(errmsg)
|
raise Exception(errmsg)
|
||||||
@ -239,6 +239,8 @@ class PickDlg(QDialog):
|
|||||||
zoom_icon.addPixmap(QPixmap(':/icons/zoom_in.png'))
|
zoom_icon.addPixmap(QPixmap(':/icons/zoom_in.png'))
|
||||||
home_icon = QIcon()
|
home_icon = QIcon()
|
||||||
home_icon.addPixmap(QPixmap(':/icons/zoom_0.png'))
|
home_icon.addPixmap(QPixmap(':/icons/zoom_0.png'))
|
||||||
|
del_icon = QIcon()
|
||||||
|
del_icon.addPixmap(QPixmap(':/icon/delete.png'))
|
||||||
|
|
||||||
# create actions
|
# create actions
|
||||||
self.filterAction = createAction(parent=self, text='Filter',
|
self.filterAction = createAction(parent=self, text='Filter',
|
||||||
@ -251,9 +253,12 @@ class PickDlg(QDialog):
|
|||||||
slot=self.zoom, icon=zoom_icon,
|
slot=self.zoom, icon=zoom_icon,
|
||||||
tip='Zoom into waveform',
|
tip='Zoom into waveform',
|
||||||
checkable=True)
|
checkable=True)
|
||||||
self.resetAction = createAction(parent=self, text='Home',
|
self.resetZoomAction = createAction(parent=self, text='Home',
|
||||||
slot=self.resetZoom, icon=home_icon,
|
slot=self.resetZoom, icon=home_icon,
|
||||||
tip='Reset zoom to original limits')
|
tip='Reset zoom to original limits')
|
||||||
|
self.resetPicksAction = createAction(parent=self, text='Delete Picks',
|
||||||
|
slot=self.delPicks, icon=del_icon,
|
||||||
|
tip='Delete current picks.')
|
||||||
|
|
||||||
# create other widget elements
|
# create other widget elements
|
||||||
self.selectPhase = QComboBox()
|
self.selectPhase = QComboBox()
|
||||||
@ -269,7 +274,7 @@ class PickDlg(QDialog):
|
|||||||
_dialtoolbar.addWidget(self.selectPhase)
|
_dialtoolbar.addWidget(self.selectPhase)
|
||||||
_dialtoolbar.addAction(self.zoomAction)
|
_dialtoolbar.addAction(self.zoomAction)
|
||||||
_dialtoolbar.addSeparator()
|
_dialtoolbar.addSeparator()
|
||||||
_dialtoolbar.addAction(self.resetAction)
|
_dialtoolbar.addAction(self.resetZoomAction)
|
||||||
|
|
||||||
# layout the innermost widget
|
# layout the innermost widget
|
||||||
_innerlayout = QVBoxLayout()
|
_innerlayout = QVBoxLayout()
|
||||||
|
Loading…
Reference in New Issue
Block a user