(self, e_highlight, entries, cur_win, offset)
Just print all entries in a column
Just print all entries in a column
Just print all entries in a column
def show_entries(self, e_highlight, entries, cur_win, offset):
        '''Just print all entries in a column'''

        self.info_win.clear()
        try:
            self.entry_win.clear()
            if entries:
                if cur_win == 1:
                    h_color = 5
                    n_color = 4
                else:
                    h_color = 6
                    n_color = 1

                ysize = self.entry_win.getmaxyx()[0]
                if len(entries) <= ysize - 3:
                    num = len(entries)
                else:
                    num = ysize - 3

                for i in range(num):
                    title = entries[i + offset].title
                    if date.today() > entries[i + offset].expire.date():
                        expired = True
                    else:
                        expired = False
                    if e_highlight == i + offset:
                        if expired is True:
                            self.entry_win.addstr(i, 2, title,
                                                  cur.color_pair(3))
                        else:
                            self.entry_win.addstr(i, 2, title,
                                                  cur.color_pair(h_color))
                    else:
                        if expired is True:
                            self.entry_win.addstr(i, 2, title,
                                                  cur.color_pair(7))
                        else:
                            self.entry_win.addstr(i, 2, title,
                                                  cur.color_pair(n_color))
                self.entry_win.addstr(ysize - 2, 2, (str(e_highlight + 1) +
                                                     ' of ' +
                                                     str(len(entries))))
        except:
            pass
        finally:
            self.entry_win.noutrefresh()

        try:
            if entries:
                xsize = self.entry_win.getmaxyx()[1]
                entry = entries[e_highlight]
                if entry.title is None:
                    title = ""
                elif len(entry.title) > xsize:
                    title = entry.title[:xsize - 2] + '\\'
                else:
                    title = entry.title
                if entry.group.title is None:
                    group_title = ""
                elif len(entry.group.title) > xsize:
                    group_title = entry.group.title[:xsize - 9] + '\\'
                else:
                    group_title = entry.group.title
                if entry.username is None:
                    username = ""
                elif len(entry.username) > xsize:
                    username = entry.username[:xsize - 12] + '\\'
                else:
                    username = entry.username
                if entry.url is None:
                    url = ""
                elif len(entry.url) > xsize:
                    url = entry.title[:xsize - 7] + '\\'
                else:
                    url = entry.url
                if entry.creation is None:
                    creation = ""
                else:
                    creation = entry.creation.__str__()[:10]
                if entry.last_access is None:
                    last_access = ""
                else:
                    last_access = entry.last_access.__str__()[:10]
                if entry.last_mod is None:
                    last_mod = ""
                else:
                    last_mod = entry.last_mod.__str__()[:10]
                if entry.expire is None:
                    expire = ""
                else:
                    if entry.expire.__str__()[:19] == '2999-12-28 23:59:59':
                        expire = "Expires: Never"
                    else:
                        expire = "Expires: " + entry.expire.__str__()[:10]
                if entry.comment is None:
                    comment = ""
                else:
                    comment = entry.comment

                self.info_win.addstr(2, 0, title, cur.A_BOLD)
                self.info_win.addstr(3, 0, "Group: " + group_title)
                self.info_win.addstr(4, 0, "Username: " + username)
                self.info_win.addstr(5, 0, "URL: " + url)
                self.info_win.addstr(6, 0, "Creation: " + creation)
                self.info_win.addstr(7, 0, "Access: " + last_access)
                self.info_win.addstr(8, 0, "Modification: " + last_mod)
                self.info_win.addstr(9, 0, expire)
                if date.today() > entry.expire.date():
                    self.info_win.addstr(9, 22, ' (expired)')
                if '\n' in comment:
                    comment = comment.split('\n')[0]
                    dots = ' ...'
                else:
                    dots = ''
                self.info_win.addstr(10, 0, "Comment: " + comment + dots)
        except:
            pass
        finally:
            self.info_win.noutrefresh()
        cur.doupdate()
def show_entries ( self , e_highlight , entries , cur_win , offset ) : self . info_win . clear ( ) try : self . entry_win . clear ( ) if entries : if cur_win == 1 : h_color = 5 n_color = 4 else : h_color = 6 n_color = 1 ysize = self . entry_win . getmaxyx ( ) [ 0 ] if len ( entries ) <= ysize - 3 : num = len ( entries ) else : num = ysize - 3 for i in range ( num ) : title = entries [ i + offset ] . title if date . today ( ) > entries [ i + offset ] . expire . date ( ) : expired = True else : expired = False if e_highlight == i + offset : if expired is True : self . entry_win . addstr ( i , 2 , title , cur . color_pair ( 3 ) ) else : self . entry_win . addstr ( i , 2 , title , cur . color_pair ( h_color ) ) else : if expired is True : self . entry_win . addstr ( i , 2 , title , cur . color_pair ( 7 ) ) else : self . entry_win . addstr ( i , 2 , title , cur . color_pair ( n_color ) ) self . entry_win . addstr ( ysize - 2 , 2 , ( str ( e_highlight + 1 ) + ' of ' + str ( len ( entries ) ) ) ) except : pass finally : self . entry_win . noutrefresh ( ) try : if entries : xsize = self . entry_win . getmaxyx ( ) [ 1 ] entry = entries [ e_highlight ] if entry . title is None : title = "" elif len ( entry . title ) > xsize : title = entry . title [ : xsize - 2 ] + '\\' else : title = entry . title if entry . group . title is None : group_title = "" elif len ( entry . group . title ) > xsize : group_title = entry . group . title [ : xsize - 9 ] + '\\' else : group_title = entry . group . title if entry . username is None : username = "" elif len ( entry . username ) > xsize : username = entry . username [ : xsize - 12 ] + '\\' else : username = entry . username if entry . url is None : url = "" elif len ( entry . url ) > xsize : url = entry . title [ : xsize - 7 ] + '\\' else : url = entry . url if entry . creation is None : creation = "" else : creation = entry . creation . __str__ ( ) [ : 10 ] if entry . last_access is None : last_access = "" else : last_access = entry . last_access . __str__ ( ) [ : 10 ] if entry . last_mod is None : last_mod = "" else : last_mod = entry . last_mod . __str__ ( ) [ : 10 ] if entry . expire is None : expire = "" else : if entry . expire . __str__ ( ) [ : 19 ] == '2999-12-28 23:59:59' : expire = "Expires: Never" else : expire = "Expires: " + entry . expire . __str__ ( ) [ : 10 ] if entry . comment is None : comment = "" else : comment = entry . comment self . info_win . addstr ( 2 , 0 , title , cur . A_BOLD ) self . info_win . addstr ( 3 , 0 , "Group: " + group_title ) self . info_win . addstr ( 4 , 0 , "Username: " + username ) self . info_win . addstr ( 5 , 0 , "URL: " + url ) self . info_win . addstr ( 6 , 0 , "Creation: " + creation ) self . info_win . addstr ( 7 , 0 , "Access: " + last_access ) self . info_win . addstr ( 8 , 0 , "Modification: " + last_mod ) self . info_win . addstr ( 9 , 0 , expire ) if date . today ( ) > entry . expire . date ( ) : self . info_win . addstr ( 9 , 22 , ' (expired)' ) if '\n' in comment : comment = comment . split ( '\n' ) [ 0 ] dots = ' ...' else : dots = '' self . info_win . addstr ( 10 , 0 , "Comment: " + comment + dots ) except : pass finally : self . info_win . noutrefresh ( ) cur . doupdate ( )