~stefan-schwarzburg/qreator/fix_bug_1208033

« back to all changes in this revision

Viewing changes to qreator_lib/helpers.py

  • Committer: David Planella
  • Date: 2013-05-20 10:29:25 UTC
  • mfrom: (168.1.2 qreator_vendors)
  • Revision ID: david.planella@ubuntu.com-20130520102925-6vwex5zjm7gzng6y
Added vendor check support for plugins

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from locale import gettext as _
28
28
 
 
29
 
 
30
class VendorError(Exception):
 
31
    """Raised by plugins if the required vendor infractucture is missing"""
 
32
    def __init__(self, value=None):
 
33
        if value is None:
 
34
            value = "Plugin disabled due to missing vendor infrastructure."
 
35
        self.value = value
 
36
    def __str__(self):
 
37
        return repr(self.value)
 
38
 
 
39
 
29
40
def get_builder(builder_file_name):
30
41
    """Return a fully-instantiated Gtk.Builder instance from specified ui
31
42
    file
83
94
    lib_logger_sh.setFormatter(formatter)
84
95
    lib_logger.addHandler(lib_logger_sh)
85
96
 
 
97
    plugin_logger = logging.getLogger('qrcodes')
 
98
    plugin_logger_sh = logging.StreamHandler()
 
99
    plugin_logger_sh.setFormatter(formatter)
 
100
    plugin_logger.addHandler(lib_logger_sh)
 
101
 
86
102
    # Set the logging level to show debug messages.
87
103
    if opts.verbose:
88
104
        logger.setLevel(logging.DEBUG)
 
105
        plugin_logger.setLevel(logging.DEBUG)
89
106
        logger.debug('logging enabled')
90
107
    if opts.verbose > 1:
91
108
        lib_logger.setLevel(logging.DEBUG)