Python kivy.logger.Logger.info() Examples

The following are 30 code examples of kivy.logger.Logger.info(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module kivy.logger.Logger , or try the search function .
Example #1
Source File: main.py    From kivy-smoothie-host with GNU General Public License v3.0 7 votes vote down vote up
def _load_modules(self):
        if not self.config.has_section('modules'):
            return

        try:
            for key in self.config['modules']:
                Logger.info("load_modules: loading module {}".format(key))
                mod = importlib.import_module('modules.{}'.format(key))
                if mod.start(self.config['modules'][key]):
                    Logger.info("load_modules: loaded module {}".format(key))
                    self.loaded_modules.append(mod)
                else:
                    Logger.info("load_modules: module {} failed to start".format(key))

        except Exception:
            Logger.warn("load_modules: exception: {}".format(traceback.format_exc())) 
Example #2
Source File: inspector.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def on_activated(self, instance, activated):
        if not activated:
            self.grect.size = 0, 0
            if self.at_bottom:
                anim = Animation(top=0, t='out_quad', d=.3)
            else:
                anim = Animation(y=self.height, t='out_quad', d=.3)
            anim.bind(on_complete=self.animation_close)
            anim.start(self.layout)
            self.widget = None
            self.widget_info = False
        else:
            self.win.add_widget(self)
            Logger.info('Inspector: inspector activated')
            if self.at_bottom:
                Animation(top=60, t='out_quad', d=.3).start(self.layout)
            else:
                Animation(y=self.height - 60, t='out_quad', d=.3).start(
                    self.layout) 
Example #3
Source File: macros_widget.py    From kivy-smoothie-host with GNU General Public License v3.0 6 votes vote down vote up
def _new_macro(self, opts):
        if opts and opts['Name'] and opts['Command']:
            btn = Factory.MacroButton()
            btn.text = opts['Name']
            btn.bind(on_press=partial(self.send, opts['Command']))
            btn.ud = True
            self.add_widget(btn)
            # write it to macros.ini
            try:
                config = configparser.ConfigParser()
                config.read(self.macro_file)
                if not config.has_section("macro buttons"):
                    config.add_section("macro buttons")
                config.set("macro buttons", opts['Name'], opts['Command'])
                with open(self.macro_file, 'w') as configfile:
                    config.write(configfile)

                Logger.info('MacrosWidget: added macro button {}'.format(opts['Name']))

            except Exception as err:
                Logger.error('MacrosWidget: ERROR - exception writing config file: {}'.format(err)) 
Example #4
Source File: video_ffpyplayer.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def play(self):
        if self._ffplayer and self._state == 'paused':
            self._ffplayer.toggle_pause()
            self._state = 'playing'
            return

        self.load()
        self._out_fmt = 'rgba'
        ff_opts = {
            'paused': True,
            'out_fmt': self._out_fmt
        }
        self._ffplayer = MediaPlayer(
                self._filename, callback=self._callback_ref,
                thread_lib='SDL',
                loglevel='info', ff_opts=ff_opts)

        self._thread = Thread(target=self._next_frame_run, name='Next frame')
        self._thread.daemon = True
        self._thread.start() 
Example #5
Source File: audio_ffpyplayer.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def load(self):
        self.unload()
        ff_opts = {'vn': True, 'sn': True}  # only audio
        self._ffplayer = MediaPlayer(self.source,
                                     callback=self._callback_ref,
                                     loglevel='info', ff_opts=ff_opts)
        player = self._ffplayer
        player.set_volume(self.volume)
        player.toggle_pause()
        self._state = 'paused'
        # wait until loaded or failed, shouldn't take long, but just to make
        # sure metadata is available.
        s = time.clock()
        while ((not player.get_metadata()['duration'])
               and not self.quitted and time.clock() - s < 10.):
            time.sleep(0.005) 
Example #6
Source File: main.py    From kivy-smoothie-host with GNU General Public License v3.0 6 votes vote down vote up
def _change_port(self, s):
        if s:
            Logger.info('MainWindow: Selected port {}'.format(s))

            if s.startswith('network'):
                mb = InputBox(title='Network address', text='Enter network address as "ipaddress[:port]"', cb=self._new_network_port)
                mb.open()

            else:
                self.config.set('General', 'serial_port', s)
                self.config.write() 
Example #7
Source File: tabbedpanel.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def remove_widget(self, widget):
        content = self.content
        if content is None:
            return
        if widget in (content, self._tab_layout):
            super(TabbedPanel, self).remove_widget(widget)
        elif isinstance(widget, TabbedPanelHeader):
            if not (self.do_default_tab and widget is self._default_tab):
                self_tabs = self._tab_strip
                self_tabs.width -= widget.width
                self_tabs.remove_widget(widget)
                if widget.state == 'down' and self.do_default_tab:
                    self._default_tab.on_release()
                self._reposition_tabs()
            else:
                Logger.info('TabbedPanel: default tab! can\'t be removed.\n' +
                            'Change `default_tab` to a different tab.')
        else:
            self._childrens.pop(widget, None)
            if widget in content.children:
                content.remove_widget(widget) 
Example #8
Source File: inspector.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def on_activated(self, instance, activated):
        if not activated:
            self.grect.size = 0, 0
            if self.at_bottom:
                anim = Animation(top=0, t='out_quad', d=.3)
            else:
                anim = Animation(y=self.height, t='out_quad', d=.3)
            anim.bind(on_complete=self.animation_close)
            anim.start(self.layout)
            self.widget = None
            self.widget_info = False
        else:
            self.win.add_widget(self)
            Logger.info('Inspector: inspector activated')
            if self.at_bottom:
                Animation(top=60, t='out_quad', d=.3).start(self.layout)
            else:
                Animation(y=self.height - 60, t='out_quad', d=.3).start(
                    self.layout) 
Example #9
Source File: screen.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def apply_device(device, scale, orientation):
    name, width, height, dpi, density = devices[device]
    if orientation == 'portrait':
        width, height = height, width
    Logger.info('Screen: Apply screen settings for {0}'.format(name))
    Logger.info('Screen: size={0}x{1} dpi={2} density={3} '
                'orientation={4}'.format(width, height, dpi, density,
                                         orientation))
    try:
        scale = float(scale)
    except:
        scale = 1
    environ['KIVY_METRICS_DENSITY'] = str(density * scale)
    environ['KIVY_DPI'] = str(dpi * scale)
    Config.set('graphics', 'width', str(int(width * scale)))
    # simulate with the android bar
    # FIXME should be configurable
    Config.set('graphics', 'height', str(int(height * scale - 25 * density)))
    Config.set('graphics', 'fullscreen', '0')
    Config.set('graphics', 'show_mousecursor', '1') 
Example #10
Source File: video_ffpyplayer.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def play(self):
        if self._ffplayer and self._state == 'paused':
            self._ffplayer.toggle_pause()
            self._state = 'playing'
            return

        self.load()
        self._out_fmt = 'rgba'
        ff_opts = {
            'paused': True,
            'out_fmt': self._out_fmt
        }
        self._ffplayer = MediaPlayer(
                self._filename, callback=self._callback_ref,
                thread_lib='SDL',
                loglevel='info', ff_opts=ff_opts)

        self._thread = Thread(target=self._next_frame_run, name='Next frame')
        self._thread.daemon = True
        self._thread.start() 
Example #11
Source File: audio_ffpyplayer.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def load(self):
        self.unload()
        ff_opts = {'vn': True, 'sn': True}  # only audio
        self._ffplayer = MediaPlayer(self.source,
                                     callback=self._callback_ref,
                                     loglevel='info', ff_opts=ff_opts)
        player = self._ffplayer
        player.set_volume(self.volume)
        player.toggle_pause()
        self._state = 'paused'
        # wait until loaded or failed, shouldn't take long, but just to make
        # sure metadata is available.
        s = time.clock()
        while ((not player.get_metadata()['duration'])
               and not self.quitted and time.clock() - s < 10.):
            time.sleep(0.005) 
Example #12
Source File: screen.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def apply_device(device, scale, orientation):
    name, width, height, dpi, density = devices[device]
    if orientation == 'portrait':
        width, height = height, width
    Logger.info('Screen: Apply screen settings for {0}'.format(name))
    Logger.info('Screen: size={0}x{1} dpi={2} density={3} '
                'orientation={4}'.format(width, height, dpi, density,
                                         orientation))
    try:
        scale = float(scale)
    except:
        scale = 1
    environ['KIVY_METRICS_DENSITY'] = str(density * scale)
    environ['KIVY_DPI'] = str(dpi * scale)
    Config.set('graphics', 'width', str(int(width * scale)))
    # simulate with the android bar
    # FIXME should be configurable
    Config.set('graphics', 'height', str(int(height * scale - 25 * density)))
    Config.set('graphics', 'fullscreen', '0')
    Config.set('graphics', 'show_mousecursor', '1') 
Example #13
Source File: screen.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def usage(device=None):
    if device:
        Logger.error('Screen: The specified device ({0}) is unknown.',
                     device)
    print('\nModule usage: python main.py -m screen:deviceid[,orientation]\n')
    print('Available devices:\n')
    print('{0:12} {1:<22} {2:<8} {3:<8} {4:<5} {5:<8}'.format(
        'Device ID', 'Name', 'Width', 'Height', 'DPI', 'Density'))
    for device, info in devices.items():
        print('{0:12} {1:<22} {2:<8} {3:<8} {4:<5} {5:<8}'.format(
            device, *info))
    print('\n')
    print('Simulate a medium-density screen such as Motolora Droid 2:\n')
    print('    python main.py -m screen:droid2\n')
    print('Simulate a high-density screen such as HTC One X, in portrait:\n')
    print('    python main.py -m screen:onex,portrait\n')
    print('Simulate the iPad 2 screen\n')
    print('    python main.py -m screen:ipad\n')
    print('If the generated window is too large, you can specify a scale:\n')
    print('    python main.py -m screen:note2,portrait,scale=.75\n')
    sys.exit(1) 
Example #14
Source File: factory.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def register(self, classname, cls=None, module=None, is_template=False,
                 baseclasses=None, filename=None, warn=False):
        '''Register a new classname referring to a real class or
        class definition in a module. Warn, if True will emit a warning message
        when a class is re-declared.

        .. versionchanged:: 1.9.0
            `warn` was added.

        .. versionchanged:: 1.7.0
            :attr:`baseclasses` and :attr:`filename` added

        .. versionchanged:: 1.0.5
            :attr:`is_template` has been added in 1.0.5.
        '''
        if cls is None and module is None and baseclasses is None:
            raise ValueError(
                'You must specify either cls= or module= or baseclasses =')
        if classname in self.classes:
            if warn:
                info = self.classes[classname]
                Logger.warning('Factory: Ignored class "{}" re-declaration. '
                'Current -  module: {}, cls: {}, baseclass: {}, filename: {}. '
                'Ignored -  module: {}, cls: {}, baseclass: {}, filename: {}.'.
                format(classname, info['module'], info['cls'],
                       info['baseclasses'], info['filename'], module, cls,
                       baseclasses, filename))
            return
        self.classes[classname] = {
            'module': module,
            'cls': cls,
            'is_template': is_template,
            'baseclasses': baseclasses,
            'filename': filename} 
Example #15
Source File: androidjoystick.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def start(self):
        pygame.joystick.init()
        Logger.info('Android: found %d joystick' % pygame.joystick.get_count())
        for i in range(pygame.joystick.get_count()):
            self.create_joystick(i) 
Example #16
Source File: androidjoystick.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def create_joystick(self, index):
        Logger.info('Android: create joystick <%d>' % index)
        js = pygame.joystick.Joystick(index)
        js.init()
        if js.get_numbuttons() == 0:
            Logger.info('Android: discard joystick <%d> cause no button' %
                        index)
            return
        self.joysticks.append(js) 
Example #17
Source File: leapfinger.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def start(self):
        # don't do the import at start, or teh error will be always displayed
        # for user who don't have Leap
        global Leap, InteractionBox
        import Leap
        from Leap import InteractionBox

        class LeapMotionListener(Leap.Listener):

            def on_init(self, controller):
                Logger.info('leapmotion: Initialized')

            def on_connect(self, controller):
                Logger.info('leapmotion: Connected')

            def on_disconnect(self, controller):
                Logger.info('leapmotion: Disconnected')

            def on_frame(self, controller):
                frame = controller.frame()
                _LEAP_QUEUE.append(frame)

            def on_exit(self, controller):
                pass

        self.uid = 0
        self.touches = {}
        self.listener = LeapMotionListener()
        self.controller = Leap.Controller(self.listener) 
Example #18
Source File: video_gstplayer.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _on_gstplayer_message(mtype, message):
    if mtype == 'error':
        Logger.error('VideoGstplayer: {}'.format(message))
    elif mtype == 'warning':
        Logger.warning('VideoGstplayer: {}'.format(message))
    elif mtype == 'info':
        Logger.info('VideoGstplayer: {}'.format(message)) 
Example #19
Source File: recorder.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def on_record(self, instance, value):
        if value:
            # generate a record filename
            self.counter = 0
            self.record_time = time()
            self.record_fd = open(self.filename, 'w')
            self.record_fd.write('#RECORDER1.0\n')
            Logger.info('Recorder: Recording inputs to %r' % self.filename)
        else:
            self.record_fd.close()
            Logger.info('Recorder: Recorded %d events in %r' % (self.counter,
                                                                self.filename))

    # needed for acting as an input provider 
Example #20
Source File: window_sdl2.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def do_pause(self):
        # should go to app pause mode.
        from kivy.app import App
        from kivy.base import stopTouchApp
        app = App.get_running_app()
        if not app:
            Logger.info('WindowSDL: No running App found, exit.')
            stopTouchApp()
            return

        if not app.dispatch('on_pause'):
            Logger.info('WindowSDL: App doesn\'t support pause mode, stop.')
            stopTouchApp()
            return

        # XXX FIXME wait for sdl resume
        while True:
            event = self._win.poll()
            if event is False:
                continue
            if event is None:
                continue

            action, args = event[0], event[1:]
            if action == 'quit':
                EventLoop.quit = True
                self.close()
                break
            elif action == 'windowrestored':
                break

        app.dispatch('on_resume') 
Example #21
Source File: __init__.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def print_gl_version():
        version = glGetString(GL_VERSION)
        vendor = glGetString(GL_VENDOR)
        renderer = glGetString(GL_RENDERER)
        Logger.info('GL: OpenGL version <{0}>'.format(version))
        Logger.info('GL: OpenGL vendor <{0}>'.format(vendor))
        Logger.info('GL: OpenGL renderer <{0}>'.format(renderer))

        # Let the user know if his graphics hardware/drivers are too old
        major, minor = gl_get_version()
        Logger.info('GL: OpenGL parsed version: %d, %d' % (major, minor))
        if (major, minor) < MIN_REQUIRED_GL_VERSION:
            msg = (
                'GL: Minimum required OpenGL version (2.0) NOT found!\n\n'
                'OpenGL version detected: {0}.{1}\n\n'
                'Version: {2}\nVendor: {3}\nRenderer: {4}\n\n'
                'Try upgrading your graphics drivers and/or your '
                'graphics hardware in case of problems.\n\n'
                'The application will leave now.').format(
                    major, minor, version, vendor, renderer)
            Logger.critical(msg)
            msgbox(msg)

        if platform != 'android':
            # XXX in the android emulator (latest version at 22 march 2013),
            # this call was segfaulting the gl stack.
            Logger.info('GL: Shading version <{0}>'.format(
                glGetString(GL_SHADING_LANGUAGE_VERSION)))
        Logger.info('GL: Texture max size <{0}>'.format(
            glGetIntegerv(GL_MAX_TEXTURE_SIZE)[0]))
        Logger.info('GL: Texture max units <{0}>'.format(
            glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS)[0]))

    # To be able to use our GL provider, we must have a window
    # Automaticly import window auto to ensure the default window creation 
Example #22
Source File: recorder.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def on_record(self, instance, value):
        if value:
            # generate a record filename
            self.counter = 0
            self.record_time = time()
            self.record_fd = open(self.filename, 'w')
            self.record_fd.write('#RECORDER1.0\n')
            Logger.info('Recorder: Recording inputs to %r' % self.filename)
        else:
            self.record_fd.close()
            Logger.info('Recorder: Recorded %d events in %r' % (self.counter,
                                                                self.filename))

    # needed for acting as an input provider 
Example #23
Source File: leapfinger.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def start(self):
        # don't do the import at start, or teh error will be always displayed
        # for user who don't have Leap
        global Leap, InteractionBox
        import Leap
        from Leap import InteractionBox

        class LeapMotionListener(Leap.Listener):

            def on_init(self, controller):
                Logger.info('leapmotion: Initialized')

            def on_connect(self, controller):
                Logger.info('leapmotion: Connected')

            def on_disconnect(self, controller):
                Logger.info('leapmotion: Disconnected')

            def on_frame(self, controller):
                frame = controller.frame()
                _LEAP_QUEUE.append(frame)

            def on_exit(self, controller):
                pass

        self.uid = 0
        self.touches = {}
        self.listener = LeapMotionListener()
        self.controller = Leap.Controller(self.listener) 
Example #24
Source File: video_gi.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _update_texture(self, sample):
        # texture will be updated with newest buffer/frame

        # read the data from the buffer memory
        mapinfo = data = None
        try:
            buf = sample.get_buffer()
            result, mapinfo = buf.map(Gst.MapFlags.READ)

            # We cannot get the data out of mapinfo, using Gst 1.0.6 + Gi 3.8.0
            # related bug report:
            #     https://bugzilla.gnome.org/show_bug.cgi?id=678663
            # ie: mapinfo.data is normally a char*, but here, we have an int
            # So right now, we use ctypes instead to read the mapinfo ourself.
            addr = mapinfo.__hash__()
            c_mapinfo = _MapInfo.from_address(addr)

            # now get the memory
            data = string_at(c_mapinfo.data, mapinfo.size)
        finally:
            if mapinfo is not None:
                buf.unmap(mapinfo)

        # upload the data to the GPU
        info = sample.get_caps().get_structure(0)
        size = info.get_value('width'), info.get_value('height')

        # texture is not allocated yet, create it first
        if not self._texture:
            self._texture = Texture.create(size=size, colorfmt='rgb')
            self._texture.flip_vertical()
            self.dispatch('on_load')

        if self._texture:
            self._texture.blit_buffer(data, size=size, colorfmt='rgb') 
Example #25
Source File: {{cookiecutter.repo_name}}.py    From cookiedozer with MIT License 5 votes vote down vote up
def on_ref_press(self, url):
        """Callback which is being run when the user clicks on a ref in the
        label.

        :param str url: URL to be opened in the webbrowser
        """
        Logger.info("Opening '{url}' in webbrowser.".format(url=url))
        webbrowser.open(url) 
Example #26
Source File: androidjoystick.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def create_joystick(self, index):
        Logger.info('Android: create joystick <%d>' % index)
        js = pygame.joystick.Joystick(index)
        js.init()
        if js.get_numbuttons() == 0:
            Logger.info('Android: discard joystick <%d> cause no button' %
                        index)
            return
        self.joysticks.append(js) 
Example #27
Source File: main.py    From RaceCapture_App with GNU General Public License v3.0 5 votes vote down vote up
def _init_tracks_success(self):
        Logger.info('RaceCaptureApp: Current tracks loaded')
        Clock.schedule_once(lambda dt: self.notifyTracksUpdated()) 
Example #28
Source File: factory.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def register(self, classname, cls=None, module=None, is_template=False,
                 baseclasses=None, filename=None, warn=False):
        '''Register a new classname referring to a real class or
        class definition in a module. Warn, if True will emit a warning message
        when a class is re-declared.

        .. versionchanged:: 1.9.0
            `warn` was added.

        .. versionchanged:: 1.7.0
            :attr:`baseclasses` and :attr:`filename` added

        .. versionchanged:: 1.0.5
            :attr:`is_template` has been added in 1.0.5.
        '''
        if cls is None and module is None and baseclasses is None:
            raise ValueError(
                'You must specify either cls= or module= or baseclasses =')
        if classname in self.classes:
            if warn:
                info = self.classes[classname]
                Logger.warning('Factory: Ignored class "{}" re-declaration. '
                'Current -  module: {}, cls: {}, baseclass: {}, filename: {}. '
                'Ignored -  module: {}, cls: {}, baseclass: {}, filename: {}.'.
                format(classname, info['module'], info['cls'],
                       info['baseclasses'], info['filename'], module, cls,
                       baseclasses, filename))
            return
        self.classes[classname] = {
            'module': module,
            'cls': cls,
            'is_template': is_template,
            'baseclasses': baseclasses,
            'filename': filename} 
Example #29
Source File: logger.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _configure(self, *largs, **kwargs):
        from time import strftime
        from kivy.config import Config
        log_dir = Config.get('kivy', 'log_dir')
        log_name = Config.get('kivy', 'log_name')

        _dir = kivy.kivy_home_dir
        if log_dir and os.path.isabs(log_dir):
            _dir = log_dir
        else:
            _dir = os.path.join(_dir, log_dir)
        if not os.path.exists(_dir):
            os.makedirs(_dir)

        self.purge_logs(_dir)

        pattern = log_name.replace('%_', '@@NUMBER@@')
        pattern = os.path.join(_dir, strftime(pattern))
        n = 0
        while True:
            filename = pattern.replace('@@NUMBER@@', str(n))
            if not os.path.exists(filename):
                break
            n += 1
            if n > 10000:  # prevent maybe flooding ?
                raise Exception('Too many logfile, remove them')

        if FileHandler.filename == filename and FileHandler.fd is not None:
            return
        FileHandler.filename = filename
        if FileHandler.fd is not None:
            FileHandler.fd.close()
        FileHandler.fd = open(filename, 'w')

        Logger.info('Logger: Record log in %s' % filename) 
Example #30
Source File: video_gi.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _update_texture(self, sample):
        # texture will be updated with newest buffer/frame

        # read the data from the buffer memory
        mapinfo = data = None
        try:
            buf = sample.get_buffer()
            result, mapinfo = buf.map(Gst.MapFlags.READ)

            # We cannot get the data out of mapinfo, using Gst 1.0.6 + Gi 3.8.0
            # related bug report:
            #     https://bugzilla.gnome.org/show_bug.cgi?id=678663
            # ie: mapinfo.data is normally a char*, but here, we have an int
            # So right now, we use ctypes instead to read the mapinfo ourself.
            addr = mapinfo.__hash__()
            c_mapinfo = _MapInfo.from_address(addr)

            # now get the memory
            data = string_at(c_mapinfo.data, mapinfo.size)
        finally:
            if mapinfo is not None:
                buf.unmap(mapinfo)

        # upload the data to the GPU
        info = sample.get_caps().get_structure(0)
        size = info.get_value('width'), info.get_value('height')

        # texture is not allocated yet, create it first
        if not self._texture:
            self._texture = Texture.create(size=size, colorfmt='rgb')
            self._texture.flip_vertical()
            self.dispatch('on_load')

        if self._texture:
            self._texture.blit_buffer(data, size=size, colorfmt='rgb')