Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pilas_plug.py
blob: 29b369b6a4475f380f8003488a32a62e62a7a515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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_())