andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 38 forks source link

Trying to assign duplicate shortcut throws backtrace #101

Closed vi closed 11 years ago

vi commented 11 years ago
  1. Open Enki (4c168585bbde4b6bd9514d237a0f5c99d2c7d3d1, qutepart f473bffd75e0c574263343b4756c340c78e85416)
  2. Settings -> Shortcut Editor
  3. (After "Invoke Completion" I see empty item with empty shortcut)
  4. Click at "Invoke Completion"
  5. Press "Ctrl+P" (which is already bound to "Print")
  6. Press the green tick button.
Traceback (most recent call last):
  File "/mnt/src/git/enki/bin/../enki/plugins/appshortcuts/ActionShortcutEditor.py", line 187, in on_tbSet_pressed
    self.setShortcut( action, self.kseShortcut.text() )
  File "/mnt/src/git/enki/bin/../enki/plugins/appshortcuts/ActionShortcutEditor.py", line 149, in setShortcut
    self._model.setShortcut( action, shortcut)
  File "/mnt/src/git/enki/bin/../enki/plugins/appshortcuts/ActionModel.py", line 149, in setShortcut
    self._cleanText( a.text() ))
NameError: global name 'a' is not defined
vi commented 11 years ago

Probably should be this:

diff --git a/enki/plugins/appshortcuts/ActionModel.py b/enki/plugins/appshortcuts/ActionModel.py
index e1d2f9b..e332517 100644
--- a/enki/plugins/appshortcuts/ActionModel.py
+++ b/enki/plugins/appshortcuts/ActionModel.py
@@ -146,7 +146,7 @@ class ActionModel(QAbstractItemModel):
                not actionToCheck.shortcut().isEmpty() and \
                actionToCheck.shortcut() == shortcut :
                 error = tr( "Can't set shortcut, it's already used by action '%s'." % \
-                            self._cleanText( a.text() ))
+                            self._cleanText( action.text() ))
                 raise UserWarning(error)

         action.setShortcut( shortcut )
andreikop commented 11 years ago

Yes Pushed a fix