step 8: harden docs and prepare rebuilt beta
This commit is contained in:
@@ -21,17 +21,39 @@ def main() -> None:
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map cache stress", width=1000, height=700)
|
||||
|
||||
def clear_memory() -> None:
|
||||
dpgm.clear_memory_cache(map_tag="cache-map")
|
||||
|
||||
def clear_disk() -> None:
|
||||
dpgm.clear_disk_cache(map_tag="cache-map")
|
||||
|
||||
def refresh_stats() -> None:
|
||||
stats = dpgm.get_cache_stats(map_tag="cache-map")
|
||||
dpg.set_value(
|
||||
"cache-stats",
|
||||
(
|
||||
f"memory {stats.memory_tiles}/{stats.memory_max_tiles} tiles | "
|
||||
f"disk {stats.disk_bytes // 1024} KiB | "
|
||||
f"hits m:{stats.memory_hits} d:{stats.disk_hits}"
|
||||
),
|
||||
)
|
||||
|
||||
with (
|
||||
dpg.window(label="Cache Stress", width=-1, height=-1),
|
||||
dpgm.map_widget(
|
||||
):
|
||||
with dpg.group(horizontal=True):
|
||||
dpg.add_button(label="Clear Memory", callback=clear_memory)
|
||||
dpg.add_button(label="Clear Disk", callback=clear_disk)
|
||||
dpg.add_button(label="Stats", callback=refresh_stats)
|
||||
dpg.add_text("", tag="cache-stats")
|
||||
with dpgm.map_widget(
|
||||
tag="cache-map",
|
||||
center=(47.9029, 1.9093),
|
||||
zoom=14,
|
||||
width=-1,
|
||||
height=-1,
|
||||
),
|
||||
):
|
||||
dpgm.add_marker("start", lat=47.9029, lon=1.9093, label="Orleans")
|
||||
):
|
||||
dpgm.add_marker("start", lat=47.9029, lon=1.9093, label="Orleans")
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
|
||||
Reference in New Issue
Block a user