145 itm.setData(Qt.UserRole, counter) |
145 itm.setData(Qt.UserRole, counter) |
146 counter += 1 |
146 counter += 1 |
147 |
147 |
148 if counter == 0: |
148 if counter == 0: |
149 itm = QListWidgetItem(self.databasesList) |
149 itm = QListWidgetItem(self.databasesList) |
150 itm.setText(self.trUtf8("No databases are used by this page.")) |
150 itm.setText(self.tr("No databases are used by this page.")) |
151 itm.setFlags(itm.flags() & Qt.ItemIsSelectable) |
151 itm.setFlags(itm.flags() & Qt.ItemIsSelectable) |
152 |
152 |
153 @pyqtSlot() |
153 @pyqtSlot() |
154 def on_securityDetailsButton_clicked(self): |
154 def on_securityDetailsButton_clicked(self): |
155 """ |
155 """ |
188 else: |
188 else: |
189 pixmap.loadFromData(cacheData.readAll()) |
189 pixmap.loadFromData(cacheData.readAll()) |
190 if pixmap.isNull(): |
190 if pixmap.isNull(): |
191 invalidPixmap = True |
191 invalidPixmap = True |
192 if invalidPixmap: |
192 if invalidPixmap: |
193 scene.addText(self.trUtf8("Preview not available.")) |
193 scene.addText(self.tr("Preview not available.")) |
194 else: |
194 else: |
195 scene.addPixmap(pixmap) |
195 scene.addPixmap(pixmap) |
196 self.imagePreview.setScene(scene) |
196 self.imagePreview.setScene(scene) |
197 |
197 |
198 def __imagesTreeContextMenuRequested(self, pos): |
198 def __imagesTreeContextMenuRequested(self, pos): |
205 if itm is None: |
205 if itm is None: |
206 return |
206 return |
207 |
207 |
208 menu = QMenu() |
208 menu = QMenu() |
209 act = menu.addAction( |
209 act = menu.addAction( |
210 self.trUtf8("Copy Image Location to Clipboard"), |
210 self.tr("Copy Image Location to Clipboard"), |
211 self.__copyAction) |
211 self.__copyAction) |
212 act.setData(itm.text(1)) |
212 act.setData(itm.text(1)) |
213 act = menu.addAction( |
213 act = menu.addAction( |
214 self.trUtf8("Copy Image Name to Clipboard"), |
214 self.tr("Copy Image Name to Clipboard"), |
215 self.__copyAction) |
215 self.__copyAction) |
216 act.setData(itm.text(0)) |
216 act.setData(itm.text(0)) |
217 menu.addSeparator() |
217 menu.addSeparator() |
218 act = menu.addAction(self.trUtf8("Save Image"), self.__saveImage) |
218 act = menu.addAction(self.tr("Save Image"), self.__saveImage) |
219 act.setData(self.imagesTree.indexOfTopLevelItem(itm)) |
219 act.setData(self.imagesTree.indexOfTopLevelItem(itm)) |
220 menu.exec_(QCursor.pos()) |
220 menu.exec_(QCursor.pos()) |
221 |
221 |
222 def __copyAction(self): |
222 def __copyAction(self): |
223 """ |
223 """ |
248 else: |
248 else: |
249 cacheData = None |
249 cacheData = None |
250 if not cacheData: |
250 if not cacheData: |
251 E5MessageBox.critical( |
251 E5MessageBox.critical( |
252 self, |
252 self, |
253 self.trUtf8("Save Image"), |
253 self.tr("Save Image"), |
254 self.trUtf8("""This image is not available.""")) |
254 self.tr("""This image is not available.""")) |
255 return |
255 return |
256 |
256 |
257 downloadDirectory = Helpviewer.HelpWindow.HelpWindow\ |
257 downloadDirectory = Helpviewer.HelpWindow.HelpWindow\ |
258 .downloadManager().downloadDirectory() |
258 .downloadManager().downloadDirectory() |
259 fn = os.path.join(downloadDirectory, os.path.basename(itm.text(1))) |
259 fn = os.path.join(downloadDirectory, os.path.basename(itm.text(1))) |
260 filename = E5FileDialog.getSaveFileName( |
260 filename = E5FileDialog.getSaveFileName( |
261 self, |
261 self, |
262 self.trUtf8("Save Image"), |
262 self.tr("Save Image"), |
263 fn, |
263 fn, |
264 self.trUtf8("All Files (*)"), |
264 self.tr("All Files (*)"), |
265 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
265 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
266 |
266 |
267 if not filename: |
267 if not filename: |
268 return |
268 return |
269 |
269 |
270 f = QFile(filename) |
270 f = QFile(filename) |
271 if not f.open(QFile.WriteOnly): |
271 if not f.open(QFile.WriteOnly): |
272 E5MessageBox.critical( |
272 E5MessageBox.critical( |
273 self, |
273 self, |
274 self.trUtf8("Save Image"), |
274 self.tr("Save Image"), |
275 self.trUtf8( |
275 self.tr( |
276 """<p>Cannot write to file <b>{0}</b>.</p>""") |
276 """<p>Cannot write to file <b>{0}</b>.</p>""") |
277 .format(filename)) |
277 .format(filename)) |
278 return |
278 return |
279 f.write(cacheData.readAll()) |
279 f.write(cacheData.readAll()) |
280 f.close() |
280 f.close() |