Ejemplo n.º 1
0
 def paint(self):
     log_paint.debug(
         f"DiagnosticLine::paint() {self.x} x {self.y} {self.len}")
     self.display.draw.rectangle((0, 0, self.display.mx, self.display.my),
                                 fill=config.BG,
                                 outline=config.BG)
     self.display.draw.line(((self.x, self.y), (self.x + self.len, self.y)),
                            fill=config.FG)
Ejemplo n.º 2
0
 def paint(self):
     log_paint.debug(f"TextView::paint() {self.x} x {self.y} {self.size}")
     self.display.draw.rectangle((0, 0, self.display.mx, self.display.my),
                                 fill=config.BG,
                                 outline=config.BG)
     self.display.draw.text((self.tx, self.ty),
                            self.text,
                            font=self.font,
                            fill=config.FG)
Ejemplo n.º 3
0
 def paint(self):
     log_paint.debug("ClockView::paint()")
     # Background
     self.display.draw.rectangle((0, 0, self.display.mx, self.display.my),
                                 fill=config.BG,
                                 outline=config.FG)
     # Clock
     clock_text = self._clock_text()
     text_width, text_height = self.display.draw.textsize(clock_text,
                                                          font=self.font)
     self.display.draw.text((self.display.cx - text_width // 2,
                             self.display.cy - text_height // 2),
                            clock_text,
                            font=self.font,
                            fill=config.FG)
     View.paint(self)
     self.last_clock_text = clock_text
Ejemplo n.º 4
0
 def paint(self):
     log_paint.debug("MovingBall::paint()")
     # Background
     bounds = ((self.x - self.radius, self.y - self.radius), (self.x + self.radius, self.y + self.radius))
     self.display.draw.rectangle((0, 0, self.display.mx, self.display.my), fill=config.BG, outline=config.FG)
     self.display.draw.ellipse(bounds, fill=config.FG, width=self.radius)
     self.display.draw.rectangle(bounds, outline=config.FG)
     self.display.draw.line(((self.x, self.y - self.radius), (self.x, self.y + self.radius)), fill=config.BG)
     self.display.draw.line(((self.x - self.radius, self.y), (self.x + self.radius, self.y)), fill=config.BG)
     crtext = f"[{self.x},{self.y}]"
     cx, cy = self.display.draw.textsize(crtext, font=self.font)
     self.display.draw.text((0, 0), crtext, font=self.font, fill=config.FG)
     self.display.draw.text((0, cy + 1), crtext, font=self.font, fill=config.BG)
     self.display.draw.text((self.display.mx - cx, 0), crtext, font=self.font, fill=config.FG)
     self.display.draw.text((self.display.mx - cx, cy + 1), crtext, font=self.font, fill=config.BG)
     self.display.draw.text((0, self.display.my - 2 * cy - 2), crtext, font=self.font, fill=config.FG)
     self.display.draw.text((0, self.display.my - cy - 1), crtext, font=self.font, fill=config.BG)
     self.display.draw.text((self.display.mx - cx, self.display.my - 2 * cy - 2), crtext, font=self.font, fill=config.FG)
     self.display.draw.text((self.display.mx - cx, self.display.my - cy - 1), crtext, font=self.font, fill=config.BG)
Ejemplo n.º 5
0
 def render(self):
     if config.USE_EMU and not self.is_painting.get():
         log_paint.debug("Emu::render()")
         self.is_painting.set(True)
         self.window.clear()
         # Extract pixels as vraw
         pil_buf = self.get_vraw_image(
         ) if self._external_frame_source is None else self._external_frame_source(
         )
         # Create a linear buffer to hold expanded pyglet-L pixels
         lin_buf = [0 for i in range(len(pil_buf) * 8)]
         BITS = [0, 1, 2, 3, 4, 5, 6, 7]
         # Transform V-packed pixels to linear buffer
         for i in range(len(pil_buf)):
             x = i % config.WIDTH
             page = (i // config.WIDTH) * 8
             mask = 0x01
             for b in BITS:
                 y = page + b
                 lin_buf[(y * config.WIDTH) +
                         x] = 255 if pil_buf[i] & mask else 0
                 mask <<= 1
         # Make it a byte-string
         frame = pack(f">{len(lin_buf)}B", *lin_buf)
         # Create a pyglet image from it
         image = pyglet.image.ImageData(self.pilimg.width,
                                        self.pilimg.height,
                                        'L',
                                        frame,
                                        pitch=-self.pilimg.width * 1)
         image.anchor_x = image.width // 2
         image.anchor_y = image.height // 2
         self.background.blit_tiled(0, 0, 0, self.window.width,
                                    self.window.height)
         image.blit(self.window.width // 2, self.window.height // 2)
         self.fps_display.draw()
         self.is_painting.set(False)
Ejemplo n.º 6
0
 def paint(self):
     log_paint.debug("View::paint()")
     self.display.paint()
Ejemplo n.º 7
0
 def paint(self):
     log_paint.debug("Manager::paint()")
     with self.current.display.mutex_disp:
         self._paint()
Ejemplo n.º 8
0
 def paint(self):
     log_paint.debug(f"RicoBall::paint() {self.x} x {self.y} {self.a} {self.v}")
     with self.display.mutex_disp:
         bounds = ((self.x - self.r, self.y - self.r), (self.x + self.r, self.y + self.r))
         self.display.draw.rectangle((0, 0, self.display.mx, self.display.my), fill=config.BG, outline=config.FG)
         self.display.draw.ellipse(bounds, fill=config.FG if self.filled else None, outline=config.FG, width=1)
Ejemplo n.º 9
0
 def paint(self):
     log_paint.debug("Saat::paint()")