Re: [PyQt] problem running pyqt on xubuntu

2012-10-20 Thread Scott Kitterman
On Saturday, October 20, 2012 08:11:29 AM Mark Summerfield wrote:
 I have built local versions of Qt 4.8.3, Python, SIP, and PyQt on an
 Xubuntu machine which has Qt 4.8.1 as its system Qt:

...

 So clearly, despite trying to build using my local Qt, PyQt seems to be
 looking at the system Qt.
 
 Is there a solution for this?

Upgrading to the newest Xubuntu release where 4.8.3 is the system Qt would be 
one way to do it.

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


Re: [PyQt] problem running pyqt on xubuntu

2012-10-20 Thread Detlev Offenbach
Hello,

I am doing it for eric development using separate Qt installation directories, 
Python virtual environments and start scripts setting the path to the Qt tools 
explicitly. Works perfectly for me. 

Just make sure to set the path explicitly when building PyQt4 and QScintilla 
stuff.

Detlev

Am 20.10.2012 um 09:43 schrieb Mark Summerfield l...@qtrac.plus.com:

 On Sat, 20 Oct 2012 03:21:51 -0400
 Scott Kitterman deb...@kitterman.com wrote:
 On Saturday, October 20, 2012 08:11:29 AM Mark Summerfield wrote:
 I have built local versions of Qt 4.8.3, Python, SIP, and PyQt on an
 Xubuntu machine which has Qt 4.8.1 as its system Qt:
 
 ...
 
 So clearly, despite trying to build using my local Qt, PyQt seems to be
 looking at the system Qt.
 
 Is there a solution for this?
 
 Upgrading to the newest Xubuntu release where 4.8.3 is the system Qt
 would be one way to do it.
 
 Yes, and so would doing a local install of 4.8.1. But my whole purpose
 is to be able to have many local builds of different combinations of 
 Py x Qt x PyQt for testing purposes.
 
 -- 
 Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
Rapid GUI Programming with Python and Qt - ISBN 0132354187
http://www.qtrac.eu/pyqtbook.html
 ___
 PyQt mailing listPyQt@riverbankcomputing.com
 http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Detlev Offenbach
det...@die-offenbachs.de



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


[PyQt] Exporting an image to a PDF

2012-10-20 Thread Ajay Garg
Hi all.

I have been looking for ways to get things exported to PDF; I must say that
I am pleasantly surprised by the ease of exporting a text-document to a PDF
:)

Googling also says that exporting an image to pdf is easier than
exporting a text-documnt in PyQt; unfortunately for me, I have not been
able to find the steps to do that :-\
So, I will be grateful if I could be directed to a Hello World program to
do this.


My requirement is very simple ::

* Read an image file (png/jpeg, etc).
* Export to PDF; simple. No editing of pixels, or any other
stuff.



Looking forward to some pointers :)



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

Re: [PyQt] Exporting an image to a PDF

2012-10-20 Thread Vincent Vande Vyvre
Le 20/10/12 15:59, Ajay Garg a écrit :
 Hi all.

 I have been looking for ways to get things exported to PDF; I must say
 that I am pleasantly surprised by the ease of exporting a
 text-document to a PDF :)

 Googling also says that exporting an image to pdf is easier than
 exporting a text-documnt in PyQt; unfortunately for me, I have not
 been able to find the steps to do that :-\
 So, I will be grateful if I could be directed to a Hello World
 program to do this.


 My requirement is very simple ::

 * Read an image file (png/jpeg, etc).
 * Export to PDF; simple. No editing of pixels, or any
 other stuff.



 Looking forward to some pointers :)



 Regards,
 Ajay



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

#--
image = QtGui.QImage(myImage.jpg)
printer = QtGui.QPrinter()
printer.setResolution(300)
printer.setOutputFormat(QtGui.QPrinter.PdfFormat)
printer.setOutputFileName(myImage.pdf)

painter = QtGui.QPainter()
painter.begin(printer)
painter.drawImage(target, image, source)
painter.end()

#

where target  source are QtCore.QRectF(sheet)  QtCore.QRectF(image)

A more complete example here:

http://bazaar.launchpad.net/~vincent-vandevyvre/oqapy/serie-1.0/view/head:/oqapy-1.0/printing.py

-- 
Vincent V.V.
Oqapy https://launchpad.net/oqapy . Qarte
https://launchpad.net/qarte . PaQager https://launchpad.net/paqager
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Exporting an image to a PDF

2012-10-20 Thread Vincent Vande Vyvre
Le 20/10/12 18:21, Ajay Garg a écrit :


 On Sat, Oct 20, 2012 at 8:43 PM, Vincent Vande Vyvre
 vincent.vandevy...@swing.be mailto:vincent.vandevy...@swing.be wrote:

 Le 20/10/12 15:59, Ajay Garg a écrit :
  Hi all.
 
  I have been looking for ways to get things exported to PDF; I
 must say
  that I am pleasantly surprised by the ease of exporting a
  text-document to a PDF :)
 
  Googling also says that exporting an image to pdf is easier than
  exporting a text-documnt in PyQt; unfortunately for me, I have not
  been able to find the steps to do that :-\
  So, I will be grateful if I could be directed to a Hello World
  program to do this.
 
 
  My requirement is very simple ::
 
  * Read an image file (png/jpeg, etc).
  * Export to PDF; simple. No editing of pixels,
 or any
  other stuff.
 
 
 
  Looking forward to some pointers :)
 
 
 
  Regards,
  Ajay
 
 
 
  ___
  PyQt mailing listPyQt@riverbankcomputing.com
 mailto:PyQt@riverbankcomputing.com
  http://www.riverbankcomputing.com/mailman/listinfo/pyqt
 Minimalistic example:

 #--
 image = QtGui.QImage(myImage.jpg)
 printer = QtGui.QPrinter()
 printer.setResolution(300)
 printer.setOutputFormat(QtGui.QPrinter.PdfFormat)
 printer.setOutputFileName(myImage.pdf)

 painter = QtGui.QPainter()
 painter.begin(printer)
 painter.drawImage(target, image, source)
 painter.end()

 #

 where target  source are QtCore.QRectF(sheet)  QtCore.QRectF(image)

 A more complete example here:

 
 http://bazaar.launchpad.net/~vincent-vandevyvre/oqapy/serie-1.0/view/head:/oqapy-1.0/printing.py
 
 http://bazaar.launchpad.net/%7Evincent-vandevyvre/oqapy/serie-1.0/view/head:/oqapy-1.0/printing.py



 Thanks a ton Vincent !!
 I could get myself started with image-exporting to pdf (all courtesy
 you :) )


 One thing I must tell you; right now, I just got myself bootstrapped,
 without truly putting the correct values in target and source.
 I have two queries though ::

 a)
 target represents the target-canvas, of which the image will take
 the size, right?



 b)
 If yes, then I find it a  little odd, that no such target is
 specified, while exporting a text-document to pdf.
 For example, here is my code to export a text-document to pdf ::

 
 from PyQt4.QtGui import *
 import sys

 app = QApplication(sys.argv)

 text_file_path = open('sample.py').read()
 doc = QTextDocument(text_file_path)

 printer = QPrinter(QPrinter.HighResolution)
 printer.setOutputFormat(QPrinter.PdfFormat)
 printer.setOutputFileName('sample.pdf')

 doc.print_(printer)
 


 Here, we can see that no target QtCore.QRectf is passed to the
 printing options.

 Any idea of this descrepancy? (as to why the target canvas is
 specified while exporting an  image; but not when exporting a
 text-document, though the target canvas size is usually fixed,
 irrespective of the source mime-type).

Because in my example I've used QPainter.drawImage() and not
QTextDocument.print_().

See the doc:

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qpainter.html#drawImage

you can also use only the origin of the image instead of target-source,
but you'll need to handle the margin parameters of your printer.


 Thanks anyways for your already rendered massive help :)



 Regards,
 Ajay



-- 
Vincent V.V.
Oqapy https://launchpad.net/oqapy . Qarte
https://launchpad.net/qarte . PaQager https://launchpad.net/paqager
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Specifying Include Directories for PyQt Build

2012-10-20 Thread Scott Kitterman
Starting with python3.3, python will support multiarch [1] in Debian and 
Ubuntu.  As part of this change, the path for some of the Python header files 
has changed, so I need to specify multiple include directories.  Here's an 
example using pkg-config so show the difference between python3.2 and python3.3 
on an i386 system:

$ pkg-config --cflags-only-I python-3.2mu
-I/usr/include/python3.2mu  

$ pkg-config --cflags-only-I python-3.3m 
-I/usr/include/python3.3m -I/usr/include/i386-linux-gnu/python3.3m  

So how do I specify both directories for building with this multi-arch'ed 
python3.3?  Any advice appreciated.

Scott K

[1] http://wiki.debian.org/Multiarch
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Specifying Include Directories for PyQt Build

2012-10-20 Thread Scott Kitterman
On Saturday, October 20, 2012 08:44:25 PM Scott Kitterman wrote:
 Starting with python3.3, python will support multiarch [1] in Debian and
 Ubuntu.  As part of this change, the path for some of the Python header
 files has changed, so I need to specify multiple include directories. 
 Here's an example using pkg-config so show the difference between python3.2
 and python3.3 on an i386 system:
 
 $ pkg-config --cflags-only-I python-3.2mu
 -I/usr/include/python3.2mu
 
 $ pkg-config --cflags-only-I python-3.3m
 -I/usr/include/python3.3m -I/usr/include/i386-linux-gnu/python3.3m
 
 So how do I specify both directories for building with this multi-arch'ed
 python3.3?  Any advice appreciated.
 
 Scott K
 
 [1] http://wiki.debian.org/Multiarch

Nevermind.  I think I understand the problem now.

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


Re: [PyQt] Specifying Include Directories for PyQt Build

2012-10-20 Thread Scott Kitterman
On Saturday, October 20, 2012 10:42:07 PM Scott Kitterman wrote:
 On Saturday, October 20, 2012 08:44:25 PM Scott Kitterman wrote:
  Starting with python3.3, python will support multiarch [1] in Debian and
  Ubuntu.  As part of this change, the path for some of the Python header
  files has changed, so I need to specify multiple include directories.
  Here's an example using pkg-config so show the difference between
  python3.2
  and python3.3 on an i386 system:
  
  $ pkg-config --cflags-only-I python-3.2mu
  -I/usr/include/python3.2mu
  
  $ pkg-config --cflags-only-I python-3.3m
  -I/usr/include/python3.3m -I/usr/include/i386-linux-gnu/python3.3m
  
  So how do I specify both directories for building with this multi-arch'ed
  python3.3?  Any advice appreciated.
  
  Scott K
  
  [1] http://wiki.debian.org/Multiarch
 
 Nevermind.  I think I understand the problem now.

I had it half solved.  Once I fixed my sip4 build, the arch specific directory 
was captured by sip in py_conf_inc_dir and I had correct includes for the 
directories configured by sip, but not for qpy.  Adding the patch below to 
configure.py solved that by adding it to the qpy .pro files.  Is this a 
reasonable way to handle it and would you consider this an appropriate change 
for upstream?

Scott K

Index: python-qt4-4.9.3/configure.py
===
--- python-qt4-4.9.3.orig/configure.py  2012-10-21 04:38:26.0 +
+++ python-qt4-4.9.3/configure.py   2012-10-21 04:40:50.912484733 +
@@ -811,6 +811,9 @@
 if sipcfg.sip_inc_dir != sipcfg.py_inc_dir:
 inc_path.insert(0, sipcfg.sip_inc_dir)

+if sipcfg.py_inc_dir != sipcfg.py_conf_inc_dir:
+   inc_path.insert(0, sipcfg.py_conf_inc_dir)
+
 if opts.bigqt:
 api_dir = ../../_qt
 else
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt