eric6/WebBrowser/Feeds/FeedsManager.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
36 newTab = pyqtSignal(QUrl, str) 36 newTab = pyqtSignal(QUrl, str)
37 newBackgroundTab = pyqtSignal(QUrl, str) 37 newBackgroundTab = pyqtSignal(QUrl, str)
38 newWindow = pyqtSignal(QUrl, str) 38 newWindow = pyqtSignal(QUrl, str)
39 newPrivateWindow = pyqtSignal(QUrl, str) 39 newPrivateWindow = pyqtSignal(QUrl, str)
40 40
41 UrlStringRole = Qt.UserRole 41 UrlStringRole = Qt.ItemDataRole.UserRole
42 ErrorDataRole = Qt.UserRole + 1 42 ErrorDataRole = Qt.ItemDataRole.UserRole + 1
43 43
44 def __init__(self, parent=None): 44 def __init__(self, parent=None):
45 """ 45 """
46 Constructor 46 Constructor
47 47
48 @param parent reference to the parent widget (QWidget) 48 @param parent reference to the parent widget (QWidget)
49 """ 49 """
50 super(FeedsManager, self).__init__(parent) 50 super(FeedsManager, self).__init__(parent)
51 self.setupUi(self) 51 self.setupUi(self)
52 self.setWindowFlags(Qt.Window) 52 self.setWindowFlags(Qt.WindowType.Window)
53 53
54 self.__wasShown = False 54 self.__wasShown = False
55 self.__loaded = False 55 self.__loaded = False
56 self.__feeds = [] 56 self.__feeds = []
57 self.__replies = {} 57 self.__replies = {}
58 # dict key is the id of the request object 58 # dict key is the id of the request object
59 # dict value is a tuple of request and tree item 59 # dict value is a tuple of request and tree item
60 60
61 self.feedsTree.setContextMenuPolicy(Qt.CustomContextMenu) 61 self.feedsTree.setContextMenuPolicy(
62 Qt.ContextMenuPolicy.CustomContextMenu)
62 self.feedsTree.customContextMenuRequested.connect( 63 self.feedsTree.customContextMenuRequested.connect(
63 self.__customContextMenuRequested) 64 self.__customContextMenuRequested)
64 self.feedsTree.itemActivated.connect(self.__itemActivated) 65 self.feedsTree.itemActivated.connect(self.__itemActivated)
65 66
66 def show(self): 67 def show(self):
173 if feedToChange: 174 if feedToChange:
174 feedIndex = self.__feeds.index(feedToChange) 175 feedIndex = self.__feeds.index(feedToChange)
175 176
176 from .FeedEditDialog import FeedEditDialog 177 from .FeedEditDialog import FeedEditDialog
177 dlg = FeedEditDialog(origUrlString, origTitle) 178 dlg = FeedEditDialog(origUrlString, origTitle)
178 if dlg.exec() == QDialog.Accepted: 179 if dlg.exec() == QDialog.DialogCode.Accepted:
179 urlString, title = dlg.getData() 180 urlString, title = dlg.getData()
180 for feed in self.__feeds: 181 for feed in self.__feeds:
181 if feed[0] == urlString: 182 if feed[0] == urlString:
182 E5MessageBox.critical( 183 E5MessageBox.critical(
183 self, 184 self,
278 return 279 return
279 280
280 topItem = self.__replies[id(reply)][1] 281 topItem = self.__replies[id(reply)][1]
281 del self.__replies[id(reply)] 282 del self.__replies[id(reply)]
282 283
283 if reply.error() == QNetworkReply.NoError: 284 if reply.error() == QNetworkReply.NetworkError.NoError:
284 linkString = "" 285 linkString = ""
285 titleString = "" 286 titleString = ""
286 287
287 xml = QXmlStreamReader() 288 xml = QXmlStreamReader()
288 xmlData = reply.readAll() 289 xmlData = reply.readAll()
375 @param column column of the activation (integer) 376 @param column column of the activation (integer)
376 """ 377 """
377 if self.feedsTree.indexOfTopLevelItem(itm) != -1: 378 if self.feedsTree.indexOfTopLevelItem(itm) != -1:
378 return 379 return
379 380
380 if QApplication.keyboardModifiers() & Qt.ControlModifier: 381 if (
382 QApplication.keyboardModifiers() &
383 Qt.KeyboardModifier.ControlModifier
384 ):
381 self.__openMessageInNewTab() 385 self.__openMessageInNewTab()
382 elif QApplication.keyboardModifiers() & Qt.ShiftModifier: 386 elif (
387 QApplication.keyboardModifiers() &
388 Qt.KeyboardModifier.ShiftModifier
389 ):
383 self.__openMessageInNewWindow() 390 self.__openMessageInNewWindow()
384 else: 391 else:
385 self.__openMessageInCurrentTab() 392 self.__openMessageInCurrentTab()
386 393
387 def __openMessageInCurrentTab(self): 394 def __openMessageInCurrentTab(self):

eric ide

mercurial