Exemple #1
0
    def build_handler(self, element, key, value, idmap, is_widget):
        if key.startswith("on_"):
            element.bind(**{key: curry(custom_callback, (element, key, value, idmap))})

        else:
            value = create_handler(element, key, value, idmap)
            trace("Builder: set %s=%s for %s" % (key, value, element))
            if is_widget and not hasattr(element, key):
                element.create_property(key)
            setattr(element, key, value)
Exemple #2
0
    def build_handler(self, element, key, value, idmap, is_widget):
        if key.startswith('on_'):
            if not element.is_event_type(key):
                key = key[3:]
            element.bind(**{key: curry(custom_callback, (
                element, key, value, idmap))})

        else:
            value = create_handler(element, key, value, idmap)
            trace('Builder: set %s=%s for %s' % (key, value, element))
            if is_widget and not hasattr(element, key):
                    element.create_property(key)
            setattr(element, key, value)
Exemple #3
0
    def build_handler(self, element, key, value, idmap, is_widget):
        if key.startswith('on_'):
            if not element.is_event_type(key):
                key = key[3:]
            element.bind(
                **{key: curry(custom_callback, (element, key, value, idmap))})

        else:
            value = create_handler(element, key, value, idmap)
            trace('Builder: set %s=%s for %s' % (key, value, element))
            if is_widget and not hasattr(element, key):
                element.create_property(key)
            setattr(element, key, value)
Exemple #4
0
    def __init__(self, **kwargs):
        super(Label, self).__init__(**kwargs)

        # bind all the property for recreating the texture
        d = ('text', 'font_size', 'font_name', 'bold', 'italic', 'halign',
             'valign', 'padding_x', 'padding_y', 'text_size')
        dkw = {}
        for x in d:
            dkw[x] = curry(self._trigger_texture_update, x)
        self.bind(**dkw)

        dkw = dict(zip(d, [getattr(self, x) for x in d]))
        self._label = CoreLabel(**dkw)

        # force the texture creation
        self.texture_update()
Exemple #5
0
    def __init__(self, **kwargs):
        super(Label, self).__init__(**kwargs)

        # bind all the property for recreating the texture
        d = ('text', 'font_size', 'font_name', 'bold', 'italic', 'halign',
             'valign', 'padding_x', 'padding_y', 'text_size')
        dkw = {}
        for x in d:
            dkw[x] = curry(self._trigger_texture_update, x)
        self.bind(**dkw)

        dkw = dict(zip(d, [getattr(self, x) for x in d]))
        self._label = CoreLabel(**dkw)

        # force the texture creation
        self.texture_update()
Exemple #6
0
    def __init__(self, name):
        logging.Logger.__init__(self, name, logging.DEBUG)
        color_formatter = ColoredFormatter(self.COLOR_FORMAT,
                                           use_color=self.use_color)
        console = logging.StreamHandler()
        console.setFormatter(color_formatter)

        # Use the custom handler instead of streaming one.
        if hasattr(sys, '_kivy_logging_handler'):
            self.addHandler(getattr(sys, '_kivy_logging_handler'))
        else:
            self.addHandler(console)
        self.addHandler(HistoryHandler())
        self.addHandler(FileHandler())
        return


if 'nosetests' not in sys.argv:
    logging.setLoggerClass(ColoredLogger)

#: Kivy default logger instance
Logger = logging.getLogger('Kivy')
Logger.logfile_activated = False

from kivy.utils import curry

Logger.trace = curry(Logger.log, logging.TRACE)

#: Kivy history handler
LoggerHistory = HistoryHandler
Exemple #7
0
    def __init__(self, name):
        logging.Logger.__init__(self, name, logging.DEBUG)
        color_formatter = ColoredFormatter(self.COLOR_FORMAT,
                                           use_color=self.use_color)
        console = logging.StreamHandler()
        console.setFormatter(color_formatter)

        # Use the custom handler instead of streaming one.
        if hasattr(sys, '_kivy_logging_handler'):
            self.addHandler(getattr(sys, '_kivy_logging_handler'))
        else:
            self.addHandler(console)
        self.addHandler(HistoryHandler())
        self.addHandler(FileHandler())
        return


if 'nosetests' not in sys.argv:
    logging.setLoggerClass(ColoredLogger)

#: Kivy default logger instance
Logger = logging.getLogger('Kivy')
Logger.logfile_activated = False

from kivy.utils import curry
Logger.trace = curry(Logger.log, logging.TRACE)

#: Kivy history handler
LoggerHistory = HistoryHandler