WebBrowser/Session/SessionManagerDialog.py

changeset 5783
44a9f08de394
parent 5782
60874802161b
child 6047
39586a2de99d
--- a/WebBrowser/Session/SessionManagerDialog.py	Sun Jul 02 19:40:39 2017 +0200
+++ b/WebBrowser/Session/SessionManagerDialog.py	Mon Jul 03 19:23:54 2017 +0200
@@ -7,6 +7,8 @@
 Module implementing a dialog to manage sessions.
 """
 
+from __future__ import unicode_literals
+
 from PyQt5.QtCore import pyqtSlot, Qt, QFileInfo
 from PyQt5.QtGui import QPalette
 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem
@@ -34,6 +36,7 @@
         """
         super(SessionManagerDialog, self).__init__(parent)
         self.setupUi(self)
+        self.setAttribute(Qt.WA_DeleteOnClose)
         
         self.newButton.clicked.connect(self.__newSession)
         self.renameButton.clicked.connect(self.__renameSession)
@@ -214,6 +217,11 @@
         filePath = itm.data(0, SessionManagerDialog.SessionFileRole)
         if filePath:
             if itm.data(0, SessionManagerDialog.BackupSessionRole):
-                WebBrowserWindow.sessionManager().replaceSession(filePath)
+                res = WebBrowserWindow.sessionManager()\
+                    .replaceSession(filePath)
             else:
-                WebBrowserWindow.sessionManager().switchToSession(filePath)
+                res = WebBrowserWindow.sessionManager()\
+                    .switchToSession(filePath)
+            
+            if res:
+                self.close()

eric ide

mercurial