306 """ |
306 """ |
307 if self.__sessionMetaData: |
307 if self.__sessionMetaData: |
308 return |
308 return |
309 |
309 |
310 sessionFilesInfoList = QDir(self.getSessionsDirectory()).entryInfoList( |
310 sessionFilesInfoList = QDir(self.getSessionsDirectory()).entryInfoList( |
311 ["*.json"], QDir.Files, QDir.Time) |
311 ["*.json"], QDir.Filter.Files, QDir.SortFlag.Time) |
312 |
312 |
313 for sessionFileInfo in sessionFilesInfoList: |
313 for sessionFileInfo in sessionFilesInfoList: |
314 sessionData = self.readSessionFromFile( |
314 sessionData = self.readSessionFromFile( |
315 sessionFileInfo.absoluteFilePath()) |
315 sessionFileInfo.absoluteFilePath()) |
316 if not sessionData or not sessionData["Windows"]: |
316 if not sessionData or not sessionData["Windows"]: |
493 title = self.tr("Rename Session") |
493 title = self.tr("Rename Session") |
494 newName, ok = QInputDialog.getText( |
494 newName, ok = QInputDialog.getText( |
495 WebBrowserWindow.getWindow(), |
495 WebBrowserWindow.getWindow(), |
496 title, |
496 title, |
497 self.tr("Please enter a new name:"), |
497 self.tr("Please enter a new name:"), |
498 QLineEdit.Normal, |
498 QLineEdit.EchoMode.Normal, |
499 suggestedName) |
499 suggestedName) |
500 |
500 |
501 if not ok: |
501 if not ok: |
502 return |
502 return |
503 |
503 |
541 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
541 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
542 newName, ok = QInputDialog.getText( |
542 newName, ok = QInputDialog.getText( |
543 WebBrowserWindow.getWindow(), |
543 WebBrowserWindow.getWindow(), |
544 self.tr("Save Session"), |
544 self.tr("Save Session"), |
545 self.tr("Please enter a name for the session:"), |
545 self.tr("Please enter a name for the session:"), |
546 QLineEdit.Normal, |
546 QLineEdit.EchoMode.Normal, |
547 self.tr("Saved Session ({0})").format( |
547 self.tr("Saved Session ({0})").format( |
548 QDateTime.currentDateTime().toString("yyyy-MM-dd HH-mm-ss"))) |
548 QDateTime.currentDateTime().toString("yyyy-MM-dd HH-mm-ss"))) |
549 |
549 |
550 if not ok: |
550 if not ok: |
551 return |
551 return |
630 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
630 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
631 newName, ok = QInputDialog.getText( |
631 newName, ok = QInputDialog.getText( |
632 WebBrowserWindow.getWindow(), |
632 WebBrowserWindow.getWindow(), |
633 self.tr("New Session"), |
633 self.tr("New Session"), |
634 self.tr("Please enter a name for the new session:"), |
634 self.tr("Please enter a name for the new session:"), |
635 QLineEdit.Normal, |
635 QLineEdit.EchoMode.Normal, |
636 self.tr("New Session ({0})").format( |
636 self.tr("New Session ({0})").format( |
637 QDateTime.currentDateTime().toString("yyyy-MM-dd HH-mm-ss"))) |
637 QDateTime.currentDateTime().toString("yyyy-MM-dd HH-mm-ss"))) |
638 |
638 |
639 if not ok: |
639 if not ok: |
640 return |
640 return |
685 self.__fillMetaDataList() |
685 self.__fillMetaDataList() |
686 |
686 |
687 if self.__sessionMetaData: |
687 if self.__sessionMetaData: |
688 # skip, if no session file available |
688 # skip, if no session file available |
689 dlg = QDialog(WebBrowserWindow.getWindow(), |
689 dlg = QDialog(WebBrowserWindow.getWindow(), |
690 Qt.WindowStaysOnTopHint) |
690 Qt.WindowType.WindowStaysOnTopHint) |
691 lbl = QLabel(self.tr("Please select the startup session:")) |
691 lbl = QLabel(self.tr("Please select the startup session:")) |
692 combo = QComboBox(dlg) |
692 combo = QComboBox(dlg) |
693 buttonBox = QDialogButtonBox( |
693 buttonBox = QDialogButtonBox( |
694 QDialogButtonBox.Ok | QDialogButtonBox.Cancel, dlg) |
694 QDialogButtonBox.StandardButton.Ok | |
|
695 QDialogButtonBox.StandardButton.Cancel, |
|
696 dlg) |
695 buttonBox.accepted.connect(dlg.accept) |
697 buttonBox.accepted.connect(dlg.accept) |
696 buttonBox.rejected.connect(dlg.reject) |
698 buttonBox.rejected.connect(dlg.reject) |
697 |
699 |
698 layout = QVBoxLayout() |
700 layout = QVBoxLayout() |
699 layout.addWidget(lbl) |
701 layout.addWidget(lbl) |
712 self.tr("{0} (last session)").format(metaData.name), |
714 self.tr("{0} (last session)").format(metaData.name), |
713 metaData.filePath |
715 metaData.filePath |
714 ) |
716 ) |
715 combo.setCurrentIndex(0) |
717 combo.setCurrentIndex(0) |
716 |
718 |
717 if dlg.exec() == QDialog.Accepted: |
719 if dlg.exec() == QDialog.DialogCode.Accepted: |
718 session = combo.currentData() |
720 session = combo.currentData() |
719 if session is None: |
721 if session is None: |
720 self.__lastActiveSession = self.__sessionDefault |
722 self.__lastActiveSession = self.__sessionDefault |
721 else: |
723 else: |
722 self.__lastActiveSession = session |
724 self.__lastActiveSession = session |