|
2 | 2 | # |
3 | 3 | # SPDX-License-Identifier: MIT |
4 | 4 |
|
5 | | -import base64 |
6 | 5 | from pathlib import Path |
7 | 6 | from typing import Any, Optional, Union |
8 | 7 |
|
9 | 8 | from wokwi_client.framebuffer import ( |
10 | | - compare_framebuffer_png, |
11 | | - framebuffer_png_bytes, |
12 | | - framebuffer_read, |
| 9 | + read_framebuffer_png_bytes, |
13 | 10 | save_framebuffer_png, |
14 | 11 | ) |
15 | 12 |
|
16 | 13 | from .__version__ import get_version |
17 | 14 | from .constants import DEFAULT_WS_URL |
18 | 15 | from .control import set_control |
19 | 16 | from .event_queue import EventQueue |
20 | | -from .file_ops import download, upload, upload_file |
| 17 | +from .file_ops import upload, upload_file |
21 | 18 | from .pins import pin_listen, pin_read |
22 | 19 | from .protocol_types import EventMessage, ResponseMessage |
23 | 20 | from .serial import monitor_lines, write_serial |
@@ -94,34 +91,6 @@ async def upload_file( |
94 | 91 | """ |
95 | 92 | return await upload_file(self._transport, filename, local_path) |
96 | 93 |
|
97 | | - async def download(self, name: str) -> bytes: |
98 | | - """ |
99 | | - Download a file from the simulator. |
100 | | -
|
101 | | - Args: |
102 | | - name: The name of the file to download. |
103 | | -
|
104 | | - Returns: |
105 | | - The downloaded file content as bytes. |
106 | | - """ |
107 | | - result = await download(self._transport, name) |
108 | | - return base64.b64decode(result["result"]["binary"]) |
109 | | - |
110 | | - async def download_file(self, name: str, local_path: Optional[Path] = None) -> None: |
111 | | - """ |
112 | | - Download a file from the simulator and save it to a local path. |
113 | | -
|
114 | | - Args: |
115 | | - name: The name of the file to download. |
116 | | - local_path: The local path to save the downloaded file. If not provided, uses the name as the path. |
117 | | - """ |
118 | | - if local_path is None: |
119 | | - local_path = Path(name) |
120 | | - |
121 | | - result = await self.download(name) |
122 | | - with open(local_path, "wb") as f: |
123 | | - f.write(result) |
124 | | - |
125 | 94 | async def start_simulation( |
126 | 95 | self, |
127 | 96 | firmware: str, |
@@ -270,22 +239,10 @@ async def set_control( |
270 | 239 | """ |
271 | 240 | return await set_control(self._transport, part=part, control=control, value=value) |
272 | 241 |
|
273 | | - async def framebuffer_read(self, id: str) -> ResponseMessage: |
274 | | - """Read the current framebuffer for the given device id.""" |
275 | | - return await framebuffer_read(self._transport, id=id) |
276 | | - |
277 | | - async def framebuffer_png_bytes(self, id: str) -> bytes: |
| 242 | + async def read_framebuffer_png_bytes(self, id: str) -> bytes: |
278 | 243 | """Return the current framebuffer as PNG bytes.""" |
279 | | - return await framebuffer_png_bytes(self._transport, id=id) |
| 244 | + return await read_framebuffer_png_bytes(self._transport, id=id) |
280 | 245 |
|
281 | 246 | async def save_framebuffer_png(self, id: str, path: Path, overwrite: bool = True) -> Path: |
282 | 247 | """Save the current framebuffer as a PNG file.""" |
283 | 248 | return await save_framebuffer_png(self._transport, id=id, path=path, overwrite=overwrite) |
284 | | - |
285 | | - async def compare_framebuffer_png( |
286 | | - self, id: str, reference: Path, save_mismatch: Optional[Path] = None |
287 | | - ) -> bool: |
288 | | - """Compare the current framebuffer with a reference PNG file.""" |
289 | | - return await compare_framebuffer_png( |
290 | | - self._transport, id=id, reference=reference, save_mismatch=save_mismatch |
291 | | - ) |
0 commit comments