arxanas / plover_wpm_meter

WPM meter plugin for the Plover stenography system
6 stars 2 forks source link

The dropdown list closes immediately but is still active if clicked once Plover input has started #8

Open nsmarkop opened 6 years ago

nsmarkop commented 6 years ago

If you open the WPM meter you can freely select from the dropdown list as expected. However, once you start typing and try to change the selection it closes immediately. If you click where the selection would have been if the list hadn't closed then you are still able to select that entry. Closing and reopening the WPM meter seems to be the only way to resolve this behavior.

I'm on Windows 10 with Plover 4.0.0.dev6 and version 0.1.1 of the plugin.

A gif of the issue:

plover_wpm_meter_dropdown

arxanas commented 6 years ago

This is pretty unusual behavior; there shouldn't be anything in the code that focuses the drop-down when you type text, for example. Does the problem go away if you let both counts drop back to 0?

I can't reproduce it on my macOS computer. When I start typing, I can still select from the drop-down menu fine. It suggests to me that it might be a Qt bug. @benoit-pierre @morinted: have either of you seen behavior like this in Qt widgets?

nsmarkop commented 6 years ago

Letting both counters drop back down to 0 doesn't resolve the issue. Though, I just went back to reproduce it again and by shrinking the window size I found it's actually putting the dropdown behind the window itself - it's not just closing / disappearing. Weird.

plover_wpm_meter_dropdown_behind

arxanas commented 6 years ago

I see. Are you able to build from source? You could try adding a raise_ call after rendering the LCD displays to see if it fixes the issue. (Admittedly, I don't see why that would change things; we're re-rendering it every 1s regardless of whether its value has changed. Similarly, our pinning the window to the top should only have happened once at startup, so it shouldn't change when you start typing.)

nsmarkop commented 6 years ago

I can install it from source, but I'm not familiar with QT at all to really know what the call is / where to add it and Python isn't the most helpful language for discovery there. If you can point out the exact changes I can go ahead and try them out to see if they help at all.

arxanas commented 6 years ago

You can apply this patch:

diff --git a/plover_wpm_meter/__init__.py b/plover_wpm_meter/__init__.py
index 4c2ab1e..7c1db5a 100644
--- a/plover_wpm_meter/__init__.py
+++ b/plover_wpm_meter/__init__.py
@@ -81,6 +81,7 @@ class PloverWpmMeter(BaseMeter, Ui_WpmMeter):
             chars = _filter_old_items(self.chars, timeout)
             wpm = _wpm_of_chars(chars, method=self.wpm_method.currentData())
             getattr(self, name).display(str(wpm))
+        self.wpm_method.raise_()

 class PloverStrokesMeter(BaseMeter, Ui_StrokesMeter):
@@ -126,6 +127,7 @@ class PloverStrokesMeter(BaseMeter, Ui_StrokesMeter):
                 method=self.strokes_method.currentData()
             )
             getattr(self, name).display("{:0.2f}".format(strokes_per_word))
+        self.strokes_method.raise_()

 def _timestamp_items(items):
nsmarkop commented 6 years ago

I couldn't apply that as a patch for some reason, but I made the changes manually and it didn't seem to change any of the behavior after installing the modified plugin (I verified it was running the new code).