MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / layout

Method layout

tensorflow/python/debug/cli/curses_ui.py:154–190  ·  view source on GitHub ↗

Get the RichTextLines layout of the scroll bar. Returns: (debugger_cli_common.RichTextLines) The text layout of the scroll bar.

(self)

Source from the content-addressed store, hash-verified

152 return rel_block_y + self._min_y if screen_coord_sys else rel_block_y
153
154 def layout(self):
155 """Get the RichTextLines layout of the scroll bar.
156
157 Returns:
158 (debugger_cli_common.RichTextLines) The text layout of the scroll bar.
159 """
160 width = self._max_x - self._min_x + 1
161 empty_line = " " * width
162 foreground_font_attr_segs = [(0, width, self.BASE_ATTR)]
163
164 if self._output_num_rows > 1:
165 block_y = self._block_y()
166
167 if width == 1:
168 up_text = "U"
169 down_text = "D"
170 elif width == 2:
171 up_text = "UP"
172 down_text = "DN"
173 elif width == 3:
174 up_text = "UP "
175 down_text = "DN "
176 else:
177 up_text = " UP "
178 down_text = "DOWN"
179
180 layout = debugger_cli_common.RichTextLines(
181 [up_text], font_attr_segs={0: [(0, width, self.BASE_ATTR)]})
182 for i in xrange(1, self._scroll_bar_height - 1):
183 font_attr_segs = foreground_font_attr_segs if i == block_y else None
184 layout.append(empty_line, font_attr_segs=font_attr_segs)
185 layout.append(down_text, font_attr_segs=foreground_font_attr_segs)
186 else:
187 layout = debugger_cli_common.RichTextLines(
188 [empty_line] * self._scroll_bar_height)
189
190 return layout
191
192 def get_click_command(self, mouse_y):
193 if self._output_num_rows <= 1:

Calls 2

_block_yMethod · 0.95
appendMethod · 0.95