Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTK GUI: Setting custom "Trigger on" value in the Abbreviations settings dialog broken #315

Closed
luziferius opened this issue Oct 22, 2019 · 0 comments
Labels
autokey triggers Issues related to hotkeys, abbreviations, window filters, etc. autokey-gtk user interface Issues related to the user interface

Comments

@luziferius
Copy link
Collaborator

luziferius commented Oct 22, 2019

Classification:

Bug

Reproducibility:

Always

Version

AutoKey version: 0.95.7

Used GUI (Gtk, Qt, or both): GTK

If the problem is known to be present in more than one version, please list all of those.

Installed via: Self-built packages

Linux Distribution: Kubuntu 19.04

Summary

Setting a custom regular expression for Trigger on in the Abbreviation settings dialogue window triggers an exception instead of working as expected

Steps to Reproduce (if applicable)

  • Open GUI
  • Click on Set button to the right of the assigned Abbreviations.
  • In the opened dialogue window, enter something in the Trigger on: editable combo box, replacing the default All non-word.
  • Add an Abbreviation to the list (any will do).
  • Hit OK

Expected Results

  • Custom trigger on mode should be saved

Actual Results

  • Instead, this is printed on the console and the custom value is not saved:
Traceback (most recent call last):
  File "/mnt/Daten/Projekte/autokey/lib/autokey/gtkui/configwindow.py", line 1389, in on_tree_selection_changed
    self.phrasePage.load(selectedObject)
  File "/mnt/Daten/Projekte/autokey/lib/autokey/gtkui/configwindow.py", line 651, in load
    self.settingsWidget.load(thePhrase)
  File "/mnt/Daten/Projekte/autokey/lib/autokey/gtkui/configwindow.py", line 141, in load
    self.abbrDialog.load(self.currentItem)
  File "/mnt/Daten/Projekte/autokey/lib/autokey/gtkui/dialogs.py", line 164, in load
    self.wordCharCombo.append_text(model.extract_wordchars(wordCharRegex).encode("utf-8"))
TypeError: Must be string, not bytes

When manually editing the .json file on disk, this traceback is produced in addition:

Traceback (most recent call last):
  File "/mnt/Daten/Projekte/autokey/lib/autokey/gtkui/dialogs.py", line 76, in on_cancel
    self.load(self.targetItem)
  File "/mnt/Daten/Projekte/autokey/lib/autokey/gtkui/dialogs.py", line 164, in load
    self.wordCharCombo.append_text(model.extract_wordchars(wordCharRegex).encode("utf-8"))
TypeError: Must be string, not bytes

Notes

The absolute file paths in the traceback above result from me running the GTK GUI from the local git checkout.

Probably the .encode() call is superfluous and should be dropped. This is a relic from the Python 2 era?

@luziferius luziferius added autokey-gtk user interface Issues related to the user interface autokey triggers Issues related to hotkeys, abbreviations, window filters, etc. labels Oct 22, 2019
luziferius added a commit to luziferius/autokey that referenced this issue Oct 22, 2019
@luziferius luziferius added this to the Bugfix release 0.95.8 milestone Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autokey triggers Issues related to hotkeys, abbreviations, window filters, etc. autokey-gtk user interface Issues related to the user interface
Projects
None yet
Development

No branches or pull requests

1 participant