WebBrowser/Session/SessionManagerDialog.py

changeset 5783
44a9f08de394
parent 5782
60874802161b
child 6047
39586a2de99d
equal deleted inserted replaced
5782:60874802161b 5783:44a9f08de394
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a dialog to manage sessions. 7 Module implementing a dialog to manage sessions.
8 """ 8 """
9
10 from __future__ import unicode_literals
9 11
10 from PyQt5.QtCore import pyqtSlot, Qt, QFileInfo 12 from PyQt5.QtCore import pyqtSlot, Qt, QFileInfo
11 from PyQt5.QtGui import QPalette 13 from PyQt5.QtGui import QPalette
12 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem 14 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem
13 15
32 @param parent reference to the parent widget 34 @param parent reference to the parent widget
33 @type QWidget 35 @type QWidget
34 """ 36 """
35 super(SessionManagerDialog, self).__init__(parent) 37 super(SessionManagerDialog, self).__init__(parent)
36 self.setupUi(self) 38 self.setupUi(self)
39 self.setAttribute(Qt.WA_DeleteOnClose)
37 40
38 self.newButton.clicked.connect(self.__newSession) 41 self.newButton.clicked.connect(self.__newSession)
39 self.renameButton.clicked.connect(self.__renameSession) 42 self.renameButton.clicked.connect(self.__renameSession)
40 self.cloneButton.clicked.connect(self.__cloneSession) 43 self.cloneButton.clicked.connect(self.__cloneSession)
41 self.deleteButton.clicked.connect(self.__deleteSession) 44 self.deleteButton.clicked.connect(self.__deleteSession)
212 return 215 return
213 216
214 filePath = itm.data(0, SessionManagerDialog.SessionFileRole) 217 filePath = itm.data(0, SessionManagerDialog.SessionFileRole)
215 if filePath: 218 if filePath:
216 if itm.data(0, SessionManagerDialog.BackupSessionRole): 219 if itm.data(0, SessionManagerDialog.BackupSessionRole):
217 WebBrowserWindow.sessionManager().replaceSession(filePath) 220 res = WebBrowserWindow.sessionManager()\
221 .replaceSession(filePath)
218 else: 222 else:
219 WebBrowserWindow.sessionManager().switchToSession(filePath) 223 res = WebBrowserWindow.sessionManager()\
224 .switchToSession(filePath)
225
226 if res:
227 self.close()

eric ide

mercurial