Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Commit

Permalink
去掉prettytable
Browse files Browse the repository at this point in the history
  • Loading branch information
pandolia committed Apr 25, 2017
1 parent 6bc22b0 commit 825ce91
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions qqbot/qcontactdb/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from qqbot.qcontactdb.contactdb import rName
from qqbot.utf8logger import DEBUG

from prettytable import PrettyTable

TAGS = ('qq=', 'name=', 'nick=', 'mark=', 'card=', 'uin=')
CHSTAGS = ('QQ', '名称', '网名', '备注名', '群名片', 'UIN')
CTYPES = {
Expand Down Expand Up @@ -55,17 +53,19 @@ def strOfList(self, tinfo, cinfo=None):
if not cl:
return head + '空'

pt = PrettyTable(('类型',) + CHSTAGS + EXCHSTAGS)
pt.align['类型'] = '1'
pt.padding_width = 1
result = [head]
result.append('=' * 100)
result.append('\t'.join(('类型',) + CHSTAGS + EXCHSTAGS))
result.append('=' * 100)

for c in cl:
pt.add_row(
[CTYPES[c.ctype]] + \
l = [CTYPES[c.ctype]] + \
[(getattr(c, tag[:-1], '') or '#') for tag in (TAGS+EXTAGS)]
)

return head + '\n' + str(pt)
result.append('\t'.join(l))

result.append('=' * 100)

return '\n'.join(result)

def ObjOfList(self, ctype, info1=None, info2=None):
if ctype in ('buddy', 'group', 'discuss'):
Expand Down

0 comments on commit 825ce91

Please sign in to comment.