4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog for importing bookmarks from other sources. |
7 Module implementing a dialog for importing bookmarks from other sources. |
8 """ |
8 """ |
|
9 |
|
10 import os |
9 |
11 |
10 from PyQt4.QtCore import pyqtSlot, Qt, QSize |
12 from PyQt4.QtCore import pyqtSlot, Qt, QSize |
11 from PyQt4.QtGui import QDialog, QListWidgetItem, QFileDialog |
13 from PyQt4.QtGui import QDialog, QListWidgetItem, QFileDialog |
12 |
14 |
13 from E5Gui import E5FileDialog, E5MessageBox |
15 from E5Gui import E5FileDialog, E5MessageBox |
15 from .Ui_BookmarksImportDialog import Ui_BookmarksImportDialog |
17 from .Ui_BookmarksImportDialog import Ui_BookmarksImportDialog |
16 |
18 |
17 from . import BookmarksImporters |
19 from . import BookmarksImporters |
18 |
20 |
19 import Utilities |
21 import Utilities |
|
22 import Globals |
20 |
23 |
21 |
24 |
22 class BookmarksImportDialog(QDialog, Ui_BookmarksImportDialog): |
25 class BookmarksImportDialog(QDialog, Ui_BookmarksImportDialog): |
23 """ |
26 """ |
24 Class implementing a dialog for importing bookmarks from other sources. |
27 Class implementing a dialog for importing bookmarks from other sources. |
83 self, |
86 self, |
84 self.trUtf8("Choose Directory ..."), |
87 self.trUtf8("Choose Directory ..."), |
85 self.__sourceDir, |
88 self.__sourceDir, |
86 QFileDialog.Options(QFileDialog.Option(0))) |
89 QFileDialog.Options(QFileDialog.Option(0))) |
87 else: |
90 else: |
|
91 if Globals.isMacPlatform(): |
|
92 filter = "*{0}".format(os.path.splitext(self.__sourceFile)[1]) |
|
93 else: |
|
94 filter = self.__sourceFile |
88 path = E5FileDialog.getOpenFileName( |
95 path = E5FileDialog.getOpenFileName( |
89 self, |
96 self, |
90 self.trUtf8("Choose File ..."), |
97 self.trUtf8("Choose File ..."), |
91 self.__sourceDir, |
98 self.__sourceDir, |
92 self.__sourceFile) |
99 filter) |
93 |
100 |
94 if path: |
101 if path: |
95 self.fileEdit.setText(Utilities.toNativeSeparators(path)) |
102 self.fileEdit.setText(Utilities.toNativeSeparators(path)) |
96 |
103 |
97 @pyqtSlot() |
104 @pyqtSlot() |