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

Method _calculate_layout

tabview/tabview.py:1050–1067  ·  view source on GitHub ↗

Setup popup window and format data.

(self)

Source from the content-addressed store, hash-verified

1048 }
1049
1050 def _calculate_layout(self):
1051 """Setup popup window and format data. """
1052 self.scr.touchwin()
1053 self.term_rows, self.term_cols = self.scr.getmaxyx()
1054 self.box_height = self.term_rows - int(self.term_rows / 2)
1055 self.win = curses.newwin(int(self.term_rows / 2),
1056 self.term_cols, self.box_height, 0)
1057 try:
1058 curses.curs_set(False)
1059 except _curses.error:
1060 pass
1061 # transform raw data into list of lines ready to be printed
1062 s = self.data.splitlines()
1063 s = [wrap(i, self.term_cols - 3, subsequent_indent=" ") or [""] for i in s]
1064 self.tdata = [i for j in s for i in j]
1065 # -3 -- 2 for the box lines and 1 for the title row
1066 self.nlines = min(len(self.tdata), self.box_height - 3)
1067 self.scr.refresh()
1068
1069 def run(self):
1070 self._running = True

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected