It makes very little sense to do a format string for nothing but zeroes
in case of unknown values. Simply return a set of 'NA' strings in place
of usual stats. This makes the error cases consistent throughout
Stats.py
The values that are displayed in the HUD box included the '%' symbol if
these values were percentages. This clutters the HUD for those who don't
need such extra characters.
This patch removes the trailing '%' from result[1]. The default
formatting for HUD values is '%3.1f' and if decimal places need to be
changed, the code for those is now simpler. A user who wishes to show a
percent symbol after any given stat value, can edit HUD_config.xml and
assign such stats the hudsuffix="%" attribute.
This patch also changes the way the tooltip strings are constructed.
Instead of appending the percent symbol to generated string, the '%' is
now generated in place by the format-string stanza '%%'.
This fixes the FPDB main window visibility with window managers that use
workspaces instead of virtual desktop(s). On such a system the
application receives WINDOW_STATE_ICONIFIED event when the workspace is
switched. This hides the window.
It wouldn't be too big a problem if the window wouldn't occasionally get
stuck in a "hide-me-loop", where any attempt to unhide/present the
window again triggers the hide routine. The two state events, _ICONIFIED
and _WITHDRAWN are not the same or even mutually exclusive. As such the
old event mask test simply did not cover all the possibilities.
Also, the property 'visible' does not necessarily match reality. It can
be set to true for iconified windows, and false to a visible window. So
a better solution is to not rely on the property, but just track the
wanted visibility state in our own code.
After this simple refactoring, the application window finally seems to
behave properly. [Also, widget.present() automatically calls .show(), so
we can kill one redundant operation.]