예제 #1
0
    def load(self, filename=None):
        """Opens a new document.

        Opens selected document in the current window if it isn't currently
        showing a document, otherwise the document is opened in a new
        window.

        Args:
            filename: Selected document. If None is provided launches a
            file dialog to let the user select a file.
            Default: None.
        """
        if filename is None:
            filename, _ = QtGui.QFileDialog.getOpenFileName(self, "Open Data File", ".",
                                                            ";;".join(self._file_filters), all_files_filter)
        if filename != '':
            dialog = loaddialog.LoadDialog(self, filename)
            return_code = dialog.exec_()
            if return_code == QtGui.QDialog.Accepted:
                try:
                    values = dialog.get_values()
                    # Load and visualize the opened record
                    QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
                    self.analysis_label.setText("Loading {}...".format(os.path.basename(filename)))
                    self.analysis_progress_bar.show()
                    stream = rc.read(filename, **values)
                    self.command_stack.push(commands.OpenStream(self, stream))
                    # Update recent list
                    self.push_recent_list(filename)
                except Exception as e:
                    error.display_error_dlg(str(e), traceback.format_exc())
                finally:
                    self.analysis_progress_bar.hide()
                    self.analysis_label.setText("")
                    QtGui.QApplication.restoreOverrideCursor()
예제 #2
0
    def load(self, filename=None):
        """Opens a new document.

        Opens selected document in the current window if it isn't currently
        showing a document, otherwise the document is opened in a new
        window.

        Args:
            filename: Selected document. If None is provided launches a
            file dialog to let the user select a file.
            Default: None.
        """
        if filename is None:
            filename, _ = QtGui.QFileDialog.getOpenFileName(
                self, "Open Data File", ".", ";;".join(self._file_filters),
                all_files_filter)
        if filename != '':
            dialog = loaddialog.LoadDialog(self, filename)
            return_code = dialog.exec_()
            if return_code == QtGui.QDialog.Accepted:
                try:
                    values = dialog.get_values()
                    # Load and visualize the opened record
                    QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
                    self.analysis_label.setText("Loading {}...".format(
                        os.path.basename(filename)))
                    self.analysis_progress_bar.show()
                    stream = rc.read(filename, **values)
                    self.command_stack.push(commands.OpenStream(self, stream))
                    # Update recent list
                    self.push_recent_list(filename)
                except Exception as e:
                    error.display_error_dlg(str(e), traceback.format_exc())
                finally:
                    self.analysis_progress_bar.hide()
                    self.analysis_label.setText("")
                    QtGui.QApplication.restoreOverrideCursor()
예제 #3
0
 def on_error(self, *args, **kwargs):
     error.display_error_dlg(*args, **kwargs)
     self.reject()
예제 #4
0
    from apasvo.gui.views import aboutdialog
    from apasvo.gui.views import svwidget
    from apasvo.gui.views import navigationtoolbar
    from apasvo.gui.views import loaddialog
    from apasvo.gui.views import savedialog
    from apasvo.gui.views import save_events_dialog
    from apasvo.gui.views import settingsdialog
    from apasvo.gui.views import takanamidialog
    from apasvo.gui.views import staltadialog
    from apasvo.gui.views import ampadialog
    from apasvo.gui.views import playertoolbar
    from apasvo.gui.views import error

    from apasvo.picking import stalta
    from apasvo.picking import ampa
    from apasvo.picking import apasvotrace as rc

    app.processEvents()

    # Create and display the main window
    main = mainwindow.MainWindow()
    main.show()
    splash.finish(main)

    try:
        app.exec_()
    except Exception, e:
        error.display_error_dlg(str(e), traceback.format_exc())
        sys.exit(1)
    sys.exit(0)
예제 #5
0
    from apasvo.gui.views import aboutdialog
    from apasvo.gui.views import svwidget
    from apasvo.gui.views import navigationtoolbar
    from apasvo.gui.views import loaddialog
    from apasvo.gui.views import savedialog
    from apasvo.gui.views import save_events_dialog
    from apasvo.gui.views import settingsdialog
    from apasvo.gui.views import takanamidialog
    from apasvo.gui.views import staltadialog
    from apasvo.gui.views import ampadialog
    from apasvo.gui.views import playertoolbar
    from apasvo.gui.views import error

    from apasvo.picking import stalta
    from apasvo.picking import ampa
    from apasvo.picking import apasvotrace as rc

    app.processEvents()

    # Create and display the main window
    main = mainwindow.MainWindow()
    main.show()
    splash.finish(main)

    try:
        app.exec_()
    except Exception, e:
        error.display_error_dlg(str(e), traceback.format_exc())
        sys.exit(1)
    sys.exit(0)