Example #1
0
            def show_error():
                import traceback
                msg = _('Playlist export failed: %s') % str(ex)
                mesk.log.error("%s\n%s" % (msg, traceback.format_exc()))

                from dialogs import ErrorDialog
                d = ErrorDialog(self.dialog, markup='<b>%s</b>' % msg)
                d.run()
                d.destroy()
Example #2
0
    def on_unhandled_exception(self, type, value, tb):
        """Called if an unhandled exception occurres. Shows the exception in
        an error dialog and prints the stack trace to stderr."""
        try:
            list = traceback.format_tb(tb, None) + \
                    traceback.format_exception_only(type, value)
            tracelog = '\nTraceback (most recent call last):\n' + "%-20s%s" % \
                    ("".join(list[:-1]), list[-1])

            message = "An internal program error has occurred."
            message += "\n" + tracelog

            gtk.gdk.threads_enter()
            ed = ErrorDialog(_("Unhandled exception"), message)
            ed.run()
            ed.destroy()
            gtk.gdk.threads_leave()

            sys.stderr.write(message)
        except:
            traceback.print_exc()
Example #3
0
    def _on_plugin_toggled(self, cell, path, model):
        new_state = not model[path][0]
        path = int(path)
        plugin_name = self._plugins[path]['NAME']

        plugin_mgr = mesk.plugin.get_manager()
        state_str = ''
        try:
            if new_state:
                state_str = _('Plugin activation error')
                plugin_mgr.activate_plugin(plugin_name)
            else:
                state_str = _('Plugin deactivation error')
                plugin_mgr.deactivate_plugin(plugin_name)
            # Update model
            model[path][0] = new_state
        except Exception, ex:
            d = ErrorDialog(self.window)
            d.set_markup('<b>%s</b>' % state_str)
            d.format_secondary_text(str(ex))
            d.run()
            d.destroy()