6 """ |
6 """ |
7 Module implementing the bookmarks manager. |
7 Module implementing the bookmarks manager. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
|
11 import contextlib |
11 |
12 |
12 from PyQt5.QtCore import ( |
13 from PyQt5.QtCore import ( |
13 pyqtSignal, QT_TRANSLATE_NOOP, QObject, QFile, QIODevice, QXmlStreamReader, |
14 pyqtSignal, QT_TRANSLATE_NOOP, QObject, QFile, QIODevice, QXmlStreamReader, |
14 QDateTime, QFileInfo, QUrl, QCoreApplication |
15 QDateTime, QFileInfo, QUrl, QCoreApplication |
15 ) |
16 ) |
321 Public method to set the visit count of a bookmark. |
322 Public method to set the visit count of a bookmark. |
322 |
323 |
323 @param node reference to the node to be changed (BookmarkNode) |
324 @param node reference to the node to be changed (BookmarkNode) |
324 @param count visit count to be set (int or str) |
325 @param count visit count to be set (int or str) |
325 """ |
326 """ |
326 try: |
327 with contextlib.suppress(ValueError): |
327 node.visitCount = int(count) |
328 node.visitCount = int(count) |
328 self.__saveTimer.changeOccurred() |
329 self.__saveTimer.changeOccurred() |
329 except ValueError: |
|
330 # ignore invalid values |
|
331 pass |
|
332 |
330 |
333 def bookmarks(self): |
331 def bookmarks(self): |
334 """ |
332 """ |
335 Public method to get a reference to the root bookmark node. |
333 Public method to get a reference to the root bookmark node. |
336 |
334 |