[pitivi] shortcuts: Refactor shortcut management logic
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] shortcuts: Refactor shortcut management logic
- Date: Mon, 11 Jul 2016 11:11:26 +0000 (UTC)
commit ae41568fc74261d15aad9251db9b8ace03bc8a02
Author: Jakub Brindza <jakub brindza gmail com>
Date: Thu Jul 7 07:48:08 2016 +0100
shortcuts: Refactor shortcut management logic
Differential Revision: https://phabricator.freedesktop.org/D1157
pitivi/application.py | 23 +++----
pitivi/clipproperties.py | 10 +--
pitivi/dialogs/startupwizard.py | 2 +-
pitivi/mainwindow.py | 35 +++++------
pitivi/medialibrary.py | 16 ++---
pitivi/{shortcutswindow.py => shortcuts.py} | 81 ++++++++++++++----------
pitivi/timeline/timeline.py | 91 ++++++++++----------------
7 files changed, 118 insertions(+), 140 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index c887f82..ee23b42 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -36,8 +36,8 @@ from pitivi.project import ProjectManager
from pitivi.settings import get_dir
from pitivi.settings import GlobalSettings
from pitivi.settings import xdg_cache_home
-from pitivi.shortcutswindow import ShortcutsWindow
-from pitivi.shortcutswindow import show_shortcuts
+from pitivi.shortcuts import ShortcutsManager
+from pitivi.shortcuts import show_shortcuts
from pitivi.undo.project import ProjectObserver
from pitivi.undo.undo import UndoableActionLog
from pitivi.utils import loggable
@@ -91,6 +91,7 @@ class Pitivi(Gtk.Application, Loggable):
self._first_action = True
Zoomable.app = self
+ self.shortcuts = ShortcutsManager(self)
def write_action(self, action, properties={}):
if self._scenario_file is None:
@@ -152,32 +153,28 @@ class Pitivi(Gtk.Application, Loggable):
self._syncDoUndo()
def _createActions(self):
- ShortcutsWindow.register_group("app", _("General"))
+ self.shortcuts.register_group("app", _("General"))
self.undo_action = Gio.SimpleAction.new("undo", None)
self.undo_action.connect("activate", self._undoCb)
self.add_action(self.undo_action)
- self.set_accels_for_action("app.undo", ["<Control>z"])
- ShortcutsWindow.add_action("app.undo", _("Undo the most recent action"))
+ self.shortcuts.add("app.undo", ["<Control>z"], _("Undo the most recent action"))
self.redo_action = Gio.SimpleAction.new("redo", None)
self.redo_action.connect("activate", self._redoCb)
self.add_action(self.redo_action)
- self.set_accels_for_action("app.redo", ["<Control><Shift>z"])
- ShortcutsWindow.add_action("app.redo", _("Redo the most recent action"))
+ self.shortcuts.add("app.redo", ["<Control><Shift>z"],
+ _("Redo the most recent action"))
self.quit_action = Gio.SimpleAction.new("quit", None)
self.quit_action.connect("activate", self._quitCb)
self.add_action(self.quit_action)
- self.set_accels_for_action("app.quit", ["<Control>q"])
- ShortcutsWindow.add_action("app.quit", _("Quit"))
+ self.shortcuts.add("app.quit", ["<Control>q"], _("Quit"))
self.show_shortcuts_action = Gio.SimpleAction.new("shortcuts_window", None)
self.show_shortcuts_action.connect("activate", self._show_shortcuts_cb)
self.add_action(self.show_shortcuts_action)
- self.set_accels_for_action("app.shortcuts_window", ["<Control>F1",
- "<Control>question"])
- ShortcutsWindow.add_action("app.shortcuts_window",
- _("Show the Shortcuts Window"))
+ self.shortcuts.add("app.shortcuts_window", ["<Control>F1", "<Control>question"],
+ _("Show the Shortcuts Window"))
def do_activate(self):
if self.gui:
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index fb62f6c..4cbd8ac 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -31,7 +31,7 @@ from pitivi.effects import AUDIO_EFFECT
from pitivi.effects import EffectsPropertiesManager
from pitivi.effects import HIDDEN_EFFECTS
from pitivi.effects import VIDEO_EFFECT
-from pitivi.shortcutswindow import ShortcutsWindow
+from pitivi.shortcuts import ShortcutsWindow
from pitivi.undo.timeline import CommitTimelineFinalizingAction
from pitivi.utils.loggable import Loggable
from pitivi.utils.ui import disable_scroll
@@ -225,15 +225,13 @@ class EffectProperties(Gtk.Expander, Loggable):
effects_actions_group = Gio.SimpleActionGroup()
self.treeview.insert_action_group("clipproperties-effects", effects_actions_group)
buttons_box.insert_action_group("clipproperties-effects", effects_actions_group)
- ShortcutsWindow.register_group("clipproperties-effects", _("Clip Effects"))
+ self.app.shortcuts.register_group("clipproperties-effects", _("Clip Effects"))
self.remove_effect_action = Gio.SimpleAction.new("remove-effect", None)
self.remove_effect_action.connect("activate", self._removeEffectCb)
effects_actions_group.add_action(self.remove_effect_action)
- self.app.set_accels_for_action("clipproperties-effects.remove-effect",
- ["Delete"])
- ShortcutsWindow.add_action("clipproperties-effects.remove-effect",
- _("Remove the selected effect"))
+ self.app.shortcuts.add("clipproperties-effects.remove-effect", ["Delete"],
+ _("Remove the selected effect"))
self.remove_effect_action.set_enabled(False)
remove_effect_button.set_action_name("clipproperties-effects.remove-effect")
diff --git a/pitivi/dialogs/startupwizard.py b/pitivi/dialogs/startupwizard.py
index d126da0..77440da 100644
--- a/pitivi/dialogs/startupwizard.py
+++ b/pitivi/dialogs/startupwizard.py
@@ -26,7 +26,7 @@ from gi.repository import Gtk
from pitivi.check import missing_soft_deps
from pitivi.configure import get_ui_dir
from pitivi.dialogs.depsmanager import DepsManager
-from pitivi.shortcutswindow import show_shortcuts
+from pitivi.shortcuts import show_shortcuts
from pitivi.utils.misc import show_user_manual
from pitivi.utils.ui import fix_infobar
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 7d39fa4..45d8d68 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -43,7 +43,7 @@ from pitivi.mediafilespreviewer import PreviewWidget
from pitivi.medialibrary import MediaLibraryWidget
from pitivi.project import ProjectSettingsDialog
from pitivi.settings import GlobalSettings
-from pitivi.shortcutswindow import ShortcutsWindow
+from pitivi.shortcuts import ShortcutsWindow
from pitivi.tabsmanager import BaseTabs
from pitivi.timeline.timeline import TimelineContainer
from pitivi.titleeditor import TitleEditor
@@ -444,52 +444,49 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
self._headerbar.pack_start(self.render_button)
def _set_keyboard_shortcuts(self):
- ShortcutsWindow.register_group("win", _("Project"))
+ self.app.shortcuts.register_group("win", _("Project"))
self.save_action = Gio.SimpleAction.new("save", None)
self.save_action.connect("activate", self._saveProjectCb)
self.add_action(self.save_action)
- self.app.set_accels_for_action("win.save", ["<Control>s"])
self.save_button.set_action_name("win.save")
- ShortcutsWindow.add_action("win.save", _("Save the current project"))
+ self.app.shortcuts.add("win.save", ["<Control>s"],
+ _("Save the current project"))
self.new_project_action = Gio.SimpleAction.new("new-project", None)
self.new_project_action.connect("activate", self._newProjectMenuCb)
self.add_action(self.new_project_action)
- self.app.set_accels_for_action("win.new-project", ["<Control>n"])
- ShortcutsWindow.add_action("win.new-project", _("Create a new project"))
+ self.app.shortcuts.add("win.new-project", ["<Control>n"],
+ _("Create a new project"))
self.open_project_action = Gio.SimpleAction.new("open-project", None)
self.open_project_action.connect("activate", self._openProjectCb)
self.add_action(self.open_project_action)
- self.app.set_accels_for_action("win.open-project", ["<Control>o"])
- ShortcutsWindow.add_action("win.open-project", _("Open a project"))
+ self.app.shortcuts.add("win.open-project", ["<Control>o"],
+ _("Open a project"))
self.save_as_action = Gio.SimpleAction.new("save-as", None)
self.save_as_action.connect("activate", self._saveProjectAsCb)
self.add_action(self.save_as_action)
- self.app.set_accels_for_action("win.save-as", ["<Control><Shift>s"])
- ShortcutsWindow.add_action("win.save-as",
- _("Save the current project as"))
+ self.app.shortcuts.add("win.save-as", ["<Control><Shift>s"],
+ _("Save the current project as"))
self.help_action = Gio.SimpleAction.new("help", None)
self.help_action.connect("activate", self._userManualCb)
self.add_action(self.help_action)
- self.app.set_accels_for_action("win.help", ["F1"])
- ShortcutsWindow.add_action("win.help", _("Help"), group="app")
+ self.app.shortcuts.add("win.help", ["F1"], _("Help"), group="app")
self.menu_button_action = Gio.SimpleAction.new("menu-button", None)
self.menu_button_action.connect("activate", self._menuCb)
self.add_action(self.menu_button_action)
- self.app.set_accels_for_action("win.menu-button", ["F10"])
- ShortcutsWindow.add_action("win.menu-button",
- _("Show the menu button content"),
- group="app")
+ self.app.shortcuts.add("win.menu-button", ["F10"],
+ _("Show the menu button content"),
+ group="app")
import_asset_action = Gio.SimpleAction.new("import-asset", None)
import_asset_action.connect("activate", self.__import_asset_cb)
self.add_action(import_asset_action)
- self.app.set_accels_for_action("win.import-asset", ["<Control>i"])
- ShortcutsWindow.add_action("win.import-asset", _("Add media files to your project"))
+ self.app.shortcuts.add("win.import-asset", ["<Control>i"],
+ _("Add media files to your project"))
def __import_asset_cb(self, unusdaction, unusedparam):
self.medialibrary.show_import_assets_dialog()
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 51e1e12..a070ef1 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -45,7 +45,7 @@ from pitivi.dialogs.clipmediaprops import ClipMediaPropsDialog
from pitivi.dialogs.filelisterrordialog import FileListErrorDialog
from pitivi.mediafilespreviewer import PreviewWidget
from pitivi.settings import GlobalSettings
-from pitivi.shortcutswindow import ShortcutsWindow
+from pitivi.shortcuts import ShortcutsWindow
from pitivi.timeline.previewers import getThumbnailCache
from pitivi.utils.loggable import Loggable
from pitivi.utils.misc import disconnectAllByFunc
@@ -429,23 +429,19 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
actions_group = Gio.SimpleActionGroup()
self.insert_action_group("medialibrary", actions_group)
- ShortcutsWindow.register_group("medialibrary", _("Media Library"))
+ self.app.shortcuts.register_group("medialibrary", _("Media Library"))
self.remove_assets_action = Gio.SimpleAction.new("remove-assets", None)
self.remove_assets_action.connect("activate", self._removeAssetsCb)
actions_group.add_action(self.remove_assets_action)
- self.app.set_accels_for_action("medialibrary.remove-assets",
- ["<Control>Delete"])
- ShortcutsWindow.add_action("medialibrary.remove-assets",
- _("Remove the selected assets"))
+ self.app.shortcuts.add("medialibrary.remove-assets", ["<Control>Delete"],
+ _("Remove the selected assets"))
self.insert_at_end_action = Gio.SimpleAction.new("insert-assets-at-end", None)
self.insert_at_end_action.connect("activate", self._insertEndCb)
actions_group.add_action(self.insert_at_end_action)
- self.app.set_accels_for_action("medialibrary.insert-assets-at-end",
- ["Insert"])
- ShortcutsWindow.add_action("medialibrary.insert-assets-at-end",
- _("Insert selected assets at the end of the timeline"))
+ self.app.shortcuts.add("medialibrary.insert-assets-at-end", ["Insert"],
+ _("Insert selected assets at the end of the timeline"))
self._updateActions()
diff --git a/pitivi/shortcutswindow.py b/pitivi/shortcuts.py
similarity index 66%
rename from pitivi/shortcutswindow.py
rename to pitivi/shortcuts.py
index 2164a6e..2c125b8 100644
--- a/pitivi/shortcutswindow.py
+++ b/pitivi/shortcuts.py
@@ -22,16 +22,55 @@ from gi.repository import Gtk
from pitivi.utils.misc import show_user_manual
+class ShortcutsManager:
+ """Manager class storing the shortcuts from all across the app"""
+
+ def __init__(self, app):
+ self.app = app
+ self.groups = []
+ self.group_titles = {}
+ self.group_actions = {}
+
+ def add(self, action, accelerators, title=None, group=None):
+ """Adds an action to be displayed.
+
+ Args:
+ action (str): The name identifying the action, formatted like
+ "prefix.name".
+ accelerators ([str]): List of accelerators corresponding to the action
+ title (Optional(str)): The title of the action.
+ group (Optional[str]): The group id registered with `register_group`
+ to be used instead of the one extracted from `action`.
+ """
+ self.app.set_accels_for_action(action, accelerators)
+
+ if title:
+ action_prefix = group or action.split(".")[0]
+ if action_prefix not in self.group_actions:
+ self.group_actions[action_prefix] = []
+ self.group_actions[action_prefix].append((action, title))
+
+ def register_group(self, action_prefix, title):
+ """Registers a group of shortcuts to be displayed.
+
+ Args:
+ action_prefix (str): The group id.
+ title (str): The title of the group.
+ """
+ if action_prefix not in self.groups:
+ self.groups.append(action_prefix)
+ self.group_titles[action_prefix] = title
+
+
class ShortcutsWindow(Gtk.ShortcutsWindow):
"""Dialog for displaying the accelerators."""
- group_titles = {}
- group_actions = {}
- groups = []
-
def __init__(self, app):
Gtk.ShortcutsWindow.__init__(self)
self.app = app
+ self.group_titles = self.app.shortcuts.group_titles
+ self.group_actions = self.app.shortcuts.group_actions
+ self.groups = self.app.shortcuts.groups
self.set_transient_for(self.app.gui)
self.set_modal(True)
self.populate()
@@ -40,10 +79,10 @@ class ShortcutsWindow(Gtk.ShortcutsWindow):
"""Gathers the accelerators and populates the window."""
section = Gtk.ShortcutsSection()
section.show()
- for group_id in ShortcutsWindow.groups:
- group = Gtk.ShortcutsGroup(title=ShortcutsWindow.group_titles[group_id])
+ for group_id in self.groups:
+ group = Gtk.ShortcutsGroup(title=self.group_titles[group_id])
group.show()
- for action, title in ShortcutsWindow.group_actions[group_id]:
+ for action, title in self.group_actions[group_id]:
accelerators = " ".join(self.app.get_accels_for_action(action))
short = Gtk.ShortcutsShortcut(title=title, accelerator=accelerators)
short.show()
@@ -53,34 +92,6 @@ class ShortcutsWindow(Gtk.ShortcutsWindow):
# otherwise the shortcuts won't show up in search.
self.add(section)
- @classmethod
- def add_action(cls, action, title, group=None):
- """Adds an action to be displayed.
-
- Args:
- action (str): The name identifying the action, formatted like
- "prefix.name".
- title (str): The title of the action.
- group (Optional[str]): The group id registered with `register_group`
- to be used instead of the one extracted from `action`.
- """
- action_prefix = group or action.split(".")[0]
- if action_prefix not in cls.group_actions:
- cls.group_actions[action_prefix] = []
- cls.group_actions[action_prefix].append((action, title))
-
- @classmethod
- def register_group(cls, action_prefix, title):
- """Registers a group of shortcuts to be displayed.
-
- Args:
- action_prefix (str): The group id.
- title (str): The title of the group.
- """
- if action_prefix not in cls.groups:
- cls.groups.append(action_prefix)
- cls.group_titles[action_prefix] = title
-
def show_shortcuts(app):
"""Shows the shortcuts window or the user manual page with the shortcuts."""
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index a046e67..a092caf 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -31,7 +31,7 @@ from pitivi.autoaligner import AutoAligner
from pitivi.configure import get_ui_dir
from pitivi.dialogs.prefs import PreferencesDialog
from pitivi.settings import GlobalSettings
-from pitivi.shortcutswindow import ShortcutsWindow
+from pitivi.shortcuts import ShortcutsWindow
from pitivi.timeline.elements import Clip
from pitivi.timeline.elements import TransitionClip
from pitivi.timeline.elements import TrimHandle
@@ -1398,47 +1398,38 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
group = Gio.SimpleActionGroup()
self.timeline.layout.insert_action_group("timeline", group)
self.toolbar.insert_action_group("timeline", group)
- ShortcutsWindow.register_group("timeline", _("Timeline"))
+ self.app.shortcuts.register_group("timeline", _("Timeline"))
# Clips actions.
self.delete_action = Gio.SimpleAction.new("delete-selected-clips", None)
self.delete_action.connect("activate", self._deleteSelected)
group.add_action(self.delete_action)
- self.app.set_accels_for_action("timeline.delete-selected-clips",
- ["Delete"])
- ShortcutsWindow.add_action("timeline.delete-selected-clips",
- _("Delete selected clips"))
+ self.app.shortcuts.add("timeline.delete-selected-clips", ["Delete"],
+ _("Delete selected clips"))
self.group_action = Gio.SimpleAction.new("group-selected-clips", None)
self.group_action.connect("activate", self._groupSelected)
group.add_action(self.group_action)
- self.app.set_accels_for_action("timeline.group-selected-clips",
- ["<Control>g"])
- ShortcutsWindow.add_action("timeline.group-selected-clips",
- _("Group selected clips together"))
+ self.app.shortcuts.add("timeline.group-selected-clips", ["<Control>g"],
+ _("Group selected clips together"))
self.ungroup_action = Gio.SimpleAction.new("ungroup-selected-clips", None)
self.ungroup_action.connect("activate", self._ungroupSelected)
group.add_action(self.ungroup_action)
- self.app.set_accels_for_action("timeline.ungroup-selected-clips",
- ["<Shift><Control>g"])
- ShortcutsWindow.add_action("timeline.ungroup-selected-clips",
- _("Ungroup selected clips"))
+ self.app.shortcuts.add("timeline.ungroup-selected-clips", ["<Shift><Control>g"],
+ _("Ungroup selected clips"))
self.copy_action = Gio.SimpleAction.new("copy-selected-clips", None)
self.copy_action.connect("activate", self.__copyClipsCb)
group.add_action(self.copy_action)
- self.app.set_accels_for_action("timeline.copy-selected-clips",
- ["<Control>c"])
- ShortcutsWindow.add_action("timeline.copy-selected-clips",
- _("Copy selected clips"))
+ self.app.shortcuts.add("timeline.copy-selected-clips", ["<Control>c"],
+ _("Copy selected clips"))
self.paste_action = Gio.SimpleAction.new("paste-clips", None)
self.paste_action.connect("activate", self.__pasteClipsCb)
group.add_action(self.paste_action)
- self.app.set_accels_for_action("timeline.paste-clips", ["<Control>v"])
- ShortcutsWindow.add_action("timeline.paste-clips",
- _("Paste selected clips"))
+ self.app.shortcuts.add("timeline.paste-clips", ["<Control>v"],
+ _("Paste selected clips"))
self.gapless_action = Gio.SimpleAction.new("toggle-gapless-mode", None)
self.gapless_action.connect("activate", self._gaplessmodeToggledCb)
@@ -1448,82 +1439,70 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.split_action = Gio.SimpleAction.new("split-clips", None)
self.split_action.connect("activate", self._splitCb)
group.add_action(self.split_action)
- self.app.set_accels_for_action("timeline.split-clips", ["S"])
self.split_action.set_enabled(True)
- ShortcutsWindow.add_action("timeline.split-clips",
- _("Split the clip at the position"))
+ self.app.shortcuts.add("timeline.split-clips", ["S"],
+ _("Split the clip at the position"))
self.keyframe_action = Gio.SimpleAction.new("keyframe-selected-clips", None)
self.keyframe_action.connect("activate", self._keyframe_cb)
group.add_action(self.keyframe_action)
- self.app.set_accels_for_action("timeline.keyframe-selected-clips",
- ["K"])
- ShortcutsWindow.add_action("timeline.keyframe-selected-clips",
- _("Add keyframe to the keyframe curve of selected clip"))
+ self.app.shortcuts.add("timeline.keyframe-selected-clips", ["K"],
+ _("Add keyframe to the keyframe curve of selected clip"))
navigation_group = Gio.SimpleActionGroup()
self.timeline.layout.insert_action_group("navigation", navigation_group)
self.toolbar.insert_action_group("navigation", navigation_group)
- ShortcutsWindow.register_group("navigation", _("Timeline Navigation"))
+ self.app.shortcuts.register_group("navigation", _("Timeline Navigation"))
self.zoom_in_action = Gio.SimpleAction.new("zoom-in", None)
self.zoom_in_action.connect("activate", self._zoomInCb)
navigation_group.add_action(self.zoom_in_action)
- self.app.set_accels_for_action("navigation.zoom-in",
- ["<Control>plus", "<Control>equal"])
- ShortcutsWindow.add_action("navigation.zoom-in", _("Zoom in"))
+ self.app.shortcuts.add("navigation.zoom-in",
+ ["<Control>plus", "<Control>equal"],
+ _("Zoom in"))
self.zoom_out_action = Gio.SimpleAction.new("zoom-out", None)
self.zoom_out_action.connect("activate", self._zoomOutCb)
navigation_group.add_action(self.zoom_out_action)
- self.app.set_accels_for_action("navigation.zoom-out",
- ["<Control>minus"])
- ShortcutsWindow.add_action("navigation.zoom-out", _("Zoom out"))
+ self.app.shortcuts.add("navigation.zoom-out", ["<Control>minus"],
+ _("Zoom out"))
self.zoom_fit_action = Gio.SimpleAction.new("zoom-fit", None)
self.zoom_fit_action.connect("activate", self._zoomFitCb)
navigation_group.add_action(self.zoom_fit_action)
- self.app.set_accels_for_action("navigation.zoom-fit", ["<Control>0"])
- ShortcutsWindow.add_action("navigation.zoom-fit",
- _("Adjust zoom to fit the project to the window"))
+ self.app.shortcuts.add("navigation.zoom-fit", ["<Control>0"],
+ _("Adjust zoom to fit the project to the window"))
self.play_action = Gio.SimpleAction.new("play", None)
self.play_action.connect("activate", self._playPauseCb)
navigation_group.add_action(self.play_action)
- self.app.set_accels_for_action("navigation.play", ["space"])
- ShortcutsWindow.add_action("navigation.play", _("Play"))
+ self.app.shortcuts.add("navigation.play", ["space"], _("Play"))
self.backward_one_frame_action = Gio.SimpleAction.new("backward_one_frame", None)
self.backward_one_frame_action.connect("activate", self._seek_backward_one_frame_cb)
navigation_group.add_action(self.backward_one_frame_action)
- self.app.set_accels_for_action("navigation.backward_one_frame",
- ["Left"])
- ShortcutsWindow.add_action("navigation.backward_one_frame",
- _("Seek backward one frame"))
+ self.app.shortcuts.add("navigation.backward_one_frame", ["Left"],
+ _("Seek backward one frame"))
self.forward_one_frame_action = Gio.SimpleAction.new("forward_one_frame", None)
self.forward_one_frame_action.connect("activate", self._seek_forward_one_frame_cb)
navigation_group.add_action(self.forward_one_frame_action)
- self.app.set_accels_for_action("navigation.forward_one_frame",
- ["Right"])
- ShortcutsWindow.add_action("navigation.forward_one_frame",
- _("Seek forward one frame"))
+ self.app.shortcuts.add("navigation.forward_one_frame", ["Right"],
+ _("Seek forward one frame"))
self.backward_one_second_action = Gio.SimpleAction.new("backward_one_second", None)
self.backward_one_second_action.connect("activate", self._seek_backward_one_second_cb)
navigation_group.add_action(self.backward_one_second_action)
- self.app.set_accels_for_action("navigation.backward_one_second",
- ["<Shift>Left"])
- ShortcutsWindow.add_action("navigation.backward_one_second",
- _("Seek backward one second"))
+ self.app.shortcuts.add("navigation.backward_one_second",
+ ["<Shift>Left"],
+ _("Seek backward one second"))
self.forward_one_second_action = Gio.SimpleAction.new("forward_one_second", None)
self.forward_one_second_action.connect("activate", self._seek_forward_one_second_cb)
navigation_group.add_action(self.forward_one_second_action)
- self.app.set_accels_for_action("navigation.forward_one_second",
- ["<Shift>Right"])
- ShortcutsWindow.add_action("navigation.forward_one_second",
- _("Seek forward one second"))
+ self.app.shortcuts.add("navigation.forward_one_second",
+ ["<Shift>Right"],
+ _("Seek forward one second"))
def _setBestZoomRatio(self, allow_zoom_in=False):
"""Sets the zoom level so that the entire timeline is in view."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]