def add_view(self, view, position=None, relative_to=None, size=(-1, -1)):
        if view is None:
            return None

        try:
            self._qt4_add_view(view, position, relative_to, size)
            view.visible = True
        except Exception:
            logger.exception('error creating view control [%s]', view.id)

            # Even though we caught the exception, it sometimes happens that
            # the view's control has been created as a child of the application
            # window (or maybe even the dock control).  We should destroy the
            # control to avoid bad UI effects.
            view.destroy_control()

            # Additionally, display an error message to the user.
            error(self.window.control, 'Unable to add view [%s]' % view.id,
                  'Workbench Plugin Error')

        return view
    def add_view(self, view, position=None, relative_to=None, size=(-1, -1)):
        if view is None:
            return None

        try:
            self._qt4_add_view(view, position, relative_to, size)
            view.visible = True
        except Exception:
            logger.exception('error creating view control [%s]', view.id)

            # Even though we caught the exception, it sometimes happens that
            # the view's control has been created as a child of the application
            # window (or maybe even the dock control).  We should destroy the
            # control to avoid bad UI effects.
            view.destroy_control()

            # Additionally, display an error message to the user.
            error(self.window.control, 'Unable to add view [%s]' % view.id,
                    'Workbench Plugin Error')

        return view
Example #3
0
    def error(self, message, title='Error'):
        """ Convenience method to show an error message dialog. """

        from pyface.message_dialog import error

        return error(self.window.control, message, title)
Example #4
0
    def error(self, message, title='Error'):
        """ Convenience method to show an error message dialog. """

        from pyface.message_dialog import error

        return error(self.window.control, message, title)