rules: fix debug messages for MouseClick rule

This commit is contained in:
Peter F. Patel-Schneider 2025-10-23 09:58:09 -04:00
parent 96adf6a026
commit b96d0bbe0b
3 changed files with 10 additions and 7 deletions

View File

@ -245,7 +245,8 @@ If the previous condition in the parent rule returns a number the scroll amounts
### Mouse click
A `MouseClick` action takes a mouse button name (`left`, `middle` or `right`) and a positive number or 'click', 'depress', or 'release'.
The action simulates that number of clicks of the specified button or just one click, depress, or release of the button.
A `MouseClick` action takes a mouse button name (`left`, `middle` or `right`) and a positive number, and simulates that number of clicks of the specified button.
### Execute
An `Execute` action takes a program and arguments and executes it asynchronously.
### Set setting

View File

@ -1321,17 +1321,17 @@ class MouseClick(Action):
self.count = count
elif warn:
logger.warning(
"rule MouseClick action: argument %s should be an integer or CLICK, PRESS, or RELEASE",
"rule MouseClick action: argument %s should be an integer or click, depress, or release",
count,
)
self.count = 1
def __str__(self):
return f"MouseClick: {self.button} ({int(self.count)})"
return f"MouseClick: {self.button} ({str(self.count)})"
def evaluate(self, feature, notification: HIDPPNotification, device, last_result):
if logger.isEnabledFor(logging.INFO):
logger.info(f"MouseClick action: {int(self.count)} {self.button}")
logger.info(f"MouseClick action: {str(self.count)} {self.button}")
if self.button and self.count:
click(buttons[self.button], self.count)
time.sleep(0.01)

View File

@ -214,7 +214,9 @@ class MouseClickUI(ActionUI):
)
self.widgets[self.label] = (0, 0, 4, 1)
self.label_b = Gtk.Label(label=_("Button"), halign=Gtk.Align.END, valign=Gtk.Align.CENTER, hexpand=True)
self.label_c = Gtk.Label(label=_("Count and Action"), halign=Gtk.Align.END, valign=Gtk.Align.CENTER, hexpand=True)
self.label_c = Gtk.Label(
label=_("Action (and Count, if click)"), halign=Gtk.Align.END, valign=Gtk.Align.CENTER, hexpand=True
)
self.field_b = CompletionEntry(self.BUTTONS)
self.field_c = Gtk.SpinButton.new_with_range(self.MIN_VALUE, self.MAX_VALUE, 1)
self.field_d = CompletionEntry(self.ACTIONS)
@ -227,8 +229,8 @@ class MouseClickUI(ActionUI):
self.widgets[self.label_b] = (0, 1, 1, 1)
self.widgets[self.field_b] = (1, 1, 1, 1)
self.widgets[self.label_c] = (2, 1, 1, 1)
self.widgets[self.field_c] = (3, 1, 1, 1)
self.widgets[self.field_d] = (4, 1, 1, 1)
self.widgets[self.field_c] = (4, 1, 1, 1)
self.widgets[self.field_d] = (3, 1, 1, 1)
def show(self, component, editable=True):
super().show(component, editable)