mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Opt: utils.py
This commit is contained in:
parent
1e8bafd1d8
commit
4f08f8fa2d
@ -166,6 +166,18 @@ def area_cross_area(area1, area2, threshold=5):
|
||||
or point_in_area((area1[2], area1[3]), area2, threshold=threshold)
|
||||
|
||||
|
||||
def float2str(n, decimal=3):
|
||||
"""
|
||||
Args:
|
||||
n (float):
|
||||
decimal (int):
|
||||
|
||||
Returns:
|
||||
str:
|
||||
"""
|
||||
return str(round(n, decimal)).ljust(decimal + 2, "0")
|
||||
|
||||
|
||||
def point2str(x, y, length=4):
|
||||
"""
|
||||
Args:
|
||||
|
||||
@ -66,8 +66,10 @@ def attr(name, text):
|
||||
logger.info('[%s] %s' % (str(name), str(text)))
|
||||
|
||||
|
||||
def attr_align(name, text, align=22):
|
||||
def attr_align(name, text, front='', align=22):
|
||||
name = str(name).rjust(align)
|
||||
if front:
|
||||
name = front + name[len(front):]
|
||||
logger.info('%s: %s' % (name, str(text)))
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user