[ocrfeeder/introspection] Use the last visited dir when adding a new image



commit 6da207207a29046ee4fb71adcb9f55b4d235155d
Author: Joaquim Rocha <me joaquimrocha com>
Date:   Sun Jun 29 20:43:19 2014 +0200

    Use the last visited dir when adding a new image
    
    This is only true in the same session but in the future, this should
    be added to the configuration so it persists between different
    sessions.

 src/ocrfeeder/studio/studioBuilder.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/ocrfeeder/studio/studioBuilder.py b/src/ocrfeeder/studio/studioBuilder.py
index e46eafd..89e0e56 100644
--- a/src/ocrfeeder/studio/studioBuilder.py
+++ b/src/ocrfeeder/studio/studioBuilder.py
@@ -159,6 +159,8 @@ class Studio:
         else:
             self.__askForEnginesMigration()
 
+        self._last_images_dir = ''
+
     def run(self):
         Gdk.threads_init()
         Gtk.main()
@@ -199,9 +201,16 @@ class Studio:
     def addImage(self, widget):
         file_open_dialog = widgetPresenter.FileDialog('open', file_filters = [(_('Images'), ['image/*'], 
[])])
         file_open_dialog.set_select_multiple(True)
+
+        if self._last_images_dir:
+            file_open_dialog.set_current_folder(self._last_images_dir)
+
         response = file_open_dialog.run()
+
         if response == Gtk.ResponseType.OK:
             self.__addImagesToReviewer(file_open_dialog.get_filenames())
+
+        self._last_images_dir = file_open_dialog.get_current_folder()
         file_open_dialog.destroy()
 
     def importFromScanner(self, widget):


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