本文整理汇总了Python中kivy.Logger.info方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.info方法的具体用法?Python Logger.info怎么用?Python Logger.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.Logger
的用法示例。
在下文中一共展示了Logger.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_device_disconnect
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def on_device_disconnect(self, device, error=None):
if error:
Logger.error("BLE: device disconnected: {}".format(error))
else:
Logger.info("BLE: device disconnected")
self.connected = None
self.ble_should_scan = True
示例2: init_nfc
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def init_nfc(self):
# http://code.tutsplus.com /tutorials/reading-nfc-tags-with-android--mobile-17278
activity = PythonActivity.mActivity
self.nfc_adapter = NfcAdapter.getDefaultAdapter(activity)
if not self.nfc_adapter:
Toast.makeText(activity, "This device doesn't support NFC.", Toast.LENGTH_LONG).show()
activity.finish()
if not self.nfc_adapter.isEnabled():
self.nfc_status.text = "NFC not enabled"
else:
self.nfc_status.text = "NFC waiting for a touch"
# https://github.com/nadam/nfc-reader/blob/master/src/se/anyro/nfc_reader/TagViewer.java#L75
nfc_present_intent = Intent(activity, activity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
# http://cheparev.com/kivy-receipt-notifications-and-service/
pending_intent = PendingIntent.getActivity(activity, 0, nfc_present_intent, 0)
# http://developer.android.com/reference/android/nfc/NfcAdapter.html#enableForegroundDispatch%28android.app.Activity,%20android.app.PendingIntent,%20android.content.IntentFilter[],%20java.lang.String[][]%29
self.nfc_adapter.enableForegroundDispatch(activity, pending_intent, None, None)
# We get the following in adb logs and on_activity_result doesn't seem to work
# W ActivityManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=android.nfc.action.TAG_DISCOVERED flg=0x20000000 cmp=com.opensourcehacker.webkivy/org.renpy.android.PythonActivity (has extras) }
# android.activity.bind(on_activity_result=self.on_activity_result)
# https://github.com/kivy/python-for-android/blob/master/pythonforandroid/recipes/android/src/android/activity.py
android.activity.bind(on_new_intent=self.on_new_intent)
Logger.info("NFC ready")
示例3: on_connection_established
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def on_connection_established(self, characteristic, error):
if error:
Logger.error("BLE: connection failed: {}".format(error))
self.on_device_disconnect(None)
return
Logger.info("BLE: connection established {}".format(repr(characteristic.value)))
self.start_data()
示例4: test_logger
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def test_logger(msg, peerid=None, intermediate=False, *args):
start_color = '\033[94m'
end_color = '\033[0m'
if peerid:
Logger.info("TRIAL: {}{} {}{}".format(start_color, peerid, msg, end_color))
else:
Logger.info("TRIAL: {}{}{}".format(start_color, msg, end_color))
示例5: press
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def press(self, selector, release=False):
Logger.info("Simulation: Press %s" % selector)
self.rebuild_tree()
self.trigger_event('on_press', selector)
if release:
self.trigger_event('on_release', selector)
示例6: __init__
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def __init__(self):
# Check and see if constants rebinding is unsuccessful
try:
constants.REBIND_CHECK = False
except const.ConstError:
Logger.info("ENV: Environment constants are secure.")
else:
raise Exception("Error with environment setup.")
# Environment
self.env_dict = {}
# Create cache
Cache.register(category='envcache', limit=2)
# Populate constants
for attr in dir(constants):
if attr.isupper():
self.env_dict[attr] = str(
getattr(constants, attr)
).encode('string_escape')
# Initiate memory tracker
if constants.PYMPLER_AVAILABLE:
self.mem_tracker = tracker.SummaryTracker()
示例7: start_advertising
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def start_advertising(self):
Logger.info("BLE: start advertising")
service = ble_peripheral.Service(self.beacon_uuid)
# char = ble_peripheral.Characteristic(uuid4(),
# value=b'1', permissions=ble_peripheral.Characteristic.permission.readable,
# properties=ble_peripheral.Characteristic.property.read)
ble_peripheral.add_service(service)
ble_peripheral.start_advertising("SmartModule Demo")
self.ble_advertising = True
self.ble_should_scan = True
示例8: vibrate_cb
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def vibrate_cb(self, time=1):
try:
vibrator.vibrate(time)
except (NotImplementedError, ImportError):
Logger.warn(
"DEVICE: No vibrate function defined for {} platform.".format(
constants.PLATFORM))
else:
Logger.info("DEVICE: BUZZ!!")
示例9: play
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def play(self, *args):
if not self._loaded_stream:
self.select_stream(self.current_stream)
try:
self._loaded_stream.play()
Logger.info("Radio: playing %s" % self.stream_list[0])
self.is_playing = True
self.play_status = 'Radio: Pornit'
except Exception as e:
self.play_status = 'Radio: Eroare'
Logger.error('Radio: Failed to play stream: {}'.format(e.message))
示例10: on_discover_services
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def on_discover_services(self, services, error):
if error:
Logger.error("BLE: error discovering services: {}".format(error))
return
Logger.info("BLE: discovered services: {}".format(services.keys()))
service = services[self.connect_uuid]
if not service:
Logger.error("BLE: service not found!")
return
service.discover_characteristics(on_discover=self.on_discover_characteristics)
示例11: central_discovered_peripheral
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def central_discovered_peripheral(self, device):
if self.connecting or self.connected:
return
print("discovered peripheral, state", iprop(device.peripheral.state))
uuid_bytes = self.client_base_uuid_bytes
for uuid, service in device.services.items():
if uuid.bytes[4:] == uuid_bytes:
Logger.info("BLE: found device {}".format(uuid))
self.ble_should_scan = False
self.stop_scanning()
self.connect_uuid = uuid
self.connect(device)
return
示例12: dump_config
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def dump_config(self):
# Start config parser
config = ConfigParser.SafeConfigParser()
# Set env constants into section
config.add_section('Environment')
for (k, v) in self.env_dict.iteritems():
if '%' not in v:
print k
config.set('Environment', k, v.encode('string_escape'))
# Writing our configuration file to 'defaults.cfg'
with open('{}/core/env/defaults.cfg'.format(constants.PROJECT_PATH), 'wb') as configfile:
config.write(configfile)
Logger.info("ENV: Dumped environment to config file.")
示例13: notify_cb
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def notify_cb(self, title='', message='', timeout=1):
try:
notification.notify(
title=title,
message=message,
app_name=constants.APP_NAME,
app_icon=os.path.join(constants.KIVY_RESOURCE_PATH_1, 'icon.png'),
timeout=timeout
)
except (NotImplementedError, ImportError):
Logger.warn(
"DEVICE: No vibrate function defined for {} platform.".format(
constants.PLATFORM))
else:
Logger.info("DEVICE: Fired Notification!")
示例14: on_device_connect
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def on_device_connect(self, device, error=None):
self.connecting = None
if error:
Logger.error("BLE: failed to connect to device: {}".format(error))
self.ble_should_scan = True
return
Logger.info("BLE: connected to device {}".format(device))
self.connected = device
# device.discover_services(uuids=(self.connect_uuid,), on_discover=self.on_discover_services)
service = device.services[self.connect_uuid]
if service:
Logger.info("BLE: found service {}".format(service))
self.on_discover_services(device.services, None)
else:
device.discover_services(on_discover=self.on_discover_services)
示例15: memory_summary
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import info [as 别名]
def memory_summary(self, summarize=True):
"Using pympler summarize module to view memory summary."
if summarize:
all_objects = muppy.get_objects()
Logger.info("ENV: \nMemory Footprint:")
Logger.info("-----------------")
return summary.print_(summary.summarize(all_objects), limit=50)
else:
Logger.info("ENV: \nMemory Tracker:")
Logger.info("---------------")
self.mem_tracker.print_diff()