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

Method show_info

tabview/tabview.py:318–342  ·  view source on GitHub ↗

Display data information in a pop-up window

(self)

Source from the content-addressed store, hash-verified

316 self.resize()
317
318 def show_info(self):
319 """Display data information in a pop-up window
320
321 """
322 fn = self.info
323 yp = self.y + self.win_y
324 xp = self.x + self.win_x
325 location = self.location_string(yp, xp)
326
327 def sizeof_fmt(num, suffix='B'):
328 for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']:
329 if abs(num) < 1024.0:
330 return "{:3.1f}{}{}".format(num, unit, suffix)
331 num /= 1024.0
332 return "{:.1f}{}{}".format(num, 'Yi', suffix)
333 size = sizeof_fmt(sys.getsizeof(self.data))
334 rows_cols = str((len(self.data), self.num_data_columns))
335 info = [("Filename/Data Info:", fn),
336 ("Current Location:", location),
337 ("Total Rows/Columns:", rows_cols),
338 ("Data Size:", size)]
339 display = "\n\n".join(["{:<20}{:<}".format(i, j)
340 for i, j in info])
341 TextBox(self.scr, data=display)()
342 self.resize()
343
344 def _search_validator(self, ch):
345 """Fix Enter and backspace for textbox.

Callers

nothing calls this directly

Calls 3

location_stringMethod · 0.95
resizeMethod · 0.95
TextBoxClass · 0.85

Tested by

no test coverage detected