Helpviewer/SiteInfo/SiteInfoDialog.py

changeset 6121
d3d64f3128b3
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
--- a/Helpviewer/SiteInfo/SiteInfoDialog.py	Wed Feb 07 18:57:46 2018 +0100
+++ b/Helpviewer/SiteInfo/SiteInfoDialog.py	Wed Feb 07 20:14:09 2018 +0100
@@ -225,31 +225,34 @@
             return
         
         menu = QMenu()
-        act = menu.addAction(
-            self.tr("Copy Image Location to Clipboard"),
-            self.__copyAction)
+        act = menu.addAction(self.tr("Copy Image Location to Clipboard"))
         act.setData(itm.text(1))
-        act = menu.addAction(
-            self.tr("Copy Image Name to Clipboard"),
-            self.__copyAction)
+        act.triggered.connect(lambda: self.__copyAction(act))
+        act = menu.addAction(self.tr("Copy Image Name to Clipboard"))
         act.setData(itm.text(0))
+        act.triggered.connect(lambda: self.__copyAction(act))
         menu.addSeparator()
-        act = menu.addAction(self.tr("Save Image"), self.__saveImage)
+        act = menu.addAction(self.tr("Save Image"))
         act.setData(self.imagesTree.indexOfTopLevelItem(itm))
+        act.triggered.connect(lambda: self.__saveImage(act))
         menu.exec_(QCursor.pos())
     
-    def __copyAction(self):
+    def __copyAction(self, act):
         """
         Private slot to copy the image URL or the image name to the clipboard.
+        
+        @param act reference to the action that triggered
+        @type QAction
         """
-        act = self.sender()
         QApplication.clipboard().setText(act.data())
     
-    def __saveImage(self):
+    def __saveImage(self, act):
         """
         Private slot to save the selected image to disk.
+        
+        @param act reference to the action that triggered
+        @type QAction
         """
-        act = self.sender()
         index = act.data()
         itm = self.imagesTree.topLevelItem(index)
         if itm is None:

eric ide

mercurial