ncssar / radiolog

SAR radio log program
Other
13 stars 3 forks source link

redraw sidebar immediately on every team status change or hide/unhide #715

Closed caver456 closed 6 months ago

caver456 commented 6 months ago

Currently, changes to the status or hidden state of a team aren't reflected in the sidebar until the next clock tick after the sidebar is shown.

In other words: for the first second of sidebar visibility, the previous team status colors and team hidden state is shown; then after a second, the sidebar updates itself.

This can lead to confusion. Instead, redraw the sidebar immediately, while it is still hidden.

This issue is in the gray area between bug and enhancement. Leaning towards 'bug'.

caver456 commented 6 months ago

Also noticed that getExtTeamName is called for every team once per second when the sidebar is visible.

caver456 commented 6 months ago

The lag is because teamTabsPopup.resizeEvent is called during updateTeamTimers but only if sidebarIsVisible is True.

.resizeEvent calls .redraw, which looks expensive. Is there a way to only call the relevant parts of it, or only call it on certain triggers like new team, team tab hide / unhide, and status change?

caver456 commented 6 months ago

Checking dict equality of teamStatusDict every second (versus a copy made a second prior) would be sufficient, but seems expensive. See this post. Instead, maybe add a trigger wherever teamStatusDict is changed, which is apparently only in two places in the code: 4797 (newEntryProcessTeam) and 8010 (setStatusFromButton).

Call the same trigger from addTab and deleteTab. Maybe that covers everything?

caver456 commented 6 months ago

Changing the full redraw from every-tick to as-needed means that sidebar blink needs to become its own function (or called by argument inside sidebar.redraw) so it can happen every tick. Dilemma: to update blink colors in the sidebar every second only when the sidebar is visible, which will cause a lag until the next tick after showing, or to update on every tick regardless of visibility, which is more expensive but eliminates the tick-lag upon showing.

caver456 commented 6 months ago

Moved color and blink handling to separate function setTeamTableColors; pass extTeamName as QTableWidgetItem.whatsThis to reduce reliance on dict lookups - hoping this will be faster / less expensive, but, didn't actually do any profiling. With 50 teams, radiolog still only shows 0.2% CPU usage.