Helpviewer/Download/DownloadManager.py

changeset 3190
a9a94491c4fd
parent 3034
7ce719013078
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
80 row = self.downloadsView.selectionModel().selectedRows()[0].row() 80 row = self.downloadsView.selectionModel().selectedRows()[0].row()
81 itm = self.__downloads[row] 81 itm = self.__downloads[row]
82 if itm.downloadCanceled(): 82 if itm.downloadCanceled():
83 menu.addAction( 83 menu.addAction(
84 UI.PixmapCache.getIcon("restart.png"), 84 UI.PixmapCache.getIcon("restart.png"),
85 self.trUtf8("Retry"), self.__contextMenuRetry) 85 self.tr("Retry"), self.__contextMenuRetry)
86 else: 86 else:
87 if itm.downloadedSuccessfully(): 87 if itm.downloadedSuccessfully():
88 menu.addAction( 88 menu.addAction(
89 UI.PixmapCache.getIcon("open.png"), 89 UI.PixmapCache.getIcon("open.png"),
90 self.trUtf8("Open"), self.__contextMenuOpen) 90 self.tr("Open"), self.__contextMenuOpen)
91 elif itm.downloading(): 91 elif itm.downloading():
92 menu.addAction( 92 menu.addAction(
93 UI.PixmapCache.getIcon("stopLoading.png"), 93 UI.PixmapCache.getIcon("stopLoading.png"),
94 self.trUtf8("Cancel"), self.__contextMenuCancel) 94 self.tr("Cancel"), self.__contextMenuCancel)
95 menu.addSeparator() 95 menu.addSeparator()
96 menu.addAction( 96 menu.addAction(
97 self.trUtf8("Open Containing Folder"), 97 self.tr("Open Containing Folder"),
98 self.__contextMenuOpenFolder) 98 self.__contextMenuOpenFolder)
99 menu.addSeparator() 99 menu.addSeparator()
100 menu.addAction( 100 menu.addAction(
101 self.trUtf8("Go to Download Page"), 101 self.tr("Go to Download Page"),
102 self.__contextMenuGotoPage) 102 self.__contextMenuGotoPage)
103 menu.addAction( 103 menu.addAction(
104 self.trUtf8("Copy Download Link"), 104 self.tr("Copy Download Link"),
105 self.__contextMenuCopyLink) 105 self.__contextMenuCopyLink)
106 menu.addSeparator() 106 menu.addSeparator()
107 menu.addAction(self.trUtf8("Select All"), self.__contextMenuSelectAll) 107 menu.addAction(self.tr("Select All"), self.__contextMenuSelectAll)
108 if selectedRowsCount > 1 or \ 108 if selectedRowsCount > 1 or \
109 (selectedRowsCount == 1 and 109 (selectedRowsCount == 1 and
110 not self.__downloads[ 110 not self.__downloads[
111 self.downloadsView.selectionModel().selectedRows()[0].row()] 111 self.downloadsView.selectionModel().selectedRows()[0].row()]
112 .downloading()): 112 .downloading()):
113 menu.addSeparator() 113 menu.addSeparator()
114 menu.addAction( 114 menu.addAction(
115 self.trUtf8("Remove From List"), 115 self.tr("Remove From List"),
116 self.__contextMenuRemoveSelected) 116 self.__contextMenuRemoveSelected)
117 117
118 menu.exec_(QCursor.pos()) 118 menu.exec_(QCursor.pos())
119 119
120 def shutdown(self): 120 def shutdown(self):
145 @return flag indicating allowance to quit (boolean) 145 @return flag indicating allowance to quit (boolean)
146 """ 146 """
147 if self.activeDownloads() > 0: 147 if self.activeDownloads() > 0:
148 res = E5MessageBox.yesNo( 148 res = E5MessageBox.yesNo(
149 self, 149 self,
150 self.trUtf8(""), 150 self.tr(""),
151 self.trUtf8("""There are %n downloads in progress.\n""" 151 self.tr("""There are %n downloads in progress.\n"""
152 """Do you want to quit anyway?""", "", 152 """Do you want to quit anyway?""", "",
153 self.activeDownloads()), 153 self.activeDownloads()),
154 icon=E5MessageBox.Warning) 154 icon=E5MessageBox.Warning)
155 if not res: 155 if not res:
156 self.show() 156 self.show()
157 return False 157 return False
158 return True 158 return True
376 def __updateItemCount(self): 376 def __updateItemCount(self):
377 """ 377 """
378 Private method to update the count label. 378 Private method to update the count label.
379 """ 379 """
380 count = len(self.__downloads) 380 count = len(self.__downloads)
381 self.countLabel.setText(self.trUtf8("%n Download(s)", "", count)) 381 self.countLabel.setText(self.tr("%n Download(s)", "", count))
382 382
383 def __updateActiveItemCount(self): 383 def __updateActiveItemCount(self):
384 """ 384 """
385 Private method to update the window title. 385 Private method to update the window title.
386 """ 386 """
387 count = self.activeDownloads() 387 count = self.activeDownloads()
388 if count > 0: 388 if count > 0:
389 self.setWindowTitle( 389 self.setWindowTitle(
390 self.trUtf8("Downloading %n file(s)", "", count)) 390 self.tr("Downloading %n file(s)", "", count))
391 else: 391 else:
392 self.setWindowTitle(self.trUtf8("Downloads")) 392 self.setWindowTitle(self.tr("Downloads"))
393 393
394 def __finished(self): 394 def __finished(self):
395 """ 395 """
396 Private slot to handle a finished download. 396 Private slot to handle a finished download.
397 """ 397 """

eric ide

mercurial