-
Notifications
You must be signed in to change notification settings - Fork 260
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
Add support for a second keybind per action #870
base: master
Are you sure you want to change the base?
Conversation
e392cfb
to
961b5a0
Compare
Wow, there's a lot here, I'll take a look as soon as I can. |
961b5a0
to
a36a3ff
Compare
bf09d79
to
4f5fba1
Compare
06228fa
to
f191937
Compare
So, there's so much here that it's impossible for me to do a review. 70,000 changes is way too big for a code review. The idea is good, but it looks like you went through it with a code formatter or linter that made a bunch of irrelevant changes. That's fine as it is, but it makes it impossible for me to easily review the changes that are necessary to the feature, and the output of the linter. Also, the doc changes should probably be done in a separate PR as well, so that we can more easily tease those out. If you could make another PR with just the changes that are necessary to implement the feature, I could definitely review that and merge it in, with some work, but as it is, I can't really review or merge this PR. |
I mentioned that it would be easier to review with GitHub's whitespace option for that reason. The line change count is also largely due to the modified translation files due to the changed strings. I can pull those and the PR should be easier to review but I do think proper translation support should be implemented at some point in time. |
f191937
to
a7c7073
Compare
Should I open the PRs for this too? We could add 3.10 and 3.11 while dropping 3.8. (I don't know of any distros that ship 3.8 and an updated terminator package.) |
keyboard shortcuts. | ||
|
||
""" | ||
|
||
import re | ||
from gi.repository import Gtk, Gdk | ||
from gi.repository import Gdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove GTK here? Is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an unused import here. There was one call that was commented out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the comment too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather keep code cleanup changes separate from feature or bugfix changes. It means when I go back theough the history I can tell exactly what changes did what. This is the point I was trying to get across with my earlier comment. There's too much going on in this commit. The stuff may be good to include in another PR, but in a PR that is just supposed to implement a feature, the code should just reflect what is necessary to implement that feature. I definitely welcome bugfixes and code cleanup PRs, just not mixed in with feature implementation PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather keep code cleanup changes separate from feature or bugfix changes. It means when I go back theough the history I can tell exactly what changes did what. This is the point I was trying to get across with my earlier comment. There's too much going on in this commit. The stuff may be good to include in another PR, but in a PR that is just supposed to implement a feature, the code should just reflect what is necessary to implement that feature. I definitely welcome bugfixes and code cleanup PRs, just not mixed in with feature implementation PRs
@@ -91,7 +95,7 @@ def reload(self): | |||
self._lookup[mask][keyval] = action | |||
self._masks |= mask | |||
|
|||
def _parsebinding(self, binding): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change this method name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The underscore kept it as an internal method. This affected the tests from being able to access the method.
@@ -103,27 +107,25 @@ def _parsebinding(self, binding): | |||
raise KeymapError('No key found') | |||
keyval = Gdk.keyval_from_name(key) | |||
if keyval == 0: | |||
raise KeymapError("Key '%s' is unrecognised" % key) | |||
raise KeymapError(f"Key '{key}' is unrecognised") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing this string formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F-strings have been preferred since Python 3.6 went GA.
@@ -103,27 +107,25 @@ def _parsebinding(self, binding): | |||
raise KeymapError('No key found') | |||
keyval = Gdk.keyval_from_name(key) | |||
if keyval == 0: | |||
raise KeymapError("Key '%s' is unrecognised" % key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing this string formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F-strings have been preferred since Python 3.6 went GA.
return (keyval, mask) | ||
|
||
def _lookup_modifier(self, modifier): | ||
"""Map modifier names to gtk values""" | ||
try: | ||
return self.modifiers[modifier.lower()] | ||
except KeyError: | ||
raise KeymapError("Unhandled modifier '<%s>'" % modifier) | ||
except KeyError as exc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing this string formatting?
keyboard shortcuts. | ||
|
||
""" | ||
|
||
import re | ||
from gi.repository import Gtk, Gdk | ||
from gi.repository import Gdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather keep code cleanup changes separate from feature or bugfix changes. It means when I go back theough the history I can tell exactly what changes did what. This is the point I was trying to get across with my earlier comment. There's too much going on in this commit. The stuff may be good to include in another PR, but in a PR that is just supposed to implement a feature, the code should just reflect what is necessary to implement that feature. I definitely welcome bugfixes and code cleanup PRs, just not mixed in with feature implementation PRs
a7c7073
to
dcf6443
Compare
Modifying code: - terminatorlib/config.py - terminatorlib/keybindings.py - terminatorlib/plugin.py - terminatorlib/preferences.glade - terminatorlib/prefseditor.py - terminatorlib/terminal_popup_menu.py - terminatorlib/window.py Modifying test: - tests/test_prefseditor_keybindings.py Closes gnome-terminator#371
dcf6443
to
520fd1f
Compare
Modifying code:
Modifying tests:
Closes #371
NOTES
ADDENDA
return
anddel
statements== True
tois True
(unsure if test conditions were meant to be truthy or not)cc @mattrose This will probably be easier to review with whitespace changes hidden. For the translation files, I just ran both scripts to pick up the new strings. I've tested this locally off of the master branch as well. For configs in the "old"/current format, there are config parsing warnings at startup (only visible if you launch from a terminal), but nothing visible otherwise to the user and nothing that impacts usability. Once any setting is modified, the new format for bindings will be written to the config and the warnings won't be seen again. So users who don't make any settings changes after upgrading won't see anything change in their experience. For the context menu, I opted to show the first binding found only, in the event more than one binding is configured for an action. A warning dialog is also shown if there is an attempt to set an existing binding to a new action or the same action twice. Feel free to let me know if any additional changes are needed in order to get this merged and released.
Question:
Should the workflows be updated for python 3.10 and 3.11? They are currently 3.8 and 3.9. I tested 3.10 and 3.11 on my local fork without issue so it should be safe to make that change. (Adding 3.12 would require working around the removal of packages like
setuptools
and I reason that isn't on the roadmap yet which is why I excluded it.)(Side note: I'd only recently learned about Terminator and it's literally been the biggest boon for my productivity of late, immediately becoming my default on every machine. Thanks to you and the team for resurrecting and maintaining it!)