Re: [PyQt] QTableWidget - pyuic does not compile several attributes

2011-07-29 Thread Protopia
Phil

I downloaded the latest snapshot and replaced the UIC directory - and looking 
at the code, all the attributes now seem to be there.

I would like to say that this was an amazingly fast response. Thanks!!

Regards, P

P.S. If I was going to be picky, I would suggest that the Kerning and 
StyleStrategy should be after the rest of the font attributes so that the order 
of the code matches the UI in the QT Designer. But given the amazingly fast 
response, that would be churlish!!

-Original Message-
From: Phil Thompson [mailto:p...@riverbankcomputing.com] 
Sent: 28 July 2011 6:46pm
To: Protopia
Cc: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] QTableWidget - pyuic does not compile several attributes

On Thu, 28 Jul 2011 01:58:38 +0100, Protopia py...@protopia.co.uk
wrote:
 I am not sure whether anyone has found this problem before, however I
 can't find it in the archives on Gmane.
 
  
 
 I first came across this problem when I designed a table in QT Designer,
 and set fonts on certain cells. But when I ran the code, no formatting.
 Looking at the code generated by pyuic I could not see the code I would
 expect to set the fonts.
 
  
 
 So, I generated a test UI file in Designer with all properties on the
 table widget, the vertical and horizontal titles and cells themselves
 (attached)
 
  
 
 And then I ran the compiler and looked at the code (attached) and found
 the following things missing:
 
  
 
 QTableWidget:
 
 1. .font.Kerning not compiled.

Fixed.

 2. .font.Antialiasing not compiled

Fixed.

 3. .QTableView.sortingEnabled is placed in reTranslateUI - however
 this does not seem to be concerned with internationalisation and I feel
 should be in the main code (though I could easily be wrong here)

This is a side effect of the way i18n support is implemented.

 4. .QTableWidget.rowCount  .columnCount - if these are specified
 explicitly in QT Designer then they appear twice in the .py file. (Of
 course this won't cause major problems, but is nevertheless
 inappropriate.)

Fixed.

 QTableWidgetItem
 
 1. Horizontal and Vertical header tooltips, whatsthis, fonts,
 textalign, background and foreground are not compiled at all.

Fixed.

 2. Cell tooltips, whatsthis, fonts and textalign are not compiled at
 all.

Fixed.

 3. Cell background and foreground are compiled, however sequence of
 statements is wrong - sets brush twice, then assigns second definition
 to both background and foreground.

Fixed.

 Whilst we are looking at this code, it would also be helpful if we were
 to leave a blank line between code for QTableWidget, Horizontal Headers,
 Vertical Headers and Cells.
 
  
 
 Note: I am using python2.7.2 32-bit, and PyQt4.8.4-1 binary
 PyQt-Py2.7-x86-gpl-4.8.4-1.exe.
 
  
 
 P.S. I am trying to look at the uiparser.py and properties.py part of
 the Pyqt4 uic compiler to see if I can work out how to fix this - but as
 yet I have failed to understand the code well enough to work it out.
 
  
 
 Rgds, P

I think QListWidgetItem and QTreeWidgetItem will have similar problems but
I'll look at those tomorrow.

Thanks,
Phil


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QTableWidget - pyuic does not compile several attributes

2011-07-29 Thread Phil Thompson
On Fri, 29 Jul 2011 11:02:05 +0200, Hans-Peter Jansen h...@urpla.net
wrote:
 Comparing output from uic with current pyuic4, I noticed, that uic will 
 only set the objectName, if not done already:
 
 if (WidgetName-objectName().isEmpty())
 WidgetName-setObjectName(QString::fromUtf8(WidgetName));
 
 That looks useful.

Yes, but given the way pyuic is implemented it's difficult to do.

 From a further cursory look, the IBeamCursor is set on the viewport:
 
 tableWidget-viewport()-setProperty(cursor,
 QVariant(QCursor(Qt::IBeamCursor)));
 
 instead of:
 
 self.tableWidget.setProperty(_fromUtf8(cursor),
 QtCore.Qt.IBeamCursor)

Fixed.

 Also note, that properties aren't fed through fromUtf8.

Fixed.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QTableWidget - pyuic does not compile several attributes

2011-07-28 Thread Hans-Peter Jansen
On Thursday 28 July 2011, 02:58:38 Protopia wrote:
 I am not sure whether anyone has found this problem before, however I
 can't find it in the archives on Gmane.



 I first came across this problem when I designed a table in QT
 Designer, and set fonts on certain cells. But when I ran the code, no
 formatting. Looking at the code generated by pyuic I could not see
 the code I would expect to set the fonts.



 So, I generated a test UI file in Designer with all properties on the
 table widget, the vertical and horizontal titles and cells themselves
 (attached)



 And then I ran the compiler and looked at the code (attached) and
 found the following things missing:



 QTableWidget:

 1. .font.Kerning not compiled.

 2. .font.Antialiasing not compiled

 3. .QTableView.sortingEnabled is placed in reTranslateUI -
 however this does not seem to be concerned with internationalisation
 and I feel should be in the main code (though I could easily be wrong
 here)

 4. .QTableWidget.rowCount  .columnCount - if these are specified
 explicitly in QT Designer then they appear twice in the .py file. (Of
 course this won't cause major problems, but is nevertheless
 inappropriate.)



 QTableWidgetItem

 1. Horizontal and Vertical header tooltips, whatsthis, fonts,
 textalign, background and foreground are not compiled at all.

 2. Cell tooltips, whatsthis, fonts and textalign are not compiled
 at all.

 3. Cell background and foreground are compiled, however sequence
 of statements is wrong - sets brush twice, then assigns second
 definition to both background and foreground.

First of all, what are you trying to archive? 

In order to breathe life into these objects, you need to add some code, 
generated by yourself (brain and all..). Designers output is a suitable 
basement for this task (in terms of subclassing or calling into), but 
in no way it's meant to be exhaustive.

If you question the output of pyuic4, the very next thing to do is 
comparing it with the output of uic. Since that is the reference 
implementation for pyuic4, any significant differences should be dealt 
with, and I guess, if nobody jumps up and provide patches, Phil will 
sometime (depending on his priorities and importance..).

 Whilst we are looking at this code, it would also be helpful if we
 were to leave a blank line between code for QTableWidget, Horizontal
 Headers, Vertical Headers and Cells.

Since pyuic4 output is not meant for human consumption (apart from 
debugging purposes), a patch from you in this area is highly unlikely 
to be applied by Phil.. [Hint: sed is your friend for such tasks]

Pete
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QTableWidget - pyuic does not compile several attributes

2011-07-28 Thread Phil Thompson
On Thu, 28 Jul 2011 01:58:38 +0100, Protopia py...@protopia.co.uk
wrote:
 I am not sure whether anyone has found this problem before, however I
 can't find it in the archives on Gmane.
 
  
 
 I first came across this problem when I designed a table in QT Designer,
 and set fonts on certain cells. But when I ran the code, no formatting.
 Looking at the code generated by pyuic I could not see the code I would
 expect to set the fonts.
 
  
 
 So, I generated a test UI file in Designer with all properties on the
 table widget, the vertical and horizontal titles and cells themselves
 (attached)
 
  
 
 And then I ran the compiler and looked at the code (attached) and found
 the following things missing:
 
  
 
 QTableWidget:
 
 1. .font.Kerning not compiled.

Fixed.

 2. .font.Antialiasing not compiled

Fixed.

 3. .QTableView.sortingEnabled is placed in reTranslateUI - however
 this does not seem to be concerned with internationalisation and I feel
 should be in the main code (though I could easily be wrong here)

This is a side effect of the way i18n support is implemented.

 4. .QTableWidget.rowCount  .columnCount - if these are specified
 explicitly in QT Designer then they appear twice in the .py file. (Of
 course this won't cause major problems, but is nevertheless
 inappropriate.)

Fixed.

 QTableWidgetItem
 
 1. Horizontal and Vertical header tooltips, whatsthis, fonts,
 textalign, background and foreground are not compiled at all.

Fixed.

 2. Cell tooltips, whatsthis, fonts and textalign are not compiled at
 all.

Fixed.

 3. Cell background and foreground are compiled, however sequence of
 statements is wrong - sets brush twice, then assigns second definition
 to both background and foreground.

Fixed.

 Whilst we are looking at this code, it would also be helpful if we were
 to leave a blank line between code for QTableWidget, Horizontal Headers,
 Vertical Headers and Cells.
 
  
 
 Note: I am using python2.7.2 32-bit, and PyQt4.8.4-1 binary
 PyQt-Py2.7-x86-gpl-4.8.4-1.exe.
 
  
 
 P.S. I am trying to look at the uiparser.py and properties.py part of
 the Pyqt4 uic compiler to see if I can work out how to fix this - but as
 yet I have failed to understand the code well enough to work it out.
 
  
 
 Rgds, P

I think QListWidgetItem and QTreeWidgetItem will have similar problems but
I'll look at those tomorrow.

Thanks,
Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt