Core: Keystroke editor will show actions available for current session. Changed wording to use correct terms forh both networks

This commit is contained in:
2022-12-20 13:02:27 -06:00
parent 250b248d25
commit ca40103df7
7 changed files with 69 additions and 10 deletions

View File

@@ -1,3 +1 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .keystrokeEditor import KeystrokeEditor

View File

@@ -0,0 +1 @@
from . import twitter, mastodon

View File

@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
actions = {
"up": _(u"Go up in the current buffer"),
"down": _(u"Go down in the current buffer"),
"left": _(u"Go to the previous buffer"),
"right": _(u"Go to the next buffer"),
"next_account": _(u"Focus the next session"),
"previous_account": _(u"Focus the previous session"),
"show_hide": _(u"Show or hide the GUI"),
"post_tweet": _("Make a new post"),
"post_reply": _(u"Reply"),
"post_retweet": _(u"Boost"),
"send_dm": _(u"Send direct message"),
"add_to_favourites": _("Add post to favorites"),
"remove_from_favourites": _(u"Remove post from favorites"),
"toggle_like": _("Add/remove post from favorites"),
"follow": _(u"Open the user actions dialogue"),
# "user_details": _(u"See user details"),
"view_item": _(u"Show post"),
"exit": _(u"Quit"),
"open_timeline": _(u"Open user timeline"),
"remove_buffer": _(u"Destroy buffer"),
"interact": _(u"Interact with the currently focused post."),
"url": _(u"Open URL"),
"open_in_browser": _(u"View in browser"),
"volume_up": _(u"Increase volume by 5%"),
"volume_down": _(u"Decrease volume by 5%"),
"go_home": _(u"Jump to the first element of a buffer"),
"go_end": _(u"Jump to the last element of the current buffer"),
"go_page_up": _(u"Jump 20 elements up in the current buffer"),
"go_page_down": _(u"Jump 20 elements down in the current buffer"),
# "update_profile": _(u"Edit profile"),
"delete": _("Delete post"),
"clear_buffer": _(u"Empty the current buffer"),
"repeat_item": _(u"Repeat last item"),
"copy_to_clipboard": _(u"Copy to clipboard"),
# "add_to_list": _(u"Add to list"),
# "remove_from_list": _(u"Remove from list"),
"toggle_buffer_mute": _(u"Mute/unmute the active buffer"),
"toggle_session_mute": _(u"Mute/unmute the current session"),
"toggle_autoread": _(u"toggle the automatic reading of incoming tweets in the active buffer"),
"search": _(u"Search on instance"),
"find": _(u"Find a string in the currently focused buffer"),
"edit_keystrokes": _(u"Show the keystroke editor"),
# "view_user_lists": _(u"Show lists for a specified user"),
"get_more_items": _(u"load previous items"),
# "get_trending_topics": _(u"Create a trending topics buffer"),
"open_conversation": _(u"View conversation"),
"check_for_updates": _(u"Check and download updates"),
"configuration": _(u"Opens the global settings dialogue"),
# "list_manager": _(u"Opens the list manager"),
"accountConfiguration": _(u"Opens the account settings dialogue"),
"audio": _(u"Try to play a media file"),
"update_buffer": _(u"Updates the buffer and retrieves possible lost items there."),
# "ocr_image": _(u"Extracts the text from a picture and displays the result in a dialog."),
# "add_alias": _("Adds an alias to an user"),
}

View File

@@ -53,7 +53,7 @@ actions = {
"configuration": _(u"Opens the global settings dialogue"),
"list_manager": _(u"Opens the list manager"),
"accountConfiguration": _(u"Opens the account settings dialogue"),
"audio": _(u"Try to play an audio file"),
"audio": _(u"Try to play a media file"),
"update_buffer": _(u"Updates the buffer and retrieves possible lost items there."),
"ocr_image": _(u"Extracts the text from a picture and displays the result in a dialog."),
"add_alias": _("Adds an alias to an user"),

View File

@@ -2,18 +2,19 @@
import widgetUtils
import config
from . import wx_ui
from . import constants
from . import actions
from pubsub import pub
class KeystrokeEditor(object):
def __init__(self):
def __init__(self, session_type="twitter"):
super(KeystrokeEditor, self).__init__()
self.actions = getattr(actions, session_type).actions
self.changed = False # Change it if the keyboard shorcuts are reassigned.
self.dialog = wx_ui.keystrokeEditorDialog()
self.map = config.keymap["keymap"]
# we need to copy the keymap before modify it, for unregistering the old keystrokes if is needed.
self.hold_map = self.map.copy()
self.dialog.put_keystrokes(constants.actions, self.map)
self.dialog.put_keystrokes(self.actions, self.map)
widgetUtils.connect_event(self.dialog.edit, widgetUtils.BUTTON_PRESSED, self.edit_keystroke)
widgetUtils.connect_event(self.dialog.undefine, widgetUtils.BUTTON_PRESSED, self.undefine_keystroke)
widgetUtils.connect_event(self.dialog.execute, widgetUtils.BUTTON_PRESSED, self.execute_action)
@@ -29,7 +30,7 @@ class KeystrokeEditor(object):
if new_keystroke != self.map[action]:
self.changed = True
self.map[action] = new_keystroke
self.dialog.put_keystrokes(constants.actions, self.map)
self.dialog.put_keystrokes(self.actions, self.map)
def undefine_keystroke(self, *args, **kwargs):
action = self.dialog.actions[self.dialog.get_action()]
@@ -40,7 +41,7 @@ class KeystrokeEditor(object):
if answer == widgetUtils.YES:
self.map[action] = ""
self.changed = True
self.dialog.put_keystrokes(constants.actions, self.map)
self.dialog.put_keystrokes(self.actions, self.map)
def set_keystroke(self, keystroke, dialog):
for i in keystroke.split("+"):