def makeField(self, imageURL, drawPoints): self.fieldSvg.set_viewbox(0, 0, self.fieldWidth, self.fieldHeight) self.fieldSvg.set_size(self.fieldWidth, self.fieldHeight) self.fieldSvg.set_on_mousedown_listener(self.mouse_down_listener) self.image = gui.SvgImage(imageURL, 0, 0, self.fieldWidth, self.fieldHeight) self.fieldSvg.append(self.image) if drawPoints: self.targetPoints = coordinates.targetPoints for point in self.targetPoints: point = fieldToSvgCoordinates(point.x, point.y, self.fieldWidth, self.fieldHeight, self.fieldPixelsPerFoot) wp_dot = gui.SvgCircle(point[0], point[1], 5) wp_dot.attributes['fill'] = 'green' self.fieldSvg.append(wp_dot) self.cursorArrow = Arrow('red', self.fieldWidth, self.fieldHeight, self.fieldPixelsPerFoot) self.fieldSvg.append(self.cursorArrow) self.robotArrow = Arrow('green', self.fieldWidth, self.fieldHeight, self.fieldPixelsPerFoot) self.fieldSvg.append(self.robotArrow)
def test_init(self): widget = gui.SvgImage(filename='food.png', x=10, y=10, w=10, h=10) assertValidHTML(widget.repr())