提交 75a6324a 编写于 作者: L LittleCoder

Classification

上级 b7da4ad3
*.pyc
log/*
storage/*
#coding=utf8
import time
import storage, out, argparser, robot
from client import WeChatClient
from ChatLikeCMD import ChatLikeCMD
import itchat.storage, itchat.out, itchat.argparser, robot
from itchat.client import WeChatClient
from plugin.ChatLikeCMD import ChatLikeCMD
ROBOT = False
......@@ -14,7 +14,7 @@ def demo_robot(s, msgList, client): # ONLY FOR DEMO
if s.find_nickname(msg['FromUserName']): robot.deal_with_msg(msg, s, client)
time.sleep(.1)
if __name__ == '__main__':
client_s = storage.Storage()
client_s = itchat.storage.Storage()
if ROBOT:
client = WeChatClient(client_s, robot = True)
else:
......@@ -29,4 +29,4 @@ if __name__ == '__main__':
front = ChatLikeCMD(header = str(client_s.find_nickname(client_s.userName)), symbol = '>', inPip = msgList)
cmdList = front.get_command_pip()
front.start()
argparser.startCommandLine(client_s, client, msgList, front, cmdList)
itchat.argparser.startCommandLine(client_s, client, msgList, front, cmdList)
......@@ -6,12 +6,12 @@ from urllib import unquote
import config, storage, out, log, tools
try:
from QRCode import QRCode
from plugin.QRCode import QRCode
CMD_QRCODE = True
except:
CMD_QRCODE = False
CMD_QRCODE = False
# CMD_QRCODE = False
BASE_URL = config.BASE_URL
DEBUG = False
......
__version__ = '0.1b'
......@@ -143,10 +143,10 @@ class ChatLikeCMD():
self.reprint_input()
self.outPip.append(c)
time.sleep(0.02)
if fitc1 in dir():
if 'fitc1' in dir():
self.process_char(fitc1)
self.cursor += 1
if fitc2 in dir():
if 'fitc2' in dir():
self.process_char(fitc2)
self.cursor += 1
elif ord(c) == 3: # Ctrl+C
......
from PIL import Image
import sys, os
import config
QR_DIR = config.QR_DIR
OS = config.OS
BLOCK = '\xA1\xF6' if OS == 'Windows' else 'MM'
class QRCode():
def __init__(self, fileName, size, padding = 0, background = 'BLACK'):
self.size = size
self.padding = padding
self.img = Image.open(fileName)
self.times = self.img.size[0]/(size + padding * 2)
self.rgb = self.img.convert('RGB')
self.white = BLOCK if background == 'BLACK' else ' '
self.black = ' ' if background == 'BLACK' else BLOCK
def print_qr(self):
sys.stdout.write(' '*50 + '\r')
sys.stdout.flush()
print self.white * (self.size + 2)
startPoint = self.padding + 0.5
for y in range(self.size):
sys.stdout.write(self.white)
for x in range(self.size):
r,g,b = self.rgb.getpixel(((x + startPoint) * self.times, (y + startPoint) * self.times))
sys.stdout.write(self.white if r > 127 else self.black)
print self.white
print self.white * (self.size + 2)
if __name__ == '__main__':
q = QRCode(os.path.join(QR_DIR, 'QR.jpg'), 37, 3, 'BLACK')
q.print_qr()
__version__ = '0.1b'
import out
import itchat.out
try:
import tuling
import plugin.tuling
TULING = True
except:
TULING = False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册