[revert] reverted accidental changes to file PyLoT.py

This commit is contained in:
Marcel Paffrath 2020-07-16 12:35:18 +02:00
parent 707c596672
commit dad383b197

View File

@ -111,7 +111,7 @@ class MainWindow(QMainWindow):
__version__ = _getVersionString()
closing = Signal()
def __init__(self, parent=None, infile=None):
def __init__(self, parent=None, infile=None, reset_qsettings=False):
super(MainWindow, self).__init__(parent)
self.init_config_files(infile)
@ -152,6 +152,8 @@ class MainWindow(QMainWindow):
self.createAction = createAction
# read settings
settings = QSettings()
if reset_qsettings:
settings.clear()
self.recentfiles = settings.value("data/recentEvents", [])
self.dispComponent = str(settings.value("plotting/dispComponent", "Z"))
@ -194,8 +196,6 @@ class MainWindow(QMainWindow):
dirname = QFileDialog().getExistingDirectory(
caption='Choose data root ...')
settings.setValue("data/dataRoot", dirname)
if settings.value('compclass', None) is None:
settings.setValue('compclass', SetChannelComponents())
if settings.value('useGuiFilter') is None:
settings.setValue('useGuiFilter', False)
if settings.value('output/Format', None) is None:
@ -1293,12 +1293,15 @@ class MainWindow(QMainWindow):
paths_exist = [os.path.exists(event.path) for event in self.project.eventlist]
if all(paths_exist):
return True
elif not any(paths_exist):
return False
else:
info_str = ''
for event, path_exists in zip(self.project.eventlist, paths_exist):
if not path_exists:
info_str += '\n{} exists: {}'.format(event.path, path_exists)
print('Unable to find certain event paths:{}'.format(info_str))
return False
return True
def modify_project_path(self, new_rootpath):
self.project.rootpath = new_rootpath
@ -3426,7 +3429,7 @@ class MainWindow(QMainWindow):
print("Network local magnitude: %4.1f" % net_ml.mag)
if magscaling is None:
scaling = False
elif magscaling[0] == 0.0 and magscaling[1] == 0.0:
elif magscaling[0] != 0 and magscaling[1] != 0:
scaling = False
else:
scaling = True
@ -3581,6 +3584,9 @@ class MainWindow(QMainWindow):
if not filename.split('.')[-1] == 'plp':
filename = fnm[0] + '.plp'
self.project.parameter = self._inputs
settings = QSettings()
autosaveXML = get_Bool(settings.value('autosaveXML', True))
if autosaveXML:
self.exportEvents()
self.project.save(filename)
self.setDirty(False)
@ -3602,6 +3608,9 @@ class MainWindow(QMainWindow):
else:
self.metadata.clear_inventory()
self.project.parameter = self._inputs
settings = QSettings()
autosaveXML = get_Bool(settings.value('autosaveXML', True))
if autosaveXML:
self.exportEvents()
self.project.save()
self.update_obspy_dmt()
@ -3900,6 +3909,7 @@ def main(args=None):
project_filename = args.project_filename
if args.input_filename:
pylot_infile = args.input_filename
reset_qsettings = args.reset_qsettings
# create the Qt application
pylot_app, app_created = create_window()
@ -3912,7 +3922,7 @@ def main(args=None):
app_icon.addPixmap(QPixmap(':/icons/pylot.png'))
# create the main window
pylot_form = MainWindow(infile=pylot_infile)
pylot_form = MainWindow(infile=pylot_infile, reset_qsettings=reset_qsettings)
pylot_form.setWindowIcon(app_icon)
pylot_form.setIconSize(QSize(60, 60))
@ -3945,5 +3955,7 @@ if __name__ == "__main__":
default=None)
parser.add_argument('-in', dest='input_filename', help='set pylot input file',
default=None)
parser.add_argument('--reset_qsettings', default=False, action='store_true',
help='reset qsettings (debug option)')
args = parser.parse_args()
sys.exit(main(args))