Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
huan authored May 9, 2020
2 parents cc22602 + 78466e1 commit 3c898d0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# https://help.github.com/articles/about-codeowners/
#

* @wechaty/python
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Huan LI (李卓桓) <https://github.com/huan>
Jingjing WU (吴京京) <https://github.com/wj-Mcat>
Chunhong HUANG (黄纯鸿) <https://github.com/huangaszaq>
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,13 @@ pip3 install wechaty

### v0.4 (Mar 15, 2020) master

1 Add a friendly exception message for PyPI users. [#24](https://github.com/wechaty/python-wechaty/issues/24)
Welcome [@huangaszaq](https://github.com/huangaszaq) for joining the project! [#42](https://github.com/wechaty/python-wechaty/pull/42)

1. Add a friendly exception message for PyPI users. [#24](https://github.com/wechaty/python-wechaty/issues/24)

### v0.1 (Mar 8, 2020)

Welcome [@wj-Mcat](https://github.com/wj-Mcat) for joining the project!
Welcome [@wj-Mcat](https://github.com/wj-Mcat) for joining the project! [#4](https://github.com/wechaty/python-wechaty/pull/4)

1. Starting translate TypeScript of Wechaty to Python
1. DevOps Setup
Expand All @@ -269,6 +271,11 @@ Project created, publish a empty module `wechaty` on PyPI.
- [Go Wechaty](https://github.com/wechaty/go-wechaty) - Go WeChat Bot SDK for Individual Account
- [Java Wechaty](https://github.com/wechaty/java-wechaty) - Java WeChat Bot SDK for Individual Account

## Maintainers

1. [@wj-Mcat](https://github.com/wj-Mcat) - Jingjing WU (吴京京)
1. [@huangaszaq](https://github.com/huangaszaq) - Chunhong HUANG (黄纯鸿)

## Author

[Huan LI](https://github.com/huan) ([李卓桓](http://linkedin.com/in/zixia)) [email protected]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pycodestyle
pylint
pylint-quotes
pytest
pytype
pytype==2020.2.20
semver
grpclib
pyee
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ requests
qrcode
chatie-grpc==0.15.dev4
requests
qrcode
42 changes: 42 additions & 0 deletions src/wechaty/utils/qrcode_terminal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import qrcode
import platform


def qr_terminal_str(data,version=None):
"""
:param data: qrcode data
:param version:1-40 or None
:return:
"""
if platform.system() == "Windows":
white_block = '▇'
black_block = ' '
new_line = '\n'
else:
white_block = '\033[0;37;47m '
black_block = '\033[0;37;40m '
new_line = '\033[0m\n'

qr = qrcode.QRCode(version)
qr.add_data(data)
if version:
qr.make()
else:
qr.make(fit=True)
output = white_block*(qr.modules_count+2) + new_line
for mn in qr.modules:
output += white_block
for m in mn:
if m:
output += black_block
else:
output += white_block
output += white_block + new_line
output += white_block*(qr.modules_count+2) + new_line
return output


def draw(data, version=None):
output = qr_terminal_str(data,version)
print (output)

0 comments on commit 3c898d0

Please sign in to comment.