qt5base-lts/tests/manual/xembed-widgets/gtk-embedder.py
Lucie Gérard 05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00

40 lines
893 B
Python
Executable File

#!/usr/bin/python
# Copyright (C) 2013 Canonical Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
from gi.repository import Gtk
from subprocess import Popen
window = Gtk.Window()
box = Gtk.VBox(False, 0)
window.add(box)
child = None
def on_button_clicked(button, socket):
global child
child = Popen(['./lineedits', str(socket.get_id())])
button = Gtk.Button("Press me to embed a Qt client")
box.pack_start(button, False, False, 0)
entry = Gtk.Entry()
box.pack_start(entry, False, False, 0)
socket = Gtk.Socket()
socket.set_size_request(200, 200)
box.add(socket)
button.connect("clicked", on_button_clicked, socket)
window.connect("destroy", Gtk.main_quit)
def plugged_event(widget):
print("A window was embedded!")
socket.connect("plug-added", plugged_event)
window.show_all()
Gtk.main()
if child:
child.terminate()