Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions itchat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@

emojiRegex = re.compile(r'<span class="emoji emoji(.{1,10})"></span>')
htmlParser = HTMLParser()
try:
b = u'\u2588'
sys.stdout.write(b + '\r')
sys.stdout.flush()
except UnicodeEncodeError:
BLOCK = 'MM'
else:
BLOCK = b
friendInfoTemplate = {}
for k in ('UserName', 'City', 'DisplayName', 'PYQuanPin', 'RemarkPYInitial', 'Province',
'KeyWord', 'RemarkName', 'PYInitial', 'EncryChatRoomId', 'Alias', 'Signature',
Expand All @@ -40,6 +32,17 @@
def clear_screen():
os.system('cls' if config.OS == 'Windows' else 'clear')

def get_BLOCK():
try:
b = u'\u2588'
sys.stdout.write(b + '\r')
sys.stdout.flush()
except UnicodeEncodeError:
BLOCK = 'MM'
else:
BLOCK = b
return BLOCK

def emoji_formatter(d, k):
''' _emoji_deebugger is for bugs about emoji match caused by wechat backstage
like :face with tears of joy: will be replaced with :cat face with tears of joy:
Expand Down Expand Up @@ -89,7 +92,9 @@ def print_qr(fileDir):
else:
os.startfile(fileDir)

def print_cmd_qr(qrText, white=BLOCK, black=' ', enableCmdQR=True):
def print_cmd_qr(qrText, white=None, black=' ', enableCmdQR=True):
if white == None:
white = get_BLOCK()
blockCount = int(enableCmdQR)
if abs(blockCount) == 0:
blockCount = 1
Expand Down