Python kivy.logger.Logger.error() Examples

The following are 30 code examples of kivy.logger.Logger.error(). 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 do_update(self):
        try:
            p = subprocess.Popen(['git', 'pull'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            result, err = p.communicate()
            if p.returncode != 0:
                self.add_line_to_log(">>> Update: Failed to run git pull")
            else:
                need_update = True
                str = result.decode('utf-8').splitlines()
                self.add_line_to_log(">>> Update:")
                for l in str:
                    self.add_line_to_log(l)
                    if "up-to-date" in l:
                        need_update = False

                if need_update:
                    self.add_line_to_log(">>> Update: Restart may be required")
        except Exception:
            self.add_line_to_log(">>> Update: Error trying to update. See log")
            Logger.error('MainWindow: {}'.format(traceback.format_exc())) 
Example #2
Source File: vkeyboard.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def _load_layout(self, *largs):
        # ensure new layouts are loaded first
        if self._trigger_load_layouts.is_triggered:
            self._load_layouts()
            self._trigger_load_layouts.cancel()

        value = self.layout
        available_layouts = self.available_layouts

        # it's a filename, try to load it directly
        if self.layout[-5:] == '.json':
            if value not in available_layouts:
                fn = resource_find(self.layout)
                self._load_layout_fn(fn, self.layout)

        if not available_layouts:
            return
        if value not in available_layouts and value != 'qwerty':
            Logger.error(
                'Vkeyboard: <%s> keyboard layout mentioned in '
                'conf file was not found, fallback on qwerty' %
                value)
            self.layout = 'qwerty'
        self.refresh(True) 
Example #3
Source File: calibration.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def __init__(self):
        super(InputPostprocCalibration, self).__init__()
        self.devices = {}
        self.frame = 0
        if not Config.has_section('postproc:calibration'):
            return
        default_params = {'xoffset': 0, 'yoffset': 0, 'xratio': 1, 'yratio': 1}
        for device_key, params_str in Config.items('postproc:calibration'):
            params = default_params.copy()
            for param in params_str.split(','):
                param = param.strip()
                if not param:
                    continue
                key, value = param.split('=', 1)
                if key not in ('xoffset', 'yoffset', 'xratio', 'yratio'):
                    Logger.error(
                        'Calibration: invalid key provided: {}'.format(key))
                params[key] = float(value)
            self.devices[device_key] = params 
Example #4
Source File: tuio.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def __init__(self, device, args):
        super(TuioMotionEventProvider, self).__init__(device, args)
        args = args.split(',')
        if len(args) <= 0:
            Logger.error('Tuio: Invalid configuration for TUIO provider')
            Logger.error('Tuio: Format must be ip:port (eg. 127.0.0.1:3333)')
            err = 'Tuio: Current configuration is <%s>' % (str(','.join(args)))
            Logger.error(err)
            return None
        ipport = args[0].split(':')
        if len(ipport) != 2:
            Logger.error('Tuio: Invalid configuration for TUIO provider')
            Logger.error('Tuio: Format must be ip:port (eg. 127.0.0.1:3333)')
            err = 'Tuio: Current configuration is <%s>' % (str(','.join(args)))
            Logger.error(err)
            return None
        self.ip, self.port = args[0].split(':')
        self.port = int(self.port)
        self.handlers = {}
        self.oscid = None
        self.tuio_event_q = deque()
        self.touches = {} 
Example #5
Source File: configv2_editor.py    From kivy-smoothie-host with GNU General Public License v3.0 6 votes vote down vote up
def _add_line(self, line):
        ll = line.lstrip().rstrip()
        if not ll.startswith("#") and ll != "":
            if ll == "ok":
                # finished
                try:
                    self.config.read_string('\n'.join(self.configdata))
                except Exception as e:
                    Logger.error("ConfigV2Editor: Error parsing the config file: {}".format(e))
                    self.app.main_window.async_display("Error parsing config file, see log")
                    self.close()
                    return

                self.configdata = []
                self._build()

            else:
                self.configdata.append(ll) 
Example #6
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 #7
Source File: main.py    From kivy-smoothie-host with GNU General Public License v3.0 6 votes vote down vote up
def handle_exception(exc_type, exc_value, exc_traceback):
    """ handle all exceptions """

    # KeyboardInterrupt is a special case.
    # We don't raise the error dialog when it occurs.
    if issubclass(exc_type, KeyboardInterrupt):
        return

    Logger.error("Unhandled Exception:")
    Logger.error("".join(traceback.format_exception(exc_type, exc_value, exc_traceback)))
    try:
        App.get_running_app().stop()
    except Exception:
        pass


# we want to handle TERM signal cleanly (sent by sv down) 
Example #8
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 #9
Source File: recorder.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def on_recorder_key(recorder, window, key, *largs):
    if key == 289:  # F8
        if recorder.play:
            Logger.error('Recorder: Cannot start recording while playing.')
            return
        recorder.record = not recorder.record
    elif key == 288:  # F7
        if recorder.record:
            Logger.error('Recorder: Cannot start playing while recording.')
            return
        recorder.play = not recorder.play
    elif key == 287:  # F6
        if recorder.play:
            recorder.unbind(play=replay)
        else:
            recorder.bind(play=replay)
            recorder.play = True 
Example #10
Source File: image.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def texture_update(self, *largs):
        if not self.source:
            self.texture = None
        else:
            filename = resource_find(self.source)
            self._loops = 0
            if filename is None:
                return Logger.error('Image: Error reading file {filename}'.
                                    format(filename=self.source))
            mipmap = self.mipmap
            if self._coreimage is not None:
                self._coreimage.unbind(on_texture=self._on_tex_change)
            try:
                self._coreimage = ci = CoreImage(filename, mipmap=mipmap,
                                                 anim_delay=self.anim_delay,
                                                 keep_data=self.keep_data,
                                                 nocache=self.nocache)
            except:
                self._coreimage = ci = None

            if ci:
                ci.bind(on_texture=self._on_tex_change)
                self.texture = ci.texture 
Example #11
Source File: base.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def stop(self):
        '''Stop all input providers and call callbacks registered using
        EventLoop.add_stop_callback().'''

        # XXX stop in reverse order that we started them!! (like push
        # pop), very important because e.g. wm_touch and WM_PEN both
        # store old window proc and the restore, if order is messed big
        # problem happens, crashing badly without error
        for provider in reversed(self.input_providers[:]):
            provider.stop()
            if provider in self.input_providers_autoremove:
                self.input_providers_autoremove.remove(provider)
                self.input_providers.remove(provider)

        # ensure any restart will not break anything later.
        self.input_events = []

        self.status = 'stopped'
        self.dispatch('on_stop') 
Example #12
Source File: presetview.py    From RaceCapture_App with GNU General Public License v3.0 6 votes vote down vote up
def _on_update_check(self):

        def on_update_check_success():
            def _success():
                # do this in the UI thread
                popup.content.on_message('Processing...')
                Clock.schedule_once(lambda dt: self.refresh_view())
                popup.dismiss()
            Clock.schedule_once(lambda dt: _success())

        def on_update_check_error(details):
            def _error(details):
                # do this in the UI thread
                popup.dismiss()
                Clock.schedule_once(lambda dt: self.refresh_view())
                Logger.error('PresetBrowserView: Error updating: {}'.format(details))
                alertPopup('Error Updating', 'There was an error updating the presets.\n\nPlease check your network connection and try again')
            Clock.schedule_once(lambda dt: _error(details))

        self.set_view_disabled(True)
        update_view = PresetUpdateStatusView()
        popup = Popup(title='Checking for updates', content=update_view, auto_dismiss=False, size_hint=(None, None), size=(dp(400), dp(200)))
        popup.open()

        self.preset_manager.refresh(update_view.on_progress, on_update_check_success, on_update_check_error) 
Example #13
Source File: image.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def texture_update(self, *largs):
        if not self.source:
            self.texture = None
        else:
            filename = resource_find(self.source)
            self._loops = 0
            if filename is None:
                return Logger.error('Image: Error reading file {filename}'.
                                    format(filename=self.source))
            mipmap = self.mipmap
            if self._coreimage is not None:
                self._coreimage.unbind(on_texture=self._on_tex_change)
            try:
                self._coreimage = ci = CoreImage(filename, mipmap=mipmap,
                                                 anim_delay=self.anim_delay,
                                                 keep_data=self.keep_data,
                                                 nocache=self.nocache)
            except:
                self._coreimage = ci = None

            if ci:
                ci.bind(on_texture=self._on_tex_change)
                self.texture = ci.texture 
Example #14
Source File: telemetryconnection.py    From RaceCapture_App with GNU General Public License v3.0 6 votes vote down vote up
def _handle_msg(self, msg_object):
        if "status" in msg_object:
            if msg_object["status"] == "ok" and not self.authorized:
                self._update_status("ok", "Podium authorized",
                                    self.STATUS_AUTHORIZED)
                Logger.info("TelemetryConnection: authorized to Podium")
                self.authorized = True
                self._send_meta()
                self._start_sample_timer()
                self._update_status("ok", False,
                                    self.STATUS_STREAMING)
            elif not self.authorized:
                # We failed, abort
                Logger.info("TelemetryConnection: failed to authorize, closing")
                self._update_status("error", "Podium: Auth failed",
                                    self.ERROR_AUTHENTICATING)
                self.end()
        else:
            # treat it like an API message
            self._api_msg_cb(msg_object) 
Example #15
Source File: mouse.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def __init__(self, device, args):
        super(MouseMotionEventProvider, self).__init__(device, args)
        self.waiting_event = deque()
        self.touches = {}
        self.counter = 0
        self.current_drag = None
        self.alt_touch = None
        self.disable_on_activity = False
        self.disable_multitouch = False
        self.multitouch_on_demenad = False

        # split arguments
        args = args.split(',')
        for arg in args:
            arg = arg.strip()
            if arg == '':
                continue
            elif arg == 'disable_on_activity':
                self.disable_on_activity = True
            elif arg == 'disable_multitouch':
                self.disable_multitouch = True
            elif arg == 'multitouch_on_demand':
                self.multitouch_on_demenad = True
            else:
                Logger.error('Mouse: unknown parameter <%s>' % arg) 
Example #16
Source File: tuio.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def __init__(self, device, args):
        super(TuioMotionEventProvider, self).__init__(device, args)
        args = args.split(',')
        if len(args) <= 0:
            Logger.error('Tuio: Invalid configuration for TUIO provider')
            Logger.error('Tuio: Format must be ip:port (eg. 127.0.0.1:3333)')
            err = 'Tuio: Current configuration is <%s>' % (str(','.join(args)))
            Logger.error(err)
            return None
        ipport = args[0].split(':')
        if len(ipport) != 2:
            Logger.error('Tuio: Invalid configuration for TUIO provider')
            Logger.error('Tuio: Format must be ip:port (eg. 127.0.0.1:3333)')
            err = 'Tuio: Current configuration is <%s>' % (str(','.join(args)))
            Logger.error(err)
            return None
        self.ip, self.port = args[0].split(':')
        self.port = int(self.port)
        self.handlers = {}
        self.oscid = None
        self.tuio_event_q = deque()
        self.touches = {} 
Example #17
Source File: calibration.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def __init__(self):
        super(InputPostprocCalibration, self).__init__()
        self.devices = {}
        self.frame = 0
        if not Config.has_section('postproc:calibration'):
            return
        default_params = {'xoffset': 0, 'yoffset': 0, 'xratio': 1, 'yratio': 1}
        for device_key, params_str in Config.items('postproc:calibration'):
            params = default_params.copy()
            for param in params_str.split(','):
                param = param.strip()
                if not param:
                    continue
                key, value = param.split('=', 1)
                if key not in ('xoffset', 'yoffset', 'xratio', 'yratio'):
                    Logger.error(
                        'Calibration: invalid key provided: {}'.format(key))
                params[key] = float(value)
            self.devices[device_key] = params 
Example #18
Source File: recorder.py    From Tickeys-linux with MIT License 6 votes vote down vote up
def on_recorder_key(recorder, window, key, *largs):
    if key == 289:  # F8
        if recorder.play:
            Logger.error('Recorder: Cannot start recording while playing.')
            return
        recorder.record = not recorder.record
    elif key == 288:  # F7
        if recorder.record:
            Logger.error('Recorder: Cannot start playing while recording.')
            return
        recorder.play = not recorder.play
    elif key == 287:  # F6
        if recorder.play:
            recorder.unbind(play=replay)
        else:
            recorder.bind(play=replay)
            recorder.play = True 
Example #19
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 #20
Source File: telemetryconnection.py    From RaceCapture_App with GNU General Public License v3.0 6 votes vote down vote up
def run(self):
        Logger.info("TelemetryConnection: connecting to: %s:%d" % (self.host, self.port))

        self._connecting = True

        # No try/except here because the connect call ends up calling socket.connect_ex,
        # which does not throw any errors. Async FTW! (Sorta)
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)

        try:
            self.connect((self.host, self.port))
        except:
            Logger.info("TelemetryConnection: exception connecting")
            self._update_status("error", "Podium: Error connecting", self.STATUS_DISCONNECTED)

        # This starts the loop around the socket connection polling
        # 'timeout' is how long the select() or poll() functions will wait for data,
        # set to 3 seconds as the default is 30s, which means our code wouldn't
        # see a disconnect until 30s after it happens
        asyncore.loop(timeout=3) 
Example #21
Source File: main.py    From RaceCapture_App with GNU General Public License v3.0 6 votes vote down vote up
def _on_preference_change(self, instance, section, key, value):
        """Called any time the app preferences are changed
        """
        token = (section, key)

        if token == ('preferences', 'send_telemetry'):
            if value == "1":  # Boolean settings values are 1/0, not True/False
                if self.rc_config.connectivityConfig.cellConfig.cellEnabled:
                    alertPopup('Telemetry error', "Disable the telemetry module before enabling app telemetry.")
                Clock.schedule_once(lambda dt: self._enable_telemetry())
            else:
                Clock.schedule_once(lambda dt: self._disable_telemetry())

        if token == ('preferences', 'conn_type'):
            # User changed their RC connection type
            Logger.info("RaceCaptureApp: RC connection type changed to {}, restarting comms".format(value))
            Clock.schedule_once(lambda dt: self._restart_comms()) 
Example #22
Source File: video_gi.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _on_gst_message(bus, message):
    Logger.trace('VideoGi: (bus) {}'.format(message))
    # log all error messages
    if message.type == Gst.MessageType.ERROR:
        error, debug = list(map(str, message.parse_error()))
        Logger.error('VideoGi: {}'.format(error))
        Logger.debug('VideoGi: {}'.format(debug)) 
Example #23
Source File: main.py    From RaceCapture_App with GNU General Public License v3.0 5 votes vote down vote up
def _init_presets_error(self, details):
        Logger.error('RaceCaptureApp: Error initializing presets: {}'.format(details)) 
Example #24
Source File: parser.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def parse_filename(filename):
    '''Parse a filename and search for it using `resource_find()`.
    If found, the resource path is returned, otherwise return the unmodified
    filename (as specified by the caller).'''
    filename = parse_string(filename)
    result = resource_find(filename)
    if result is None:
        Logger.error('Resource: unable to find <%s>' % filename)
    return result or filename 
Example #25
Source File: audio_gi.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _on_gst_message(self, bus, message):
        t = message.type
        if t == Gst.MessageType.EOS:
            self._data.set_state(Gst.State.NULL)
            if self.loop:
                self.play()
            else:
                self.stop()
        elif t == Gst.MessageType.ERROR:
            self._data.set_state(Gst.State.NULL)
            err, debug = message.parse_error()
            Logger.error('AudioGi: %s' % err)
            Logger.debug(str(debug))
            self.stop() 
Example #26
Source File: video_pygst.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def _on_gst_message(bus, message):
    Logger.trace('VideoPyGst: (bus) %s' % str(message))
    # log all error messages
    if message.type == gst.MESSAGE_ERROR:
        error, debug = list(map(str, message.parse_error()))
        Logger.error('VideoPyGst: %s' % error)
        Logger.debug('VideoPyGst: %s' % debug) 
Example #27
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 #28
Source File: main.py    From RaceCapture_App with GNU General Public License v3.0 5 votes vote down vote up
def on_read_config_error(self, detail):
        self.showActivity("Error reading configuration")
        toast("Error reading configuration. Check your connection", length_long=True)
        Logger.error("RaceCaptureApp:Error reading configuration: {}".format(str(detail))) 
Example #29
Source File: main.py    From RaceCapture_App with GNU General Public License v3.0 5 votes vote down vote up
def _init_tracks_error(self, details):
        Logger.error('RaceCaptureApp: Error initializing tracks: {}'.format(details)) 
Example #30
Source File: base.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def idle(self):
        '''This function is called after every frame. By default:

           * it "ticks" the clock to the next frame.
           * it reads all input and dispatches events.
           * it dispatches `on_update`, `on_draw` and `on_flip` events to the
             window.
        '''

        # update dt
        Clock.tick()

        # read and dispatch input from providers
        self.dispatch_input()

        # flush all the canvas operation
        Builder.sync()

        # tick before draw
        Clock.tick_draw()

        # flush all the canvas operation
        Builder.sync()

        window = self.window
        if window and window.canvas.needs_redraw:
            window.dispatch('on_draw')
            window.dispatch('on_flip')

        # don't loop if we don't have listeners !
        if len(self.event_listeners) == 0:
            Logger.error('Base: No event listeners have been created')
            Logger.error('Base: Application will leave')
            self.exit()
            return False

        return self.quit