Example #1
0
 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)
Example #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))
Example #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))
Example #4
0
 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)
Example #5
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))
Example #6
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))
Example #7
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))
Example #8
0
 def clrline(self, line):
     """Clear the specified line in DHI database."""
     self.sendmsg(unt4.unt4(xx=0, yy=int(line), erl=True))
Example #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))
Example #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))
Example #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))
Example #12
0
 def add_rider(self, rvec):
     """Send a rider vector to the announcer."""
     self.sendmsg(unt4.unt4(header='rider',text=chr(unt4.US).join(rvec)))
Example #13
0
 def set_start(self, stod):
     """Update the announcer's relative start time."""
     self.sendmsg(unt4.unt4(header='start',text=stod.rawtime()))
Example #14
0
 def set_time(self, tstr):
     """Update the announcer's time."""
     self.sendmsg(unt4.unt4(header='time',text=tstr))
Example #15
0
 def set_title(self, line):
     """Update the announcer's title line."""
     self.sendmsg(unt4.unt4(header='title',text=line))
Example #16
0
 def clrline(self, line):
     """Clear the specified line in DHI database."""
     self.sendmsg(unt4.unt4(xx=0,yy=int(line),erl=True))