How to use _update_line method in lisa

Best Python code snippet using lisa_python

widget.py

Source:widget.py Github

copy

Full Screen

...77 assert len(p) == 278 if p == self.pos:79 return80 self.transform.translate = p[0], p[1], 0, 081 self._update_line()82 @property83 def size(self):84 """The size (w, h) of this widget.85 If the widget is a child of another widget, then its size is assigned86 automatically by its parent.87 """88 return self._size89 @size.setter90 def size(self, s):91 assert isinstance(s, tuple)92 assert len(s) == 293 if self._size == s:94 return95 self._size = s96 self._update_line()97 self._update_child_widgets()98 self._update_clipper()99 self.events.resize()100 @property101 def width(self):102 """The actual width of this widget"""103 return self._size[0]104 @property105 def width_min(self):106 """The minimum width the widget can have"""107 return self._width_limits[0]108 @width_min.setter109 def width_min(self, width_min):110 """Set the minimum height of the widget111 Parameters112 ----------113 height_min: float114 the minimum height of the widget115 """116 if width_min is None:117 self._width_limits[0] = 0118 return119 width_min = float(width_min)120 assert(0 <= width_min)121 self._width_limits[0] = width_min122 self._update_layout()123 @property124 def width_max(self):125 """The maximum width the widget can have"""126 return self._width_limits[1]127 @width_max.setter128 def width_max(self, width_max):129 """Set the maximum width of the widget.130 Parameters131 ----------132 width_max: None | float133 the maximum width of the widget. if None, maximum width134 is unbounded135 """136 if width_max is None:137 self._width_limits[1] = None138 return139 width_max = float(width_max)140 assert(self.width_min <= width_max)141 self._width_limits[1] = width_max142 self._update_layout()143 @property144 def height(self):145 """The actual height of the widget"""146 return self._size[1]147 @property148 def height_min(self):149 """The minimum height of the widget"""150 return self._height_limits[0]151 @height_min.setter152 def height_min(self, height_min):153 """Set the minimum height of the widget154 Parameters155 ----------156 height_min: float157 the minimum height of the widget158 """159 if height_min is None:160 self._height_limits[0] = 0161 return162 height_min = float(height_min)163 assert(height_min >= 0)164 self._height_limits[0] = height_min165 self._update_layout()166 @property167 def height_max(self):168 """The maximum height of the widget"""169 return self._height_limits[1]170 @height_max.setter171 def height_max(self, height_max):172 """Set the maximum height of the widget.173 Parameters174 ----------175 height_max: None | float176 the maximum height of the widget. if None, maximum height177 is unbounded178 """179 if height_max is None:180 self._height_limits[1] = None181 return182 height_max = float(height_max)183 assert(0 <= self.height_min <= height_max)184 self._height_limits[1] = height_max185 self._update_layout()186 @property187 def rect(self):188 return Rect((0, 0), self.size)189 @rect.setter190 def rect(self, r):191 with self.events.resize.blocker():192 self.pos = r.pos193 self.size = r.size194 self.update()195 self.events.resize()196 @property197 def inner_rect(self):198 """The rectangular area inside the margin, border, and padding.199 Generally widgets should avoid drawing or placing sub-widgets outside200 this rectangle.201 """202 m = self.margin + self._border_width + self.padding203 if not self.border_color.is_blank:204 m += 1205 return Rect((m, m), (self.size[0]-2*m, self.size[1]-2*m))206 @property207 def stretch(self):208 """Stretch factors (w, h) used when determining how much space to209 allocate to this widget in a layout.210 If either stretch factor is None, then it will be assigned when the211 widget is added to a layout based on the number of columns or rows it212 occupies.213 """214 return self._stretch215 @stretch.setter216 def stretch(self, s):217 self._stretch = [float(s[0]), float(s[1])]218 if self._stretch[0] == 0:219 raise RuntimeError("received 0 as stretch parameter: %s", s)220 if self._stretch[1] == 0:221 raise RuntimeError("received 0 as stretch parameter: %s", s)222 self._update_layout()223 def _update_layout(self):224 if isinstance(self.parent, Widget):225 self.parent._update_child_widgets()226 def _update_clipper(self):227 """Called whenever the clipper for this widget may need to be updated.228 """229 if self.clip_children and self._clipper is None:230 self._clipper = Clipper()231 elif not self.clip_children:232 self._clipper = None233 if self._clipper is None:234 return235 self._clipper.rect = self.inner_rect236 self._clipper.transform = self.get_transform('framebuffer', 'visual')237 @property238 def border_color(self):239 """ The color of the border.240 """241 return self._border_color242 @border_color.setter243 def border_color(self, b):244 self._border_color = Color(b)245 self._update_colors()246 self._update_line()247 self.update()248 @property249 def bgcolor(self):250 """ The background color of the Widget.251 """252 return self._bgcolor253 @bgcolor.setter254 def bgcolor(self, value):255 self._bgcolor = Color(value)256 self._update_colors()257 self._update_line()258 self.update()259 @property260 def margin(self):261 return self._margin262 @margin.setter263 def margin(self, m):264 self._margin = m265 self._update_child_widgets()266 self._update_line()267 self.update()268 self.events.resize()269 @property270 def padding(self):271 return self._padding272 @padding.setter273 def padding(self, p):274 self._padding = p275 self._update_child_widgets()276 self.update()277 def _update_line(self):278 """ Update border line to match new shape """279 w = self._border_width280 m = self.margin281 # border is drawn within the boundaries of the widget:282 #283 # size = (8, 7) margin=2284 # internal rect = (3, 3, 2, 1)285 # ........286 # ........287 # ..BBBB..288 # ..B B..289 # ..BBBB..290 # ........291 # ...........

Full Screen

Full Screen

scheme_object.py

Source:scheme_object.py Github

copy

Full Screen

...53 self.unselect()54 def _update_ellipse(self, *args):55 self.background_ellipse.pos = self.pos56 self.background_ellipse.size = self.size57 def _update_line(self, *args):58 if self.selected:59 self.line.rectangle = (60 self.x - 5,61 self.y - 5,62 self.width + 10,63 self.height + 10,64 )65 else:66 self.line.rectangle = (self.x, self.y, 0, 0)67 def _update_icon(self, *args):68 if self.sensor_icon:69 self.sensor_icon.center = self.center70 def set_background_image(self, image_path: str):71 if self.sensor_icon:72 self.remove_widget(self.sensor_icon)73 self.sensor_icon = SensorIcon(74 image_path,75 size_hint=[0.85, 0.85],76 pos_hint={"center_x": 0.5, "center_y": 0.5},77 )78 self.add_widget(self.sensor_icon)79 self.bind(pos=self._update_icon, size=self._update_icon)80 def _add_name_label(self):81 self._remove_name_label()82 self.label = Label(83 text=f"[color=000000]{self.sensor_name}[/color]",84 pos_hint={"center_x": 0.5, "center_y": -0.1},85 markup=True,86 )87 self.add_widget(self.label)88 def _remove_name_label(self):89 if self.label:90 self.remove_widget(self.label)91 def get_data(self):92 return {93 "x": self.pos[0],94 "y": self.pos[1],95 "width": self.size[0],96 "height": self.size[1],97 "type": self.sensor.get_sensor_type().name,98 "topic": self.sensor.get_sensor_id(),99 }100 def select(self):101 self.selected = True102 self._update_line()103 self._update_ellipse()104 def unselect(self):105 self.selected = False106 self._update_line()107 self._update_ellipse()108 def show_popup_window(self):109 content, button = self.get_popup_window_content()110 popup = Popup(111 title="Sensor Details",112 content=content,113 size_hint=(None, None),114 size=content.size,115 auto_dismiss=False,116 )117 button.bind(on_press=popup.dismiss)118 button.bind(on_press=popup.dismiss)119 popup.open()120 @abstractmethod...

Full Screen

Full Screen

mlplotter.py

Source:mlplotter.py Github

copy

Full Screen

...37 self.val_lines[name] = ax.plot([], [], color=d['color'], linestyle='--')[0]38 ax.legend()39# self.f.canvas.draw()40# plt.pause(0.01)41 def _update_line(self, line, new_x, new_y):42 xdata, ydata = line.get_xdata(), line.get_ydata()43 xdata = np.concatenate((xdata, [new_x]))44 ydata = np.concatenate((ydata, [new_y]))45 line.set_xdata(xdata)46 line.set_ydata(ydata)47 ax = line.axes48 ax.relim()49 ax.autoscale_view()50 ax.set_ylim([0, 1])51 def add_train(self, name, training_samples, value):52 self._update_line(self.train_lines[name], training_samples, value)53 def add_val(self, name, value):54 xdata = self.train_lines[name].get_xdata()55 self._update_line(self.val_lines[name], xdata[-1] if len(xdata) > 0 else 0, value)56 def plot(self):57 self.f.canvas.draw()58 plt.pause(0.01)59 def save(self, save_dir, suffix=""):60 fig_name = "training_{0}.png".format(suffix)61 pkl_name = "plotter_{0}.pkl".format(suffix)62 self.f.savefig(os.path.join(save_dir, fig_name))63 with open(os.path.join(save_dir, pkl_name), 'w') as f:64 pickle.dump(dict([(k, (v.get_xdata(), v.get_ydata())) for k, v in self.train_lines.items()] +65 [(k, (v.get_xdata(), v.get_ydata())) for k, v in self.val_lines.items()]),66 f)67 def close(self):...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful