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