i've used "--servername" and "--socketid" to embed gvim into a qt app
but with no success.
i can normally embed xterm using this code but with gvim nothing
happens although if i use no args (for gvim process) it normally opens
gvim outside of qt app.
any ideas/tips?

Aljosa Mohorovic


python/qt code:
---------------------------------------------------------------------
# -*- coding: utf-8 -*-
import atexit
import sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class GVim(QX11EmbedContainer):
   def __init__(self, parent):
       QX11EmbedContainer.__init__(self, parent)
       self.process = QProcess(self)
       self.connect(self.process,
                    SIGNAL("finished(int, QProcess::ExitStatus)"),
                    self.on_cmd_close)
       atexit.register(self.kill)

   def kill(self):
       self.process.kill()
       self.process.waitForFinished()

   def show_cmd(self):
       args =  ["--servername", "%d" % self.winId(), "--socketid",
"%d" % self.winId()]
       # args = []
       print args

       self.process.start("gvim", args)

       print "error:", self.process.error()
       if self.process.error() == QProcess.FailedToStart:
           print "cmd not installed"

   def on_cmd_close(self, exit_code, exit_status):
       print "close", exit_code, exit_status
       self.close()

if __name__ == "__main__":
    app = QApplication(sys.argv)

    widget = QMainWindow()
    cmd = GVim(widget)
    cmd.show_cmd()
    cmd.resize(500,500)

    widget.resize(800,800)
    widget.show()

    sys.exit(app.exec_())

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui