timprove recently_open menu - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit 464a89ddf530d3c748812b4122198d537fa06ba7
 (DIR) parent b40f3571e80a00c0f349c406e430899566154a6b
 (HTM) Author: ThomasV <thomasv@gitorious>
       Date:   Fri,  7 Aug 2015 19:24:43 +0200
       
       improve recently_open menu
       
       Diffstat:
         M gui/qt/main_window.py               |       8 ++++++--
       
       1 file changed, 6 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -290,6 +290,10 @@ class ElectrumWindow(QMainWindow):
                    return
                if not storage.file_exists:
                    self.show_message(_("File not found") + ' ' + filename)
       +            recent = self.config.get('recently_open', [])
       +            if filename in recent:
       +                recent.remove(filename)
       +                self.config.set_key('recently_open', recent)
                    return
                # read wizard action
                try:
       t@@ -373,10 +377,10 @@ class ElectrumWindow(QMainWindow):
                recent = self.config.get('recently_open', [])
                if filename and filename not in recent:
                    recent.insert(0, filename)
       -            recent = recent[:10]
       +            recent = recent[:5]
                    self.config.set_key('recently_open', recent)
                self.recently_visited_menu.clear()
       -        for i, k in enumerate(recent):
       +        for i, k in enumerate(sorted(recent)):
                    b = os.path.basename(k)
                    def loader(k):
                        return lambda: self.load_wallet_file(k)