示例#1
0
文件: announce.py 项目: rijilks/scbdo
 def clear(self):
     """Re-set all lines and draw a 'welcome'."""
     ntxt = ''
     for i in range(0, SCB_H - 1):
         ntxt += ''.ljust(SCB_W) + '\n'
     ntxt += ''.ljust(SCB_W)
     self.buffer.set_text(ntxt)
     if self.motd != '':
         m = unt4.unt4(yy=0, xx=0, text=self.motd, erl=True)
         self.msg_cb(m)
示例#2
0
 def unt_msg_cb(self, c, e):
     """Handle a message packet."""
     su = irclib.nm_to_n(e.source()).lower()
     tg = e.target().lower()
     if su == self.srvnick and tg == self.channel:
         self._pacing(0.0)
         # Have a 'broadcast' packet ... append and then search
         self.rdbuf += unt4.decode(''.join(e.arguments()))
         idx = self.rdbuf.find(chr(unt4.EOT))
         if idx >= 0:
             msgtxt = self.rdbuf[0:idx+1]
             self.rdbuf = self.rdbuf[idx+1:]
             if self.cb is not None:
                 glib.idle_add(self.cb, unt4.unt4(unt4str=msgtxt))
示例#3
0
 def unt_msg_cb(self, c, e):
     """Handle a message packet."""
     su = irclib.nm_to_n(e.source()).lower()
     tg = e.target().lower()
     if su == self.srvnick and tg == self.channel:
         self._pacing(0.0)
         # Have a 'broadcast' packet ... append and then search
         self.rdbuf += unt4.decode("".join(e.arguments()))
         idx = self.rdbuf.find(chr(unt4.EOT))
         if idx >= 0:
             msgtxt = self.rdbuf[0 : idx + 1]
             self.rdbuf = self.rdbuf[idx + 1 :]
             if self.cb is not None:
                 glib.idle_add(self.cb, unt4.unt4(unt4str=msgtxt))
示例#4
0
文件: announce.py 项目: rijilks/scbdo
 def intro(self):
     m = unt4.unt4()
     m.yy = SCB_H - 1
     m.text = 'SCBdo track announce ' + scbdo.VERSION
     m.xx = SCB_W - len(m.text)
     self.msg_cb(m)
示例#5
0
文件: sender.py 项目: rijilks/scbdo
 def postxt(self, line, oft, msg):
     """Position msg at oft on line in DHI database."""
     assert oft >= 0, 'Offset should be >= 0'
     if oft < self.linelen:
         msg = msg[0:(self.linelen - oft)]
         self.sendmsg(unt4.unt4(xx=int(oft), yy=int(line), text=msg))
示例#6
0
文件: sender.py 项目: rijilks/scbdo
 def linefill(self, line, char='_'):
     """Use char to fill the specified line."""
     msg = char * self.linelen
     self.sendmsg(unt4.unt4(xx=0, yy=int(line), text=msg))
示例#7
0
文件: sender.py 项目: rijilks/scbdo
 def setline(self, line, msg):
     """Set the specified DHI database line to msg."""
     msg = msg[0:self.linelen].ljust(self.linelen)
     msg = msg + ' ' * (self.linelen - len(msg))
     self.sendmsg(unt4.unt4(xx=0, yy=int(line), text=msg))
示例#8
0
文件: sender.py 项目: rijilks/scbdo
 def clrline(self, line):
     """Clear the specified line in DHI database."""
     self.sendmsg(unt4.unt4(xx=0, yy=int(line), erl=True))
示例#9
0
 def postxt(self, line, oft, msg):
     """Position msg at oft on line in DHI database."""
     assert oft >= 0, 'Offset should be >= 0'
     if oft < self.linelen:
         msg = msg[0:(self.linelen-oft)]
         self.sendmsg(unt4.unt4(xx=int(oft),yy=int(line),text=msg))
示例#10
0
 def linefill(self, line, char='_'):
     """Use char to fill the specified line."""
     msg = char * self.linelen
     self.sendmsg(unt4.unt4(xx=0,yy=int(line),text=msg))
示例#11
0
 def setline(self, line, msg):
     """Set the specified DHI database line to msg."""
     msg = msg[0:self.linelen].ljust(self.linelen)
     msg = msg + ' ' * (self.linelen - len(msg))
     self.sendmsg(unt4.unt4(xx=0,yy=int(line),text=msg))
示例#12
0
文件: uscbsrv.py 项目: rijilks/scbdo
 def add_rider(self, rvec):
     """Send a rider vector to the announcer."""
     self.sendmsg(unt4.unt4(header='rider',text=chr(unt4.US).join(rvec)))
示例#13
0
文件: uscbsrv.py 项目: rijilks/scbdo
 def set_start(self, stod):
     """Update the announcer's relative start time."""
     self.sendmsg(unt4.unt4(header='start',text=stod.rawtime()))
示例#14
0
文件: uscbsrv.py 项目: rijilks/scbdo
 def set_time(self, tstr):
     """Update the announcer's time."""
     self.sendmsg(unt4.unt4(header='time',text=tstr))
示例#15
0
文件: uscbsrv.py 项目: rijilks/scbdo
 def set_title(self, line):
     """Update the announcer's title line."""
     self.sendmsg(unt4.unt4(header='title',text=line))
示例#16
0
 def clrline(self, line):
     """Clear the specified line in DHI database."""
     self.sendmsg(unt4.unt4(xx=0,yy=int(line),erl=True))