#!/usr/bin/python # -*- coding: utf-8 -*- # """ Abstract class for graphical interface. Name: interface.py Author: Alessandro dos Santos Ferreira ( santosferreira.alessandro@gmail.com ) """ import traceback from abc import ABCMeta, abstractmethod class Interface(object): __metaclass__ = ABCMeta @abstractmethod def show(self): pass class InterfaceException(Exception): DEBUG = True @staticmethod def format_exception(message = None): if message is not None: return "Unexpected error:\n%s" % message.replace('%', '%%') elif InterfaceException.DEBUG == True: return "Unexpected error:\n%s" % traceback.format_exc().replace('%', '%%') else: return "Unexpected error\n"