PS V:\Workspace\System-Simulator> git diff
diff --git a/.gitignore b/.gitignore
index 015e55e..073c487 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,4 @@
__pycache__/**
.deltallm/**
docs/plans/**
-_circuit_preview.png
-_prev_*.png
-
+.ignore/**
diff --git a/circuit_canvas.py b/circuit_canvas.py
index 98a46f6..d2ffda2 100644
--- a/circuit_canvas.py
+++ b/circuit_canvas.py
@@ -63,9 +63,9 @@ class Layout:
S3_Y_TOP: float = 135.0
S3_Y_BOT: float = 180.0
# battery box
- BATT_CY: float = 270.0
- BATT_W: float = 180.0
- BATT_H: float = 100.0
+ BATT_CY: float = 300.0
+ BATT_W: float = 100.0
+ BATT_H: float = 150.0
# labels
SRC_LBL_X: float = 320.0
SRC_LBL_Y: float = 300.0
@@ -74,18 +74,18 @@ class Layout:
# current arrows + labels
SRC_ARROW_LEAD_Y: float = 150.0
SRC_ARROW_RET_Y: float = 350.0
- SRC_ARROW_LBL_DY: float = 34.0
+ SRC_ARROW_LBL_DY: float = 60.0
SRC_RAIL_ARROW_X: float = 470.0
LOAD_ARROW_LEAD_Y: float = 150.0
LOAD_ARROW_RET_Y: float = 350.0
- LOAD_ARROW_LBL_DY: float = -34.0
+ LOAD_ARROW_LBL_DY: float = -60.0
LOAD_RAIL_ARROW_X: float = 660.0
BAT_ARROW_TOP_Y: float = 112.0
BAT_ARROW_MID_Y: float = 200.0
- BAT_ARROW_BOT_Y: float = 370.0
- BAT_ARROW_LBL_DY: float = 40.0
+ BAT_ARROW_BOT_Y: float = 390.0
+ BAT_ARROW_LBL_DY: float = 60.0
# node A label (offset above the top rail)
- NODE_LBL_DY: float = -44.0
+ NODE_LBL_DY: float = -30.0
LAYOUT = Layout()
@@ -369,16 +369,19 @@ def _battery_branch(s, view=None):
top = cy - L.BATT_H / 2
bot = cy + L.BATT_H / 2
out = []
+
# wires: node A -> S3 (top), S3 -> box top, box(-) -> ground
out.append(_line(L.X_BAT, L.Y_TOP, L.X_BAT, L.S3_Y_TOP, on, view=view))
out.append(_line(L.X_BAT, L.S3_Y_BOT, L.X_BAT, top, on, view=view))
out.append(_line(L.X_BAT, bot, L.X_BAT, L.Y_BOT, on, view=view))
+
out.append(_rect(cx - L.BATT_W / 2, top, L.BATT_W, L.BATT_H, col, 2.4,
view=view))
- out.append(_text(cx, top + 14, "+", 15, col, ft.FontWeight.BOLD,
+ out.append(_text(cx, top + 10, "+", 15, col, ft.FontWeight.BOLD,
view=view))
- out.append(_text(cx, bot - 12, "−", 15, col, ft.FontWeight.BOLD,
+ out.append(_text(cx, bot - 10, "−", 15, col, ft.FontWeight.BOLD,
view=view))
+
# SOC bar
soc = max(0.0, min(100.0, s.soc_pct))
bar_w = L.BATT_W - 60
@@ -388,7 +391,7 @@ def _battery_branch(s, view=None):
fill_col = C_GREEN if soc > 20 else (C_AMBER if soc > 10 else C_RED)
out.append(_fill_rect(cx - bar_w / 2, cy - 8, bar_w * soc / 100.0,
14, fill_col, view=view))
- out.append(_text(cx, cy - 22, f"BATTERY {s.num_cells}S "
+ out.append(_text(cx, top + 35, f"BATTERY\n{s.num_cells}S "
f"{s.capacity_ah:g} Ah", 15, C_TEXT,
ft.FontWeight.BOLD, view=view))
out.append(_text(cx, cy + 30, f"SOC {soc:.0f}% SOH {s.soh_pct:g}%",
@@ -443,7 +446,7 @@ def _current_arrows(s, view=None):
view=view))
out.append(_arrow(L.X_SRC, L.SRC_ARROW_RET_Y, 0, -1 if up else 1, c,
view=view))
- out.append(_text(L.X_SRC + 34, L.SRC_ARROW_LEAD_Y,
+ out.append(_text(L.X_SRC + L.SRC_ARROW_LBL_DY, L.SRC_ARROW_LEAD_Y,
f"I = {abs(s.i_source):.1f} A", 20, c,
ft.FontWeight.BOLD, view=view))
if abs(s.i_load) > 1e-9:
@@ -455,7 +458,7 @@ def _current_arrows(s, view=None):
view=view))
out.append(_arrow(L.X_LOAD, L.LOAD_ARROW_RET_Y, 0, 1 if dn else -1, c,
view=view))
- out.append(_text(L.X_LOAD - 34, L.LOAD_ARROW_LEAD_Y,
+ out.append(_text(L.X_LOAD + L.LOAD_ARROW_LBL_DY, L.LOAD_ARROW_LEAD_Y,
f"I = {abs(s.i_load):.1f} A", 20, c,
ft.FontWeight.BOLD, view=view))
if abs(s.i_battery) > 1e-9:
Duplicate Check
Describe the bug
Please refer the screenshots/video section below. The video shows the flashing behavior I have experienced. I have uploaded a zip file and pasted a diff of changes I was making one-by-one while saving regularly, when the issue re-surfaced. I have experienced the same behavior with
flet runin another project I developed, and on a different machine, so it is not an individual instance.Note: The flashing does not start immediately; it starts randomly after few minutes of making changes. The video was made after the flashing started.
Code sample
Code
battery-system-simulator.zip
The zip file contains the complete code that I have tested with. I made the following changes by hand one by one and saving in batches when I experienced this.
To reproduce
flet run -d -r --ignore-dirs "$((Get-Content .\.gitignore) -join ',')" .\bench_gui.py(without .gitignore if none is there).Expected behavior
Please refer the videos for the bug demo.
Screenshots / Videos
Captures
Both videos are from my current project. The first one is the first time I tested and observed the flashing in this project. The second one starts from the beginning of running the command in PowerShell and has verbose logs as well at the end. The logs are copied in the logs section.
Screen.Recording.2026-10-04.151111.mp4
bug.mp4
Operating System
Windows
Operating system details
Microsoft Windows NT 10.0.22631.0
Flet version
1.0.3
Regression
Yes, it used to work in a previous Flet version (please specify the version in additional details)
Suggestions
The hot-reload session seems to be getting killed out. Start there.
PS: Good Work!!
Logs
Logs
Additional details
Flet previously used: 0.85.3.