From 494d281d6150107aaadf6c685fa945cbda8466da Mon Sep 17 00:00:00 2001 From: ann-christin Date: Thu, 25 Aug 2022 14:00:37 +0200 Subject: [PATCH 1/7] update github link --- PyLoT.py | 12 ++++++++---- pylot/core/io/default_parameters.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/PyLoT.py b/PyLoT.py index 08a5d2c1..3e70fc58 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -480,7 +480,7 @@ class MainWindow(QMainWindow): "automatic pick " "data.", False) self.compare_action.setEnabled(False) - self.qualities_action = self.createAction(parent=self, text='Show pick qualitites...', + self.qualities_action = self.createAction(parent=self, text='Show pick qualities...', slot=self.pickQualities, shortcut='Alt+Q', icon=qualities_icon, tip='Histogram of pick qualities') self.qualities_action.setEnabled(False) @@ -2861,7 +2861,9 @@ class MainWindow(QMainWindow): self.log_deleted_picks([deleted_pick]) def log_deleted_picks(self, deleted_picks, event_path=None): - ''' Log deleted picks to list self.deleted_picks ''' + ''' + Log deleted picks to list self.deleted_picks + ''' if not event_path: event_path = self.get_current_event_path() for deleted_pick in deleted_picks: @@ -2875,7 +2877,9 @@ class MainWindow(QMainWindow): self.deleted_picks[event_path].append(deleted_pick) def dump_deleted_picks(self, event_path): - ''' Save deleted picks to json file for event in event_path. Load old file before and merge''' + ''' + Save deleted picks to json file for event in event_path. Load old file before and merge + ''' try: deleted_picks_from_file = self.load_deleted_picks(event_path) except Exception as e: @@ -3783,7 +3787,7 @@ class MainWindow(QMainWindow): def helpHelp(self): if checkurl(): form = HelpForm(self, - 'https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/wiki') + 'https://github.com/seismology-RUB/PyLoT') else: form = HelpForm(self, ':/help.html') form.show() diff --git a/pylot/core/io/default_parameters.py b/pylot/core/io/default_parameters.py index 6e216939..6207d590 100644 --- a/pylot/core/io/default_parameters.py +++ b/pylot/core/io/default_parameters.py @@ -78,7 +78,7 @@ defaults = {'rootpath': {'type': str, 'vp': {'type': float, 'tooltip': 'average P-wave velocity', - 'value': 3530., + 'value': 3531., 'min': 0., 'max': np.inf, 'namestring': 'P-velocity'}, From 0d91f9e3fe25b6978051e71bc5b8e59308af4a57 Mon Sep 17 00:00:00 2001 From: ann-christin Date: Thu, 25 Aug 2022 14:03:05 +0200 Subject: [PATCH 2/7] update github link --- pylot/core/io/default_parameters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylot/core/io/default_parameters.py b/pylot/core/io/default_parameters.py index 6207d590..6e216939 100644 --- a/pylot/core/io/default_parameters.py +++ b/pylot/core/io/default_parameters.py @@ -78,7 +78,7 @@ defaults = {'rootpath': {'type': str, 'vp': {'type': float, 'tooltip': 'average P-wave velocity', - 'value': 3531., + 'value': 3530., 'min': 0., 'max': np.inf, 'namestring': 'P-velocity'}, From a8c6f4c9724999b8c4a0a8fdc48230309d92f992 Mon Sep 17 00:00:00 2001 From: ann-christin Date: Thu, 25 Aug 2022 15:31:08 +0200 Subject: [PATCH 3/7] [reformat] spell checking --- PyLoT.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PyLoT.py b/PyLoT.py index 3e70fc58..d9282d7e 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -1170,7 +1170,7 @@ class MainWindow(QMainWindow): ''' if not self.project: self.createNewProject() - ed = getExistingDirectories(self, 'Select event directories...') + ed = GetExistingDirectories(self, 'Select event directories...') if ed.exec_(): eventlist = [event for event in ed.selectedFiles() if not event.endswith('EVENTS-INFO')] basepath = eventlist[0].split(os.path.basename(eventlist[0]))[0] @@ -3967,13 +3967,13 @@ class Project(object): return project -class getExistingDirectories(QFileDialog): +class GetExistingDirectories(QFileDialog): ''' File dialog with possibility to select multiple folders. ''' def __init__(self, *args): - super(getExistingDirectories, self).__init__(*args) + super(GetExistingDirectories, self).__init__(*args) self.setOption(self.DontUseNativeDialog, True) self.setOption(self.ReadOnly, True) self.setFileMode(self.Directory) From 207d0b3a6fbb94d2c1d428852d0bea5ef315e268 Mon Sep 17 00:00:00 2001 From: ann-christin Date: Mon, 14 Nov 2022 11:18:15 +0100 Subject: [PATCH 4/7] [update] directly pass args from arg parser --- PyLoT.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/PyLoT.py b/PyLoT.py index 8c57a359..06e8974c 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -4038,16 +4038,7 @@ def create_window(): return app, app_created -def main(args=None): - project_filename = None - # args.project_filename = 'C:/Shared/AlpArray/alparray_data/project_alparray_test.plp' - pylot_infile = None - if args: - if args.project_filename: - project_filename = args.project_filename - if args.input_filename: - pylot_infile = args.input_filename - reset_qsettings = args.reset_qsettings +def main(project_filename=None, pylot_infile=None, reset_qsettings=False): # create the Qt application pylot_app, app_created = create_window() @@ -4096,4 +4087,5 @@ if __name__ == "__main__": parser.add_argument('--reset_qsettings', default=False, action='store_true', help='reset qsettings (debug option)') args = parser.parse_args() - sys.exit(main(args)) + sys.exit(main(project_filename=args.project_filename, pylot_infile=args.input_filename, + reset_qsettings=args.reset_qsettings)) From ebf6d4806a4d583cb04bb5510d62f4c71c4b27af Mon Sep 17 00:00:00 2001 From: ann-christin Date: Mon, 14 Nov 2022 11:52:25 +0100 Subject: [PATCH 5/7] [minor] reformating --- PyLoT.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/PyLoT.py b/PyLoT.py index 06e8974c..610a8f3c 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -118,15 +118,13 @@ class MainWindow(QMainWindow): infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in') print('Using default input file {}'.format(infile)) if os.path.isfile(infile) == False: - infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file') + infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file')[0] - if not os.path.exists(infile[0]): + if not os.path.exists(infile): QMessageBox.warning(self, "PyLoT Warning", "No PyLoT-input file declared!") sys.exit(0) - self.infile = infile[0] - else: - self.infile = infile + self.infile = infile self._inputs = PylotParameter(infile) self._props = None From 66b7dea706d26cfe94b9fa0c8046f25404ec4ad8 Mon Sep 17 00:00:00 2001 From: ann-christin Date: Mon, 14 Nov 2022 14:14:12 +0100 Subject: [PATCH 6/7] [update] pylot.in no longer mandatory --- PyLoT.py | 12 ++++++++---- pylot/core/util/defaults.py | 4 +--- pylot/core/util/utils.py | 7 +++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/PyLoT.py b/PyLoT.py index 610a8f3c..ef1b1b05 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -117,15 +117,19 @@ class MainWindow(QMainWindow): if not infile: infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in') print('Using default input file {}'.format(infile)) - if os.path.isfile(infile) == False: + if os.path.isfile(infile) is False: infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file')[0] if not os.path.exists(infile): QMessageBox.warning(self, "PyLoT Warning", - "No PyLoT-input file declared!") - sys.exit(0) - self.infile = infile + "No PyLoT-input file declared! Using default parameters!") + infile = None + self._inputs = PylotParameter(infile) + if not infile: + self._inputs.reset_defaults() + + self.infile = infile self._props = None self.gain = 1. diff --git a/pylot/core/util/defaults.py b/pylot/core/util/defaults.py index d982da8c..5d64422a 100644 --- a/pylot/core/util/defaults.py +++ b/pylot/core/util/defaults.py @@ -26,9 +26,7 @@ elif system_name == "Windows": # suffix for phase name if not phase identified by last letter (P, p, etc.) ALTSUFFIX = ['diff', 'n', 'g', '1', '2', '3'] -FILTERDEFAULTS = readDefaultFilterInformation(os.path.join(os.path.expanduser('~'), - '.pylot', - 'pylot.in')) +FILTERDEFAULTS = readDefaultFilterInformation() TIMEERROR_DEFAULTS = os.path.join(os.path.expanduser('~'), '.pylot', diff --git a/pylot/core/util/utils.py b/pylot/core/util/utils.py index 2567b079..af5f0e0c 100644 --- a/pylot/core/util/utils.py +++ b/pylot/core/util/utils.py @@ -37,15 +37,14 @@ def getAutoFilteroptions(phase, parameter): return filteroptions -def readDefaultFilterInformation(fname): +def readDefaultFilterInformation(): """ Read default filter information from pylot.in file - :param fname: path to pylot.in file - :type fname: str :return: dictionary containing the defailt filter information :rtype: dict """ - pparam = PylotParameter(fname) + pparam = PylotParameter() + pparam.reset_defaults() return readFilterInformation(pparam) From 8d94440e770468377f5836357773b87952bb3b09 Mon Sep 17 00:00:00 2001 From: ann-christin Date: Mon, 14 Nov 2022 14:14:59 +0100 Subject: [PATCH 7/7] [bugfix] logwidget always initiated --- PyLoT.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/PyLoT.py b/PyLoT.py index ef1b1b05..ee02e5b4 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -734,15 +734,12 @@ class MainWindow(QMainWindow): _widget.setLayout(self._main_layout) _widget.showFullScreen() + self.logwidget = LogWidget(parent=None) if use_logwidget: - self.logwidget = LogWidget(parent=None) self.logwidget.show() self.stdout = self.logwidget.stdout self.stderr = self.logwidget.stderr - sys.stdout = self.stdout - sys.stderr = self.stderr - # Not sure why but the lines above kept messing with the Ouput even with use_logwidget disabled sys.stdout = self.stdout sys.stderr = self.stderr