def GetVHash_from_local(hash_str, size, logger=None): ''' trigger this object to perform update of the visualized vhash based on parameter h ''' if hash_str == UNKNOWN_HASH: unknown_hash_image = os.path.join( IMAGE_PATH, 'other/unknown_robot_{size}x{size}.png') return wx.Bitmap(unknown_hash_image.format(size=size)) try: images_dir = os.path.join(IMAGE_PATH, "robohash") buffer_istream = io.BytesIO( get_robohash(images_dir, hash_str, size, size).getvalue()) image = wx.EmptyImage(1, 1) image.LoadStream(buffer_istream) bitmap = image.ConvertToBitmap() return bitmap except Exception as exc: if logger: logger.debug("exception fetching Visual Hash: %s" % exc) connection_problem_image = os.path.join( IMAGE_PATH, 'other/noconnection_robot_{size}x{size}.png') return wx.Bitmap(connection_problem_image.format(size=size), wx.BITMAP_TYPE_ANY)
def GetVHash_from_local(hash_str, size, logger=None): ''' trigger this object to perform update of the visualized vhash based on parameter h ''' if hash_str == UNKNOWN_HASH: unknown_hash_image = os.path.join(IMAGE_PATH, 'other/unknown_robot_{size}x{size}.png') return wx.Bitmap(unknown_hash_image.format(size=size)) try: images_dir = os.path.join(IMAGE_PATH, "robohash") buffer_istream = io.BytesIO(get_robohash(images_dir, hash_str, size, size).getvalue()) image = wx.EmptyImage(1, 1) image.LoadStream(buffer_istream) bitmap = image.ConvertToBitmap() return bitmap except Exception as exc: if logger: logger.debug("exception fetching Visual Hash: %s" % exc) connection_problem_image = os.path.join( IMAGE_PATH, 'other/noconnection_robot_{size}x{size}.png') return wx.Bitmap(connection_problem_image.format(size=size), wx.BITMAP_TYPE_ANY)
def GetVHash_from_local(hash_str, size, logger=None): ''' trigger this object to perform update of the visualized vhash based on parameter h ''' if hash_str == UNKNOWN_HASH: return wx.Bitmap(UNKNOWN_HASH_IMAGE.format(size=size)) try: buffer_istream = io.BytesIO(get_robohash(hash_str, size, size).getvalue()) image = wx.EmptyImage(1, 1) image.LoadStream(buffer_istream) bitmap = image.ConvertToBitmap() return bitmap except Exception as exc: if logger: logger.debug("exception fetching Visual Hash: %s" % exc) return wx.Bitmap(CONNECTION_PROBLEM_IMAGE.format(size=size), wx.BITMAP_TYPE_ANY)