MCPcopy Create free account
hub / github.com/TabViewer/tabview / display

Method display

tabview/tabview.py:821–869  ·  view source on GitHub ↗

Refresh the current display

(self)

Source from the content-addressed store, hash-verified

819 return all
820
821 def display(self):
822 """Refresh the current display"""
823 yp = self.y + self.win_y
824 xp = self.x + self.win_x
825
826 # Print the current cursor cell in the top left corner
827 self.scr.move(0, 0)
828 self.scr.clrtoeol()
829 info = " {}".format(self.location_string(yp, xp))
830 addstr(self.scr, info, curses.A_REVERSE)
831
832 # Adds the current cell content after the 'current cell' display
833 wc = self.max_x - len(info) - 2
834 s = self.cellstr(yp, xp, wc)
835 addstr(self.scr, " " + s, curses.A_NORMAL)
836
837 # Print a divider line
838 self.scr.hline(1, 0, curses.ACS_HLINE, self.max_x)
839
840 # Print the header if the correct offset is set
841 if self.header_offset == self.header_offset_orig:
842 self.scr.move(self.header_offset - 1, 0)
843 self.scr.clrtoeol()
844 for x in range(0, self.vis_columns):
845 xc, wc = self.column_xw(x)
846 s = self.hdrstr(x + self.win_x, wc)
847 addstr(self.scr, self.header_offset - 1, xc, s, curses.A_BOLD)
848
849 # Print the table data
850 for y in range(0, self.max_y - self.header_offset -
851 self._search_win_open):
852 yc = y + self.header_offset
853 self.scr.move(yc, 0)
854 self.scr.clrtoeol()
855 for x in range(0, self.vis_columns):
856 if x == self.x and y == self.y:
857 attr = curses.A_REVERSE
858 else:
859 attr = curses.A_NORMAL
860 xc, wc = self.column_xw(x)
861 s = self.cellstr(y + self.win_y, x + self.win_x, wc)
862 if yc == self.max_y - 1 and x == self.vis_columns - 1:
863 # Prevents a curses error when filling in the bottom right
864 # character
865 insstr(self.scr, yc, xc, s, attr)
866 else:
867 addstr(self.scr, yc, xc, s, attr)
868
869 self.scr.refresh()
870
871 def strpad(self, s, width):
872 if width < 1:

Callers 4

__init__Method · 0.95
_search_validatorMethod · 0.95
runMethod · 0.95
mainMethod · 0.95

Calls 6

location_stringMethod · 0.95
cellstrMethod · 0.95
column_xwMethod · 0.95
hdrstrMethod · 0.95
addstrFunction · 0.85
insstrFunction · 0.85

Tested by 1

mainMethod · 0.76