10 # |
10 # |
11 # This is a Python port of the TLDExtractor of Qupzilla |
11 # This is a Python port of the TLDExtractor of Qupzilla |
12 # Copyright (C) 2014 Razi Alavizadeh <s.r.alavizadeh@gmail.com> |
12 # Copyright (C) 2014 Razi Alavizadeh <s.r.alavizadeh@gmail.com> |
13 # |
13 # |
14 |
14 |
15 |
|
16 import collections |
15 import collections |
|
16 import os |
17 |
17 |
18 from PyQt5.QtCore import QObject, QUrl, QFile, QFileInfo, QRegExp, qWarning |
18 from PyQt5.QtCore import QObject, QUrl, QFile, QFileInfo, QRegExp, qWarning |
19 |
19 |
20 from E5Gui import E5MessageBox |
20 from E5Gui import E5MessageBox |
21 |
|
22 from .data import tld_rc # __IGNORE_WARNING__ |
|
23 |
21 |
24 |
22 |
25 class E5TldHostParts(object): |
23 class E5TldHostParts(object): |
26 """ |
24 """ |
27 Class implementing the host parts helper. |
25 Class implementing the host parts helper. |
247 Private method to get the default search paths for the TLD data file. |
245 Private method to get the default search paths for the TLD data file. |
248 |
246 |
249 @return default search paths for the TLD data file |
247 @return default search paths for the TLD data file |
250 @rtype list of str |
248 @rtype list of str |
251 """ |
249 """ |
252 # TODO: replace this with path to our data directory to remove .qrc |
250 return [os.path.join(os.path.dirname(__file__), "data")] |
253 return [":"] |
|
254 |
251 |
255 def getTldDownloadUrl(self): |
252 def getTldDownloadUrl(self): |
256 """ |
253 """ |
257 Public method to get the TLD data file download URL. |
254 Public method to get the TLD data file download URL. |
258 |
255 |
432 @return normalized host address |
429 @return normalized host address |
433 @rtype str |
430 @rtype str |
434 """ |
431 """ |
435 return host.lower() |
432 return host.lower() |
436 |
433 |
437 # TODO: remove this part and delete 'test_psl.txt' |
|
438 ################################################################# |
434 ################################################################# |
439 ## Methods below are for testing purposes |
435 ## Methods below are for testing purposes |
440 ################################################################# |
436 ################################################################# |
441 |
437 |
442 def test(self): |
438 def test(self): |