[add] parameters now changed as part of project, some small fixes
This commit is contained in:
parent
f7d0e49458
commit
0af795969b
35
QtPyLoT.py
35
QtPyLoT.py
@ -633,6 +633,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.updatePicks(type=type)
|
self.updatePicks(type=type)
|
||||||
self.drawPicks(picktype=type)
|
self.drawPicks(picktype=type)
|
||||||
self.draw()
|
self.draw()
|
||||||
|
self.setDirty(True)
|
||||||
|
|
||||||
def add_recentfile(self, event):
|
def add_recentfile(self, event):
|
||||||
self.recentfiles.insert(0, event)
|
self.recentfiles.insert(0, event)
|
||||||
@ -2021,7 +2022,7 @@ class MainWindow(QMainWindow):
|
|||||||
if not self.get_current_event() or not self.project.location:
|
if not self.get_current_event() or not self.project.location:
|
||||||
self.setWindowTitle("PyLoT - New project [*]")
|
self.setWindowTitle("PyLoT - New project [*]")
|
||||||
elif self.get_current_event():
|
elif self.get_current_event():
|
||||||
self.setWindowTitle("PyLoT - [{}]".format(self.project.location))
|
self.setWindowTitle("PyLoT - {} [*]".format(self.project.location))
|
||||||
else:
|
else:
|
||||||
self.setWindowTitle(
|
self.setWindowTitle(
|
||||||
"PyLoT - seismic processing the python way[*]")
|
"PyLoT - seismic processing the python way[*]")
|
||||||
@ -2065,6 +2066,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.project = Project()
|
self.project = Project()
|
||||||
self.init_events(new=True)
|
self.init_events(new=True)
|
||||||
self.setDirty(True)
|
self.setDirty(True)
|
||||||
|
self.project.parameter=self._inputs
|
||||||
self.project.save(filename)
|
self.project.save(filename)
|
||||||
self.setDirty(False)
|
self.setDirty(False)
|
||||||
self.update_status('Creating new project...', duration=1000)
|
self.update_status('Creating new project...', duration=1000)
|
||||||
@ -2076,18 +2078,6 @@ class MainWindow(QMainWindow):
|
|||||||
'''
|
'''
|
||||||
if not self.okToContinue():
|
if not self.okToContinue():
|
||||||
return
|
return
|
||||||
# if self.project:
|
|
||||||
# if self.project.dirty:
|
|
||||||
# qmb = QMessageBox(self, icon=QMessageBox.Question, text='Save changes in current project?')
|
|
||||||
# qmb.setStandardButtons(QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
|
|
||||||
# qmb.setDefaultButton(QMessageBox.Yes)
|
|
||||||
# answer = qmb.exec_()
|
|
||||||
# if answer == 16384:
|
|
||||||
# self.saveProject()
|
|
||||||
# elif answer == 65536:
|
|
||||||
# pass
|
|
||||||
# elif answer == 4194304:
|
|
||||||
# return
|
|
||||||
if not fnm:
|
if not fnm:
|
||||||
dlg = QFileDialog()
|
dlg = QFileDialog()
|
||||||
fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)')
|
fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)')
|
||||||
@ -2096,13 +2086,17 @@ class MainWindow(QMainWindow):
|
|||||||
fnm = fnm[0]
|
fnm = fnm[0]
|
||||||
if fnm:
|
if fnm:
|
||||||
self.project = Project.load(fnm)
|
self.project = Project.load(fnm)
|
||||||
|
if hasattr(self.project, 'parameter'):
|
||||||
|
if self.project.parameter:
|
||||||
|
self._inputs = self.project.parameter
|
||||||
self.tabs.setCurrentIndex(0) # implemented to prevent double-loading of waveform data
|
self.tabs.setCurrentIndex(0) # implemented to prevent double-loading of waveform data
|
||||||
self.init_events(new=True)
|
self.init_events(new=True)
|
||||||
if hasattr(self.project, 'metadata'):
|
|
||||||
self.init_array_map(index=0)
|
|
||||||
else:
|
|
||||||
self.init_array_tab()
|
|
||||||
self.setDirty(False)
|
self.setDirty(False)
|
||||||
|
if hasattr(self.project, 'metadata'):
|
||||||
|
if self.project.metadata:
|
||||||
|
self.init_array_map(index=0)
|
||||||
|
return
|
||||||
|
self.init_array_tab()
|
||||||
|
|
||||||
def saveProjectAs(self):
|
def saveProjectAs(self):
|
||||||
self.saveProject(new=True)
|
self.saveProject(new=True)
|
||||||
@ -2117,6 +2111,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.setDirty(True)
|
self.setDirty(True)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
self.project.parameter=self._inputs
|
||||||
self.project.save()
|
self.project.save()
|
||||||
if not self.project.dirty:
|
if not self.project.dirty:
|
||||||
print('Saved back project to file:\n{}'.format(self.project.location))
|
print('Saved back project to file:\n{}'.format(self.project.location))
|
||||||
@ -2133,6 +2128,9 @@ class MainWindow(QMainWindow):
|
|||||||
self.fill_eventbox()
|
self.fill_eventbox()
|
||||||
self.getPlotWidget().draw()
|
self.getPlotWidget().draw()
|
||||||
|
|
||||||
|
def _setDirty(self):
|
||||||
|
self.setDirty(True)
|
||||||
|
|
||||||
def setDirty(self, value):
|
def setDirty(self, value):
|
||||||
self.saveProjectAction.setEnabled(value)
|
self.saveProjectAction.setEnabled(value)
|
||||||
self.saveProjectAsAction.setEnabled(value)
|
self.saveProjectAsAction.setEnabled(value)
|
||||||
@ -2150,6 +2148,8 @@ class MainWindow(QMainWindow):
|
|||||||
def pickParameter(self):
|
def pickParameter(self):
|
||||||
if not self.paraBox:
|
if not self.paraBox:
|
||||||
self.paraBox = AutoPickParaBox(self._inputs)
|
self.paraBox = AutoPickParaBox(self._inputs)
|
||||||
|
self.paraBox._apply.clicked.connect(self._setDirty)
|
||||||
|
self.paraBox._okay.clicked.connect(self._setDirty)
|
||||||
self.paraBox.show()
|
self.paraBox.show()
|
||||||
|
|
||||||
def PyLoTprefs(self):
|
def PyLoTprefs(self):
|
||||||
@ -2176,6 +2176,7 @@ class Project(object):
|
|||||||
self.eventlist = []
|
self.eventlist = []
|
||||||
self.location = None
|
self.location = None
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
|
self.parameter = None
|
||||||
self._table = None
|
self._table = None
|
||||||
|
|
||||||
def add_eventlist(self, eventlist):
|
def add_eventlist(self, eventlist):
|
||||||
|
@ -1 +1 @@
|
|||||||
2030-dirty
|
f7d0-dirty
|
||||||
|
Loading…
Reference in New Issue
Block a user