eric7/WebBrowser/SiteInfo/SiteInfoDialog.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8322
b422b4e77d19
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
18 from PyQt6.QtNetwork import QSslCertificate # __IGNORE_WARNING__ 18 from PyQt6.QtNetwork import QSslCertificate # __IGNORE_WARNING__
19 SSL = True 19 SSL = True
20 except ImportError: 20 except ImportError:
21 SSL = False 21 SSL = False
22 22
23 from E5Gui import E5MessageBox, E5FileDialog 23 from E5Gui import EricMessageBox, EricFileDialog
24 24
25 from .Ui_SiteInfoDialog import Ui_SiteInfoDialog 25 from .Ui_SiteInfoDialog import Ui_SiteInfoDialog
26 26
27 from ..Tools import Scripts, WebBrowserTools 27 from ..Tools import Scripts, WebBrowserTools
28 from ..WebBrowserPage import WebBrowserPage 28 from ..WebBrowserPage import WebBrowserPage
329 pixmapItem = self.imagePreview.scene().items()[0] 329 pixmapItem = self.imagePreview.scene().items()[0]
330 if not isinstance(pixmapItem, QGraphicsPixmapItem): 330 if not isinstance(pixmapItem, QGraphicsPixmapItem):
331 return 331 return
332 332
333 if pixmapItem.pixmap().isNull(): 333 if pixmapItem.pixmap().isNull():
334 E5MessageBox.warning( 334 EricMessageBox.warning(
335 self, 335 self,
336 self.tr("Save Image"), 336 self.tr("Save Image"),
337 self.tr( 337 self.tr(
338 """<p>This preview is not available.</p>""")) 338 """<p>This preview is not available.</p>"""))
339 return 339 return
341 imageFileName = WebBrowserTools.getFileNameFromUrl(QUrl(itm.text(1))) 341 imageFileName = WebBrowserTools.getFileNameFromUrl(QUrl(itm.text(1)))
342 index = imageFileName.rfind(".") 342 index = imageFileName.rfind(".")
343 if index != -1: 343 if index != -1:
344 imageFileName = imageFileName[:index] + ".png" 344 imageFileName = imageFileName[:index] + ".png"
345 345
346 filename = E5FileDialog.getSaveFileName( 346 filename = EricFileDialog.getSaveFileName(
347 self, 347 self,
348 self.tr("Save Image"), 348 self.tr("Save Image"),
349 imageFileName, 349 imageFileName,
350 self.tr("All Files (*)"), 350 self.tr("All Files (*)"),
351 E5FileDialog.DontConfirmOverwrite) 351 EricFileDialog.DontConfirmOverwrite)
352 352
353 if not filename: 353 if not filename:
354 return 354 return
355 355
356 if not pixmapItem.pixmap().save(filename, "PNG"): 356 if not pixmapItem.pixmap().save(filename, "PNG"):
357 E5MessageBox.critical( 357 EricMessageBox.critical(
358 self, 358 self,
359 self.tr("Save Image"), 359 self.tr("Save Image"),
360 self.tr( 360 self.tr(
361 """<p>Cannot write to file <b>{0}</b>.</p>""") 361 """<p>Cannot write to file <b>{0}</b>.</p>""")
362 .format(filename)) 362 .format(filename))

eric ide

mercurial