Re: [PyQt] Missing QPageSize enum in vars(QPrinter) ?

2013-10-12 Thread Phil Thompson
On Thu, 10 Oct 2013 09:43:10 -0400, lloyd konneker boo...@nc.rr.com
wrote:
 This code worked in PyQt4 and Qt4 to get a dictionary of paper size
names:
 
 paperSizeNames = {}
 print(vars(QPrinter))
 for key, value in vars(QPrinter).items():  # Python2 iteritems():
if isinstance(value, QPrinter.PageSize):
  print(key, value)
  paperSizeNames[value] = key
 
 It no longer works in PyQt5 and Qt5.0.1.  But other enum values appear 
 to be in vars(QPrinter)?  Is missing QPageSize enum a bug of omission in

 PyQt5?
 
 This is NOT too important, since Qt 5.1 offers 
 QPrinter.supportedSizesWithNames(), which more or less does the same 
 thing (returns a map from names to QSizeF, which I suppose could be 
 mapped to QPageSize enum values i.e. encodings.)
 
 Is there another way to get the names of Qt enum values?

In Qt5 the PageSize enum is defined in the QPagedPaintDevice class.

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


[PyQt] Missing QPageSize enum in vars(QPrinter) ?

2013-10-10 Thread lloyd konneker

This code worked in PyQt4 and Qt4 to get a dictionary of paper size names:

paperSizeNames = {}
print(vars(QPrinter))
for key, value in vars(QPrinter).items():  # Python2 iteritems():
  if isinstance(value, QPrinter.PageSize):
print(key, value)
paperSizeNames[value] = key

It no longer works in PyQt5 and Qt5.0.1.  But other enum values appear 
to be in vars(QPrinter)?  Is missing QPageSize enum a bug of omission in 
PyQt5?


This is NOT too important, since Qt 5.1 offers 
QPrinter.supportedSizesWithNames(), which more or less does the same 
thing (returns a map from names to QSizeF, which I suppose could be 
mapped to QPageSize enum values i.e. encodings.)


Is there another way to get the names of Qt enum values?
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt