diff options
Diffstat (limited to 'pilas_plug.py')
-rw-r--r-- | pilas_plug.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/pilas_plug.py b/pilas_plug.py new file mode 100644 index 0000000..29b369b --- /dev/null +++ b/pilas_plug.py @@ -0,0 +1,44 @@ +""" + +This command provides a plug to embed Qt. + +The X11 window ID is passed as the unique parameter. + +""" + +import os +import sys + +base = os.environ['SUGAR_BUNDLE_PATH'] + +qtpath = os.path.join(base, 'qt') +sys.path.append(qtpath) + +# del sys.path[sys.path.index('/usr/lib/python2.7/site-packages')] + +from PyQt4.QtGui import QApplication +from PyQt4.QtCore import QString +from PyQt4.QtGui import QHBoxLayout +from PyQt4.QtGui import QLineEdit +from PyQt4.QtGui import QX11EmbedWidget + +import pilas +from pilas import aplicacion + +app = QApplication(sys.argv) + +parent_window_id = int(sys.argv[1]) +screen_width = int(sys.argv[2]) +screen_height = int(sys.argv[3]) + +window = QX11EmbedWidget() +window.embedInto(parent_window_id) +window.show() + +hbox = QHBoxLayout(window) +pilas_height = 2.0 / 3 * screen_height +pilas_width = 2.0 / 3 * screen_width +pilas_widget = aplicacion.Window(parent=window, pilas_width=pilas_width, pilas_height=pilas_height) +hbox.addWidget(pilas_widget) + +sys.exit(app.exec_()) |