def fm(self,format_str,args): if isinstance(args,tuple): return zh_format(format_str,*args) elif isinstance(args,dict): return zh_format_d(format_str,**args) else : raise TypeError(u'No tuple or dict')
def bottom_bar(self,repos=False,close=False): if close : self.write(ac.save) if repos : self.write(ac.move2(24,0)) self.write( zh_format(self.bottom_txt, datetime.now().ctime(), self.session.userid)) if close : self.write(ac.restore)
def top_bar(self,left=u'',mid=u'逸仙时空 Yat-Sen Channel',right=None): if right is None : try: right = self.session.lastboard except AttributeError: right = '' self.write( zh_format(self.top_txt, left, zh_center(mid,40), right) )
def render(self,string,*args): ''' Write string % dict if has any key/value arguments, Or just print write to remote. ''' if args : self.write( zh_format(string,*args) ) else: self.write(string)
def bottom_bar(self,msg=''): self.write(zh_format(self.bottom_text, msg or u'现在的时间是【%s】'% datetime.now().ctime(), self.l,self.r)) self.fix_cursor()
def format(self,string,*args,**kwargs): if args: return zh_format(string,*args) else: return zh_format_d(string,**kwargs)
def message(self,msg): self.write(zh_format(self.message_txt, datetime.now().ctime(), manager.online.total_online(), self.userid, msg[:20]))
def bottom_bar(self): self.write(zh_format(self.bottom_txt, datetime.now().ctime(), manager.online.total_online(), self.userid))