def scrollingRefresh(self): self.win.erase( ) top = self.topLineNum bottom = self.topLineNum + self.WIN_LINES for (index, line) in enumerate(self.indexList[top:bottom]): linenum = self.topLineNum + index if linenum in self.markedLineNum: marking = self.MARKING else: marking = self.NO_MARKING try: if index == self.highlightLineNum: subj, frm, to, date, msg = messageDict[ linenum+1 ] msg = textwrap(text=msg, width=self.X-36) # Hightlight current line self.indexWin.addstr(index, 0, line[:self.indexTextLengdth], marking | curses.A_BOLD | curses.A_STANDOUT) self.titleWin.addstr(0, 0, subj.rstrip()[0:self.X-40]) self.titleWin.addstr(0, 0, date) for (i, msg) in enumerate(msg.split('\n')[:self.Y-8]): self.previewWin.addstr(i, 0, msg) cur_line = '%d / %d' % (linenum+1, len(messageDict.keys())) self.win.addstr(y-2, int((x-1)-len(cur_line)), cur_line, color_green | curses.A_BOLD) else: self.indexWin.addstr(index, 0, line[:self.indexTextLengdth], marking) except: self.win.addstr(0, 60, 'Error') self.Frame( ) self.win.refresh( )
def scrollingRefresh(self): self.win.erase() top = self.topLineNum bottom = self.topLineNum + self.WIN_LINES for (index, line) in enumerate(self.indexList[top:bottom]): linenum = self.topLineNum + index if linenum in self.markedLineNum: marking = self.MARKING else: marking = self.NO_MARKING try: if index == self.highlightLineNum: subj, frm, to, date, msg = messageDict[linenum + 1] msg = textwrap(text=msg, width=self.X - 36) # Hightlight current line self.indexWin.addstr( index, 0, line[:self.indexTextLengdth], marking | curses.A_BOLD | curses.A_STANDOUT) self.titleWin.addstr(0, 0, subj.rstrip()[0:self.X - 40]) self.titleWin.addstr(0, 0, date) for (i, msg) in enumerate(msg.split('\n')[:self.Y - 8]): self.previewWin.addstr(i, 0, msg) cur_line = '%d / %d' % (linenum + 1, len( messageDict.keys())) self.win.addstr(y - 2, int((x - 1) - len(cur_line)), cur_line, color_green | curses.A_BOLD) else: self.indexWin.addstr(index, 0, line[:self.indexTextLengdth], marking) except: self.win.addstr(0, 60, 'Error') self.Frame() self.win.refresh()
def displayMessage(self, **kw): """ Display email in email message box """ self.markLine() self.win.erase() # headerWin y, x = 2, 1 height, width = 4, self.X - 2 headerWin = self.win.subwin(height, width, y, x) # messageWin y, x = height * 2, 1 height, width = self.Y - y, self.X - 2 messageWin = self.win.subwin(height - 1, width, y, x) # headerBox y, x = 2, 1 height, width = 4, self.X - 2 self.win.attrset(color_blue | curses.A_BOLD) rectangle(self.win, y - 1, x - 1, height + 2, width + x) # messageBox y, x = height * 2, 1 height, width = self.Y - y, self.X - 2 rectangle(self.win, y - 1, x - 1, height + (y - 1), width + x) self.win.attrset(color_normal | curses.A_NORMAL) #Y, X = self.y, self.x hight, width = self.Y - 9, self.X - 2 msgnum = self.topLineNum + self.highlightLineNum + 1 # get subject, from, date, message to display if not kw: subj, frm, to, date, msg = messageDict.get(msgnum, 'Error') else: for value in kw.values(): subj, frm, to, date, msg = value msg = textwrap(text=msg, width=width).split('\n') headerWin.addstr(0, 0, 'Subject: %s' % subj.strip()) #[0:self.X-12]) headerWin.addstr(1, 0, 'From : %s' % frm.strip()) #[0:self.X-9]) headerWin.addstr(2, 0, 'To : %s' % to.strip()) #[0:self.X-9]) headerWin.addstr(3, 0, 'Date : %s' % date.strip()) #[0:self.X-9]) top = 0 bottom = hight self.scrollingText(textpad=messageWin, text=msg, top=0, bottom=hight - 2, y=hight - 1, x=width) self.markLine()
def displayMessage(self, **kw): """ Display email in email message box """ self.markLine( ) self.win.erase( ) # headerWin y, x = 2, 1 height, width = 4, self.X-2 headerWin = self.win.subwin(height, width, y, x) # messageWin y, x = height*2, 1 height, width = self.Y-y, self.X-2 messageWin = self.win.subwin(height-1, width, y, x) # headerBox y, x = 2, 1 height, width = 4, self.X-2 self.win.attrset(color_blue | curses.A_BOLD) rectangle(self.win, y-1, x-1, height+2, width+x) # messageBox y, x = height*2, 1 height, width = self.Y-y, self.X-2 rectangle(self.win, y-1, x-1, height+(y-1), width+x) self.win.attrset(color_normal | curses.A_NORMAL) #Y, X = self.y, self.x hight, width = self.Y-9, self.X-2 msgnum = self.topLineNum + self.highlightLineNum + 1 # get subject, from, date, message to display if not kw: subj, frm, to, date, msg = messageDict.get(msgnum, 'Error') else: for value in kw.values( ): subj, frm, to, date, msg = value msg = textwrap(text=msg, width=width).split('\n') headerWin.addstr(0, 0, 'Subject: %s' % subj.strip( ))#[0:self.X-12]) headerWin.addstr(1, 0, 'From : %s' % frm.strip( ) )#[0:self.X-9]) headerWin.addstr(2, 0, 'To : %s' % to.strip( ) )#[0:self.X-9]) headerWin.addstr(3, 0, 'Date : %s' % date.strip( ))#[0:self.X-9]) top = 0 bottom = hight self.scrollingText(textpad=messageWin, text=msg, top=0, bottom=hight-2, y=hight-1, x=width) self.markLine( )