[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] pyuic and phonon from PyQt4 of PyKDE4
From:       Marcos Dione <mdione () grulic ! org ! ar>
Date:       2009-12-26 17:26:01
Message-ID: 20091226172600.GC4492 () mustang ! grulicueva ! net
[Download RAW message or body]

some distros seem to prefer KDE's phonon to Qt's phonon. this means that qt
is compiled with the -nophonon option and then use phonon from the kdesupport
module. this reflects in the python bindings, for instance, in the following
way:

 File "/usr/lib/python2.6/site-packages/PyQt4/uic/__init__.py", line 158, in loadUiType
 exec(code_string.getvalue(), ui_globals)
 File "<string>", line 73, in <module>
 ImportError: cannot import name phonon

    it's trying to import 'phonon' from PyQt4 for a .ui file that has a
'Phonon.SeekSlider'. the altarnative is to import 'phonon' from 'PyKDE4'. I
tracked this down to the code generator and made a patch to try to solve it.
it's attached. any comments?

-- 
(Not so) Random fortune:
11:58 < m4rgin4l> yo por plata me pongo cualquier cosa

["pyqt-phonon_from_pyqt4_or_pykde4.diff" (text/x-diff)]

diff -aur PyQt-x11-gpl-4.6.1.orig/pyuic/uic/widget-plugins/phonon.py \
                PyQt-x11-gpl-4.6.1/pyuic/uic/widget-plugins/phonon.py
--- PyQt-x11-gpl-4.6.1.orig/pyuic/uic/widget-plugins/phonon.py	2009-10-23 09:49:48.000000000 \
                -0300
+++ PyQt-x11-gpl-4.6.1/pyuic/uic/widget-plugins/phonon.py	2009-12-26 14:17:55.000000000 -0300
@@ -7,10 +7,16 @@
 # variable MODULE is inserted into the local namespace by the plugin loader.
 pluginType = MODULE
 
+try:
+    import PyQt4.phonon
+    phononModule= "PyQt4.phonon"
+except ImportError:
+    import PyKDE4.phonon
+    phononModule= "PyKDE4.phonon"
 
 # moduleInformation() must return a tuple (module, widget_list).  If "module"
 # is "A" and any widget from this module is used, the code generator will write
 # "import A".  If "module" is "A[.B].C", the code generator will write
 # "from A[.B] import C".  Each entry in "widget_list" must be unique.
 def moduleInformation():
-    return "PyQt4.phonon", ("Phonon.SeekSlider", "Phonon.VideoPlayer", "Phonon.VolumeSlider")
+    return phononModule, ("Phonon.SeekSlider", "Phonon.VideoPlayer", "Phonon.VolumeSlider")



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic