[pitivi] Replace <Control> with <Primary> for accelerators
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Replace <Control> with <Primary> for accelerators
- Date: Tue, 27 Sep 2016 08:48:54 +0000 (UTC)
commit 2560fa493372586cb5a0029a00bba8782d00dfe8
Author: Jakub Brindza <jakub brindza gmail com>
Date: Thu Sep 8 12:59:18 2016 +0100
Replace <Control> with <Primary> for accelerators
Differential Revision: https://phabricator.freedesktop.org/D1303
pitivi/application.py | 8 ++++----
pitivi/mainwindow.py | 10 +++++-----
pitivi/medialibrary.py | 2 +-
pitivi/timeline/timeline.py | 18 +++++++++---------
tests/test_shortcuts.py | 32 ++++++++++++++++----------------
5 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index a089ac8..2a46304 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -157,25 +157,25 @@ class Pitivi(Gtk.Application, Loggable):
self.undo_action = Gio.SimpleAction.new("undo", None)
self.undo_action.connect("activate", self._undoCb)
self.add_action(self.undo_action)
- self.shortcuts.add("app.undo", ["<Control>z"],
+ self.shortcuts.add("app.undo", ["<Primary>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.shortcuts.add("app.redo", ["<Control><Shift>z"],
+ self.shortcuts.add("app.redo", ["<Primary><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.shortcuts.add("app.quit", ["<Control>q"], _("Quit"))
+ self.shortcuts.add("app.quit", ["<Primary>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.shortcuts.add("app.shortcuts_window",
- ["<Control>F1", "<Control>question"],
+ ["<Primary>F1", "<Primary>question"],
_("Show the Shortcuts Window"))
def do_activate(self):
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index e06dbbb..fa9ad46 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -441,26 +441,26 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
self.save_action = Gio.SimpleAction.new("save", None)
self.save_action.connect("activate", self._saveProjectCb)
self.add_action(self.save_action)
- self.app.shortcuts.add("win.save", ["<Control>s"],
+ self.app.shortcuts.add("win.save", ["<Primary>s"],
_("Save the current project"))
self.save_button.set_action_name("win.save")
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.shortcuts.add("win.new-project", ["<Control>n"],
+ self.app.shortcuts.add("win.new-project", ["<Primary>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.shortcuts.add("win.open-project", ["<Control>o"],
+ self.app.shortcuts.add("win.open-project", ["<Primary>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.shortcuts.add("win.save-as", ["<Control><Shift>s"],
+ self.app.shortcuts.add("win.save-as", ["<Primary><Shift>s"],
_("Save the current project as"))
self.help_action = Gio.SimpleAction.new("help", None)
@@ -478,7 +478,7 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
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.shortcuts.add("win.import-asset", ["<Control>i"],
+ self.app.shortcuts.add("win.import-asset", ["<Primary>i"],
_("Add media files to your project"))
def __import_asset_cb(self, unusdaction, unusedparam):
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index c26f66b..a8f16cb 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -431,7 +431,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
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.shortcuts.add("medialibrary.remove-assets", ["<Control>Delete"],
+ self.app.shortcuts.add("medialibrary.remove-assets", ["<Primary>Delete"],
_("Remove the selected assets"))
self.insert_at_end_action = Gio.SimpleAction.new("insert-assets-at-end", None)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index d1fe861..27ad076 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1402,25 +1402,25 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.group_action = Gio.SimpleAction.new("group-selected-clips", None)
self.group_action.connect("activate", self._group_selected_cb)
group.add_action(self.group_action)
- self.app.shortcuts.add("timeline.group-selected-clips", ["<Control>g"],
+ self.app.shortcuts.add("timeline.group-selected-clips", ["<Primary>g"],
_("Group selected clips together"))
self.ungroup_action = Gio.SimpleAction.new("ungroup-selected-clips", None)
self.ungroup_action.connect("activate", self._ungroup_selected_cb)
group.add_action(self.ungroup_action)
- self.app.shortcuts.add("timeline.ungroup-selected-clips", ["<Shift><Control>g"],
+ self.app.shortcuts.add("timeline.ungroup-selected-clips", ["<Primary><Shift>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.shortcuts.add("timeline.copy-selected-clips", ["<Control>c"],
+ self.app.shortcuts.add("timeline.copy-selected-clips", ["<Primary>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.shortcuts.add("timeline.paste-clips", ["<Control>v"],
+ self.app.shortcuts.add("timeline.paste-clips", ["<Primary>v"],
_("Paste selected clips"))
self.gapless_action = Gio.SimpleAction.new("toggle-gapless-mode", None)
@@ -1432,13 +1432,13 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.split_action.connect("activate", self._splitCb)
group.add_action(self.split_action)
self.split_action.set_enabled(True)
- self.app.shortcuts.add("timeline.split-clips", ["S"],
+ 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.shortcuts.add("timeline.keyframe-selected-clips", ["K"],
+ self.app.shortcuts.add("timeline.keyframe-selected-clips", ["k"],
_("Add keyframe to the keyframe curve of selected clip"))
navigation_group = Gio.SimpleActionGroup()
@@ -1450,19 +1450,19 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.zoom_in_action.connect("activate", self._zoomInCb)
navigation_group.add_action(self.zoom_in_action)
self.app.shortcuts.add("navigation.zoom-in",
- ["<Control>plus", "<Control>equal"],
+ ["<Primary>plus", "<Primary>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.shortcuts.add("navigation.zoom-out", ["<Control>minus"],
+ self.app.shortcuts.add("navigation.zoom-out", ["<Primary>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.shortcuts.add("navigation.zoom-fit", ["<Control>0"],
+ self.app.shortcuts.add("navigation.zoom-fit", ["<Primary>0"],
_("Adjust zoom to fit the project to the window"))
self.play_action = Gio.SimpleAction.new("play", None)
diff --git a/tests/test_shortcuts.py b/tests/test_shortcuts.py
index 254c6ca..f520f2b 100644
--- a/tests/test_shortcuts.py
+++ b/tests/test_shortcuts.py
@@ -40,20 +40,20 @@ class TestShortcutsManager(TestCase):
self.assertListEqual(manager.groups, ["alpha_group", "beta_group"])
# Test grouping using the stripping away group name from action name
- manager.add("alpha_group.first", ["<Control>A"], "First action")
+ manager.add("alpha_group.first", ["<Primary>A"], "First action")
self.assertIn(("alpha_group.first", "First action"),
manager.group_actions["alpha_group"])
- manager.add("alpha_group.second", ["<Control>B"], "Second action")
+ manager.add("alpha_group.second", ["<Primary>B"], "Second action")
self.assertIn(("alpha_group.second", "Second action"),
manager.group_actions["alpha_group"])
- manager.add("beta_group.first", ["<Control>C"], "First beta action")
+ manager.add("beta_group.first", ["<Primary>C"], "First beta action")
self.assertIn(("beta_group.first", "First beta action"),
manager.group_actions["beta_group"])
# Test grouping using the group optional argument
# if group parameter is set, the action prefix can be anything,
# it should be disregarded in favour of the group value.
- manager.add("anything.third_action", ["<Control>D"], "Third action",
+ manager.add("anything.third_action", ["<Primary>D"], "Third action",
group="beta_group")
self.assertIn(("anything.third_action", "Third action"),
manager.group_actions["beta_group"])
@@ -68,7 +68,7 @@ class TestShortcutsManager(TestCase):
# Test the add is calling set_accels_for_action(),
# since there is no shortcuts.conf in the directory.
manager.register_group("general", "General group")
- manager.add("prefix.action1", ["<Control>P"], "Action one")
+ manager.add("prefix.action1", ["<Primary>P"], "Action one")
self.assertEqual(app.set_accels_for_action.call_count, 1)
# Create the temporary shortcuts.conf file
@@ -77,7 +77,7 @@ class TestShortcutsManager(TestCase):
manager2 = ShortcutsManager(app)
manager2.register_group("other", "Other group")
- manager2.add("prefix.action4", ["<Control>W"],
+ manager2.add("prefix.action4", ["<Primary>W"],
"Action addition not invoking set_accels_for_action")
# No. of calls to set_accels_for_action should be unchanged now
# because calling set_accels_for_action isn't allowed with .conf existing
@@ -95,22 +95,22 @@ class TestShortcutsManager(TestCase):
# Set default shortcuts
manager.register_group("group", "Test group")
- manager.add("group.action1", ["<Control>i"], "Action 1")
- manager.add("group.action2", ["<Shift>p", "<Control>m"], "Action 2")
- manager.add("group.action3", ["<Control><Shift>a", "a"], "Action 3")
+ manager.add("group.action1", ["<Primary>i"], "Action 1")
+ manager.add("group.action2", ["<Shift>p", "<Primary>m"], "Action 2")
+ manager.add("group.action3", ["<Primary><Shift>a", "a"], "Action 3")
# After saving the shortcuts, the accels should be set when
# initializing a ShortcutsManger.
- app.get_accels_for_action.side_effect = [(["<Control>i"]),
- (["<Shift>p", "<Control>m"]),
- (["<Control><Shift>a", "a"])]
+ app.get_accels_for_action.side_effect = [(["<Primary>i"]),
+ (["<Shift>p", "<Primary>m"]),
+ (["<Primary><Shift>a", "a"])]
manager.save()
app.reset_mock()
unused_manager2 = ShortcutsManager(app)
self.assertEqual(app.set_accels_for_action.call_count, 3)
- calls = [mock.call("group.action1", ["<Control>i"]),
- mock.call("group.action2", ["<Shift>p", "<Control>m"]),
- mock.call("group.action3", ["<Control><Shift>a", "a"])]
+ calls = [mock.call("group.action1", ["<Primary>i"]),
+ mock.call("group.action2", ["<Shift>p", "<Primary>m"]),
+ mock.call("group.action3", ["<Primary><Shift>a", "a"])]
app.set_accels_for_action.assert_has_calls(calls, any_order=True)
def test_reset_accels(self):
@@ -124,7 +124,7 @@ class TestShortcutsManager(TestCase):
# Set default shortcuts - they will be stored in self.defaults_accelerators.
manager.register_group("group", "Test group")
- manager.add("group.action1", ["<Control>i"], "Action 1")
+ manager.add("group.action1", ["<Primary>i"], "Action 1")
manager.add("group.action2", ["<Shift>p"], "Action 2")
# Test reset of a single action. The shortcuts are saved and no file removed.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]