本文整理汇总了Python中kivy.Logger.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.debug方法的具体用法?Python Logger.debug怎么用?Python Logger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.Logger
的用法示例。
在下文中一共展示了Logger.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_image_filepath
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def on_image_filepath(self, _, image_filepath):
# self has default size at this point, sizing must be done in on_size
try:
self.canvas.remove(self._core_image)
Logger.debug('%s: removed old _core_image', self.__class__.__name__)
except:
pass
with self.canvas:
# mipmap=True changes tex_coords and screws up calculations
# TODO Research mipmap more
self._core_image = cimage = CoreImage(image_filepath, mipmap=False)
texture = cimage.texture
self.image.texture = texture
self.mesh.texture = texture
self.texture = texture
# TODO Position Image center/zoomed by default
# Nexus 10 Image is smaller, test density independent
# TODO Is there any benifit to Image vs Rectangle w/ Texture ?
# No need for Image if we're not taking advantage of ratio maintaining code
# img = Image(texture=texture, keep_ratio=True, allow_stretch=True)
# img.bind(norm_image_size=self.on_norm_image_size)
# self.add_widget(img)
# Just set Scatter and Rectangle to texture size
self.image.size = texture.size
self.size = texture.size
示例2: stringReceived
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def stringReceived(self, string):
phone_data = json.loads(string)
user = phone_data["user"]
directory = phone_data["directory"]
filename = phone_data["filename"]
raw_data = phone_data["raw_data"]
has_raw_data = phone_data["has_raw_data"]
Logger.debug("FilenameReceiver Server: received: {0}, {1}, {2}, {3}".format(user, directory, filename, has_raw_data))
# Save the file to disk (if we have the file data)
if has_raw_data == "1":
image_data = raw_data.decode('base64')
folder_path = os.getcwd() + os.sep + "received_files" + os.sep + directory
if not os.path.exists(folder_path):
os.makedirs(folder_path)
f = open(folder_path+os.sep+filename, 'wb')
f.write(image_data)
f.close()
Logger.debug("FilenameReceiver Server: wrote image file to, received_files/{0}/{1}".format(directory, filename))
# Do something here, in terms of logic (assuming received the file).
result = self.app_root.root.process_image_from_phone(int(user), folder_path+os.sep+filename, filename)
if result is True:
# Send an ack back to the computer (or phone), with the filename
source = self.transport.getPeer() # retrieve the ip of the computer that sent us the payload
output = {"filename": filename}
line = json.dumps(output)
ClientCreator(reactor, TCPSender).connectTCP(source.host, 7895).addCallback(sendMessage, "{0}".format(line)).addErrback(printError)
示例3: verifyCallback
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def verifyCallback(self, connection, x509, errno, depth, preverifyOK):
# default value of post verify is set False
postverifyOK = False
if not preverifyOK:
# Pre-verification failed
Logger.debug(
"SSLCONTEXT: [Pre-verification] Certificate verification failed, {}".format(x509.get_subject()))
else:
# Add post verification callback here.
# Get x509 subject
subject = x509.get_subject()
Logger.debug("SSLCONTEXT: [Pre-verification] Certificate [{}] Verfied.".format(subject))
# Perform post verification checks
postverifyOK = self.postverifyCallback(subject, preverifyOK)
# Post verification tasks
if postverifyOK:
self.postverify_hook(connection, x509)
return preverifyOK and postverifyOK
示例4: postverifyCallback
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def postverifyCallback(self, subject, preverifyOK):
if not preverifyOK:
return preverifyOK
# variables for post-verify callback check on cert fields
_cert_fields = constants.SSL_CERT_FIELDS
_values_dict = constants.SSL_POST_VERIF_VALUES
# Passed checks
checklist_count = 0
# Get certificate components
certificate_components = dict(subject.get_components())
# Check fields
for i in _values_dict.keys():
if certificate_components[_cert_fields[i]] in _values_dict[i]:
checklist_count += 1
else:
print certificate_components[_cert_fields[i]]
print _values_dict[i]
# Checklist roundoff
if checklist_count == len(_values_dict.keys()):
Logger.debug("SSLCONTEXT: [Post-verification] certificate verfication passed.")
return True
else:
Logger.debug(
"SSLCONTEXT: [Post-verification] Certificate verification failed. ({}/{} checks passed)".format(checklist_count, len(_values_dict.keys())))
return False
示例5: add_picture_to_scroller
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def add_picture_to_scroller(self, instance, widget):
if self.parent is not None:
self.parent.remove_widget(widget)
item = widget
# adjust the size of the image to allow for the borderimage background to be shown
# fudge the borderimage into the equation (hard because it is drawn outside of the image,
# and thus does not come into the calculations for the scrollview, which means
# we need to manually fix up the left/right/top/bottom cases, for this to show
# properly on the screen
# 36 happens to the be border image size numbers we are using in the .kv file
item.image.size = item.image.image_ratio*(self.scrollview_height-36), self.scrollview_height-36
item.size = item.image.size[0]+36, item.image.size[1]+18
item.size_hint_x = None
# the scroller, effects size, and not the scale of the container, so we must adjust for this,
# else the object will be in the container with its current transforms, which would look weird
item.scale = 1
item.rotation = 0
try:
self.items.add_widget(widget)
except:
Logger.debug("Vertical Scroller: (picture) timing issue, means user touched this object, so now it has a parent, when it shouldn't, so don't add to the scroller afterall")
示例6: on_parent_size
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def on_parent_size(self, widget, size):
if not self.autosize:
# Other code will set pos/scale
return
Logger.debug(self.__class__.__name__ + '.on_parent_size %s', size)
p_width, p_height = size
# Ignore default/zero sizes
if p_height == 0.0 or p_height == 1:
Logger.debug('ignoring size %s', size)
return
# self size is always set to Image size, instead just re-center and re-scale
# Idea: Maybe avoid this if user has moved-resized?
# Fit Image/Mesh within
#self.image.size = size
# TODO Control points should stay aligned with image
#print(self.__class__.__name__, 'on_size', size)
# FIXME Updating Image.size messes up ControlPoint references
# Only do this once
# if self._image_size_set:
# return
# self.image.size = size
# self._image_size_set = True
img = self.image
self.center = self.parent.center
# scale up to fit, whichever dimension is smaller
h_scale = p_height/float(self.height)
w_scale = p_width/float(self.width)
self.scale = min(h_scale, w_scale)
示例7: dataReceived
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def dataReceived(self, data):
# print data
if len(data) == 1:
state = int(data)
assert 0 <= state
assert state <= 3
Logger.debug(self.__class__.__name__ + ': in ' + whoAmI() + '. ' + 'State is: ' + state)
self.mindCupolaArduinoController.setModeAutomatically(state)
示例8: generate_uuid
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def generate_uuid(host=None):
"""
Generate capsule UID for particular host.
"""
uuid_str = str(uuid5(NAMESPACE_URL, host))[0:8]
Logger.debug("UTILITIES: UUID({}) = {}".format(host, uuid_str))
return uuid_str
示例9: get_nat_ip
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def get_nat_ip():
"Get IP of NAT."
s = socket(AF_INET, SOCK_STREAM)
host = "127.0.0.1"
try:
s.connect(("www.google.com", 80))
except error:
Logger.debug("UTILITIES: No active NAT connection.")
return host
else:
host = s.getsockname()[0]
s.close()
return host
示例10: on_animation_step
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def on_animation_step(self, widget, step):
"""animation_step changed.
move control points to step with animation
Set mesh_attached=False if on setup_step
"""
Logger.debug('%s: on_animation_step %s', self.__class__.__name__, step)
if not isinstance(step, basestring):
raise ValueError('animation_step must be a string, given %s'%step, type(step))
# Track all possible step keys
if step != setup_step and step not in self.animation_steps_order:
self.animation_steps_order.append(step)
resume_animation = self.animating
if self.animating:
# Switched step while previewing animation
self.preview_animation(False)
if step == setup_step:
self.image_opacity = self.faded_image_opacity
# ControlPoints will detach mesh after animation in: move_control_points()
self.mesh_attached = False
else:
# Not first animation step
self.image_opacity = 0.0
mesh = self.mesh
if self._previous_step == setup_step:
# Redo base vertices when moving from 0 to other
Logger.debug('Recalculating vertices/indices during transition from step 0')
self.calc_mesh_vertices(step=setup_step, preserve_uv=False)
if not self.mesh_attached:
# attach before moving to other animation steps
for cp in self.control_points:
cp.attach_mesh(True)
self.mesh_attached = True
self.move_control_points(step, detach_mesh_after=step == setup_step)
self._previous_step = step
if resume_animation:
self.preview_animation()
示例11: get_my_ip
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def get_my_ip():
"Get my public IP address or if offline get my NAT IP."
try:
# Get IP from curlmyip.com which gives the raw ip address
my_pub_ip = urlopen("http://curlmyip.com").read().strip()
# Check for portal redirects if offline
if not ip_address_is_valid(my_pub_ip):
my_pub_ip = None
except URLError:
Logger.debug("UTILITIES: No active internet connection.")
my_pub_ip = None
# Get local IP
my_loc_ip = get_local_ip()
return (my_loc_ip, my_pub_ip)
示例12: print_message
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def print_message(self, msg, peerid=None, intermediate=False):
"Print a message in the output window."
# Indicates multiline output required
if intermediate:
text = "{}{}".format(constants.GUI_LABEL_LEFT_PADDING, msg)
else:
# One line print
if not peerid:
peerid = self.comm_service.peerid
# If local pid, substitute with peer name
if peerid == self.comm_service.peerid:
peerid = constants.PEER_NAME
# Get peer message color
rcc = self.comm_service.swarm_manager.get_peerid_color(peerid)
# Single line output with peer id
text = "{}{}[color={}]{}[/color] : {}".format(
constants.GUI_LABEL_LEFT_PADDING, constants.GUI_LABEL_PROMPT_SYM, rcc, str(peerid), msg
)
text = "\n{}".format(text)
# Send text to console
self.display_text("\n" + text)
# Print in log
if constants.ENABLE_CMD_LOG:
# Get peer id for log
if not peerid:
logger_peerid = constants.PEER_NAME
else:
logger_peerid = peerid
Logger.debug("TESTSERVER: [{}] => {}".format(logger_peerid, msg))
示例13: peripheral_service_added
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def peripheral_service_added(self, service):
Logger.debug("BLE: connect: peripheral service added: {}".format(service))
示例14: connectionMade
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def connectionMade(self):
Logger.debug(self.__class__.__name__ + ': in [' + whoAmI() + '] Connected.')
示例15: on_manualMode
# 需要导入模块: from kivy import Logger [as 别名]
# 或者: from kivy.Logger import debug [as 别名]
def on_manualMode(self, instance, value):
assert type(value) in [bool]
Logger.debug(self.__class__.__name__ + ': in [' + whoAmI() + '] manualMode is ' + str(self.manualMode) )