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

Keyboard Shortcut Improvements #2683

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

cyberphantom52
Copy link
Contributor

@cyberphantom52 cyberphantom52 commented Feb 16, 2023

Description

Aims to add standard keyboard shortcuts to bottles for easier access to certain actions. Also adds a shortcuts window.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.

  • Locally

Makes sure the list view gets properly updated when deleting a bottle
update_bottles already updates the config so this is not necessary
@cyberphantom52
Copy link
Contributor Author

Currently shortcuts are available but we would ideally want them to be context dependent, for example we wouldn't want "New Bottle" shortcut to be available when the user is inside a existing bottle.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2023

Pylint result on modfied files:
************* Module bottles.frontend.main
bottles/frontend/main.py:27:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:27:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:28:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:28:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:29:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:29:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:49:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:50:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:52:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:54:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:58:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:63:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:66:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:66:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:85:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:89:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:89:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:89:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:90:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:91:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:91:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:92:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:92:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:93:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:93:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:94:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:94:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:95:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:95:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:96:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:96:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:97:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:97:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:185:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:185:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:185:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:185:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:208:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:208:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:212:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:212:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:213:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:216:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:216:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:216:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:216:0: W1405: Quote delimiter ' is inconsistent with the rest of the file (inconsistent-quotes)
bottles/frontend/main.py:33:0: C0413: Import "from gi.repository import Gtk, Gio, Gdk, GLib, GObject, Adw" should be placed at the top of the module (wrong-import-position)
bottles/frontend/main.py:33:0: E0611: No name 'Adw' in module 'gi.repository' (no-name-in-module)
bottles/frontend/main.py:35:0: W0401: Wildcard import bottles.frontend.params (wildcard-import)
bottles/frontend/main.py:35:0: C0413: Import "from bottles.frontend.params import *" should be placed at the top of the module (wrong-import-position)
bottles/frontend/main.py:36:0: C0413: Import "from bottles.backend.logger import Logger" should be placed at the top of the module (wrong-import-position)
bottles/frontend/main.py:37:0: C0413: Import "from bottles.frontend.windows.main_window import MainWindow" should be placed at the top of the module (wrong-import-position)
bottles/frontend/main.py:38:0: C0413: Import "from bottles.frontend.views.preferences import PreferencesWindow" should be placed at the top of the module (wrong-import-position)
bottles/frontend/main.py:39:0: C0413: Import "from bottles.backend.health import HealthChecker" should be placed at the top of the module (wrong-import-position)
bottles/frontend/main.py:50:0: C0103: Constant name "base_dir" doesn't conform to UPPER_CASE naming style (invalid-name)
bottles/frontend/main.py:174:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/main.py:180:12: W0105: String statement has no effect (pointless-string-statement)
bottles/frontend/main.py:184:16: C0103: Variable name "a" doesn't conform to snake_case naming style (invalid-name)
bottles/frontend/main.py:215:8: W0621: Redefining name 'subprocess' from outer scope (line 24) (redefined-outer-name)
bottles/frontend/main.py:202:12: C0415: Import outside toplevel (bottles.frontend.windows.bottlepicker.BottlePickerDialog) (import-outside-toplevel)
bottles/frontend/main.py:215:8: W0404: Reimport 'subprocess' (imported line 24) (reimported)
bottles/frontend/main.py:215:8: C0415: Import outside toplevel (subprocess) (import-outside-toplevel)
bottles/frontend/main.py:216:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/frontend/main.py:195:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bottles/frontend/main.py:249:8: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/main.py:243:15: W0613: Unused argument 'action' (unused-argument)
bottles/frontend/main.py:243:28: W0613: Unused argument 'param' (unused-argument)
bottles/frontend/main.py:252:15: W0613: Unused argument 'action' (unused-argument)
bottles/frontend/main.py:252:28: W0613: Unused argument 'param' (unused-argument)
bottles/frontend/main.py:260:24: W0613: Unused argument 'action' (unused-argument)
bottles/frontend/main.py:260:37: W0613: Unused argument 'param' (unused-argument)
bottles/frontend/main.py:268:0: W0613: Unused argument 'args' (unused-argument)
bottles/frontend/main.py:272:0: W0613: Unused argument 'args' (unused-argument)
bottles/frontend/main.py:275:4: W1113: Keyword argument before variable positional arguments list in the definition of __show_importer_view function (keyword-arg-before-vararg)
bottles/frontend/main.py:275:35: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/main.py:275:0: W0613: Unused argument 'args' (unused-argument)
bottles/frontend/main.py:260:4: W0238: Unused private member `Bottles.__refresh(self, action=None, param=None)` (unused-private-member)
bottles/frontend/main.py:239:8: W0201: Attribute 'win' defined outside __init__ (attribute-defined-outside-init)
bottles/frontend/main.py:374:9: W0613: Unused argument 'version' (unused-argument)
bottles/frontend/main.py:20:0: C0411: standard import "import os" should be placed before "import gi" (wrong-import-order)
bottles/frontend/main.py:21:0: C0411: standard import "import gettext" should be placed before "import gi" (wrong-import-order)
bottles/frontend/main.py:22:0: C0411: standard import "import locale" should be placed before "import gi" (wrong-import-order)
bottles/frontend/main.py:23:0: C0411: standard import "import webbrowser" should be placed before "import gi" (wrong-import-order)
bottles/frontend/main.py:24:0: C0411: standard import "import subprocess" should be placed before "import gi" (wrong-import-order)
bottles/frontend/main.py:25:0: C0411: standard import "from os import path" should be placed before "import gi" (wrong-import-order)
bottles/frontend/main.py:24:0: W0611: Unused import subprocess (unused-import)
bottles/frontend/main.py:33:0: W0611: Unused Gdk imported from gi.repository (unused-import)
bottles/frontend/main.py:35:0: W0614: Unused import(s) APP_NAME_LOWER, APP_ID, BUILD_TYPE, ANIM_DURATION, EXECUTABLE_EXTS and DOC_URL from wildcard import of bottles.frontend.params (unused-wildcard-import)
************* Module bottles.frontend.views.new
bottles/frontend/views/new.py:174:0: C0303: Trailing whitespace (trailing-whitespace)
bottles/frontend/views/new.py:263:9: W0511: TODO: Remove this ugly zig zag and find a better way to set the environment (fixme)
bottles/frontend/views/new.py:284:13: W0511: TODO: Implement AdwMessageDialog to prompt the user if they are (fixme)
bottles/frontend/views/new.py:20:0: E0611: No name 'Adw' in module 'gi.repository' (no-name-in-module)
bottles/frontend/views/new.py:121:8: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bottles/frontend/views/new.py:175:8: W0105: String statement has no effect (pointless-string-statement)

@TheEvilSkeleton TheEvilSkeleton added this to the 52.0 milestone Feb 20, 2023
@TheEvilSkeleton
Copy link
Contributor

Can you rename kb-shortcuts.blp to help-overlay.blp? It's the default file name in GNOME Builder.

@cyberphantom52
Copy link
Contributor Author

Can you rename kb-shortcuts.blp to help-overlay.blp? It's the default file name in GNOME Builder.

Yes i'll update that

self.__create_action('new', self.__new_bottle, ['<primary>n'])
self.__create_action('switch_to_bottles_page', self.__show_bottles_view, ['<alt>1'])
self.__create_action('switch_to_library_page', self.__show_library_view, ['<alt>2'])
self.__create_action('go_back', self.__go_back, ['<alt>Left'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Escape would help.

Suggested change
self.__create_action('go_back', self.__go_back, ['<alt>Left'])
self.__create_action('go_back', self.__go_back, ['<alt>Left', 'Escape'])

self.win.stack_main.set_visible_child_name("page_list")

def __go_back(self, *_args):
self.win.main_leaf.navigate(Adw.NavigationDirection.BACK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it locally and it doesn't work well in practice. Instead of going back a page, it goes to the main page when I press Alt+Left:

2023-06-24.08-39-24.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted this too, thats why i didn't add this once to the keyboard shortcuts window, the reason for this being we have two separate leaflets, this should be fixed automatically when we switch to AdwNavigationView.

@mirkobrombin
Copy link
Member

Is this still a draft?

@cyberphantom52
Copy link
Contributor Author

Is this still a draft?

Last i remember, there was this issue #2683 (comment)

Apart from that i think this just needs a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants