# Path: apasvo/gui/views/error.py
# def display_error_dlg(msg, additional_info=None, parent=None):


from PySide import QtCore
from PySide import QtGui
from apasvo.gui.views import error
    def run(self, task):
        self.label.setText(self.label_text)
        self._task = task
        self._thread = QtCore.QThread(self)
        self._task.moveToThread(self._thread)
        self._thread.started.connect(self._task.run)
        self._task.finished.connect(self._thread.quit)
        self._task.finished.connect(self.accept)
        self._task.finished.connect(self._task.deleteLater)
        self._task.error.connect(self.on_error)
        self._thread.finished.connect(self._thread.deleteLater)
        self._thread.start()
        return self.exec_()

    def set_label_text(self, label_text):
        self.label_text = label_text
        self.label.setText(self.label_text)

    def set_cancel_button_text(self, cancel_button_text):
        self.cancel_button_text = cancel_button_text
        self.button_cancel.setText(self.cancel_button_text)

    def reject(self):
        self.label.setText(self.cancel_label_text)
        self._task.abort()
        self._thread.quit()
        self._thread.wait()
        return QtGui.QDialog.reject(self)

    def on_error(self, *args, **kwargs):

# Path: apasvo/gui/views/error.py
# def display_error_dlg(msg, additional_info=None, parent=None):


# Path: apasvo/gui/views/processingdialog.py
from PySide import QtCore
from PySide import QtGui
from apasvo.gui.views import error

    def run(self, task):
        self.label.setText(self.label_text)
        self._task = task
        self._thread = QtCore.QThread(self)
        self._task.moveToThread(self._thread)
        self._thread.started.connect(self._task.run)
        self._task.finished.connect(self._thread.quit)
        self._task.finished.connect(self.accept)
        self._task.finished.connect(self._task.deleteLater)
        self._task.error.connect(self.on_error)
        self._thread.finished.connect(self._thread.deleteLater)
        self._thread.start()
        return self.exec_()

    def set_label_text(self, label_text):
        self.label_text = label_text
        self.label.setText(self.label_text)

    def set_cancel_button_text(self, cancel_button_text):
        self.cancel_button_text = cancel_button_text
        self.button_cancel.setText(self.cancel_button_text)

    def reject(self):
        self.label.setText(self.cancel_label_text)
        self._task.abort()
        self._thread.quit()
        self._thread.wait()
        return QtGui.QDialog.reject(self)

    def on_error(self, *args, **kwargs):

        error.display_error_dlg(*args, **kwargs)