Closed nneul closed 2 years ago
Commenting out both the icon and tooltip updates clears symptom - but obviously breaks ui function.
This addresses most of the flashing for me, with caveat that it disables the tooltip status update too, but still less visually irritating.
diff --git a/proximity.py b/proximity.py
index b791961..8e6b295 100755
--- a/proximity.py
+++ b/proximity.py
@@ -329,6 +329,7 @@ class ProximityGUI(object):
self.icon = XApp.StatusIcon()
self.icon.set_tooltip_text(_("BlueProximity starting..."))
self.icon.set_icon_name(dist_path + icon_error)
+ self.last_icon_name = dist_path + icon_error
# self.icon.connect('activate', self.showWindow)
# self.icon.connect('popup-menu', self.popupMenu, self.popupmenu)
@@ -950,7 +951,9 @@ class ProximityGUI(object):
if self.pauseMode:
from gi.repository import GdkPixbuf
# GdkPixbuf.Pixbuf.new_from_file(dist_path + icon_pause)
- self.icon.set_icon_name(dist_path + icon_pause)
+ if self.last_icon_name != dist_path + icon_pause:
+ self.icon.set_icon_name(dist_path + icon_pause)
+ self.last_icon_name = dist_path + icon_pause
self.icon.set_tooltip_text(_('Pause Mode - not connected'))
else:
@@ -977,8 +980,10 @@ class ProximityGUI(object):
simu = _('\nSimulation Mode (locking disabled)')
else:
simu = ''
- self.icon.set_icon_name(dist_path + con_icons[connection_state])
- self.icon.set_tooltip_text(con_info + '\n' + simu)
+ if self.last_icon_name != dist_path + con_icons[connection_state]:
+ self.icon.set_icon_name(dist_path + con_icons[connection_state])
+ self.last_icon_name = dist_path + con_icons[connection_state]
+ #self.icon.set_tooltip_text(con_info + '\n' + simu)
# print("self.proxi.Simulate is: {}".format(self.proxi.Simulate))
from gi.repository import GLib as glib
self.timer = glib.timeout_add(1000, self.updateState)
Probably should just do the same last_tooltip_text, and then it would only flash when the distance changed.
Hi @nneul, Thanks for reaching out and sorry for the late reply. I'm not seeing any flashing icon myself so I don't really know what you're experiencing. Could you perhaps attach a picture or provide a small video about it, please? Maybe it relates to your desktop environment? What are you using? KDE? Gnome? Something else?
Cheers, Rigo
Running XFCe on Ubuntu 20. Will try to capture a video when I'm back in office. From some various googling, it does appear that other apps have seen this behavior with the set_icon_name and set_tooltip_text calls with no clear resolution -- so it may just be that the best "fix" is minimizing the behavior as opposed to eliminating it.
Hi again :vulcan_salute:
I know now what you were experiencing! And it's quite puzzling, as It only showed up now when I started testing a new feature: building an AppImage for BlueProximity. The odd thing is that it's exactly the same code base, and when I run it directly on my system works fine. No flashing icon at all. But when I ran the AppImage I clearly saw what you reported. So, now I can investigate the problem.
I'll let you know when I find a fix for it.
Cheers, Rigo
Cool. I figure at the very least, maintaining a variable for 'last set state' would allow reducing the number of UI updates issued against those icons/helptext, minimizing the symptom (and probably reducing overall wasted cpu doing those updates). Let me know if you need a branch tested.
Hey @nneul,
I've created an AppImage package for the application and it seems to not have the problem anymore. In fact, after last time, when I commented above, the icon hasn't flashed again. Would you mind trying the AppImage and letting me know if the problem still persists, please?
You can find the package on its release page: https://github.com/tiktaalik-dev/blueproximity/releases/tag/v1.3.3
Cheers, Rigo
Still blinking away for me unfortunately.
I'm closing this issue as I haven't been able to reproduce the problem again after creating the AppImage package. In case you have something else to report, please feel free to reopen it. Cheers.
I'm getting a flashing (shows then disappears) matching the interval set here:
glib.timeout_add(500, self.updateState)
I'm getting
(proximity.py:3367389): Gdk-CRITICAL **: 13:42:33.029: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
at the same time.
Adding some tracing to updateState - the alert for gdk is not happening until a delay AFTER the updateState runs, but that may be due to event loop handling.
Any ideas?