def on_toolbar_insert_image(self, *args): dialog = Qt.QFileDialog() dialog.setFileMode(Qt.QFileDialog.AnyFile) dialog.setNameFilters([ "Images JPEG/PNG/TIFF (*.png *.jpg *.jpeg *.tiff)", ]) if not dialog.exec_(): return filenames = dialog.selectedFiles() for fn in filenames: self.insertImage(fn)
def on_toolbar_insert_image(self, *args): docid, editor = self.getCurrentEditor() if not docid or not editor or not editor.has_images: return dialog = Qt.QFileDialog() dialog.setFileMode(Qt.QFileDialog.AnyFile) dialog.setNameFilters([ "Images JPEG/PNG/TIFF (*.png *.jpg *.jpeg *.tiff)", ]) if not dialog.exec_(): return filenames = dialog.selectedFiles() for fn in filenames: editor.insertImage(fn)