285 itm = self.imagesTree.itemAt(pos) |
285 itm = self.imagesTree.itemAt(pos) |
286 if itm is None: |
286 if itm is None: |
287 return |
287 return |
288 |
288 |
289 menu = QMenu() |
289 menu = QMenu() |
290 act = menu.addAction(self.tr("Copy Image Location to Clipboard")) |
290 act1 = menu.addAction(self.tr("Copy Image Location to Clipboard")) |
291 act.setData(itm.text(1)) |
291 act1.setData(itm.text(1)) |
292 act.triggered.connect(lambda: self.__copyAction(act)) |
292 act1.triggered.connect(lambda: self.__copyAction(act1)) |
293 act = menu.addAction(self.tr("Copy Image Name to Clipboard")) |
293 act2 = menu.addAction(self.tr("Copy Image Name to Clipboard")) |
294 act.setData(itm.text(0)) |
294 act2.setData(itm.text(0)) |
295 act.triggered.connect(lambda: self.__copyAction(act)) |
295 act2.triggered.connect(lambda: self.__copyAction(act2)) |
296 menu.addSeparator() |
296 menu.addSeparator() |
297 act = menu.addAction(self.tr("Save Image")) |
297 act3 = menu.addAction(self.tr("Save Image")) |
298 act.setData(self.imagesTree.indexOfTopLevelItem(itm)) |
298 act3.setData(self.imagesTree.indexOfTopLevelItem(itm)) |
299 act.triggered.connect(lambda: self.__saveImage(act)) |
299 act3.triggered.connect(lambda: self.__saveImage(act3)) |
300 menu.exec(self.imagesTree.viewport().mapToGlobal(pos)) |
300 menu.exec(self.imagesTree.viewport().mapToGlobal(pos)) |
301 |
301 |
302 def __copyAction(self, act): |
302 def __copyAction(self, act): |
303 """ |
303 """ |
304 Private slot to copy the image URL or the image name to the clipboard. |
304 Private slot to copy the image URL or the image name to the clipboard. |