[addresses #167] started fixing the multiple phase saving issue
This commit is contained in:
		
							parent
							
								
									497ca39c91
								
							
						
					
					
						commit
						1f7049691c
					
				
							
								
								
									
										13
									
								
								QtPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								QtPyLoT.py
									
									
									
									
									
								
							| @ -405,13 +405,16 @@ class MainWindow(QMainWindow): | ||||
|         except OverwriteError: | ||||
|             msgBox = QMessageBox() | ||||
|             msgBox.setText("Picks have been modified!") | ||||
|             msgBox.setInformativeText("Do you want to overwrite the picks and save?") | ||||
|             msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | | ||||
|                                       QMessageBox.Cancel) | ||||
|             msgBox.setInformativeText("Do you want to save the changes and overwrite the picks?") | ||||
|             msgBox.setDetailedText(self.getData().getPicksStr()) | ||||
|             msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Cancel) | ||||
|             msgBox.setDefaultButton(QMessageBox.Save) | ||||
|             ret = msgBox.exec_() | ||||
|             if ret == QMessageBox.Save: | ||||
|                 print('Overwrite and Save') | ||||
|                 self.getData().resetPicks() | ||||
|                 self.saveData() | ||||
|             elif ret == QMessageBox.Cancel: | ||||
|                 return False | ||||
|         try: | ||||
|             self.getData().exportEvent(self.fname, exform) | ||||
|         except FormatError: | ||||
| @ -425,6 +428,8 @@ class MainWindow(QMainWindow): | ||||
|             fbasename, exform = os.path.splitext(fname[0]) | ||||
|             if not fbasename: | ||||
|                 return False | ||||
|             elif not exform: | ||||
|                 exform = fname[1].split('*')[1][:-1] | ||||
|             self.getData().exportEvent(fbasename, exform) | ||||
|         return True | ||||
| 
 | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| 1abc-dirty | ||||
| 497c-dirty | ||||
|  | ||||
| @ -52,6 +52,13 @@ class Data(object): | ||||
|     def __str__(self): | ||||
|         return str(self.wfdata) | ||||
| 
 | ||||
|     def getPicksStr(self): | ||||
|         picks_str = '' | ||||
|         for pick in self.getEvtData().picks: | ||||
|             picks_str += str(pick) + '\n' | ||||
|         return picks_str | ||||
| 
 | ||||
| 
 | ||||
|     def getParent(self): | ||||
|         """ | ||||
| 
 | ||||
| @ -360,9 +367,11 @@ class Data(object): | ||||
| 
 | ||||
|         def applyPicks(picks): | ||||
|             """ | ||||
| 
 | ||||
|             Creates ObsPy pick objects and append it to the picks list from the | ||||
|             PyLoT dictionary contain all picks. | ||||
|             :param picks: | ||||
|             :raise OverwriteError: | ||||
|             :raise OverwriteError: raises an OverwriteError if the picks list is | ||||
|              not empty. The GUI will then ask for a decision. | ||||
|             """ | ||||
|             firstonset = None | ||||
|             if self.getEvtData().picks: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user