1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed 069667c

filedialogs: rewrite handling of editor context menu without functools

- functools is not available in Python 2.4
- connecting dynamic function sometimes confuses GC

Note that QObject.sender() of PyQt 4.7.3 does not work if decorated by
pyqtSlot.

  • Participants
  • Parent commits c449bb5
  • Branches default

Comments (0)

Files changed (1)

File tortoisehg/hgqt/filedialogs.py

View file
 
 import os
 import difflib
-import functools
 
 from tortoisehg.util import hglib
 from tortoisehg.hgqt.i18n import _
         self.splitter.addWidget(layouttowidget(self.horizontalLayout))
         self.splitter.addWidget(self.frame)
 
-    def fileViewMenuRequest(self, sci, point):
+    #@pyqtSlot(QPoint)
+    def fileViewMenuRequest(self, point):
+        sci = self.sender()
         menu = sci.createStandardContextMenu()
         point = sci.viewport().mapToGlobal(point)
         menu.exec_(point)
             sci.verticalScrollBar().installEventFilter(self)
 
             sci.setContextMenuPolicy(Qt.CustomContextMenu)
-            sci.customContextMenuRequested.connect(
-                functools.partial(self.fileViewMenuRequest, sci))
+            sci.customContextMenuRequested.connect(self.fileViewMenuRequest)
 
             sci.setFrameShape(QFrame.NoFrame)
             sci.setMarginLineNumbers(1, True)