added load project option from command line (QtPyLoT.py -p)
This commit is contained in:
parent
b3a4470910
commit
8975913143
20
QtPyLoT.py
20
QtPyLoT.py
@ -25,6 +25,7 @@ https://www.iconfinder.com/iconsets/flavour
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import matplotlib
|
||||
|
||||
matplotlib.use('Qt4Agg')
|
||||
@ -1356,6 +1357,7 @@ class MainWindow(QMainWindow):
|
||||
self.update_status('picks accepted ({0})'.format(station))
|
||||
replot = self.addPicks(station, pickDlg.getPicks())
|
||||
self.get_current_event().setPick(station, pickDlg.getPicks())
|
||||
print(pickDlg.getPicks())
|
||||
if replot:
|
||||
self.plotWaveformData()
|
||||
self.drawPicks()
|
||||
@ -1974,8 +1976,9 @@ class MainWindow(QMainWindow):
|
||||
fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)')
|
||||
if not fnm:
|
||||
return
|
||||
if fnm[0]:
|
||||
self.project = Project.load(fnm[0])
|
||||
fnm = fnm[0]
|
||||
if fnm:
|
||||
self.project = Project.load(fnm)
|
||||
self.tabs.setCurrentIndex(0) # implemented to prevent double-loading of waveform data
|
||||
self.init_events(new=True)
|
||||
if hasattr(self.project, 'metadata'):
|
||||
@ -2213,7 +2216,7 @@ def create_window():
|
||||
return app, app_created
|
||||
|
||||
|
||||
def main():
|
||||
def main(args=None):
|
||||
# create the Qt application
|
||||
pylot_app, app_created = create_window()
|
||||
#pylot_app = QApplication(sys.argv)
|
||||
@ -2247,6 +2250,11 @@ def main():
|
||||
pylot_app.processEvents()
|
||||
|
||||
splash.finish(pylot_form)
|
||||
|
||||
if args:
|
||||
if args.project_filename:
|
||||
pylot_form.loadProject(args.project_filename)
|
||||
|
||||
if app_created:
|
||||
pylot_app.exec_()
|
||||
else:
|
||||
@ -2254,4 +2262,8 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
parser = argparse.ArgumentParser(description='Welcome to PyLoT.')
|
||||
parser.add_argument('-p', dest='project_filename', help='load project file',
|
||||
default=None)
|
||||
args = parser.parse_args()
|
||||
sys.exit(main(args))
|
||||
|
@ -1 +1 @@
|
||||
69b2-dirty
|
||||
b3a44-dirty
|
||||
|
Loading…
Reference in New Issue
Block a user