Best Python code snippet using yandex-tank
screen.py
Source:screen.py
...74 if len(right_line_plain) > self.right_panel_width:75 right_line = right_line[:self.76 right_panel_width] + self.markup.RESET77 return right_line78 def __render_left_panel(self):79 ''' Render left blocks '''80 self.log.debug("Rendering left blocks")81 lines = []82 for row in self.block_rows:83 space_left = self.left_panel_width84 # render blocks85 for block in row:86 block.render()87 space_left -= block.width88 # merge blocks output into row89 space = ' ' * int(math.floor(float(space_left) / (len(row) + 1)))90 had_lines = True91 while had_lines:92 had_lines = False93 line = space94 for block in row:95 if block.lines:96 block_line = block.lines.pop(0)97 line += block_line + ' ' * (98 block.width -99 len(self.markup.clean_markup(block_line)))100 had_lines = True101 else:102 line += ' ' * block.width103 line += space104 lines.append(line)105 # lines.append(". " * (1 + self.left_panel_width / 3))106 # lines.append("")107 return lines108 def render_screen(self):109 ''' Main method to render screen view '''110 self.term_width, self.term_height = get_terminal_size()111 self.log.debug(112 "Terminal size: %sx%s", self.term_width, self.term_height)113 self.right_panel_width = int(114 (self.term_width - len(self.RIGHT_PANEL_SEPARATOR)) *115 (float(self.info_panel_percent) / 100)) - 1116 if self.right_panel_width > 0:117 self.left_panel_width = self.term_width - \118 self.right_panel_width - len(self.RIGHT_PANEL_SEPARATOR) - 2119 else:120 self.right_panel_width = 0121 self.left_panel_width = self.term_width - 1122 self.log.debug(123 "Left/right panels width: %s/%s", self.left_panel_width,124 self.right_panel_width)125 widget_output = []126 if self.right_panel_width:127 widget_output = []128 self.log.debug("There are %d info widgets" % len(self.info_widgets))129 for index, widget in sorted(130 self.info_widgets.iteritems(),131 key=lambda item: (item[1].get_index(), item[0])):132 self.log.debug("Rendering info widget #%s: %s", index, widget)133 widget_out = widget.render(self).strip()134 if widget_out:135 widget_output += widget_out.split("\n")136 widget_output += [""]137 left_lines = self.__render_left_panel()138 self.log.debug("Composing final screen output")139 output = []140 for line_no in range(1, self.term_height):141 line = " "142 if line_no > 1 and left_lines:143 left_line = left_lines.pop(0)144 left_line_plain = self.markup.clean_markup(left_line)145 if len(left_line) > self.left_panel_width:146 if len(left_line_plain) > self.left_panel_width:147 left_line = left_line[:self.148 left_panel_width] + self.markup.RESET149 left_line += (150 ' ' * (self.left_panel_width - len(left_line_plain)))151 line += left_line...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!