Commits

Yuya Nishihara committed c624e91

quickop: change HeadlessQuickop to QObject and pass to qtrun as dummy QWidget

Since 3380d68b55d3, Qt's eventloop won't be executed if dlgfunc returns None.

Instead of keeping hidden widget by quickop, now quickop.run returns dummy
QWidget-like object to qtrun. This also fixes temporary appearance of empty
window on drag_copy and drag_move.

Comments (0)

Files changed (1)

tortoisehg/hgqt/quickop.py

             self.files = lfiles
             self.cmd.run(cmdline)
 
-instance = None
-class HeadlessQuickop(QWidget):
+class HeadlessQuickop(QObject):
     def __init__(self, repo, cmdline):
-        QWidget.__init__(self)
+        QObject.__init__(self)
         self.files = cmdline[1:]
         os.chdir(repo.root)
-        self.cmd = cmdui.Runner(True, self)
+        self.cmd = cmdui.Runner(True, None)  # parent must be QWidget or None
         self.cmd.commandFinished.connect(self.commandFinished)
         self.cmd.run(cmdline)
-        self.hide()
 
     def commandFinished(self, ret):
         if ret == 0:
             shlib.shell_notify(self.files)
             sys.exit(0)
 
+    # dummy methods to act as QWidget (see run.qtrun)
+    def show(self):
+        pass
+    def raise_(self):
+        pass
+
 def run(ui, *pats, **opts):
     pats = hglib.canonpaths(pats)
     if opts.get('canonpats'):
     imm = repo.ui.config('tortoisehg', 'immediate', '')
     if command in imm.lower():
         cmdline = [command] + pats
-        global instance
-        instance = HeadlessQuickop(repo, cmdline)
-        return None
+        return HeadlessQuickop(repo, cmdline)
     else:
         return QuickOpDialog(repo, command, pats, None)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.