本文整理汇总了Python中kivy.logger.Logger.error方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.error方法的具体用法?Python Logger.error怎么用?Python Logger.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.logger.Logger
的用法示例。
在下文中一共展示了Logger.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_line
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)
示例2: do_update
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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()))
示例3: handle_exception
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)
示例4: _new_macro
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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))
示例5: usage
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)
示例6: on_recorder_key
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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
示例7: texture_update
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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
示例8: stop
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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')
示例9: __init__
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)
示例10: __init__
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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 = {}
示例11: __init__
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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
示例12: _load_layout
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)
示例13: _on_preference_change
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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())
示例14: run
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)
示例15: _handle_msg
# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import error [as 别名]
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)