Ejemplo n.º 1
0
 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')
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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) )
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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()
Ejemplo n.º 6
0
 def format(self,string,*args,**kwargs):
     if args:
         return zh_format(string,*args)
     else:
         return zh_format_d(string,**kwargs)
Ejemplo n.º 7
0
 def message(self,msg):
     self.write(zh_format(self.message_txt, datetime.now().ctime(),
                          manager.online.total_online(), self.userid, msg[:20]))
Ejemplo n.º 8
0
 def bottom_bar(self):
     self.write(zh_format(self.bottom_txt,
                          datetime.now().ctime(),
                          manager.online.total_online(),
                          self.userid))