[Qgis-developer] OT: qtdesigner problems: generated ui file not valid for pyuic4

Matthew Perry perrygeo at gmail.com
Thu Oct 4 20:37:17 EDT 2007


That must be it. I've got QTDesigner 4.3.. all qt4.3 libs but pyuic4
is for an earlier version:

 Python User Interface Compiler 4.1 for Qt version 4.2.2, qt

Looks like fiesty users are in a hard spot since they have backported
all the qt4.3 stuff but not the pyqt4-dev-tools

- matt

On 10/4/07, Tim Sutton <tim at linfiniti.com> wrote:
> Hi Matthew
>
> It could be that your PyQt stuff expects e.g. Qt4.2 and you have 4.3.
> There have been changes to the ui  format between the two versions
> which could concevably cause such issues.
>
> Regards
>
> Tim
>
> 2007/10/4, Matthew Perry <perrygeo at gmail.com>:
> > Hi folks,
> >
> >  Not a qgis question per se but I figured that someone on this list
> > might have encountered this and/or come up with a solution.
> >
> >  It appears that designer-qt4 is generating ui files that are not
> > compatible with pyuic4. I'm using straight ubuntu fiesty packages for
> > all the qt software.
> >
> >  Basic problem is that simply opening and saving a ui file in qt
> > designer (making no changes at all) messes up a previously valid ui
> > file. The example below shows the details.
> >
> > Has anyone else encountered this issue on ubuntu? Am I doing something
> > obviously wrong here? Any ideas on how to fix this?
> >
> > -----------------------------------------------------
> > cp mainwindow.ui mainwindow.orig.ui
> > cp mainwindow_ui.py mainwindow_ui.orig.py
> > make clean
> >
> > # generate the python file from the untouched ui file
> > pyuic4 -d -o mainwindow_ui.py mainwindow.ui
> > # OK; still runs fine
> >
> > diff mainwindow_ui.py mainwindow_ui.orig.py
> > 5c5
> > < # Created: Thu Oct  4 13:17:24 2007
> > ---
> > > # Created: Wed Oct  3 09:44:22 2007
> >
> >
> > # open qt4 deisgner
> > designer-qt4 mainwindow.ui
> > # Change NOTHING, just file > save
> >
> > # compile with pyuic4
> > pyuic4 -d -o mainwindow_ui.py mainwindow.ui
> > Traceback (most recent call last):
> >   File "/usr/bin/pyuic4", line 65, in <module>
> >     error = generateUi(args[1], options.output, options.execute, options.indent)
> >   File "/usr/bin/pyuic4", line 28, in generateUi
> >     uic.compileUi(uifname, pyfile, execute, indent)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/__init__.py", line
> > 56, in compileUi
> >     winfo = compiler.UICompiler().compileUi(uifile, pyfile)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/Compiler/compiler.py",
> > line 71, in compileUi
> >     w = self.parse(input_stream)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 524, in parse
> >     actor(elem)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 372, in createUserInterface
> >     self.traverseWidgetTree(elem)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 349, in traverseWidgetTree
> >     handler(self, child)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 165, in createWidget
> >     self.traverseWidgetTree(elem)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 349, in traverseWidgetTree
> >     handler(self, child)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 240, in createLayout
> >     self.traverseWidgetTree(elem)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 349, in traverseWidgetTree
> >     handler(self, child)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 249, in handleItem
> >     self.traverseWidgetTree(elem)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 349, in traverseWidgetTree
> >     handler(self, child)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 165, in createWidget
> >     self.traverseWidgetTree(elem)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 349, in traverseWidgetTree
> >     handler(self, child)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 158, in createWidget
> >     self.stack.push(self.setupObject(widgetClass(elem), parent, elem))
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/uiparser.py", line
> > 133, in setupObject
> >     self.wprops.setProperties(obj, branch)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/properties.py",
> > line 189, in setProperties
> >     self.convert(prop, widget))
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/properties.py",
> > line 156, in convert
> >     return func(prop[0], **args)
> >   File "/usr/lib/python2.5/site-packages/PyQt4/uic/properties.py",
> > line 116, in _sizepolicy
> >     sizePolicy.setHorizontalStretch(values[2])
> > IndexError: list index out of range
> >
> > # show differences in ui file due to saving with qt4 designer
> > diff mainwindow.ui mainwindow.orig.ui
> > 17c17
> > <     <property name="leftMargin" >
> > ---
> > >     <property name="margin" >
> > 20,32c20
> > <     <property name="topMargin" >
> > <      <number>9</number>
> > <     </property>
> > <     <property name="rightMargin" >
> > <      <number>9</number>
> > <     </property>
> > <     <property name="bottomMargin" >
> > <      <number>9</number>
> > <     </property>
> > <     <property name="horizontalSpacing" >
> > <      <number>6</number>
> > <     </property>
> > <     <property name="verticalSpacing" >
> > ---
> > >     <property name="spacing" >
> > 45c33,35
> > <         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
> > ---
> > >         <sizepolicy>
> > >          <hsizetype>5</hsizetype>
> > >          <vsizetype>5</vsizetype>
> > 64,65c54,55
> > <           <width>405</width>
> > <           <height>573</height>
> > ---
> > >           <width>353</width>
> > >           <height>583</height>
> > 72c62
> > <          <property name="leftMargin" >
> > ---
> > >          <property name="margin" >
> > 75,87c65
> > <          <property name="topMargin" >
> > <           <number>9</number>
> > <          </property>
> > <          <property name="rightMargin" >
> > <           <number>9</number>
> > <          </property>
> > <          <property name="bottomMargin" >
> > <           <number>9</number>
> > <          </property>
> > <          <property name="horizontalSpacing" >
> > <           <number>6</number>
> > <          </property>
> > <          <property name="verticalSpacing" >
> > ---
> > >          <property name="spacing" >
> > 118c96,98
> > <         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
> > ---
> > >         <sizepolicy>
> > >          <hsizetype>5</hsizetype>
> > >          <vsizetype>5</vsizetype>
> > 140c120
> > <      <height>25</height>
> > ---
> > >      <height>24</height>
> >
> >
> >
> > --
> > Matthew T. Perry
> > http://www.perrygeo.net
> >
> > "Never ascribe to malice, that which can be adequately explained by
> > incompetence."
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.qgis.org
> > http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
> >
>
>
> --
> Tim Sutton
> QGIS Project Steering Committee Member - Release  Manager
> Visit http://qgis.org for a great open source GIS
> openModeller Desktop Developer
> Visit http://openModeller.sf.net for a great open source ecological
> niche modelling tool
> Home Page: http://tim.linfiniti.com
> Skype: timlinux
> Irc: timlinux on #qgis at freenode.net
>


-- 
Matthew T. Perry
http://www.perrygeo.net

"Never ascribe to malice, that which can be adequately explained by
incompetence."



More information about the Qgis-developer mailing list