eric6/WebBrowser/Bookmarks/BookmarksImportDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2012 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog for importing bookmarks from other sources.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
1725
d7a3430f7cbf Adapted the bookmarks importers to Mac OS X and changed the SQL stuff of the firefox importer to use sqlite3 because of issues of QSql on Mac OS X.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1717
diff changeset
10 import os
d7a3430f7cbf Adapted the bookmarks importers to Mac OS X and changed the SQL stuff of the firefox importer to use sqlite3 because of issues of QSql on Mac OS X.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1717
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
12 from PyQt5.QtCore import pyqtSlot, Qt, QSize
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
13 from PyQt5.QtWidgets import QDialog, QListWidgetItem
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
15 from E5Gui import E5MessageBox
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
16 from E5Gui.E5PathPicker import E5PathPickerModes
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_BookmarksImportDialog import Ui_BookmarksImportDialog
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from . import BookmarksImporters
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
1725
d7a3430f7cbf Adapted the bookmarks importers to Mac OS X and changed the SQL stuff of the firefox importer to use sqlite3 because of issues of QSql on Mac OS X.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1717
diff changeset
22 import Globals
1717
ba85828cd357 Added a bookmarks importer for Internet Explorer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1713
diff changeset
23
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 class BookmarksImportDialog(QDialog, Ui_BookmarksImportDialog):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Class implementing a dialog for importing bookmarks from other sources.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 SourcesListIdRole = Qt.UserRole
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 def __init__(self, parent=None):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 Constructor
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 @param parent reference to the parent widget (QWidget)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
37 super(BookmarksImportDialog, self).__init__(parent)
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.setupUi(self)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
40 self.filePicker.setMode(E5PathPickerModes.OpenFileMode)
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
41
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.sourcesList.setIconSize(QSize(48, 48))
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 for icon, displayText, idText in BookmarksImporters.getImporters():
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 itm = QListWidgetItem(icon, displayText, self.sourcesList)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 itm.setData(self.SourcesListIdRole, idText)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__currentPage = 0
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__selectedSource = ""
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.__topLevelBookmarkNode = None
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.__sourceFile = ""
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.__sourceDir = ""
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.pagesWidget.setCurrentIndex(self.__currentPage)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.__enableNextButton()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def __enableNextButton(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Private slot to set the enabled state of the next button.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 if self.__currentPage == 0:
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
61 self.nextButton.setEnabled(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
62 len(self.sourcesList.selectedItems()) == 1)
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 elif self.__currentPage == 1:
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
64 self.nextButton.setEnabled(self.filePicker.text() != "")
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 @pyqtSlot()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 def on_sourcesList_itemSelectionChanged(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 Private slot to handle changes of the selection of the import source.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.__enableNextButton()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @pyqtSlot(str)
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
74 def on_filePicker_textChanged(self, txt):
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
76 Private slot handling changes of the file to import bookmarks form.
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @param txt text of the line edit (string)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.__enableNextButton()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 @pyqtSlot()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 def on_nextButton_clicked(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 Private slot to switch to the next page.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 if self.sourcesList.currentItem() is None:
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 return
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 if self.__currentPage == 0:
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.__selectedSource = self.sourcesList.currentItem().data(
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.SourcesListIdRole)
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
93 (pixmap, sourceName, self.__sourceFile, info, prompt,
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
94 self.__sourceDir) = BookmarksImporters.getImporterInfo(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
95 self.__selectedSource)
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.iconLabel.setPixmap(pixmap)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.importingFromLabel.setText(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
99 self.tr("<b>Importing from {0}</b>").format(sourceName))
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 self.fileLabel1.setText(info)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.fileLabel2.setText(prompt)
3002
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
102 self.standardDirLabel.setText(
6ffc581f00f1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
103 "<i>{0}</i>".format(self.__sourceDir))
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
105 self.nextButton.setText(self.tr("Finish"))
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 self.__currentPage += 1
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.pagesWidget.setCurrentIndex(self.__currentPage)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.__enableNextButton()
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
110
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
111 if self.__selectedSource == "ie":
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
112 self.filePicker.setMode(E5PathPickerModes.DirectoryMode)
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
113 else:
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
114 self.filePicker.setMode(E5PathPickerModes.OpenFileMode)
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
115 if Globals.isMacPlatform():
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
116 fileFilter = "*{0}".format(
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
117 os.path.splitext(self.__sourceFile)[1])
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
118 else:
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
119 fileFilter = self.__sourceFile
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
120 self.filePicker.setFilters(fileFilter)
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
121 self.filePicker.setDefaultDirectory(self.__sourceDir)
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 elif self.__currentPage == 1:
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
124 if self.filePicker.text() == "":
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 return
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 importer = BookmarksImporters.getImporter(self.__selectedSource)
4582
3a1d1d4c6f4f Modified more dialogs to use the path picker widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
128 importer.setPath(self.filePicker.text())
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 if importer.open():
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 self.__topLevelBookmarkNode = importer.importedBookmarks()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 if importer.error():
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3002
diff changeset
132 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3002
diff changeset
133 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
134 self.tr("Error importing bookmarks"),
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 importer.errorString())
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 return
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self.accept()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 @pyqtSlot()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 def on_cancelButton_clicked(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
143 Private slot documentation goes here.
1713
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.reject()
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 def getImportedBookmarks(self):
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 Public method to get the imported bookmarks.
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 @return top level bookmark (BookmarkNode)
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 """
56fdde8a2441 Added a bookmarks importer to get them directly from other browsers files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 return self.__topLevelBookmarkNode

eric ide

mercurial