[pitivi] Add support for Ctrl+i keyboard shortcut for opening the import filechooser dialog



commit f108e996c529b1ab7c3bd67530b1eed4c6eb644c
Author: Mahmoud Khalil <mahmoudkhalil11 gmail com>
Date:   Mon Aug 17 18:41:13 2015 +0200

    Add support for Ctrl+i keyboard shortcut for opening the import filechooser dialog

 pitivi/mainwindow.py   |    9 +++++++++
 pitivi/medialibrary.py |    4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 7d31603..7d39fa4 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -485,6 +485,15 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
                                    _("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"))
+
+    def __import_asset_cb(self, unusdaction, unusedparam):
+        self.medialibrary.show_import_assets_dialog()
+
     def showProjectStatus(self):
         project = self.app.project_manager.current_project
         dirty = project.hasUnsavedModifications()
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 0d1cc94..b070e1d 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -538,7 +538,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
             self._welcome_infobar.hide()
 
     def _importSourcesCb(self, unused_action):
-        self._showImportSourcesDialog()
+        self.show_import_assets_dialog()
 
     def _removeAssetsCb(self, unused_action, unused_parameter):
         """Removes the selected assets from the project."""
@@ -657,7 +657,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
 
         return True
 
-    def _showImportSourcesDialog(self):
+    def show_import_assets_dialog(self):
         """Pops up the "Import Sources" dialog box."""
         dialog = Gtk.FileChooserDialog()
         dialog.set_title(_("Select One or More Files"))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]