From 00145f3ab9e26665d48405eec53940ace37f6962 Mon Sep 17 00:00:00 2001 From: Michael Kielstra Date: Wed, 24 Jul 2019 11:57:09 -0400 Subject: [PATCH] Added close-after-select functionality and rebased to current master. --- catfish/CatfishWindow.py | 14 ++- catfish_lib/CatfishSettings.py | 1 + catfish_lib/Window.py | 5 +- data/ui/CatfishWindow.ui | 19 +++++ po/catfish.pot | 150 ++++++++++++++++++++++++++++++++- 5 files changed, 182 insertions(+), 7 deletions(-) diff --git a/catfish/CatfishWindow.py b/catfish/CatfishWindow.py index fadafb77..dfab8420 100644 --- a/catfish/CatfishWindow.py +++ b/catfish/CatfishWindow.py @@ -145,6 +145,8 @@ class CatfishWindow(Window): self.fulltext = builder.get_named_object("menus.application.fulltext") self.sidebar_toggle_menu = builder.get_named_object( "menus.application.advanced") + self.close_after_select = builder.get_named_object( + "menus.application.closeafterselect") # -- Sidebar -- # self.button_time_custom = builder.get_named_object( @@ -359,10 +361,10 @@ class CatfishWindow(Window): self.app_menu_event = not self.app_menu_event if not self.app_menu_event: return - if listbox.get_row_at_index(5) == row: + if listbox.get_row_at_index(6) == row: listbox.get_parent().hide() self.on_menu_update_index_activate(row) - if listbox.get_row_at_index(6) == row: + if listbox.get_row_at_index(7) == row: listbox.get_parent().hide() self.on_mnu_about_activate(row) @@ -511,6 +513,8 @@ class CatfishWindow(Window): self.fulltext.set_active(self.options.fulltext) self.sidebar_toggle_menu.set_active( self.settings.get_setting('show-sidebar')) + self.close_after_select.set_active( + self.settings.get_setting('close-after-select')) self.show_thumbnail = self.options.thumbnails @@ -888,6 +892,10 @@ class CatfishWindow(Window): """Show the Update Search Index dialog.""" self.update_index_dialog.show() + def on_menu_closeafterselect_toggled(self, widget): + active = widget.get_active() + self.settings.set_setting('close-after-select', active) + # -- Sidebar -- # def on_sidebar_toggle_toggled(self, widget): """Toggle visibility of the sidebar.""" @@ -1027,6 +1035,8 @@ class CatfishWindow(Window): command = ['xdg-open', filename] try: subprocess.Popen(command, shell=False) + if(self.settings.get_setting('close-after-select')): + self.destroy() return except Exception as msg: logger.debug('Exception encountered while opening %s.' + diff --git a/catfish_lib/CatfishSettings.py b/catfish_lib/CatfishSettings.py index 60e162bd..67991e24 100644 --- a/catfish_lib/CatfishSettings.py +++ b/catfish_lib/CatfishSettings.py @@ -24,6 +24,7 @@ default_settings = { 'use-headerbar': None, 'show-hidden-files': False, 'show-sidebar': False, + 'close-after-select': False, 'window-width': 650, 'window-height': 470, 'window-x': -1, diff --git a/catfish_lib/Window.py b/catfish_lib/Window.py index 607a5f7a..ae7293d6 100644 --- a/catfish_lib/Window.py +++ b/catfish_lib/Window.py @@ -56,7 +56,8 @@ __builder__ = { "hidden": "application_menu_hidden", "fulltext": "application_menu_fulltext", "advanced": "application_menu_advanced", - "update": "application_menu_update" + "update": "application_menu_update", + "closeafterselect": "application_menu_closeafterselect" }, # File Context Menu "file": { @@ -348,4 +349,4 @@ class Window(Gtk.Window): def on_catfish_window_configure_event(self, widget, event): pos = self.get_position() self.settings.set_setting('window-x', pos.root_x) - self.settings.set_setting('window-y', pos.root_y) \ No newline at end of file + self.settings.set_setting('window-y', pos.root_y) diff --git a/data/ui/CatfishWindow.ui b/data/ui/CatfishWindow.ui index b2a0ee7b..c5ae3b6e 100644 --- a/data/ui/CatfishWindow.ui +++ b/data/ui/CatfishWindow.ui @@ -1221,6 +1221,25 @@ + + + 100 + True + True + + + Close _on Selection + True + True + False + True + 0 + True + + + + + True diff --git a/po/catfish.pot b/po/catfish.pot index cb21f30e..11b0141a 100644 --- a/po/catfish.pot +++ b/po/catfish.pot @@ -17,8 +17,8 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../org.xfce.Catfish.desktop.in.h:1 ../data/ui/CatfishWindow.ui.h:28 -#: ../catfish/CatfishWindow.py:679 +#: ../catfish.desktop.in.h:1 ../data/ui/CatfishWindow.ui.h:28 +#: ../catfish/CatfishWindow.py:669 msgid "Catfish File Search" msgstr "" @@ -121,7 +121,7 @@ msgstr "" msgid "End Date" msgstr "" -#: ../data/ui/CatfishWindow.ui.h:23 ../catfish_lib/Window.py:217 +#: ../data/ui/CatfishWindow.ui.h:23 ../catfish_lib/Window.py:218 msgid "Catfish" msgstr "" @@ -137,7 +137,11 @@ msgstr "" msgid "File Type" msgstr "" +<<<<<<< HEAD #: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1215 +======= +#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1142 +>>>>>>> 761eaffa... ../0001.patch msgid "Modified" msgstr "" @@ -191,11 +195,19 @@ msgid "_Exact Match" msgstr "" #: ../data/ui/CatfishWindow.ui.h:39 +<<<<<<< HEAD msgid "Show _Sidebar" msgstr "" #: ../data/ui/CatfishWindow.ui.h:40 msgid "_Update Search Index..." +======= +msgid "Close _on Selection" +msgstr "" + +#: ../data/ui/CatfishWindow.ui.h:40 +msgid "_Update Search Index…" +>>>>>>> 761eaffa... ../0001.patch msgstr "" #: ../data/ui/CatfishWindow.ui.h:41 @@ -283,6 +295,7 @@ msgstr "" msgid "%s (invalid encoding)" msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:249 msgid "Unknown" msgstr "" @@ -304,10 +317,34 @@ msgid "Authentication cancelled." msgstr "" #: ../catfish/CatfishWindow.py:661 +======= +#: ../catfish/CatfishWindow.py:239 +msgid "Unknown" +msgstr "" + +#: ../catfish/CatfishWindow.py:243 +msgid "Never" +msgstr "" + +#: ../catfish/CatfishWindow.py:637 +msgid "An error occurred while updating the database." +msgstr "" + +#: ../catfish/CatfishWindow.py:639 +msgid "Authentication failed." +msgstr "" + +#: ../catfish/CatfishWindow.py:645 +msgid "Authentication cancelled." +msgstr "" + +#: ../catfish/CatfishWindow.py:651 +>>>>>>> 761eaffa... ../0001.patch msgid "Search database updated successfully." msgstr "" #. Set the dialog status to running. +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:736 msgid "Updating..." msgstr "" @@ -317,49 +354,89 @@ msgid "Stop Search" msgstr "" #: ../catfish/CatfishWindow.py:771 +======= +#: ../catfish/CatfishWindow.py:726 +msgid "Updating..." +msgstr "" + +#: ../catfish/CatfishWindow.py:760 +msgid "Stop Search" +msgstr "" + +#: ../catfish/CatfishWindow.py:761 +>>>>>>> 761eaffa... ../0001.patch msgid "" "Search is in progress...\n" "Press the cancel button or the Escape key to stop." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:780 msgid "Begin Search" msgstr "" #: ../catfish/CatfishWindow.py:1035 +======= +#: ../catfish/CatfishWindow.py:770 +msgid "Begin Search" +msgstr "" + +#: ../catfish/CatfishWindow.py:968 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "\"%s\" could not be opened." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1087 +======= +#: ../catfish/CatfishWindow.py:1014 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "\"%s\" could not be saved." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1104 +======= +#: ../catfish/CatfishWindow.py:1031 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "\"%s\" could not be deleted." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1144 +======= +#: ../catfish/CatfishWindow.py:1071 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "Save \"%s\" as..." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1179 +======= +#: ../catfish/CatfishWindow.py:1106 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "" "Are you sure that you want to \n" "permanently delete \"%s\"?" msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1183 +======= +#: ../catfish/CatfishWindow.py:1110 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "" "Are you sure that you want to \n" "permanently delete the %i selected files?" msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1186 msgid "If you delete a file, it is permanently lost." msgstr "" @@ -397,20 +474,68 @@ msgid "No files found." msgstr "" #: ../catfish/CatfishWindow.py:1541 +======= +#: ../catfish/CatfishWindow.py:1113 +msgid "If you delete a file, it is permanently lost." +msgstr "" + +#: ../catfish/CatfishWindow.py:1136 +msgid "Filename" +msgstr "" + +#: ../catfish/CatfishWindow.py:1138 +msgid "Size" +msgstr "" + +#: ../catfish/CatfishWindow.py:1140 +msgid "Location" +msgstr "" + +#: ../catfish/CatfishWindow.py:1152 +msgid "Preview" +msgstr "" + +#: ../catfish/CatfishWindow.py:1160 +msgid "Details" +msgstr "" + +#: ../catfish/CatfishWindow.py:1379 +msgid "Today" +msgstr "" + +#: ../catfish/CatfishWindow.py:1381 +msgid "Yesterday" +msgstr "" + +#: ../catfish/CatfishWindow.py:1462 +msgid "No files found." +msgstr "" + +#: ../catfish/CatfishWindow.py:1464 +>>>>>>> 761eaffa... ../0001.patch msgid "" "Try making your search less specific\n" "or try another directory." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1547 msgid "1 file found." msgstr "" #: ../catfish/CatfishWindow.py:1549 +======= +#: ../catfish/CatfishWindow.py:1470 +msgid "1 file found." +msgstr "" + +#: ../catfish/CatfishWindow.py:1472 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "%i files found." msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1555 msgid "bytes" msgstr "" @@ -424,11 +549,30 @@ msgid "Results will be displayed as soon as they are found." msgstr "" #: ../catfish/CatfishWindow.py:1670 +======= +#: ../catfish/CatfishWindow.py:1478 +msgid "bytes" +msgstr "" + +#: ../catfish/CatfishWindow.py:1586 ../catfish/CatfishWindow.py:1595 +msgid "Searching…" +msgstr "" + +#: ../catfish/CatfishWindow.py:1588 +msgid "Results will be displayed as soon as they are found." +msgstr "" + +#: ../catfish/CatfishWindow.py:1593 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "Searching for \"%s\"" msgstr "" +<<<<<<< HEAD #: ../catfish/CatfishWindow.py:1760 +======= +#: ../catfish/CatfishWindow.py:1682 +>>>>>>> 761eaffa... ../0001.patch #, python-format msgid "Search results for \"%s\"" msgstr "" -- 2.20.1