From kaveh.shahbazian at gmail.com Sun Mar 2 22:56:34 2014 From: kaveh.shahbazian at gmail.com (Kaveh Shahbazian) Date: Mon, 3 Mar 2014 01:26:34 +0330 Subject: [PySide] On Webkit Message-ID: When will the Webkit engine be updated? Or rather is such a thing part of the roadmap? Background: I am developing a desktop html5 app (currently windows (down to xp) but I need it at least on osx too) and after investigating a rather long list (according to the spent time and effort; some like​ ​ node-webkit, awesomium, air, tidesdk, ​ ​spectre, ...) I have succeeded to compile use Python + CEFPython + PyInstaller with some hurdles (C# developer, no Python background)​ ​ but actual result. One friend advised for taking a look at PySide; and I can say It's demos on Windows look awesome! But maaaaaa! It's Webkit html5 score is 220!​ Thanks;​ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericacane at splitu.com Mon Mar 3 00:47:05 2014 From: ericacane at splitu.com (Erica B.) Date: Sun, 2 Mar 2014 15:47:05 -0800 Subject: [PySide] Install via pip fails on OS X Mavericks Message-ID: Hi all, I'm attempting to install pyside via pip on my Macbook Pro running OS X 10.9.2 (Mavericks) and am running into some issues. The install fails with the following error: /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: > fatal error: 'tr1/functional' file not found > #include HASH_FUN_H // defined in config.h > ^ > /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: > note: expanded from macro 'HASH_FUN_H' > #define HASH_FUN_H > ^ > 1 error generated. > make[2]: *** [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] > Error 1 > make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 > make: *** [all] Error 2 > error: Error compiling shiboken After some searching, it seems this is a Mavericks error and may have been fixed in November (https://codereview.qt-project.org/#change,69324), but that change hasn't made its way to PyPi (https://pypi.python.org/pypi/PySide). If this is the case, perhaps the PyPi package could use a refresh. If not, any ideas what can be done to fix the error? Thanks! Erica -------------- next part -------------- An HTML attachment was scrubbed... URL: From rymg19 at gmail.com Mon Mar 3 03:03:15 2014 From: rymg19 at gmail.com (Ryan) Date: Sun, 02 Mar 2014 20:03:15 -0600 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: I know this doesn't help, but can't you just download the source and build it yourself? That's what I usually do. "Erica B." wrote: >Hi all, > >I'm attempting to install pyside via pip on my Macbook Pro running OS X >10.9.2 (Mavericks) and am running into some issues. The install fails >with >the following error: > >/build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >> fatal error: 'tr1/functional' file not found >> #include HASH_FUN_H // defined in config.h >> ^ >> >/build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >> note: expanded from macro 'HASH_FUN_H' >> #define HASH_FUN_H >> ^ >> 1 error generated. >> make[2]: *** >[libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] >> Error 1 >> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >> make: *** [all] Error 2 >> error: Error compiling shiboken > > >After some searching, it seems this is a Mavericks error and may have >been >fixed in November (https://codereview.qt-project.org/#change,69324), >but >that change hasn't made its way to PyPi >(https://pypi.python.org/pypi/PySide). >If this is the case, perhaps the PyPi package could use a refresh. If >not, >any ideas what can be done to fix the error? > >Thanks! >Erica > > >------------------------------------------------------------------------ > >_______________________________________________ >PySide mailing list >PySide at qt-project.org >http://lists.qt-project.org/mailman/listinfo/pyside -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at seanfisk.com Mon Mar 3 07:06:12 2014 From: sean at seanfisk.com (Sean Fisk) Date: Mon, 3 Mar 2014 01:06:12 -0500 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: Hi Erica, This won't fix the PyPi issue, but I usually install on Mac OS X using Homebrew . Though that has had some recent issues as well. Cheers, -- Sean Fisk On Sun, Mar 2, 2014 at 6:47 PM, Erica B. wrote: > Hi all, > > I'm attempting to install pyside via pip on my Macbook Pro running OS X > 10.9.2 (Mavericks) and am running into some issues. The install fails with > the following error: > > /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >> fatal error: 'tr1/functional' file not found >> #include HASH_FUN_H // defined in config.h >> ^ >> /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >> note: expanded from macro 'HASH_FUN_H' >> #define HASH_FUN_H >> ^ >> 1 error generated. >> make[2]: *** [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] >> Error 1 >> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >> make: *** [all] Error 2 >> error: Error compiling shiboken > > > After some searching, it seems this is a Mavericks error and may have been > fixed in November (https://codereview.qt-project.org/#change,69324), but > that change hasn't made its way to PyPi ( > https://pypi.python.org/pypi/PySide). If this is the case, perhaps the > PyPi package could use a refresh. If not, any ideas what can be done to fix > the error? > > Thanks! > Erica > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericacane at splitu.com Mon Mar 3 07:29:39 2014 From: ericacane at splitu.com (Erica Cane) Date: Sun, 2 Mar 2014 22:29:39 -0800 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: Thanks for the responses Ryan and Sean. Is it possible to use homebrew or source to install into a virtualenv? On Sun, Mar 2, 2014 at 10:06 PM, Sean Fisk wrote: > Hi Erica, > > This won't fix the PyPi issue, but I usually install on Mac OS X using > Homebrew . Though that has had some recent issues as > well. > > Cheers, > > > -- > Sean Fisk > > > On Sun, Mar 2, 2014 at 6:47 PM, Erica B. wrote: > >> Hi all, >> >> I'm attempting to install pyside via pip on my Macbook Pro running OS X >> 10.9.2 (Mavericks) and am running into some issues. The install fails with >> the following error: >> >> /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >>> fatal error: 'tr1/functional' file not found >>> #include HASH_FUN_H // defined in config.h >>> ^ >>> /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >>> note: expanded from macro 'HASH_FUN_H' >>> #define HASH_FUN_H >>> ^ >>> 1 error generated. >>> make[2]: *** [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] >>> Error 1 >>> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >>> make: *** [all] Error 2 >>> error: Error compiling shiboken >> >> >> After some searching, it seems this is a Mavericks error and may have >> been fixed in November (https://codereview.qt-project.org/#change,69324), >> but that change hasn't made its way to PyPi ( >> https://pypi.python.org/pypi/PySide). If this is the case, perhaps the >> PyPi package could use a refresh. If not, any ideas what can be done to fix >> the error? >> >> Thanks! >> Erica >> >> >> _______________________________________________ >> >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at seanfisk.com Mon Mar 3 07:44:22 2014 From: sean at seanfisk.com (Sean Fisk) Date: Mon, 3 Mar 2014 01:44:22 -0500 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: When compiling from source, you can install into a virtualenv. When using Homebrew, it's not possible to install into a virtualenv. I don't use Homebrew's Python, and don't install any other Python packages other than PySide. Then, inside of the virtualenv, I use a PTH fileto point to Homebrew's site-packages/ directory. Unfortunately, this also includes any other Python packages installed by Homebrew if you decide to install them. It's not the best option, but it works well. I can send you my PTH-file-writing-script if you are interested. If you are interested in compiling from source into a virtualenv, my team is working on improving the PySide BuildScriptsrepo and I can send you what we have as well. If you are interested in either of these, expect a reply from me tomorrow as it is pretty late in my neck of the woods. Cheers, -- Sean Fisk On Mon, Mar 3, 2014 at 1:29 AM, Erica Cane wrote: > Thanks for the responses Ryan and Sean. > > Is it possible to use homebrew or source to install into a virtualenv? > > > On Sun, Mar 2, 2014 at 10:06 PM, Sean Fisk wrote: > >> Hi Erica, >> >> This won't fix the PyPi issue, but I usually install on Mac OS X using >> Homebrew . Though that has had some recent issues as >> well. >> >> Cheers, >> >> >> -- >> Sean Fisk >> >> >> On Sun, Mar 2, 2014 at 6:47 PM, Erica B. wrote: >> >>> Hi all, >>> >>> I'm attempting to install pyside via pip on my Macbook Pro running OS X >>> 10.9.2 (Mavericks) and am running into some issues. The install fails with >>> the following error: >>> >>> /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >>>> fatal error: 'tr1/functional' file not found >>>> #include HASH_FUN_H // defined in config.h >>>> ^ >>>> /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >>>> note: expanded from macro 'HASH_FUN_H' >>>> #define HASH_FUN_H >>>> ^ >>>> 1 error generated. >>>> make[2]: *** >>>> [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] Error 1 >>>> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >>>> make: *** [all] Error 2 >>>> error: Error compiling shiboken >>> >>> >>> After some searching, it seems this is a Mavericks error and may have >>> been fixed in November (https://codereview.qt-project.org/#change,69324), >>> but that change hasn't made its way to PyPi ( >>> https://pypi.python.org/pypi/PySide). If this is the case, perhaps the >>> PyPi package could use a refresh. If not, any ideas what can be done to fix >>> the error? >>> >>> Thanks! >>> Erica >>> >>> >>> _______________________________________________ >>> >>> PySide mailing list >>> PySide at qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From philip.starkey at monash.edu Mon Mar 3 13:15:34 2014 From: philip.starkey at monash.edu (Philip Starkey) Date: Mon, 3 Mar 2014 12:15:34 +0000 (UTC) Subject: [PySide] Form dialog subclassing QDialog References: <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> <20140228214830.74e7ad86@bouzin.lan> Message-ID: Matthew Woehlke users.sourceforge.net> writes: > > On 2014-02-28 15:48, Jérôme wrote: > > I wrongly assumed the dialog was destroyed at the end of the execution of its > > exec_() method, and therefore it was too late to get its values. > > Ah... nope, just hidden . In fact you can call show() or even exec_() > again if you like (on the same dialog). It's not destroyed until it goes > out of scope, same as most classes. > I just want to add to this: if you have specified a parent widget when instantiating the QDialog, it is not destroyed until the parent widget is destroyed. If you set the parent widget to be your main window (which is likely to never be destroyed for the life of the program), and create a new QDialog on a button click, you will find your program leaks memory (because Qt is holding an internal reference to the QDialog, even though it has gone out of scope in Python). It is best to call dialog.deleteLater() once you do not wish to access the dialog anymore. Of course, if you plan to hide/show the same dialog many times, you don't have to do this, but in that case you would also be keeping a Python reference to the dialog around. In general, to avoid memory usage growing in your program, call dialog.deleteLater() (once finished) if you don't plan to hold onto a Python reference to the dialog! From greatrgb at gmail.com Mon Mar 3 16:40:22 2014 From: greatrgb at gmail.com (Tony Barbieri) Date: Mon, 3 Mar 2014 10:40:22 -0500 Subject: [PySide] Issue with QStandardItemModel, QSortFilterProxyModel and fetchMore Message-ID: Hello! I have a QTreeView which I am populating using a QStandardItemModel. I also have data that needs to only be queried once a certain level of the tree is accessed. I am using the fetchMore method and it appears to work great. Unfortunately once I add in QSortFilterProxyModel, there are extra empty items being added to the tree. I'm not sure where it's coming from or how I can avoid it. Below is the fetchMore method I'm using. I appreciate any thoughts! def fetchMore(self, index) parent = self.itemFromIndex(index) self.beginInsertRows(index, 0, len(sg_data)) for item in sg_data: parent.appendRow(item) self.endInsertRows() -- -tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpe at wingware.com Mon Mar 3 17:28:14 2014 From: jpe at wingware.com (John Ehresman) Date: Mon, 03 Mar 2014 11:28:14 -0500 Subject: [PySide] On Webkit In-Reply-To: References: Message-ID: <5314AD9E.7040100@wingware.com> On 3/2/14, 4:56 PM, Kaveh Shahbazian wrote: > When will the Webkit engine be updated? Or rather is such a thing part > of the roadmap? The version of Webkit exposed by PySide will change when PySide supports Qt5. PySide is a wrapper that exposes the Qt library, including Qt's version of WebKit and right now PySide works with Qt4 and not with Qt5. The long range plan is to add support for Qt5 to PySide, but no one is actively working on it that I know of. Cheers, John From mw_triad at users.sourceforge.net Mon Mar 3 17:35:50 2014 From: mw_triad at users.sourceforge.net (Matthew Woehlke) Date: Mon, 03 Mar 2014 11:35:50 -0500 Subject: [PySide] Form dialog subclassing QDialog In-Reply-To: References: <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> <20140228214830.74e7ad86@bouzin.lan> Message-ID: On 2014-03-03 07:15, Philip Starkey wrote: > Matthew Woehlke writes: > I just want to add to this: if you have specified a parent widget when > instantiating the QDialog, it is not destroyed until the parent widget is > destroyed. This is a pyside-ism? The parent QObject takes an additional Python reference to the child? (I'm pretty sure this doesn't happen in C++...) Though you bring up another point; parented QObjects (at least in C++) are destroyed when their parents are destroyed, which I would assume bypasses Python's refcounting? (Maybe the Python object would still exist, but would be invalid.) So that's something else to keep in mind, but probably rarely relevant (it's unusual that the parent would be destroyed while you still care about the child). -- Matthew From greatrgb at gmail.com Mon Mar 3 17:44:59 2014 From: greatrgb at gmail.com (Tony Barbieri) Date: Mon, 3 Mar 2014 11:44:59 -0500 Subject: [PySide] Issue with QStandardItemModel, QSortFilterProxyModel and fetchMore In-Reply-To: References: Message-ID: I resolved it by not calling beginInsertRows and endInsertRows...perhaps the appendRow call is already taking care of notifying the proxy and view? Seems to have cleared up the issue. Thanks! -tony On Mon, Mar 3, 2014 at 10:40 AM, Tony Barbieri wrote: > Hello! > > I have a QTreeView which I am populating using a QStandardItemModel. I > also have data that needs to only be queried once a certain level of the > tree is accessed. I am using the fetchMore method and it appears to work > great. > > Unfortunately once I add in QSortFilterProxyModel, there are extra empty > items being added to the tree. I'm not sure where it's coming from or how > I can avoid it. Below is the fetchMore method I'm using. I appreciate any > thoughts! > > def fetchMore(self, index) > parent = self.itemFromIndex(index) > > self.beginInsertRows(index, 0, len(sg_data)) > for item in sg_data: > parent.appendRow(item) > self.endInsertRows() > > -- > -tony > -- -tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerome at jolimont.fr Mon Mar 3 18:13:20 2014 From: jerome at jolimont.fr (=?UTF-8?Q?J=C3=A9r=C3=B4me?=) Date: Mon, 03 Mar 2014 18:13:20 +0100 Subject: [PySide] Form dialog subclassing QDialog In-Reply-To: <5310DCA5.3000000@bluewin.ch> References: "" <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> Message-ID: <99c1db6b2e0387840d313052d78d9797@jolimont.fr> Hi. Thank you all for your answers/precisions. I adapted the code proposed by Aaron to my needs. I'm attaching the new version. I implemented Add, Edit, Remove, and even Copy (i.e. "Edit as new"). A few questions remain (and probably much more to come...). Isn't there a data duplication in the TableModel class, with both the buildings[] list, and the model's Items ? In practice, this is what I was going to do since there will be attributes that are not values but references to other custom classes instances. But although I was expecting to do this, I suspected it might not be the best way. I ended up removing the Controller and merging it with the Main window. It looked simpler to me, but it might not be the best choice. I also had to remove the TableView class, because the TableView is already instanciated in the .py file generated by Qt Designer and I didn't know how to do otherwise. In practice, I now have a main window that acts both as view and controller, and a building model. (Qt's doc talks about Model/View programming.) The whole {TableView + AddEditCopyRemove buttons} is meant to be used extensively in this application, so it may become a custom widget. There is currently no value check. At some point, the model would need to be able to perform a check and return an error if, for instance, we don't want two buildings with the same name. I suppose I'll find a way using Exceptions. Thanks again for your precious help. Things are clearer now and I'm not stuck anymore. Have a nice evening. -- Jérôme -------------- next part -------------- A non-text attachment was scrubbed... Name: buildingSurvey.py Type: text/x-c++ Size: 4332 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dialogBuilding.py Type: text/x-c++ Size: 4389 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dialogBuilding.ui Type: application/xml Size: 3676 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mainwindow.py Type: text/x-c++ Size: 4248 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mainwindow.ui Type: application/xml Size: 2716 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: building.py Type: text/x-c++ Size: 3939 bytes Desc: not available URL: From a.richi at bluewin.ch Mon Mar 3 18:32:56 2014 From: a.richi at bluewin.ch (Aaron Richiger) Date: Mon, 03 Mar 2014 18:32:56 +0100 Subject: [PySide] Form dialog subclassing QDialog In-Reply-To: <99c1db6b2e0387840d313052d78d9797@jolimont.fr> References: "" <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> <99c1db6b2e0387840d313052d78d9797@jolimont.fr> Message-ID: <5314BCC8.7080500@bluewin.ch> Hello Jerome! Yes, you could simply remove all self.buildings occurences in your code to remove redundancy. If you need a list of all buildings in the model, you could implement a get_buildings_list() method that builds and returns a list from the models items. For editing entries QDelegates are great, you can define any widget as editor. In the delegates, you can also handle invalid input, sometimes QValidator is another option. Have a look at both directions and their subclasses, they are very powerful. Have a nice evening! Aaron Am 03.03.2014 18:13, schrieb Jérôme: > Hi. > > Thank you all for your answers/precisions. > > I adapted the code proposed by Aaron to my needs. I'm attaching the new > version. > > I implemented Add, Edit, Remove, and even Copy (i.e. "Edit as new"). > > A few questions remain (and probably much more to come...). > > Isn't there a data duplication in the TableModel class, with both the > buildings[] list, and the model's Items ? In practice, this is what I > was going to do since there will be attributes that are not values but > references to other custom classes instances. But although I was > expecting to do this, I suspected it might not be the best way. > > I ended up removing the Controller and merging it with the Main window. > It looked simpler to me, but it might not be the best choice. > > I also had to remove the TableView class, because the TableView is > already instanciated in the .py file generated by Qt Designer and I > didn't know how to do otherwise. > > In practice, I now have a main window that acts both as view and > controller, and a building model. (Qt's doc talks about Model/View > programming.) > > The whole {TableView + AddEditCopyRemove buttons} is meant to be used > extensively in this application, so it may become a custom widget. > > There is currently no value check. At some point, the model would need > to be able to perform a check and return an error if, for instance, we > don't want two buildings with the same name. I suppose I'll find a way > using Exceptions. > > Thanks again for your precious help. Things are clearer now and I'm not > stuck anymore. > > Have a nice evening. > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericacane at splitu.com Mon Mar 3 23:23:52 2014 From: ericacane at splitu.com (Erica Cane) Date: Mon, 3 Mar 2014 14:23:52 -0800 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: Thanks Sean. I am indeed interested in compiling from source in a virtualenv. That said, the ideal solution would be for the PyPi package to be updated with the fix for Mavericks. :) Thanks again! Erica On Sun, Mar 2, 2014 at 10:44 PM, Sean Fisk wrote: > When compiling from source, you can install into a virtualenv. When using > Homebrew, it's not possible to install into a virtualenv. > > I don't use Homebrew's Python, and don't install any other Python packages > other than PySide. Then, inside of the virtualenv, I use a PTH fileto point to Homebrew's > site-packages/ directory. Unfortunately, this also includes any other > Python packages installed by Homebrew if you decide to install them. It's > not the best option, but it works well. I can send you my > PTH-file-writing-script if you are interested. > > If you are interested in compiling from source into a virtualenv, my team > is working on improving the PySide BuildScriptsrepo and I can send you what we have as well. > > If you are interested in either of these, expect a reply from me tomorrow > as it is pretty late in my neck of the woods. > > Cheers, > > > -- > Sean Fisk > > > On Mon, Mar 3, 2014 at 1:29 AM, Erica Cane wrote: > >> Thanks for the responses Ryan and Sean. >> >> Is it possible to use homebrew or source to install into a virtualenv? >> >> >> On Sun, Mar 2, 2014 at 10:06 PM, Sean Fisk wrote: >> >>> Hi Erica, >>> >>> This won't fix the PyPi issue, but I usually install on Mac OS X using >>> Homebrew . Though that has had some recent issues as >>> well. >>> >>> Cheers, >>> >>> >>> -- >>> Sean Fisk >>> >>> >>> On Sun, Mar 2, 2014 at 6:47 PM, Erica B. wrote: >>> >>>> Hi all, >>>> >>>> I'm attempting to install pyside via pip on my Macbook Pro running OS X >>>> 10.9.2 (Mavericks) and am running into some issues. The install fails with >>>> the following error: >>>> >>>> /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >>>>> fatal error: 'tr1/functional' file not found >>>>> #include HASH_FUN_H // defined in config.h >>>>> ^ >>>>> /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >>>>> note: expanded from macro 'HASH_FUN_H' >>>>> #define HASH_FUN_H >>>>> ^ >>>>> 1 error generated. >>>>> make[2]: *** >>>>> [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] Error 1 >>>>> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >>>>> make: *** [all] Error 2 >>>>> error: Error compiling shiboken >>>> >>>> >>>> After some searching, it seems this is a Mavericks error and may have >>>> been fixed in November (https://codereview.qt-project.org/#change,69324), >>>> but that change hasn't made its way to PyPi ( >>>> https://pypi.python.org/pypi/PySide). If this is the case, perhaps the >>>> PyPi package could use a refresh. If not, any ideas what can be done to fix >>>> the error? >>>> >>>> Thanks! >>>> Erica >>>> >>>> >>>> _______________________________________________ >>>> >>>> PySide mailing list >>>> PySide at qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From backup.rlacko at gmail.com Tue Mar 4 01:05:05 2014 From: backup.rlacko at gmail.com (Roman Lacko) Date: Tue, 4 Mar 2014 01:05:05 +0100 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: Hi, You can also install PySide with pip directli from git repository. This should work, but have not tested with latest version: pip install git+ssh://github.com/PySide/pyside-setup.git -Roman 2014-03-03 23:23 GMT+01:00 Erica Cane : > Thanks Sean. I am indeed interested in compiling from source in a > virtualenv. That said, the ideal solution would be for the PyPi package to > be updated with the fix for Mavericks. :) > > Thanks again! > Erica > > > On Sun, Mar 2, 2014 at 10:44 PM, Sean Fisk wrote: > >> When compiling from source, you can install into a virtualenv. When using >> Homebrew, it's not possible to install into a virtualenv. >> >> I don't use Homebrew's Python, and don't install any other Python >> packages other than PySide. Then, inside of the virtualenv, I use a PTH >> file to point to Homebrew's >> site-packages/ directory. Unfortunately, this also includes any other >> Python packages installed by Homebrew if you decide to install them. It's >> not the best option, but it works well. I can send you my >> PTH-file-writing-script if you are interested. >> >> If you are interested in compiling from source into a virtualenv, my team >> is working on improving the PySide BuildScriptsrepo and I can send you what we have as well. >> >> If you are interested in either of these, expect a reply from me tomorrow >> as it is pretty late in my neck of the woods. >> >> Cheers, >> >> >> -- >> Sean Fisk >> >> >> On Mon, Mar 3, 2014 at 1:29 AM, Erica Cane wrote: >> >>> Thanks for the responses Ryan and Sean. >>> >>> Is it possible to use homebrew or source to install into a virtualenv? >>> >>> >>> On Sun, Mar 2, 2014 at 10:06 PM, Sean Fisk wrote: >>> >>>> Hi Erica, >>>> >>>> This won't fix the PyPi issue, but I usually install on Mac OS X using >>>> Homebrew . Though that has had some recent issues as >>>> well. >>>> >>>> Cheers, >>>> >>>> >>>> -- >>>> Sean Fisk >>>> >>>> >>>> On Sun, Mar 2, 2014 at 6:47 PM, Erica B. wrote: >>>> >>>>> Hi all, >>>>> >>>>> I'm attempting to install pyside via pip on my Macbook Pro running OS >>>>> X 10.9.2 (Mavericks) and am running into some issues. The install fails >>>>> with the following error: >>>>> >>>>> /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >>>>>> fatal error: 'tr1/functional' file not found >>>>>> #include HASH_FUN_H // defined in config.h >>>>>> ^ >>>>>> /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >>>>>> note: expanded from macro 'HASH_FUN_H' >>>>>> #define HASH_FUN_H >>>>>> ^ >>>>>> 1 error generated. >>>>>> make[2]: *** >>>>>> [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] Error 1 >>>>>> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >>>>>> make: *** [all] Error 2 >>>>>> error: Error compiling shiboken >>>>> >>>>> >>>>> After some searching, it seems this is a Mavericks error and may have >>>>> been fixed in November ( >>>>> https://codereview.qt-project.org/#change,69324), but that change >>>>> hasn't made its way to PyPi (https://pypi.python.org/pypi/PySide). If >>>>> this is the case, perhaps the PyPi package could use a refresh. If not, any >>>>> ideas what can be done to fix the error? >>>>> >>>>> Thanks! >>>>> Erica >>>>> >>>>> >>>>> _______________________________________________ >>>>> >>>>> PySide mailing list >>>>> PySide at qt-project.org >>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>> >>>>> >>>> >>> >> > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at seanfisk.com Fri Mar 7 16:47:43 2014 From: sean at seanfisk.com (Sean Fisk) Date: Fri, 7 Mar 2014 10:47:43 -0500 Subject: [PySide] Install via pip fails on OS X Mavericks In-Reply-To: References: Message-ID: Hi Erica, I would first try Roman's solution. However, a member of my team is rewriting the PySide build scripts to update them, support pyenv, and in general simplify them. I believe they are updated to build with the stable 1.2.1. You can find his work here-- make sure you check out the rewrite branch. I don't know if you've used the build scripts before, but the only change you should have to make is to change the PREFIX variable in environment.shto match the prefix of the virtualenv itself. Good luck! -- Sean Fisk On Mon, Mar 3, 2014 at 7:05 PM, Roman Lacko wrote: > Hi, > > You can also install PySide with pip directli from git repository. > > This should work, but have not tested with latest version: > pip install git+ssh://github.com/PySide/pyside-setup.git > > -Roman > > 2014-03-03 23:23 GMT+01:00 Erica Cane : > > Thanks Sean. I am indeed interested in compiling from source in a >> virtualenv. That said, the ideal solution would be for the PyPi package to >> be updated with the fix for Mavericks. :) >> >> Thanks again! >> Erica >> >> >> On Sun, Mar 2, 2014 at 10:44 PM, Sean Fisk wrote: >> >>> When compiling from source, you can install into a virtualenv. When >>> using Homebrew, it's not possible to install into a virtualenv. >>> >>> I don't use Homebrew's Python, and don't install any other Python >>> packages other than PySide. Then, inside of the virtualenv, I use a PTH >>> file to point to >>> Homebrew's site-packages/ directory. Unfortunately, this also includes >>> any other Python packages installed by Homebrew if you decide to install >>> them. It's not the best option, but it works well. I can send you my >>> PTH-file-writing-script if you are interested. >>> >>> If you are interested in compiling from source into a virtualenv, my >>> team is working on improving the PySide BuildScriptsrepo and I can send you what we have as well. >>> >>> If you are interested in either of these, expect a reply from me >>> tomorrow as it is pretty late in my neck of the woods. >>> >>> Cheers, >>> >>> >>> -- >>> Sean Fisk >>> >>> >>> On Mon, Mar 3, 2014 at 1:29 AM, Erica Cane wrote: >>> >>>> Thanks for the responses Ryan and Sean. >>>> >>>> Is it possible to use homebrew or source to install into a virtualenv? >>>> >>>> >>>> On Sun, Mar 2, 2014 at 10:06 PM, Sean Fisk wrote: >>>> >>>>> Hi Erica, >>>>> >>>>> This won't fix the PyPi issue, but I usually install on Mac OS X using >>>>> Homebrew . Though that has had some recent issues as >>>>> well. >>>>> >>>>> Cheers, >>>>> >>>>> >>>>> -- >>>>> Sean Fisk >>>>> >>>>> >>>>> On Sun, Mar 2, 2014 at 6:47 PM, Erica B. wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> I'm attempting to install pyside via pip on my Macbook Pro running OS >>>>>> X 10.9.2 (Mavericks) and am running into some issues. The install fails >>>>>> with the following error: >>>>>> >>>>>> /build/PySide/sources/shiboken/ext/sparsehash/google/dense_hash_map:97:10: >>>>>>> fatal error: 'tr1/functional' file not found >>>>>>> #include HASH_FUN_H // defined in config.h >>>>>>> ^ >>>>>>> /build/PySide/sources/shiboken/ext/sparsehash/google/sparsehash/sparseconfig.h:18:24: >>>>>>> note: expanded from macro 'HASH_FUN_H' >>>>>>> #define HASH_FUN_H >>>>>>> ^ >>>>>>> 1 error generated. >>>>>>> make[2]: *** >>>>>>> [libshiboken/CMakeFiles/libshiboken.dir/sbkconverter.cpp.o] Error 1 >>>>>>> make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2 >>>>>>> make: *** [all] Error 2 >>>>>>> error: Error compiling shiboken >>>>>> >>>>>> >>>>>> After some searching, it seems this is a Mavericks error and may have >>>>>> been fixed in November ( >>>>>> https://codereview.qt-project.org/#change,69324), but that change >>>>>> hasn't made its way to PyPi (https://pypi.python.org/pypi/PySide). >>>>>> If this is the case, perhaps the PyPi package could use a refresh. If not, >>>>>> any ideas what can be done to fix the error? >>>>>> >>>>>> Thanks! >>>>>> Erica >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> >>>>>> PySide mailing list >>>>>> PySide at qt-project.org >>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>> >>>>>> >>>>> >>>> >>> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From schampailler at skynet.be Sat Mar 8 11:07:24 2014 From: schampailler at skynet.be (Stefan Champailler) Date: Sat, 08 Mar 2014 11:07:24 +0100 Subject: [PySide] Form dialog subclassing QDialog In-Reply-To: <99c1db6b2e0387840d313052d78d9797@jolimont.fr> References: "" <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> <99c1db6b2e0387840d313052d78d9797@jolimont.fr> Message-ID: <531AEBDC.1050809@skynet.be> Didn't chaeck everything but I'm under the impression you're going through the kind of questions I had three years ago.. In Qt, the model and view are clearly separated. However, some components provide "default model" (I think QTableView does that). So, they actually implements the model for you... In the beginning this confused me because those default models "hid" the regular one. And that made my code a bit awkward... my 0.0000002 eurocents stF On 03/03/2014 06:13 PM, Jérôme wrote: > Hi. > > Thank you all for your answers/precisions. > > I adapted the code proposed by Aaron to my needs. I'm attaching the new > version. > > I implemented Add, Edit, Remove, and even Copy (i.e. "Edit as new"). > > A few questions remain (and probably much more to come...). > > Isn't there a data duplication in the TableModel class, with both the > buildings[] list, and the model's Items ? In practice, this is what I > was going to do since there will be attributes that are not values but > references to other custom classes instances. But although I was > expecting to do this, I suspected it might not be the best way. > > I ended up removing the Controller and merging it with the Main window. > It looked simpler to me, but it might not be the best choice. > > I also had to remove the TableView class, because the TableView is > already instanciated in the .py file generated by Qt Designer and I > didn't know how to do otherwise. > > In practice, I now have a main window that acts both as view and > controller, and a building model. (Qt's doc talks about Model/View > programming.) > > The whole {TableView + AddEditCopyRemove buttons} is meant to be used > extensively in this application, so it may become a custom widget. > > There is currently no value check. At some point, the model would need > to be able to perform a check and return an error if, for instance, we > don't want two buildings with the same name. I suppose I'll find a way > using Exceptions. > > Thanks again for your precious help. Things are clearer now and I'm not > stuck anymore. > > Have a nice evening. > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside -- Timeo Danaos et dona ferentes Twitter @Arakowa1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From esp.home at gmail.com Sat Mar 8 16:35:10 2014 From: esp.home at gmail.com (Evgeny) Date: Sat, 08 Mar 2014 19:35:10 +0400 Subject: [PySide] Very slow items removing from QGraphicsScene Message-ID: <531B38AE.6060302@gmail.com> Hi everyone, My program should work with a great number of graphic items in the graphic scene QGraphicsScene. There are hundred thousand homogeneous items similar to QGraphicsRectItem. The items can be removed or added at the runtime. All the items sometimes are removed from the scene. I have noticed that if I want to remove all the items from the scene using “clear” method or in the loop using “removeItem” method (“clear” works much longer), I have to wait for a long time the operation completing, if the cleaning is used not for the first time. In this case, the item removing, unlike the element adding that is always the same, is extremely slow. Such a situation occurs when there are more than several thousand items (more than 10 000). The time for the removing items increases exponentially (see the pictures with the attached plots). Also I have written a simple test example (please, find the attached example), demonstrating this problem. At present I use PySide, version 1.2.1 (Qt 4.8.5) and Python 2.7.6 x86/x64 on OS Windows 7 x64. CPU: Intel Core 2 Quad 6600 RAM: 6 Gb -- Best regards, Evgeny -------------- next part -------------- #coding=utf-8 """ Simple benchmark items removing from QGraphicScene """ import sys import time from PySide.QtGui import QApplication from PySide.QtGui import QGraphicsScene def elapsed_time(func): def wrapper(*args): t = time.time() try: ret = func(*args) except: raise finally: print '({}) Elapsed time: {:.3f} sec.'.format(func.func_name, time.time() - t) return ret return wrapper @elapsed_time def add_items(scene, items, n): del items[:] for i in xrange(n): item = scene.addRect(i, i, 1, 1) items.append(item) @elapsed_time def remove_items(scene, items): for item in items: scene.removeItem(item) del items[:] #=============================================================================== if __name__ == '__main__': app = QApplication(sys.argv) scene = QGraphicsScene() items = [] n = 50000 # First run (fast) add_items(scene, items, n) remove_items(scene, items) # Second run (very long) add_items(scene, items, n) remove_items(scene, items) sys.exit() -------------- next part -------------- A non-text attachment was scrubbed... Name: bench_qgraphicsscene.png Type: image/png Size: 14530 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bench_qgraphicsscene_semilogx.png Type: image/png Size: 12857 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bench_qgraphicsscene_semilogy.png Type: image/png Size: 16524 bytes Desc: not available URL: From frank at ohufx.com Fri Mar 14 02:30:16 2014 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 14 Mar 2014 14:30:16 +1300 Subject: [PySide] using QProcess to run python function In-Reply-To: References: <52E1C66C.3050400@ohufx.com> <52E1CD36.4070302@ohufx.com> <52E1D314.8000800@ohufx.com> <52E1E19E.7090402@ohufx.com> <52E1EEE3.9040801@ohufx.com> <52E3488F.1060501@ohufx.com> <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> Message-ID: <53225BA8.8040506@ohufx.com> after a much longer absence from this than anticipated, I'm finally trying to get back into this. I had a look at your example Sean and it makes sense so far. Now I'm trying to follow your advise and use QThreadPool, but am not finding any good examples on it's usage. Unfortunately, the first example mentioned in the docs already throws an error for me: from PySide import QtCore class HelloWorldTask(QtCore.QRunnable): def run(self): print "Hello world from thread", QtCore.QThread.currentThread() hello = HelloWorldTask() # QThreadPool takes ownership and deletes 'hello' automatically QtCore.QThreadPool.globalInstance().start(hello) result: Hello world from thread Traceback (most recent call last): File "/ohufx/pipeline/tools/python/sandbox/QThreadPoolTest.py", line 6, in run print "Hello world from thread", QtCore.QThread.currentThread() AttributeError: 'NoneType' object has no attribute 'QThread' What am I missing here? Cheers, frank On 28/01/14 08:00, Sean Fisk wrote: > On Sat, Jan 25, 2014 at 2:38 AM, Frank Rueter | OHUfx > wrote: > > fantastic, thanks Sean!! > I will examine this to make sure I understand everything, then > give QThreadPool a whirl. Am more than happy to learn from more > experienced people and adjust my approaches accordingly, so thanks > a lot for your time with this! > > > No problem! Let me know if you have any questions about the code. > > > Cheers, > frank > > > > On 25/01/14 20:03, Sean Fisk wrote: >> >> Hi Frank, >> >> I updated your example to hopefully work as you would like. I >> added a progress bar update as well. I’m going to make a >> last-ditch effort to convince you to stop doing things manually >> with |QThread|, and move to using |QThreadPool| >> . >> Everything about the |QThreadPool| API is much nicer, and it’s >> worked much better for me in real projects. Also, the Python ‘s >> |multiprocessing| >> and >> |concurrent.futures| modules >> can work well if you’re careful about your callbacks. >> >> Also, there is a large discussion about not overriding the >> |run()| method of |QThread|. I don’t think overriding it is so >> bad if you don’t need the thread to be running an event loop of >> its own. I still prefer the |QThreadPool| API, though. Someone >> please correct me if this is totally wrong and there is never a >> reason to override it. >> >> Here is the code: >> >> |#!/usr/bin/env python >> >> import sys >> import time >> >> from PySideimport QtGui >> from PySideimport QtCore >> >> TOTAL_WIDGETS =10 >> >> class Worker(QtCore.QObject): >> processed = QtCore.Signal(int) >> finished = QtCore.Signal() >> >> # Overriding this is not necessary if you're not doing anything in it. >> >> # def __init__(self): >> # super(Worker, self).__init__() >> >> def helloWorld(self): >> for iin xrange(TOTAL_WIDGETS): >> # We sleep first to simulate an operation taking place. >> time.sleep(0.5) >> print 'hello %s' % i >> self.processed.emit(i +1) >> # Must manually emit the finished signal. >> self.finished.emit() >> >> class MainUI(QtGui.QWidget): >> def __init__(self, parent=None): >> super(MainUI, self).__init__(parent) >> self.extraThread = QtCore.QThread() >> >> # IMPORTANT: Don't quit the app until the thread has completed. Prevents errors like: >> # >> # QThread: Destroyed while thread is still running >> # >> QtGui.QApplication.instance().aboutToQuit.connect(self.quit) >> >> self.worker = Worker() >> self.worker.moveToThread(self.extraThread) >> self.setupUI() >> self.connectSignalsAndSlots() >> >> def setupUI(self): >> # CREAT MAIN LAYOUT AND WIDGETS >> mainLayout = QtGui.QVBoxLayout() >> btnLayout = QtGui.QHBoxLayout() >> mainLayout.addLayout(btnLayout) >> self.setLayout(mainLayout) >> >> self.progressBar = QtGui.QProgressBar(self) >> self.progressBar.setRange(0, TOTAL_WIDGETS) >> self.progressBar.setVisible(False) >> self.btnWork = QtGui.QPushButton('Do Work') >> self.btnCancel = QtGui.QPushButton('Cancel') >> self.btnCancel.setDisabled(True) >> >> self.guiResponseProgressbar = QtGui.QProgressBar(self) >> self.guiResponseProgressbar.setRange(0,0) >> >> self.outputWindow = QtGui.QTextEdit() >> >> mainLayout.addWidget(self.progressBar) >> mainLayout.addWidget(self.outputWindow) >> mainLayout.addWidget(self.guiResponseProgressbar) >> >> btnLayout.addWidget(self.btnWork) >> btnLayout.addWidget(self.btnCancel) >> >> def connectSignalsAndSlots(self): >> print 'connecting signals' >> self.btnWork.clicked.connect(self.startWorker) >> >> # Pleas see . Bad bad bad bad bad. >> # self.btnCancel.clicked.connect(self.extraThread.terminate) >> >> # THREAD STARTED >> # Not necessary; just do this in startWorker. >> # self.extraThread.started.connect(lambda: self.btnWork.setDisabled(True)) >> # self.extraThread.started.connect(lambda: self.btnCancel.setEnabled(True)) >> # self.extraThread.started.connect(self.progressBar.show) >> self.extraThread.started.connect(self.worker.helloWorld) >> >> # THREAD FINISHED >> # self.extraThread.finished.connect(lambda: self.btnCancel.setDisabled(True)) >> # self.extraThread.finished.connect(self.extraThread.deleteLater) >> # self.extraThread.finished.connect(self.worker.deleteLater) >> self.extraThread.finished.connect(self.finished) >> >> # Connect worker signals. >> self.worker.processed.connect(self.progressBar.setValue) >> self.worker.finished.connect(self.finished) >> >> # SHOW PROGRESS BAR WHEN PUBLISHING STARTS >> # self.extraThread.started.connect(self.progressBar.show) >> # CONNECT PROCESS TO PROGRESS BAR AND OUTPUT WINDOW >> # NOT DONE YET >> >> def startWorker(self): >> # GO >> self.btnWork.setDisabled(True) >> self.btnCancel.setEnabled(True) >> self.progressBar.show() >> print 'starting worker thread' >> self.extraThread.start() >> >> # THIS IS BLOCKING THE GUI THREAD! Try putting this back in and seeing >> # what happens to the gui_response_progressbar. >> >> # for i in xrange(10): >> # print 'from main thread:', i >> # time.sleep(.3) >> >> def finished(self): >> print 'finished' >> self.btnCancel.setDisabled(True) >> # self.extraThread.deleteLater() >> # self.worker.deleteLater() >> >> def quit(self): >> # Quit the thread's event loop. Note that this *doesn't* stop tasks >> # running in the thread, it just stops the thread from dispatching >> # events. >> self.extraThread.quit() >> # Wait for the thread to complete. If the thread's task is not done, >> # this will block. >> self.extraThread.wait() >> >> if __name__ =='__main__': >> args = sys.argv >> app = QtGui.QApplication(args) >> p = MainUI() >> p.show() >> # Annoyance on Mac OS X. >> p.raise_() >> sys.exit(app.exec_())| >> >> Cheers, >> >> >> >> -- >> Sean Fisk >> >> >> On Sat, Jan 25, 2014 at 12:30 AM, Frank Rueter | OHUfx >> > wrote: >> >> quick update: >> I just learnt about connection types but those didn't help >> either in this case: >> http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads >> >> >> >> >> On 25/01/14 18:15, Frank Rueter | OHUfx wrote: >>> And of course I ran into trouble :-D >>> Here is my test code trying to ustilise QThread: >>> http://pastebin.com/Q26Q9M1M >>> >>> The basic structure seems to work (the extra thread and the >>> main thread are running at the same time), but my UI does >>> not update according to the signal connections, e.g.: >>> When the thread starts the progress bar is supposed to be >>> shown, the "Do Work" button should be disabled, the "Cancel" >>> button disabled. >>> etc. >>> >>> I tried calling self.update() in the MainUI when the thread >>> starts but to no avail. >>> I'm sure I'm missing something obvious as usual. >>> >>> I tried to adhere to what I learnt on this list about >>> threading and avoid sub-classing QThread. >>> >>> Cheers, >>> frank >>> >>> On 24/01/14 17:41, Frank Rueter | OHUfx wrote: >>>> Great, thanks. I shall adjust my code. >>>> I am interested in seeing how you would go about it, but >>>> let me have a go from scratch, I will be able to understand >>>> things much better afterwards :) >>>> >>>> Cheers, >>>> frank >>>> >>>> >>>> On 24/01/14 17:38, Sean Fisk wrote: >>>>> On Thu, Jan 23, 2014 at 10:44 PM, Frank Rueter | OHUfx >>>>> > wrote: >>>>> >>>>> Much appreciated but as I mentioned, I think I jumped >>>>> the gun with my post and should be using QThread to >>>>> hook the python code to my QProgressBar and debug >>>>> output window (QTextEdit). >>>>> >>>>> That would be a correct way to use |QProgressBar|. Also, >>>>> for subprocess output, I would consider using >>>>> |QPlainTextEdit| instead of |QTextEdit| as is is more >>>>> performant with high amounts of text. >>>>> >>>>> If you are interested, I just wrote an asynchronous module >>>>> for PySide for the project on which I am currently >>>>> working. It is based on Python’s futures >>>>> module and works great >>>>> with Qt’s signals/slots. Although the project is primarily >>>>> closed-source, I would be happy to share the async >>>>> implementation with you. I don’t know if would fit your >>>>> needs, but for us it’s much easier than manually spawning >>>>> |QThread|s and even easier than |QThreadPool|. >>>>> >>>>> Good luck! >>>>> >>>>> I will investigate that now >>>>> >>>>> >>>>> >>>>> On 24/01/14 16:08, Sean Fisk wrote: >>>>>> On Thu, Jan 23, 2014 at 9:42 PM, Frank Rueter | OHUfx >>>>>> > wrote: >>>>>> >>>>>> Thanks Sean and Ryan, >>>>>> >>>>>> I'm still not quite clear on how this ties into >>>>>> QProcess.start() >>>>>> >>>>>> >>>>>> It doesn’t tie in with |QProcess| at all. We’re >>>>>> advising to avoid using that :) >>>>>> >>>>>> I do have a if __name__ ... block in the script >>>>>> in question. >>>>>> An example would certainly be awesome, but if >>>>>> it's less hassle, explaining how your and Ryan's >>>>>> advise helps use QProcess on a python module >>>>>> might already suffice. Maybe a simlpe example >>>>>> says it all though?! >>>>>> >>>>>> >>>>>> I will whip up a simple example for you, but it might >>>>>> take a few hours (lots of stuff to do right now). >>>>>> >>>>>> I'm not using python 3 btw >>>>>> >>>>>> Thanks guys for your help!! >>>>>> >>>>>> frank >>>>>> >>>>>> >>>>>> On 24/01/14 15:33, Sean Fisk wrote: >>>>>>> >>>>>>> Hi Frank, >>>>>>> >>>>>>> You should definitely avoid calling Python as a >>>>>>> subprocess if you can. As far as Ryan’s example, >>>>>>> I agree with the |if __name__...| but I think >>>>>>> that using the |imp| module is a bit overkill. I >>>>>>> would recommend using Setuptool’s |entry_points| >>>>>>> keyword >>>>>>> . >>>>>>> Or distutils’ |scripts| keyword >>>>>>> , >>>>>>> if you must. >>>>>>> >>>>>>> An example of a well-known Python package which >>>>>>> does this is Pygments >>>>>>> , which >>>>>>> has a large “library” component but also comes >>>>>>> with the |pygmentize| command-line script. The >>>>>>> Pygments codebase is pretty large, so if you >>>>>>> would like me to whip up a simpler example I’d >>>>>>> be glad to do so. >>>>>>> >>>>>>> Cheers, >>>>>>> >>>>>>> -- >>>>>>> Sean Fisk >>>>>>> >>>>>>> >>>>>>> On Thu, Jan 23, 2014 at 9:17 PM, Frank Rueter | >>>>>>> OHUfx > >>>>>>> wrote: >>>>>>> >>>>>>> Sorry if I'm being thick, but I'm not quite >>>>>>> understanding how this helps to connect a >>>>>>> python function to qprocess?! All your code >>>>>>> does is execute the script, right?! >>>>>>> I can already call myscript.main() straight >>>>>>> up, but maybe I'm missing the point as I'm >>>>>>> unfamiliar with the imp module. >>>>>>> >>>>>>> Let me elaborate a little bit more: >>>>>>> myscript.main() calls a bunch of other >>>>>>> python scripts that (directly or through >>>>>>> other scripts again) execute external >>>>>>> programs to do some conversion work. Those >>>>>>> external programs spit out their progress to >>>>>>> stdout which I can see fine when I run >>>>>>> myscript.main() manually in a python terminal. >>>>>>> >>>>>>> Now I need run myscript.main() via QProcess >>>>>>> and grab stdout to do be able to show a >>>>>>> progress bar as well as show stdout and >>>>>>> stderr in a debug window inside my QT code. >>>>>>> >>>>>>> >>>>>>> Cheers, >>>>>>> frank >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 24/01/14 14:58, Ryan Gonzalez wrote: >>>>>>>> If you put an "if __name__ == '__main__'" >>>>>>>> and a main functions, you could always >>>>>>>> import the script from the GUI frontend. >>>>>>>> Example: >>>>>>>> >>>>>>>> myscript.py >>>>>>>> >>>>>>>> def main(argv): >>>>>>>> do_cool_stuff() >>>>>>>> return 0 >>>>>>>> >>>>>>>> if __name__ == '__main__': >>>>>>>> sys.exit(main(sys.argv)) >>>>>>>> >>>>>>>> mygui.py(Python 2): >>>>>>>> >>>>>>>> import imp >>>>>>>> >>>>>>>> ... >>>>>>>> >>>>>>>> main = imp.load_module('myscript', >>>>>>>> *imp.find_module('myscript')) >>>>>>>> >>>>>>>> main.main(my_argv) >>>>>>>> >>>>>>>> mygui.py(Python 3): >>>>>>>> >>>>>>>> import importlib.machinery >>>>>>>> >>>>>>>> main = >>>>>>>> importlib.machinery.SourceFileLoader('myscript', >>>>>>>> 'myscript.py').load_module('myscript') >>>>>>>> >>>>>>>> main.main(my_argv) >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Jan 23, 2014 at 7:48 PM, Frank >>>>>>>> Rueter | OHUfx >>>>>>> > wrote: >>>>>>>> >>>>>>>> Hi all, >>>>>>>> >>>>>>>> I got a little code design question: >>>>>>>> >>>>>>>> I have a python script that does a lot >>>>>>>> of file >>>>>>>> processing/converting/uploading etc and >>>>>>>> I'd like to write a decent >>>>>>>> interface for it now. >>>>>>>> The main goal is to be able to show the >>>>>>>> user detailed info about the >>>>>>>> current step and progress as well as >>>>>>>> clean up properly in case the whole >>>>>>>> thing is cancelled. >>>>>>>> >>>>>>>> My existing python code needs to stay >>>>>>>> independent of QT so any >>>>>>>> application that supports python can >>>>>>>> use it. >>>>>>>> I am wondering now how to best connect >>>>>>>> the python script and the PySide >>>>>>>> code. Should I just run the script as >>>>>>>> an argument to the python >>>>>>>> interpreter like I would with any other >>>>>>>> program? E.g.: >>>>>>>> >>>>>>>> process = QtCore.QProcess(self) >>>>>>>> process.start(, >>>>>>>> ) >>>>>>>> >>>>>>>> As simple as this seems, it feels odd >>>>>>>> to use python to call itself as an >>>>>>>> external program. >>>>>>>> >>>>>>>> >>>>>>>> I'm happy to go that way but am curious >>>>>>>> how others are doing this?! >>>>>>>> >>>>>>>> Cheers, >>>>>>>> frank >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> PySide mailing list >>>>>>>> PySide at qt-project.org >>>>>>>> >>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Ryan >>>>>>>> If anybody ever asks me why I prefer C++ to >>>>>>>> C, my answer will be simple: "It's >>>>>>>> becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, >>>>>>>> I don't think that was nul-terminated." >>>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> PySide mailing list >>>>>>> PySide at qt-project.org >>>>>>> >>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> PySide mailing list >>>> PySide at qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >>> >>> _______________________________________________ >>> PySide mailing list >>> PySide at qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/pyside >> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> >> > > -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Fri Mar 14 05:00:23 2014 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 14 Mar 2014 17:00:23 +1300 Subject: [PySide] using QProcess to run python function In-Reply-To: <53225BA8.8040506@ohufx.com> References: <52E1C66C.3050400@ohufx.com> <52E1CD36.4070302@ohufx.com> <52E1D314.8000800@ohufx.com> <52E1E19E.7090402@ohufx.com> <52E1EEE3.9040801@ohufx.com> <52E3488F.1060501@ohufx.com> <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> Message-ID: <53227ED7.7020607@ohufx.com> False alarm: Looks like the culprit wasn't the code but the debugger I was using spat it's dummy more or less silently. When I run the same code in a different interpreter it works as expected. On 14/03/14 14:30, Frank Rueter | OHUfx wrote: > after a much longer absence from this than anticipated, I'm finally > trying to get back into this. > I had a look at your example Sean and it makes sense so far. > Now I'm trying to follow your advise and use QThreadPool, but am not > finding any good examples on it's usage. > Unfortunately, the first example mentioned in the docs > > already throws an error for me: > > from PySide import QtCore > class HelloWorldTask(QtCore.QRunnable): > def run(self): > print "Hello world from thread", QtCore.QThread.currentThread() > > hello = HelloWorldTask() > # QThreadPool takes ownership and deletes 'hello' automatically > QtCore.QThreadPool.globalInstance().start(hello) > > result: > Hello world from thread > Traceback (most recent call last): > File "/ohufx/pipeline/tools/python/sandbox/QThreadPoolTest.py", line > 6, in run > print "Hello world from thread", QtCore.QThread.currentThread() > AttributeError: 'NoneType' object has no attribute 'QThread' > > > > What am I missing here? > > Cheers, > frank > > > > > > On 28/01/14 08:00, Sean Fisk wrote: >> On Sat, Jan 25, 2014 at 2:38 AM, Frank Rueter | OHUfx >> > wrote: >> >> fantastic, thanks Sean!! >> I will examine this to make sure I understand everything, then >> give QThreadPool a whirl. Am more than happy to learn from more >> experienced people and adjust my approaches accordingly, so >> thanks a lot for your time with this! >> >> >> No problem! Let me know if you have any questions about the code. >> >> >> Cheers, >> frank >> >> >> >> On 25/01/14 20:03, Sean Fisk wrote: >>> >>> Hi Frank, >>> >>> I updated your example to hopefully work as you would like. I >>> added a progress bar update as well. I'm going to make a >>> last-ditch effort to convince you to stop doing things manually >>> with |QThread|, and move to using |QThreadPool| >>> . >>> Everything about the |QThreadPool| API is much nicer, and it's >>> worked much better for me in real projects. Also, the Python 's >>> |multiprocessing| >>> and >>> |concurrent.futures| modules >>> can work well if you're careful about your callbacks. >>> >>> Also, there is a large discussion about not overriding the >>> |run()| method of |QThread|. I don't think overriding it is so >>> bad if you don't need the thread to be running an event loop of >>> its own. I still prefer the |QThreadPool| API, though. Someone >>> please correct me if this is totally wrong and there is never a >>> reason to override it. >>> >>> Here is the code: >>> >>> |#!/usr/bin/env python >>> >>> import sys >>> import time >>> >>> from PySideimport QtGui >>> from PySideimport QtCore >>> >>> TOTAL_WIDGETS =10 >>> >>> class Worker(QtCore.QObject): >>> processed = QtCore.Signal(int) >>> finished = QtCore.Signal() >>> >>> # Overriding this is not necessary if you're not doing anything in it. >>> >>> # def __init__(self): >>> # super(Worker, self).__init__() >>> >>> def helloWorld(self): >>> for iin xrange(TOTAL_WIDGETS): >>> # We sleep first to simulate an operation taking place. >>> time.sleep(0.5) >>> print 'hello %s' % i >>> self.processed.emit(i +1) >>> # Must manually emit the finished signal. >>> self.finished.emit() >>> >>> class MainUI(QtGui.QWidget): >>> def __init__(self, parent=None): >>> super(MainUI, self).__init__(parent) >>> self.extraThread = QtCore.QThread() >>> >>> # IMPORTANT: Don't quit the app until the thread has completed. Prevents errors like: >>> # >>> # QThread: Destroyed while thread is still running >>> # >>> QtGui.QApplication.instance().aboutToQuit.connect(self.quit) >>> >>> self.worker = Worker() >>> self.worker.moveToThread(self.extraThread) >>> self.setupUI() >>> self.connectSignalsAndSlots() >>> >>> def setupUI(self): >>> # CREAT MAIN LAYOUT AND WIDGETS >>> mainLayout = QtGui.QVBoxLayout() >>> btnLayout = QtGui.QHBoxLayout() >>> mainLayout.addLayout(btnLayout) >>> self.setLayout(mainLayout) >>> >>> self.progressBar = QtGui.QProgressBar(self) >>> self.progressBar.setRange(0, TOTAL_WIDGETS) >>> self.progressBar.setVisible(False) >>> self.btnWork = QtGui.QPushButton('Do Work') >>> self.btnCancel = QtGui.QPushButton('Cancel') >>> self.btnCancel.setDisabled(True) >>> >>> self.guiResponseProgressbar = QtGui.QProgressBar(self) >>> self.guiResponseProgressbar.setRange(0,0) >>> >>> self.outputWindow = QtGui.QTextEdit() >>> >>> mainLayout.addWidget(self.progressBar) >>> mainLayout.addWidget(self.outputWindow) >>> mainLayout.addWidget(self.guiResponseProgressbar) >>> >>> btnLayout.addWidget(self.btnWork) >>> btnLayout.addWidget(self.btnCancel) >>> >>> def connectSignalsAndSlots(self): >>> print 'connecting signals' >>> self.btnWork.clicked.connect(self.startWorker) >>> >>> # Pleas see . Bad bad bad bad bad. >>> # self.btnCancel.clicked.connect(self.extraThread.terminate) >>> >>> # THREAD STARTED >>> # Not necessary; just do this in startWorker. >>> # self.extraThread.started.connect(lambda: self.btnWork.setDisabled(True)) >>> # self.extraThread.started.connect(lambda: self.btnCancel.setEnabled(True)) >>> # self.extraThread.started.connect(self.progressBar.show) >>> self.extraThread.started.connect(self.worker.helloWorld) >>> >>> # THREAD FINISHED >>> # self.extraThread.finished.connect(lambda: self.btnCancel.setDisabled(True)) >>> # self.extraThread.finished.connect(self.extraThread.deleteLater) >>> # self.extraThread.finished.connect(self.worker.deleteLater) >>> self.extraThread.finished.connect(self.finished) >>> >>> # Connect worker signals. >>> self.worker.processed.connect(self.progressBar.setValue) >>> self.worker.finished.connect(self.finished) >>> >>> # SHOW PROGRESS BAR WHEN PUBLISHING STARTS >>> # self.extraThread.started.connect(self.progressBar.show) >>> # CONNECT PROCESS TO PROGRESS BAR AND OUTPUT WINDOW >>> # NOT DONE YET >>> >>> def startWorker(self): >>> # GO >>> self.btnWork.setDisabled(True) >>> self.btnCancel.setEnabled(True) >>> self.progressBar.show() >>> print 'starting worker thread' >>> self.extraThread.start() >>> >>> # THIS IS BLOCKING THE GUI THREAD! Try putting this back in and seeing >>> # what happens to the gui_response_progressbar. >>> >>> # for i in xrange(10): >>> # print 'from main thread:', i >>> # time.sleep(.3) >>> >>> def finished(self): >>> print 'finished' >>> self.btnCancel.setDisabled(True) >>> # self.extraThread.deleteLater() >>> # self.worker.deleteLater() >>> >>> def quit(self): >>> # Quit the thread's event loop. Note that this *doesn't* stop tasks >>> # running in the thread, it just stops the thread from dispatching >>> # events. >>> self.extraThread.quit() >>> # Wait for the thread to complete. If the thread's task is not done, >>> # this will block. >>> self.extraThread.wait() >>> >>> if __name__ =='__main__': >>> args = sys.argv >>> app = QtGui.QApplication(args) >>> p = MainUI() >>> p.show() >>> # Annoyance on Mac OS X. >>> p.raise_() >>> sys.exit(app.exec_())| >>> >>> Cheers, >>> >>> >>> >>> -- >>> Sean Fisk >>> >>> >>> On Sat, Jan 25, 2014 at 12:30 AM, Frank Rueter | OHUfx >>> > wrote: >>> >>> quick update: >>> I just learnt about connection types but those didn't help >>> either in this case: >>> http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads >>> >>> >>> >>> >>> On 25/01/14 18:15, Frank Rueter | OHUfx wrote: >>>> And of course I ran into trouble :-D >>>> Here is my test code trying to ustilise QThread: >>>> http://pastebin.com/Q26Q9M1M >>>> >>>> The basic structure seems to work (the extra thread and the >>>> main thread are running at the same time), but my UI does >>>> not update according to the signal connections, e.g.: >>>> When the thread starts the progress bar is supposed to be >>>> shown, the "Do Work" button should be disabled, the >>>> "Cancel" button disabled. >>>> etc. >>>> >>>> I tried calling self.update() in the MainUI when the thread >>>> starts but to no avail. >>>> I'm sure I'm missing something obvious as usual. >>>> >>>> I tried to adhere to what I learnt on this list about >>>> threading and avoid sub-classing QThread. >>>> >>>> Cheers, >>>> frank >>>> >>>> On 24/01/14 17:41, Frank Rueter | OHUfx wrote: >>>>> Great, thanks. I shall adjust my code. >>>>> I am interested in seeing how you would go about it, but >>>>> let me have a go from scratch, I will be able to >>>>> understand things much better afterwards :) >>>>> >>>>> Cheers, >>>>> frank >>>>> >>>>> >>>>> On 24/01/14 17:38, Sean Fisk wrote: >>>>>> On Thu, Jan 23, 2014 at 10:44 PM, Frank Rueter | OHUfx >>>>>> > wrote: >>>>>> >>>>>> Much appreciated but as I mentioned, I think I jumped >>>>>> the gun with my post and should be using QThread to >>>>>> hook the python code to my QProgressBar and debug >>>>>> output window (QTextEdit). >>>>>> >>>>>> That would be a correct way to use |QProgressBar|. Also, >>>>>> for subprocess output, I would consider using >>>>>> |QPlainTextEdit| instead of |QTextEdit| as is is more >>>>>> performant with high amounts of text. >>>>>> >>>>>> If you are interested, I just wrote an asynchronous >>>>>> module for PySide for the project on which I am currently >>>>>> working. It is based on Python's futures >>>>>> module and works great >>>>>> with Qt's signals/slots. Although the project is >>>>>> primarily closed-source, I would be happy to share the >>>>>> async implementation with you. I don't know if would fit >>>>>> your needs, but for us it's much easier than manually >>>>>> spawning |QThread|s and even easier than |QThreadPool|. >>>>>> >>>>>> Good luck! >>>>>> >>>>>> I will investigate that now >>>>>> >>>>>> >>>>>> >>>>>> On 24/01/14 16:08, Sean Fisk wrote: >>>>>>> On Thu, Jan 23, 2014 at 9:42 PM, Frank Rueter | >>>>>>> OHUfx > wrote: >>>>>>> >>>>>>> Thanks Sean and Ryan, >>>>>>> >>>>>>> I'm still not quite clear on how this ties into >>>>>>> QProcess.start() >>>>>>> >>>>>>> >>>>>>> It doesn't tie in with |QProcess| at all. We're >>>>>>> advising to avoid using that :) >>>>>>> >>>>>>> I do have a if __name__ ... block in the script >>>>>>> in question. >>>>>>> An example would certainly be awesome, but if >>>>>>> it's less hassle, explaining how your and Ryan's >>>>>>> advise helps use QProcess on a python module >>>>>>> might already suffice. Maybe a simlpe example >>>>>>> says it all though?! >>>>>>> >>>>>>> >>>>>>> I will whip up a simple example for you, but it >>>>>>> might take a few hours (lots of stuff to do right now). >>>>>>> >>>>>>> I'm not using python 3 btw >>>>>>> >>>>>>> Thanks guys for your help!! >>>>>>> >>>>>>> frank >>>>>>> >>>>>>> >>>>>>> On 24/01/14 15:33, Sean Fisk wrote: >>>>>>>> >>>>>>>> Hi Frank, >>>>>>>> >>>>>>>> You should definitely avoid calling Python as a >>>>>>>> subprocess if you can. As far as Ryan's >>>>>>>> example, I agree with the |if __name__...| but >>>>>>>> I think that using the |imp| module is a bit >>>>>>>> overkill. I would recommend using Setuptool's >>>>>>>> |entry_points| keyword >>>>>>>> . >>>>>>>> Or distutils' |scripts| keyword >>>>>>>> , >>>>>>>> if you must. >>>>>>>> >>>>>>>> An example of a well-known Python package which >>>>>>>> does this is Pygments >>>>>>>> , >>>>>>>> which has a large "library" component but also >>>>>>>> comes with the |pygmentize| command-line >>>>>>>> script. The Pygments codebase is pretty large, >>>>>>>> so if you would like me to whip up a simpler >>>>>>>> example I'd be glad to do so. >>>>>>>> >>>>>>>> Cheers, >>>>>>>> >>>>>>>> -- >>>>>>>> Sean Fisk >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Jan 23, 2014 at 9:17 PM, Frank Rueter | >>>>>>>> OHUfx >>>>>>> > wrote: >>>>>>>> >>>>>>>> Sorry if I'm being thick, but I'm not quite >>>>>>>> understanding how this helps to connect a >>>>>>>> python function to qprocess?! All your code >>>>>>>> does is execute the script, right?! >>>>>>>> I can already call myscript.main() straight >>>>>>>> up, but maybe I'm missing the point as I'm >>>>>>>> unfamiliar with the imp module. >>>>>>>> >>>>>>>> Let me elaborate a little bit more: >>>>>>>> myscript.main() calls a bunch of other >>>>>>>> python scripts that (directly or through >>>>>>>> other scripts again) execute external >>>>>>>> programs to do some conversion work. Those >>>>>>>> external programs spit out their progress >>>>>>>> to stdout which I can see fine when I run >>>>>>>> myscript.main() manually in a python terminal. >>>>>>>> >>>>>>>> Now I need run myscript.main() via QProcess >>>>>>>> and grab stdout to do be able to show a >>>>>>>> progress bar as well as show stdout and >>>>>>>> stderr in a debug window inside my QT code. >>>>>>>> >>>>>>>> >>>>>>>> Cheers, >>>>>>>> frank >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 24/01/14 14:58, Ryan Gonzalez wrote: >>>>>>>>> If you put an "if __name__ == '__main__'" >>>>>>>>> and a main functions, you could always >>>>>>>>> import the script from the GUI frontend. >>>>>>>>> Example: >>>>>>>>> >>>>>>>>> myscript.py >>>>>>>>> >>>>>>>>> def main(argv): >>>>>>>>> do_cool_stuff() >>>>>>>>> return 0 >>>>>>>>> >>>>>>>>> if __name__ == '__main__': >>>>>>>>> sys.exit(main(sys.argv)) >>>>>>>>> >>>>>>>>> mygui.py(Python 2): >>>>>>>>> >>>>>>>>> import imp >>>>>>>>> >>>>>>>>> ... >>>>>>>>> >>>>>>>>> main = imp.load_module('myscript', >>>>>>>>> *imp.find_module('myscript')) >>>>>>>>> >>>>>>>>> main.main(my_argv) >>>>>>>>> >>>>>>>>> mygui.py(Python 3): >>>>>>>>> >>>>>>>>> import importlib.machinery >>>>>>>>> >>>>>>>>> main = >>>>>>>>> importlib.machinery.SourceFileLoader('myscript', >>>>>>>>> 'myscript.py').load_module('myscript') >>>>>>>>> >>>>>>>>> main.main(my_argv) >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Jan 23, 2014 at 7:48 PM, Frank >>>>>>>>> Rueter | OHUfx >>>>>>>> > wrote: >>>>>>>>> >>>>>>>>> Hi all, >>>>>>>>> >>>>>>>>> I got a little code design question: >>>>>>>>> >>>>>>>>> I have a python script that does a lot >>>>>>>>> of file >>>>>>>>> processing/converting/uploading etc >>>>>>>>> and I'd like to write a decent >>>>>>>>> interface for it now. >>>>>>>>> The main goal is to be able to show >>>>>>>>> the user detailed info about the >>>>>>>>> current step and progress as well as >>>>>>>>> clean up properly in case the whole >>>>>>>>> thing is cancelled. >>>>>>>>> >>>>>>>>> My existing python code needs to stay >>>>>>>>> independent of QT so any >>>>>>>>> application that supports python can >>>>>>>>> use it. >>>>>>>>> I am wondering now how to best connect >>>>>>>>> the python script and the PySide >>>>>>>>> code. Should I just run the script as >>>>>>>>> an argument to the python >>>>>>>>> interpreter like I would with any >>>>>>>>> other program? E.g.: >>>>>>>>> >>>>>>>>> process = QtCore.QProcess(self) >>>>>>>>> process.start(, >>>>>>>>> ) >>>>>>>>> >>>>>>>>> As simple as this seems, it feels odd >>>>>>>>> to use python to call itself as an >>>>>>>>> external program. >>>>>>>>> >>>>>>>>> >>>>>>>>> I'm happy to go that way but am >>>>>>>>> curious how others are doing this?! >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> frank >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> PySide mailing list >>>>>>>>> PySide at qt-project.org >>>>>>>>> >>>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Ryan >>>>>>>>> If anybody ever asks me why I prefer C++ >>>>>>>>> to C, my answer will be simple: "It's >>>>>>>>> becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. >>>>>>>>> Wait, I don't think that was nul-terminated." >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> PySide mailing list >>>>>>>> PySide at qt-project.org >>>>>>>> >>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> PySide mailing list >>>>> PySide at qt-project.org >>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>>> >>>> _______________________________________________ >>>> PySide mailing list >>>> PySide at qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >>> _______________________________________________ >>> PySide mailing list >>> PySide at qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >> >> > > -- > ohufxLogo 50x50 *vfx compositing > | *workflow customisation > and consulting * * > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From sean at seanfisk.com Fri Mar 14 05:15:46 2014 From: sean at seanfisk.com (Sean Fisk) Date: Fri, 14 Mar 2014 00:15:46 -0400 Subject: [PySide] using QProcess to run python function In-Reply-To: <53227ED7.7020607@ohufx.com> References: <52E1C66C.3050400@ohufx.com> <52E1CD36.4070302@ohufx.com> <52E1D314.8000800@ohufx.com> <52E1E19E.7090402@ohufx.com> <52E1EEE3.9040801@ohufx.com> <52E3488F.1060501@ohufx.com> <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> Message-ID: Hi Frank, Glad you got that figured out. One more important thing: To achieve a "clean exit", you should wait for the completion of all tasks associated with the QThreadPool before exiting. Use something like: thread_pool = QtCore.QThreadPool.globalInstance() thread_pool.start(hello) thread_pool.waitForDone() It is a common idiom to have the application wait for this before it exits: If you are using a QApplication or QCoreApplication (i.e., a Qt event loop): from PySide import QtCore QtCore.QCoreApplication.instance().aboutToQuit.connect(thread_pool.waitForDone) Or with Python's exit handlers: import atexit atexit.register(thread_pool.waitForDone) In general, I would prefer Qt's method if you are running an event loop. Hope this helps! -- Sean Fisk On Fri, Mar 14, 2014 at 12:00 AM, Frank Rueter | OHUfx wrote: > False alarm: > Looks like the culprit wasn't the code but the debugger I was using spat > it's dummy more or less silently. > When I run the same code in a different interpreter it works as expected. > > > > > On 14/03/14 14:30, Frank Rueter | OHUfx wrote: > > after a much longer absence from this than anticipated, I'm finally trying > to get back into this. > I had a look at your example Sean and it makes sense so far. > Now I'm trying to follow your advise and use QThreadPool, but am not > finding any good examples on it's usage. > Unfortunately, the first example mentioned in the docsalready throws an error for me: > > from PySide import QtCore > class HelloWorldTask(QtCore.QRunnable): > def run(self): > print "Hello world from thread", QtCore.QThread.currentThread() > > hello = HelloWorldTask() > # QThreadPool takes ownership and deletes 'hello' automatically > QtCore.QThreadPool.globalInstance().start(hello) > > result: > Hello world from thread > Traceback (most recent call last): > File "/ohufx/pipeline/tools/python/sandbox/QThreadPoolTest.py", line 6, > in run > print "Hello world from thread", QtCore.QThread.currentThread() > AttributeError: 'NoneType' object has no attribute 'QThread' > > > > What am I missing here? > > Cheers, > frank > > > > > > On 28/01/14 08:00, Sean Fisk wrote: > > On Sat, Jan 25, 2014 at 2:38 AM, Frank Rueter | OHUfx wrote: > >> fantastic, thanks Sean!! >> I will examine this to make sure I understand everything, then give >> QThreadPool a whirl. Am more than happy to learn from more experienced >> people and adjust my approaches accordingly, so thanks a lot for your time >> with this! >> > > No problem! Let me know if you have any questions about the code. > >> >> Cheers, >> frank >> >> >> >> On 25/01/14 20:03, Sean Fisk wrote: >> >> Hi Frank, >> >> I updated your example to hopefully work as you would like. I added a >> progress bar update as well. I'm going to make a last-ditch effort to >> convince you to stop doing things manually with QThread, and move to >> using QThreadPool. >> Everything about the QThreadPool API is much nicer, and it's worked much >> better for me in real projects. Also, the Python 's multiprocessingand >> concurrent.futures modules can work >> well if you're careful about your callbacks. >> >> Also, there is a large discussion about not overriding the run() method >> of QThread. I don't think overriding it is so bad if you don't need the >> thread to be running an event loop of its own. I still prefer the >> QThreadPool API, though. Someone please correct me if this is totally >> wrong and there is never a reason to override it. >> >> Here is the code: >> >> #!/usr/bin/env python >> import sysimport time >> from PySide import QtGuifrom PySide import QtCore >> >> TOTAL_WIDGETS = 10 >> class Worker(QtCore.QObject): >> processed = QtCore.Signal(int) >> finished = QtCore.Signal() >> >> # Overriding this is not necessary if you're not doing anything in it. >> >> # def __init__(self): >> # super(Worker, self).__init__() >> >> def helloWorld(self): >> for i in xrange(TOTAL_WIDGETS): >> # We sleep first to simulate an operation taking place. >> time.sleep(0.5) >> print 'hello %s' % i >> self.processed.emit(i + 1) >> # Must manually emit the finished signal. >> self.finished.emit() >> class MainUI(QtGui.QWidget): >> def __init__(self, parent=None): >> super(MainUI, self).__init__(parent) >> self.extraThread = QtCore.QThread() >> >> # IMPORTANT: Don't quit the app until the thread has completed. Prevents errors like: >> # >> # QThread: Destroyed while thread is still running >> # >> QtGui.QApplication.instance().aboutToQuit.connect(self.quit) >> >> self.worker = Worker() >> self.worker.moveToThread(self.extraThread) >> self.setupUI() >> self.connectSignalsAndSlots() >> >> def setupUI(self): >> # CREAT MAIN LAYOUT AND WIDGETS >> mainLayout = QtGui.QVBoxLayout() >> btnLayout = QtGui.QHBoxLayout() >> mainLayout.addLayout(btnLayout) >> self.setLayout(mainLayout) >> >> self.progressBar = QtGui.QProgressBar(self) >> self.progressBar.setRange(0, TOTAL_WIDGETS) >> self.progressBar.setVisible(False) >> self.btnWork = QtGui.QPushButton('Do Work') >> self.btnCancel = QtGui.QPushButton('Cancel') >> self.btnCancel.setDisabled(True) >> >> self.guiResponseProgressbar = QtGui.QProgressBar(self) >> self.guiResponseProgressbar.setRange(0, 0) >> >> self.outputWindow = QtGui.QTextEdit() >> >> mainLayout.addWidget(self.progressBar) >> mainLayout.addWidget(self.outputWindow) >> mainLayout.addWidget(self.guiResponseProgressbar) >> >> btnLayout.addWidget(self.btnWork) >> btnLayout.addWidget(self.btnCancel) >> >> def connectSignalsAndSlots(self): >> print 'connecting signals' >> self.btnWork.clicked.connect(self.startWorker) >> >> # Pleas see . Bad bad bad bad bad. >> # self.btnCancel.clicked.connect(self.extraThread.terminate) >> >> # THREAD STARTED >> # Not necessary; just do this in startWorker. >> # self.extraThread.started.connect(lambda: self.btnWork.setDisabled(True)) >> # self.extraThread.started.connect(lambda: self.btnCancel.setEnabled(True)) >> # self.extraThread.started.connect(self.progressBar.show) >> self.extraThread.started.connect(self.worker.helloWorld) >> >> # THREAD FINISHED >> # self.extraThread.finished.connect(lambda: self.btnCancel.setDisabled(True)) >> # self.extraThread.finished.connect(self.extraThread.deleteLater) >> # self.extraThread.finished.connect(self.worker.deleteLater) >> self.extraThread.finished.connect(self.finished) >> >> # Connect worker signals. >> self.worker.processed.connect(self.progressBar.setValue) >> self.worker.finished.connect(self.finished) >> >> # SHOW PROGRESS BAR WHEN PUBLISHING STARTS >> # self.extraThread.started.connect(self.progressBar.show) >> # CONNECT PROCESS TO PROGRESS BAR AND OUTPUT WINDOW >> # NOT DONE YET >> >> def startWorker(self): >> # GO >> self.btnWork.setDisabled(True) >> self.btnCancel.setEnabled(True) >> self.progressBar.show() >> print 'starting worker thread' >> self.extraThread.start() >> >> # THIS IS BLOCKING THE GUI THREAD! Try putting this back in and seeing >> # what happens to the gui_response_progressbar. >> >> # for i in xrange(10): >> # print 'from main thread:', i >> # time.sleep(.3) >> >> def finished(self): >> print 'finished' >> self.btnCancel.setDisabled(True) >> # self.extraThread.deleteLater() >> # self.worker.deleteLater() >> >> def quit(self): >> # Quit the thread's event loop. Note that this *doesn't* stop tasks >> # running in the thread, it just stops the thread from dispatching >> # events. >> self.extraThread.quit() >> # Wait for the thread to complete. If the thread's task is not done, >> # this will block. >> self.extraThread.wait() >> if __name__ == '__main__': >> args = sys.argv >> app = QtGui.QApplication(args) >> p = MainUI() >> p.show() >> # Annoyance on Mac OS X. >> p.raise_() >> sys.exit(app.exec_()) >> >> Cheers, >> >> >> -- >> Sean Fisk >> >> >> On Sat, Jan 25, 2014 at 12:30 AM, Frank Rueter | OHUfx wrote: >> >>> quick update: >>> I just learnt about connection types but those didn't help either in >>> this case: >>> >>> http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads >>> >>> >>> >>> On 25/01/14 18:15, Frank Rueter | OHUfx wrote: >>> >>> And of course I ran into trouble :-D >>> Here is my test code trying to ustilise QThread: >>> http://pastebin.com/Q26Q9M1M >>> >>> The basic structure seems to work (the extra thread and the main thread >>> are running at the same time), but my UI does not update according to the >>> signal connections, e.g.: >>> When the thread starts the progress bar is supposed to be shown, the "Do >>> Work" button should be disabled, the "Cancel" button disabled. >>> etc. >>> >>> I tried calling self.update() in the MainUI when the thread starts but >>> to no avail. >>> I'm sure I'm missing something obvious as usual. >>> >>> I tried to adhere to what I learnt on this list about threading and >>> avoid sub-classing QThread. >>> >>> Cheers, >>> frank >>> >>> On 24/01/14 17:41, Frank Rueter | OHUfx wrote: >>> >>> Great, thanks. I shall adjust my code. >>> I am interested in seeing how you would go about it, but let me have a >>> go from scratch, I will be able to understand things much better afterwards >>> :) >>> >>> Cheers, >>> frank >>> >>> >>> On 24/01/14 17:38, Sean Fisk wrote: >>> >>> On Thu, Jan 23, 2014 at 10:44 PM, Frank Rueter | OHUfx >> > wrote: >>> >>>> Much appreciated but as I mentioned, I think I jumped the gun with my >>>> post and should be using QThread to hook the python code to my QProgressBar >>>> and debug output window (QTextEdit). >>>> >>> That would be a correct way to use QProgressBar. Also, for subprocess >>> output, I would consider using QPlainTextEdit instead of QTextEdit as >>> is is more performant with high amounts of text. >>> >>> If you are interested, I just wrote an asynchronous module for PySide >>> for the project on which I am currently working. It is based on Python's >>> futures module and works great with >>> Qt's signals/slots. Although the project is primarily closed-source, I >>> would be happy to share the async implementation with you. I don't know if >>> would fit your needs, but for us it's much easier than manually spawning >>> QThreads and even easier than QThreadPool. >>> >>> Good luck! >>> >>>> I will investigate that now >>>> >>>> >>>> >>>> On 24/01/14 16:08, Sean Fisk wrote: >>>> >>>> On Thu, Jan 23, 2014 at 9:42 PM, Frank Rueter | OHUfx >>> > wrote: >>>> >>>>> Thanks Sean and Ryan, >>>>> >>>>> I'm still not quite clear on how this ties into QProcess.start() >>>>> >>>> >>>> It doesn't tie in with QProcess at all. We're advising to avoid using >>>> that :) >>>> >>>>> I do have a if __name__ ... block in the script in question. >>>>> An example would certainly be awesome, but if it's less hassle, >>>>> explaining how your and Ryan's advise helps use QProcess on a python module >>>>> might already suffice. Maybe a simlpe example says it all though?! >>>>> >>>> >>>> I will whip up a simple example for you, but it might take a few >>>> hours (lots of stuff to do right now). >>>> >>>>> I'm not using python 3 btw >>>>> >>>>> Thanks guys for your help!! >>>>> >>>>> frank >>>>> >>>>> >>>>> On 24/01/14 15:33, Sean Fisk wrote: >>>>> >>>>> Hi Frank, >>>>> >>>>> You should definitely avoid calling Python as a subprocess if you can. >>>>> As far as Ryan's example, I agree with the if __name__... but I think >>>>> that using the imp module is a bit overkill. I would recommend using >>>>> Setuptool's entry_points keyword. >>>>> Or distutils' scripts keyword, >>>>> if you must. >>>>> >>>>> An example of a well-known Python package which does this is Pygments, >>>>> which has a large "library" component but also comes with the >>>>> pygmentize command-line script. The Pygments codebase is pretty >>>>> large, so if you would like me to whip up a simpler example I'd be glad to >>>>> do so. >>>>> >>>>> Cheers, >>>>> -- >>>>> Sean Fisk >>>>> >>>>> >>>>> On Thu, Jan 23, 2014 at 9:17 PM, Frank Rueter | OHUfx >>>> > wrote: >>>>> >>>>>> Sorry if I'm being thick, but I'm not quite understanding how this >>>>>> helps to connect a python function to qprocess?! All your code does is >>>>>> execute the script, right?! >>>>>> I can already call myscript.main() straight up, but maybe I'm missing >>>>>> the point as I'm unfamiliar with the imp module. >>>>>> >>>>>> Let me elaborate a little bit more: >>>>>> myscript.main() calls a bunch of other python scripts that (directly >>>>>> or through other scripts again) execute external programs to do some >>>>>> conversion work. Those external programs spit out their progress to stdout >>>>>> which I can see fine when I run myscript.main() manually in a python >>>>>> terminal. >>>>>> >>>>>> Now I need run myscript.main() via QProcess and grab stdout to do be >>>>>> able to show a progress bar as well as show stdout and stderr in a debug >>>>>> window inside my QT code. >>>>>> >>>>>> >>>>>> Cheers, >>>>>> frank >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On 24/01/14 14:58, Ryan Gonzalez wrote: >>>>>> >>>>>> If you put an "if __name__ == '__main__'" and a main functions, you >>>>>> could always import the script from the GUI frontend. Example: >>>>>> >>>>>> myscript.py >>>>>> >>>>>> def main(argv): >>>>>> do_cool_stuff() >>>>>> return 0 >>>>>> >>>>>> if __name__ == '__main__': >>>>>> sys.exit(main(sys.argv)) >>>>>> >>>>>> mygui.py(Python 2): >>>>>> >>>>>> import imp >>>>>> >>>>>> ... >>>>>> >>>>>> main = imp.load_module('myscript', *imp.find_module('myscript')) >>>>>> >>>>>> main.main(my_argv) >>>>>> >>>>>> mygui.py(Python 3): >>>>>> >>>>>> import importlib.machinery >>>>>> >>>>>> main = importlib.machinery.SourceFileLoader('myscript', >>>>>> 'myscript.py').load_module('myscript') >>>>>> >>>>>> main.main(my_argv) >>>>>> >>>>>> >>>>>> On Thu, Jan 23, 2014 at 7:48 PM, Frank Rueter | OHUfx < >>>>>> frank at ohufx.com> wrote: >>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> I got a little code design question: >>>>>>> >>>>>>> I have a python script that does a lot of file >>>>>>> processing/converting/uploading etc and I'd like to write a decent >>>>>>> interface for it now. >>>>>>> The main goal is to be able to show the user detailed info about the >>>>>>> current step and progress as well as clean up properly in case the >>>>>>> whole >>>>>>> thing is cancelled. >>>>>>> >>>>>>> My existing python code needs to stay independent of QT so any >>>>>>> application that supports python can use it. >>>>>>> I am wondering now how to best connect the python script and the >>>>>>> PySide >>>>>>> code. Should I just run the script as an argument to the python >>>>>>> interpreter like I would with any other program? E.g.: >>>>>>> >>>>>>> process = QtCore.QProcess(self) >>>>>>> process.start(, ) >>>>>>> >>>>>>> As simple as this seems, it feels odd to use python to call itself >>>>>>> as an >>>>>>> external program. >>>>>>> >>>>>>> >>>>>>> I'm happy to go that way but am curious how others are doing this?! >>>>>>> >>>>>>> Cheers, >>>>>>> frank >>>>>>> >>>>>>> _______________________________________________ >>>>>>> PySide mailing list >>>>>>> PySide at qt-project.org >>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Ryan >>>>>> If anybody ever asks me why I prefer C++ to C, my answer will be >>>>>> simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think >>>>>> that was nul-terminated." >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> PySide mailing list >>>>>> PySide at qt-project.org >>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >>> >>> _______________________________________________ >>> PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >>> >>> >>> _______________________________________________ >>> PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >>> >>> _______________________________________________ >>> PySide mailing list >>> PySide at qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/pyside >>> >>> >> >> > > -- > [image: ohufxLogo 50x50] *vfx compositing > | workflow customisation and > consulting * > > > _______________________________________________ > PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside > > > -- > [image: ohufxLogo 50x50] *vfx compositing > | workflow customisation and > consulting * > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Fri Mar 14 05:27:16 2014 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Fri, 14 Mar 2014 17:27:16 +1300 Subject: [PySide] using QProcess to run python function In-Reply-To: References: <52E1C66C.3050400@ohufx.com> <52E1CD36.4070302@ohufx.com> <52E1D314.8000800@ohufx.com> <52E1E19E.7090402@ohufx.com> <52E1EEE3.9040801@ohufx.com> <52E3488F.1060501@ohufx.com> <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> Message-ID: <53228524.20102@ohufx.com> great, thanks Sean. In order to communicate with the progress in each thread (to drive progress and catch finished and error events), should I use QtCore.QThread.currentThread() and hook up my slots to it's events? Cheers and thanks a lot for bearing with me here. frank On 14/03/14 17:15, Sean Fisk wrote: > > Hi Frank, > > Glad you got that figured out. One more important thing: > > To achieve a "clean exit", you should wait for the completion of all > tasks associated with the |QThreadPool| before exiting. Use something > like: > > |thread_pool = QtCore.QThreadPool.globalInstance() > thread_pool.start(hello) > thread_pool.waitForDone() > | > > It is a common idiom to have the application wait for this before it > exits: > > If you are using a |QApplication| or |QCoreApplication| (i.e., a Qt > event loop): > > |from PySideimport QtCore > QtCore.QCoreApplication.instance().aboutToQuit.connect(thread_pool.waitForDone) > | > > Or with Python's exit handlers: > > |import atexit > atexit.register(thread_pool.waitForDone) > | > > In general, I would prefer Qt's method if you are running an event loop. > > Hope this helps! > > > > -- > Sean Fisk > > > On Fri, Mar 14, 2014 at 12:00 AM, Frank Rueter | OHUfx > > wrote: > > False alarm: > Looks like the culprit wasn't the code but the debugger I was > using spat it's dummy more or less silently. > When I run the same code in a different interpreter it works as > expected. > > > > > On 14/03/14 14:30, Frank Rueter | OHUfx wrote: >> after a much longer absence from this than anticipated, I'm >> finally trying to get back into this. >> I had a look at your example Sean and it makes sense so far. >> Now I'm trying to follow your advise and use QThreadPool, but am >> not finding any good examples on it's usage. >> Unfortunately, the first example mentioned in the docs >> >> already throws an error for me: >> >> from PySide import QtCore >> class HelloWorldTask(QtCore.QRunnable): >> def run(self): >> print "Hello world from thread", >> QtCore.QThread.currentThread() >> >> hello = HelloWorldTask() >> # QThreadPool takes ownership and deletes 'hello' automatically >> QtCore.QThreadPool.globalInstance().start(hello) >> >> result: >> Hello world from thread >> Traceback (most recent call last): >> File "/ohufx/pipeline/tools/python/sandbox/QThreadPoolTest.py", >> line 6, in run >> print "Hello world from thread", QtCore.QThread.currentThread() >> AttributeError: 'NoneType' object has no attribute 'QThread' >> >> >> >> What am I missing here? >> >> Cheers, >> frank >> >> >> >> >> >> On 28/01/14 08:00, Sean Fisk wrote: >>> On Sat, Jan 25, 2014 at 2:38 AM, Frank Rueter | OHUfx >>> > wrote: >>> >>> fantastic, thanks Sean!! >>> I will examine this to make sure I understand everything, >>> then give QThreadPool a whirl. Am more than happy to learn >>> from more experienced people and adjust my approaches >>> accordingly, so thanks a lot for your time with this! >>> >>> >>> No problem! Let me know if you have any questions about the code. >>> >>> >>> Cheers, >>> frank >>> >>> >>> >>> On 25/01/14 20:03, Sean Fisk wrote: >>>> >>>> Hi Frank, >>>> >>>> I updated your example to hopefully work as you would like. >>>> I added a progress bar update as well. I'm going to make a >>>> last-ditch effort to convince you to stop doing things >>>> manually with |QThread|, and move to using |QThreadPool| >>>> . >>>> Everything about the |QThreadPool| API is much nicer, and >>>> it's worked much better for me in real projects. Also, the >>>> Python 's |multiprocessing| >>>> and >>>> |concurrent.futures| >>>> modules can work well if you're careful about your callbacks. >>>> >>>> Also, there is a large discussion about not overriding the >>>> |run()| method of |QThread|. I don't think overriding it is >>>> so bad if you don't need the thread to be running an event >>>> loop of its own. I still prefer the |QThreadPool| API, >>>> though. Someone please correct me if this is totally wrong >>>> and there is never a reason to override it. >>>> >>>> Here is the code: >>>> >>>> |#!/usr/bin/env python >>>> >>>> import sys >>>> import time >>>> >>>> from PySideimport QtGui >>>> from PySideimport QtCore >>>> >>>> TOTAL_WIDGETS =10 >>>> >>>> class Worker(QtCore.QObject): >>>> processed = QtCore.Signal(int) >>>> finished = QtCore.Signal() >>>> >>>> # Overriding this is not necessary if you're not doing anything in it. >>>> >>>> # def __init__(self): >>>> # super(Worker, self).__init__() >>>> >>>> def helloWorld(self): >>>> for iin xrange(TOTAL_WIDGETS): >>>> # We sleep first to simulate an operation taking place. >>>> time.sleep(0.5) >>>> print 'hello %s' % i >>>> self.processed.emit(i +1) >>>> # Must manually emit the finished signal. >>>> self.finished.emit() >>>> >>>> class MainUI(QtGui.QWidget): >>>> def __init__(self, parent=None): >>>> super(MainUI, self).__init__(parent) >>>> self.extraThread = QtCore.QThread() >>>> >>>> # IMPORTANT: Don't quit the app until the thread has completed. Prevents errors like: >>>> # >>>> # QThread: Destroyed while thread is still running >>>> # >>>> QtGui.QApplication.instance().aboutToQuit.connect(self.quit) >>>> >>>> self.worker = Worker() >>>> self.worker.moveToThread(self.extraThread) >>>> self.setupUI() >>>> self.connectSignalsAndSlots() >>>> >>>> def setupUI(self): >>>> # CREAT MAIN LAYOUT AND WIDGETS >>>> mainLayout = QtGui.QVBoxLayout() >>>> btnLayout = QtGui.QHBoxLayout() >>>> mainLayout.addLayout(btnLayout) >>>> self.setLayout(mainLayout) >>>> >>>> self.progressBar = QtGui.QProgressBar(self) >>>> self.progressBar.setRange(0, TOTAL_WIDGETS) >>>> self.progressBar.setVisible(False) >>>> self.btnWork = QtGui.QPushButton('Do Work') >>>> self.btnCancel = QtGui.QPushButton('Cancel') >>>> self.btnCancel.setDisabled(True) >>>> >>>> self.guiResponseProgressbar = QtGui.QProgressBar(self) >>>> self.guiResponseProgressbar.setRange(0,0) >>>> >>>> self.outputWindow = QtGui.QTextEdit() >>>> >>>> mainLayout.addWidget(self.progressBar) >>>> mainLayout.addWidget(self.outputWindow) >>>> mainLayout.addWidget(self.guiResponseProgressbar) >>>> >>>> btnLayout.addWidget(self.btnWork) >>>> btnLayout.addWidget(self.btnCancel) >>>> >>>> def connectSignalsAndSlots(self): >>>> print 'connecting signals' >>>> self.btnWork.clicked.connect(self.startWorker) >>>> >>>> # Pleas see . Bad bad bad bad bad. >>>> # self.btnCancel.clicked.connect(self.extraThread.terminate) >>>> >>>> # THREAD STARTED >>>> # Not necessary; just do this in startWorker. >>>> # self.extraThread.started.connect(lambda: self.btnWork.setDisabled(True)) >>>> # self.extraThread.started.connect(lambda: self.btnCancel.setEnabled(True)) >>>> # self.extraThread.started.connect(self.progressBar.show) >>>> self.extraThread.started.connect(self.worker.helloWorld) >>>> >>>> # THREAD FINISHED >>>> # self.extraThread.finished.connect(lambda: self.btnCancel.setDisabled(True)) >>>> # self.extraThread.finished.connect(self.extraThread.deleteLater) >>>> # self.extraThread.finished.connect(self.worker.deleteLater) >>>> self.extraThread.finished.connect(self.finished) >>>> >>>> # Connect worker signals. >>>> self.worker.processed.connect(self.progressBar.setValue) >>>> self.worker.finished.connect(self.finished) >>>> >>>> # SHOW PROGRESS BAR WHEN PUBLISHING STARTS >>>> # self.extraThread.started.connect(self.progressBar.show) >>>> # CONNECT PROCESS TO PROGRESS BAR AND OUTPUT WINDOW >>>> # NOT DONE YET >>>> >>>> def startWorker(self): >>>> # GO >>>> self.btnWork.setDisabled(True) >>>> self.btnCancel.setEnabled(True) >>>> self.progressBar.show() >>>> print 'starting worker thread' >>>> self.extraThread.start() >>>> >>>> # THIS IS BLOCKING THE GUI THREAD! Try putting this back in and seeing >>>> # what happens to the gui_response_progressbar. >>>> >>>> # for i in xrange(10): >>>> # print 'from main thread:', i >>>> # time.sleep(.3) >>>> >>>> def finished(self): >>>> print 'finished' >>>> self.btnCancel.setDisabled(True) >>>> # self.extraThread.deleteLater() >>>> # self.worker.deleteLater() >>>> >>>> def quit(self): >>>> # Quit the thread's event loop. Note that this *doesn't* stop tasks >>>> # running in the thread, it just stops the thread from dispatching >>>> # events. >>>> self.extraThread.quit() >>>> # Wait for the thread to complete. If the thread's task is not done, >>>> # this will block. >>>> self.extraThread.wait() >>>> >>>> if __name__ =='__main__': >>>> args = sys.argv >>>> app = QtGui.QApplication(args) >>>> p = MainUI() >>>> p.show() >>>> # Annoyance on Mac OS X. >>>> p.raise_() >>>> sys.exit(app.exec_())| >>>> >>>> Cheers, >>>> >>>> >>>> >>>> -- >>>> Sean Fisk >>>> >>>> >>>> On Sat, Jan 25, 2014 at 12:30 AM, Frank Rueter | OHUfx >>>> > wrote: >>>> >>>> quick update: >>>> I just learnt about connection types but those didn't >>>> help either in this case: >>>> http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads >>>> >>>> >>>> >>>> >>>> On 25/01/14 18:15, Frank Rueter | OHUfx wrote: >>>>> And of course I ran into trouble :-D >>>>> Here is my test code trying to ustilise QThread: >>>>> http://pastebin.com/Q26Q9M1M >>>>> >>>>> The basic structure seems to work (the extra thread >>>>> and the main thread are running at the same time), but >>>>> my UI does not update according to the signal >>>>> connections, e.g.: >>>>> When the thread starts the progress bar is supposed to >>>>> be shown, the "Do Work" button should be disabled, the >>>>> "Cancel" button disabled. >>>>> etc. >>>>> >>>>> I tried calling self.update() in the MainUI when the >>>>> thread starts but to no avail. >>>>> I'm sure I'm missing something obvious as usual. >>>>> >>>>> I tried to adhere to what I learnt on this list about >>>>> threading and avoid sub-classing QThread. >>>>> >>>>> Cheers, >>>>> frank >>>>> >>>>> On 24/01/14 17:41, Frank Rueter | OHUfx wrote: >>>>>> Great, thanks. I shall adjust my code. >>>>>> I am interested in seeing how you would go about it, >>>>>> but let me have a go from scratch, I will be able to >>>>>> understand things much better afterwards :) >>>>>> >>>>>> Cheers, >>>>>> frank >>>>>> >>>>>> >>>>>> On 24/01/14 17:38, Sean Fisk wrote: >>>>>>> On Thu, Jan 23, 2014 at 10:44 PM, Frank Rueter | >>>>>>> OHUfx > wrote: >>>>>>> >>>>>>> Much appreciated but as I mentioned, I think I >>>>>>> jumped the gun with my post and should be using >>>>>>> QThread to hook the python code to my >>>>>>> QProgressBar and debug output window (QTextEdit). >>>>>>> >>>>>>> That would be a correct way to use |QProgressBar|. >>>>>>> Also, for subprocess output, I would consider using >>>>>>> |QPlainTextEdit| instead of |QTextEdit| as is is >>>>>>> more performant with high amounts of text. >>>>>>> >>>>>>> If you are interested, I just wrote an asynchronous >>>>>>> module for PySide for the project on which I am >>>>>>> currently working. It is based on Python's futures >>>>>>> module and works >>>>>>> great with Qt's signals/slots. Although the project >>>>>>> is primarily closed-source, I would be happy to >>>>>>> share the async implementation with you. I don't >>>>>>> know if would fit your needs, but for us it's much >>>>>>> easier than manually spawning |QThread|s and even >>>>>>> easier than |QThreadPool|. >>>>>>> >>>>>>> Good luck! >>>>>>> >>>>>>> I will investigate that now >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 24/01/14 16:08, Sean Fisk wrote: >>>>>>>> On Thu, Jan 23, 2014 at 9:42 PM, Frank Rueter | >>>>>>>> OHUfx >>>>>>> > wrote: >>>>>>>> >>>>>>>> Thanks Sean and Ryan, >>>>>>>> >>>>>>>> I'm still not quite clear on how this ties >>>>>>>> into QProcess.start() >>>>>>>> >>>>>>>> >>>>>>>> It doesn't tie in with |QProcess| at all. We're >>>>>>>> advising to avoid using that :) >>>>>>>> >>>>>>>> I do have a if __name__ ... block in the >>>>>>>> script in question. >>>>>>>> An example would certainly be awesome, but >>>>>>>> if it's less hassle, explaining how your >>>>>>>> and Ryan's advise helps use QProcess on a >>>>>>>> python module might already suffice. Maybe >>>>>>>> a simlpe example says it all though?! >>>>>>>> >>>>>>>> >>>>>>>> I will whip up a simple example for you, but it >>>>>>>> might take a few hours (lots of stuff to do >>>>>>>> right now). >>>>>>>> >>>>>>>> I'm not using python 3 btw >>>>>>>> >>>>>>>> Thanks guys for your help!! >>>>>>>> >>>>>>>> frank >>>>>>>> >>>>>>>> >>>>>>>> On 24/01/14 15:33, Sean Fisk wrote: >>>>>>>>> >>>>>>>>> Hi Frank, >>>>>>>>> >>>>>>>>> You should definitely avoid calling Python >>>>>>>>> as a subprocess if you can. As far as >>>>>>>>> Ryan's example, I agree with the |if >>>>>>>>> __name__...| but I think that using the >>>>>>>>> |imp| module is a bit overkill. I would >>>>>>>>> recommend using Setuptool's |entry_points| >>>>>>>>> keyword >>>>>>>>> . >>>>>>>>> Or distutils' |scripts| keyword >>>>>>>>> , >>>>>>>>> if you must. >>>>>>>>> >>>>>>>>> An example of a well-known Python package >>>>>>>>> which does this is Pygments >>>>>>>>> , >>>>>>>>> which has a large "library" component but >>>>>>>>> also comes with the |pygmentize| >>>>>>>>> command-line script. The Pygments codebase >>>>>>>>> is pretty large, so if you would like me >>>>>>>>> to whip up a simpler example I'd be glad >>>>>>>>> to do so. >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Sean Fisk >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Jan 23, 2014 at 9:17 PM, Frank >>>>>>>>> Rueter | OHUfx >>>>>>>> > wrote: >>>>>>>>> >>>>>>>>> Sorry if I'm being thick, but I'm not >>>>>>>>> quite understanding how this helps to >>>>>>>>> connect a python function to >>>>>>>>> qprocess?! All your code does is >>>>>>>>> execute the script, right?! >>>>>>>>> I can already call myscript.main() >>>>>>>>> straight up, but maybe I'm missing the >>>>>>>>> point as I'm unfamiliar with the imp >>>>>>>>> module. >>>>>>>>> >>>>>>>>> Let me elaborate a little bit more: >>>>>>>>> myscript.main() calls a bunch of other >>>>>>>>> python scripts that (directly or >>>>>>>>> through other scripts again) execute >>>>>>>>> external programs to do some >>>>>>>>> conversion work. Those external >>>>>>>>> programs spit out their progress to >>>>>>>>> stdout which I can see fine when I run >>>>>>>>> myscript.main() manually in a python >>>>>>>>> terminal. >>>>>>>>> >>>>>>>>> Now I need run myscript.main() via >>>>>>>>> QProcess and grab stdout to do be able >>>>>>>>> to show a progress bar as well as show >>>>>>>>> stdout and stderr in a debug window >>>>>>>>> inside my QT code. >>>>>>>>> >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> frank >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On 24/01/14 14:58, Ryan Gonzalez wrote: >>>>>>>>>> If you put an "if __name__ == >>>>>>>>>> '__main__'" and a main functions, you >>>>>>>>>> could always import the script from >>>>>>>>>> the GUI frontend. Example: >>>>>>>>>> >>>>>>>>>> myscript.py >>>>>>>>>> >>>>>>>>>> def main(argv): >>>>>>>>>> do_cool_stuff() >>>>>>>>>> return 0 >>>>>>>>>> >>>>>>>>>> if __name__ == '__main__': >>>>>>>>>> sys.exit(main(sys.argv)) >>>>>>>>>> >>>>>>>>>> mygui.py(Python 2): >>>>>>>>>> >>>>>>>>>> import imp >>>>>>>>>> >>>>>>>>>> ... >>>>>>>>>> >>>>>>>>>> main = imp.load_module('myscript', >>>>>>>>>> *imp.find_module('myscript')) >>>>>>>>>> >>>>>>>>>> main.main(my_argv) >>>>>>>>>> >>>>>>>>>> mygui.py(Python 3): >>>>>>>>>> >>>>>>>>>> import importlib.machinery >>>>>>>>>> >>>>>>>>>> main = >>>>>>>>>> importlib.machinery.SourceFileLoader('myscript', >>>>>>>>>> 'myscript.py').load_module('myscript') >>>>>>>>>> >>>>>>>>>> main.main(my_argv) >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Thu, Jan 23, 2014 at 7:48 PM, >>>>>>>>>> Frank Rueter | OHUfx >>>>>>>>> > wrote: >>>>>>>>>> >>>>>>>>>> Hi all, >>>>>>>>>> >>>>>>>>>> I got a little code design question: >>>>>>>>>> >>>>>>>>>> I have a python script that does >>>>>>>>>> a lot of file >>>>>>>>>> processing/converting/uploading >>>>>>>>>> etc and I'd like to write a decent >>>>>>>>>> interface for it now. >>>>>>>>>> The main goal is to be able to >>>>>>>>>> show the user detailed info about the >>>>>>>>>> current step and progress as well >>>>>>>>>> as clean up properly in case the >>>>>>>>>> whole >>>>>>>>>> thing is cancelled. >>>>>>>>>> >>>>>>>>>> My existing python code needs to >>>>>>>>>> stay independent of QT so any >>>>>>>>>> application that supports python >>>>>>>>>> can use it. >>>>>>>>>> I am wondering now how to best >>>>>>>>>> connect the python script and the >>>>>>>>>> PySide >>>>>>>>>> code. Should I just run the >>>>>>>>>> script as an argument to the python >>>>>>>>>> interpreter like I would with any >>>>>>>>>> other program? E.g.: >>>>>>>>>> >>>>>>>>>> process = QtCore.QProcess(self) >>>>>>>>>> process.start(, >>>>>>>>>> ) >>>>>>>>>> >>>>>>>>>> As simple as this seems, it feels >>>>>>>>>> odd to use python to call itself >>>>>>>>>> as an >>>>>>>>>> external program. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> I'm happy to go that way but am >>>>>>>>>> curious how others are doing this?! >>>>>>>>>> >>>>>>>>>> Cheers, >>>>>>>>>> frank >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> PySide mailing list >>>>>>>>>> PySide at qt-project.org >>>>>>>>>> >>>>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Ryan >>>>>>>>>> If anybody ever asks me why I prefer >>>>>>>>>> C++ to C, my answer will be simple: >>>>>>>>>> "It's >>>>>>>>>> becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. >>>>>>>>>> Wait, I don't think that was >>>>>>>>>> nul-terminated." >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> PySide mailing list >>>>>>>>> PySide at qt-project.org >>>>>>>>> >>>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> PySide mailing list >>>>>> PySide at qt-project.org >>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> PySide mailing list >>>>> PySide at qt-project.org >>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>>> _______________________________________________ >>>> PySide mailing list >>>> PySide at qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>> >>> >> >> -- >> ohufxLogo 50x50 *vfx compositing >> | *workflow >> customisation and consulting >> * * >> >> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside > > -- > ohufxLogo 50x50 *vfx compositing > | *workflow > customisation and consulting > * * > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From sean at seanfisk.com Fri Mar 14 06:39:27 2014 From: sean at seanfisk.com (Sean Fisk) Date: Fri, 14 Mar 2014 01:39:27 -0400 Subject: [PySide] using QProcess to run python function In-Reply-To: <53228524.20102@ohufx.com> References: <52E1C66C.3050400@ohufx.com> <52E1CD36.4070302@ohufx.com> <52E1D314.8000800@ohufx.com> <52E1E19E.7090402@ohufx.com> <52E1EEE3.9040801@ohufx.com> <52E3488F.1060501@ohufx.com> <52E34BF5.7070002@ohufx.com> <52E36A0D.5010003@ohufx.com> <53225BA8.8040506@ohufx.com> <53227ED7.7020607@ohufx.com> <53228524.20102@ohufx.com> Message-ID: Hi Frank, I've modified the earlier example to display the progress in the best way that I know. It doesn't use the finished signal, but it should be pretty easy to adapt it to your needs. Let me know if this is what you want! [Either way, it's fun to click it a bunch of times :) ] Cheers, - Sean #!/usr/bin/env python import sysimport time from PySide import QtGuifrom PySide import QtCore TOTAL_WIDGETS = 10 class Worker(QtCore.QRunnable, QtCore.QObject): processed = QtCore.Signal(int) finished = QtCore.Signal() def __init__(self, parent=None): # IMPORTANT: We must call the constructors of *both* parents. QtCore.QObject.__init__(self, parent) QtCore.QRunnable.__init__(self, parent) def run(self): for i in xrange(TOTAL_WIDGETS): # We sleep first to simulate an operation taking place. time.sleep(0.5) print 'Thread: {0}, Processed: {1}'.format( QtCore.QThread.currentThread(), i) self.processed.emit(i + 1) # Must manually emit the finished signal. self.finished.emit() class MainWindow(QtGui.QWidget): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self._thread_pool = QtCore.QThreadPool.globalInstance() # IMPORTANT: Don't quit the app until the thread has completed. # Prevents errors like: # # QThread: Destroyed while thread is still running # # QThreadPool.waitForDone() is, unfortunately, not a slot. QtGui.QApplication.instance().aboutToQuit.connect( lambda: self._thread_pool.waitForDone()) self._layout = QtGui.QVBoxLayout(self) self._add_button = QtGui.QPushButton('Start New Task') self._layout.addWidget(self._add_button) self._add_button.clicked.connect(self._start_new_task) def _start_new_task(self): task = Worker() progress_bar = QtGui.QProgressBar() progress_bar.setRange(0, TOTAL_WIDGETS) task.processed.connect(progress_bar.setValue) self._layout.addWidget(progress_bar) self._thread_pool.start(task) if __name__ == '__main__': app = QtGui.QApplication(sys.argv) window = MainWindow() window.show() window.raise_() raise SystemExit(app.exec_()) -- Sean Fisk On Fri, Mar 14, 2014 at 12:27 AM, Frank Rueter | OHUfx wrote: > great, thanks Sean. > In order to communicate with the progress in each thread (to drive > progress and catch finished and error events), should I use > QtCore.QThread.currentThread() and hook up my slots to it's events? > > Cheers and thanks a lot for bearing with me here. > > frank > > > > On 14/03/14 17:15, Sean Fisk wrote: > > Hi Frank, > > Glad you got that figured out. One more important thing: > > To achieve a "clean exit", you should wait for the completion of all tasks > associated with the QThreadPool before exiting. Use something like: > > thread_pool = QtCore.QThreadPool.globalInstance() > thread_pool.start(hello) > thread_pool.waitForDone() > > It is a common idiom to have the application wait for this before it exits: > > If you are using a QApplication or QCoreApplication (i.e., a Qt event > loop): > > from PySide import QtCore > QtCore.QCoreApplication.instance().aboutToQuit.connect(thread_pool.waitForDone) > > Or with Python's exit handlers: > > import atexit > atexit.register(thread_pool.waitForDone) > > In general, I would prefer Qt's method if you are running an event loop. > > Hope this helps! > > > -- > Sean Fisk > > > On Fri, Mar 14, 2014 at 12:00 AM, Frank Rueter | OHUfx wrote: > >> False alarm: >> Looks like the culprit wasn't the code but the debugger I was using spat >> it's dummy more or less silently. >> When I run the same code in a different interpreter it works as expected. >> >> >> >> >> On 14/03/14 14:30, Frank Rueter | OHUfx wrote: >> >> after a much longer absence from this than anticipated, I'm finally >> trying to get back into this. >> I had a look at your example Sean and it makes sense so far. >> Now I'm trying to follow your advise and use QThreadPool, but am not >> finding any good examples on it's usage. >> Unfortunately, the first example mentioned in the docsalready throws an error for me: >> >> from PySide import QtCore >> class HelloWorldTask(QtCore.QRunnable): >> def run(self): >> print "Hello world from thread", QtCore.QThread.currentThread() >> >> hello = HelloWorldTask() >> # QThreadPool takes ownership and deletes 'hello' automatically >> QtCore.QThreadPool.globalInstance().start(hello) >> >> result: >> Hello world from thread >> Traceback (most recent call last): >> File "/ohufx/pipeline/tools/python/sandbox/QThreadPoolTest.py", line 6, >> in run >> print "Hello world from thread", QtCore.QThread.currentThread() >> AttributeError: 'NoneType' object has no attribute 'QThread' >> >> >> >> What am I missing here? >> >> Cheers, >> frank >> >> >> >> >> >> On 28/01/14 08:00, Sean Fisk wrote: >> >> On Sat, Jan 25, 2014 at 2:38 AM, Frank Rueter | OHUfx wrote: >> >>> fantastic, thanks Sean!! >>> I will examine this to make sure I understand everything, then give >>> QThreadPool a whirl. Am more than happy to learn from more experienced >>> people and adjust my approaches accordingly, so thanks a lot for your time >>> with this! >>> >> >> No problem! Let me know if you have any questions about the code. >> >>> >>> Cheers, >>> frank >>> >>> >>> >>> On 25/01/14 20:03, Sean Fisk wrote: >>> >>> Hi Frank, >>> >>> I updated your example to hopefully work as you would like. I added a >>> progress bar update as well. I'm going to make a last-ditch effort to >>> convince you to stop doing things manually with QThread, and move to >>> using QThreadPool. >>> Everything about the QThreadPool API is much nicer, and it's worked >>> much better for me in real projects. Also, the Python 's multiprocessingand >>> concurrent.futures modules can work >>> well if you're careful about your callbacks. >>> >>> Also, there is a large discussion about not overriding the run() method >>> of QThread. I don't think overriding it is so bad if you don't need the >>> thread to be running an event loop of its own. I still prefer the >>> QThreadPool API, though. Someone please correct me if this is totally >>> wrong and there is never a reason to override it. >>> >>> Here is the code: >>> >>> #!/usr/bin/env python >>> import sysimport time >>> from PySide import QtGuifrom PySide import QtCore >>> >>> TOTAL_WIDGETS = 10 >>> class Worker(QtCore.QObject): >>> processed = QtCore.Signal(int) >>> finished = QtCore.Signal() >>> >>> # Overriding this is not necessary if you're not doing anything in it. >>> >>> # def __init__(self): >>> # super(Worker, self).__init__() >>> >>> def helloWorld(self): >>> for i in xrange(TOTAL_WIDGETS): >>> # We sleep first to simulate an operation taking place. >>> time.sleep(0.5) >>> print 'hello %s' % i >>> self.processed.emit(i + 1) >>> # Must manually emit the finished signal. >>> self.finished.emit() >>> class MainUI(QtGui.QWidget): >>> def __init__(self, parent=None): >>> super(MainUI, self).__init__(parent) >>> self.extraThread = QtCore.QThread() >>> >>> # IMPORTANT: Don't quit the app until the thread has completed. Prevents errors like: >>> # >>> # QThread: Destroyed while thread is still running >>> # >>> QtGui.QApplication.instance().aboutToQuit.connect(self.quit) >>> >>> self.worker = Worker() >>> self.worker.moveToThread(self.extraThread) >>> self.setupUI() >>> self.connectSignalsAndSlots() >>> >>> def setupUI(self): >>> # CREAT MAIN LAYOUT AND WIDGETS >>> mainLayout = QtGui.QVBoxLayout() >>> btnLayout = QtGui.QHBoxLayout() >>> mainLayout.addLayout(btnLayout) >>> self.setLayout(mainLayout) >>> >>> self.progressBar = QtGui.QProgressBar(self) >>> self.progressBar.setRange(0, TOTAL_WIDGETS) >>> self.progressBar.setVisible(False) >>> self.btnWork = QtGui.QPushButton('Do Work') >>> self.btnCancel = QtGui.QPushButton('Cancel') >>> self.btnCancel.setDisabled(True) >>> >>> self.guiResponseProgressbar = QtGui.QProgressBar(self) >>> self.guiResponseProgressbar.setRange(0, 0) >>> >>> self.outputWindow = QtGui.QTextEdit() >>> >>> mainLayout.addWidget(self.progressBar) >>> mainLayout.addWidget(self.outputWindow) >>> mainLayout.addWidget(self.guiResponseProgressbar) >>> >>> btnLayout.addWidget(self.btnWork) >>> btnLayout.addWidget(self.btnCancel) >>> >>> def connectSignalsAndSlots(self): >>> print 'connecting signals' >>> self.btnWork.clicked.connect(self.startWorker) >>> >>> # Pleas see . Bad bad bad bad bad. >>> # self.btnCancel.clicked.connect(self.extraThread.terminate) >>> >>> # THREAD STARTED >>> # Not necessary; just do this in startWorker. >>> # self.extraThread.started.connect(lambda: self.btnWork.setDisabled(True)) >>> # self.extraThread.started.connect(lambda: self.btnCancel.setEnabled(True)) >>> # self.extraThread.started.connect(self.progressBar.show) >>> self.extraThread.started.connect(self.worker.helloWorld) >>> >>> # THREAD FINISHED >>> # self.extraThread.finished.connect(lambda: self.btnCancel.setDisabled(True)) >>> # self.extraThread.finished.connect(self.extraThread.deleteLater) >>> # self.extraThread.finished.connect(self.worker.deleteLater) >>> self.extraThread.finished.connect(self.finished) >>> >>> # Connect worker signals. >>> self.worker.processed.connect(self.progressBar.setValue) >>> self.worker.finished.connect(self.finished) >>> >>> # SHOW PROGRESS BAR WHEN PUBLISHING STARTS >>> # self.extraThread.started.connect(self.progressBar.show) >>> # CONNECT PROCESS TO PROGRESS BAR AND OUTPUT WINDOW >>> # NOT DONE YET >>> >>> def startWorker(self): >>> # GO >>> self.btnWork.setDisabled(True) >>> self.btnCancel.setEnabled(True) >>> self.progressBar.show() >>> print 'starting worker thread' >>> self.extraThread.start() >>> >>> # THIS IS BLOCKING THE GUI THREAD! Try putting this back in and seeing >>> # what happens to the gui_response_progressbar. >>> >>> # for i in xrange(10): >>> # print 'from main thread:', i >>> # time.sleep(.3) >>> >>> def finished(self): >>> print 'finished' >>> self.btnCancel.setDisabled(True) >>> # self.extraThread.deleteLater() >>> # self.worker.deleteLater() >>> >>> def quit(self): >>> # Quit the thread's event loop. Note that this *doesn't* stop tasks >>> # running in the thread, it just stops the thread from dispatching >>> # events. >>> self.extraThread.quit() >>> # Wait for the thread to complete. If the thread's task is not done, >>> # this will block. >>> self.extraThread.wait() >>> if __name__ == '__main__': >>> args = sys.argv >>> app = QtGui.QApplication(args) >>> p = MainUI() >>> p.show() >>> # Annoyance on Mac OS X. >>> p.raise_() >>> sys.exit(app.exec_()) >>> >>> Cheers, >>> >>> >>> -- >>> Sean Fisk >>> >>> >>> On Sat, Jan 25, 2014 at 12:30 AM, Frank Rueter | OHUfx wrote: >>> >>>> quick update: >>>> I just learnt about connection types but those didn't help either in >>>> this case: >>>> >>>> http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads >>>> >>>> >>>> >>>> On 25/01/14 18:15, Frank Rueter | OHUfx wrote: >>>> >>>> And of course I ran into trouble :-D >>>> Here is my test code trying to ustilise QThread: >>>> http://pastebin.com/Q26Q9M1M >>>> >>>> The basic structure seems to work (the extra thread and the main thread >>>> are running at the same time), but my UI does not update according to the >>>> signal connections, e.g.: >>>> When the thread starts the progress bar is supposed to be shown, the >>>> "Do Work" button should be disabled, the "Cancel" button disabled. >>>> etc. >>>> >>>> I tried calling self.update() in the MainUI when the thread starts but >>>> to no avail. >>>> I'm sure I'm missing something obvious as usual. >>>> >>>> I tried to adhere to what I learnt on this list about threading and >>>> avoid sub-classing QThread. >>>> >>>> Cheers, >>>> frank >>>> >>>> On 24/01/14 17:41, Frank Rueter | OHUfx wrote: >>>> >>>> Great, thanks. I shall adjust my code. >>>> I am interested in seeing how you would go about it, but let me have a >>>> go from scratch, I will be able to understand things much better afterwards >>>> :) >>>> >>>> Cheers, >>>> frank >>>> >>>> >>>> On 24/01/14 17:38, Sean Fisk wrote: >>>> >>>> On Thu, Jan 23, 2014 at 10:44 PM, Frank Rueter | OHUfx < >>>> frank at ohufx.com> wrote: >>>> >>>>> Much appreciated but as I mentioned, I think I jumped the gun with my >>>>> post and should be using QThread to hook the python code to my QProgressBar >>>>> and debug output window (QTextEdit). >>>>> >>>> That would be a correct way to use QProgressBar. Also, for subprocess >>>> output, I would consider using QPlainTextEdit instead of QTextEdit as >>>> is is more performant with high amounts of text. >>>> >>>> If you are interested, I just wrote an asynchronous module for PySide >>>> for the project on which I am currently working. It is based on Python's >>>> futures module and works great with >>>> Qt's signals/slots. Although the project is primarily closed-source, I >>>> would be happy to share the async implementation with you. I don't know if >>>> would fit your needs, but for us it's much easier than manually spawning >>>> QThreads and even easier than QThreadPool. >>>> >>>> Good luck! >>>> >>>>> I will investigate that now >>>>> >>>>> >>>>> >>>>> On 24/01/14 16:08, Sean Fisk wrote: >>>>> >>>>> On Thu, Jan 23, 2014 at 9:42 PM, Frank Rueter | OHUfx < >>>>> frank at ohufx.com> wrote: >>>>> >>>>>> Thanks Sean and Ryan, >>>>>> >>>>>> I'm still not quite clear on how this ties into QProcess.start() >>>>>> >>>>> >>>>> It doesn't tie in with QProcess at all. We're advising to avoid >>>>> using that :) >>>>> >>>>>> I do have a if __name__ ... block in the script in question. >>>>>> An example would certainly be awesome, but if it's less hassle, >>>>>> explaining how your and Ryan's advise helps use QProcess on a python module >>>>>> might already suffice. Maybe a simlpe example says it all though?! >>>>>> >>>>> >>>>> I will whip up a simple example for you, but it might take a few >>>>> hours (lots of stuff to do right now). >>>>> >>>>>> I'm not using python 3 btw >>>>>> >>>>>> Thanks guys for your help!! >>>>>> >>>>>> frank >>>>>> >>>>>> >>>>>> On 24/01/14 15:33, Sean Fisk wrote: >>>>>> >>>>>> Hi Frank, >>>>>> >>>>>> You should definitely avoid calling Python as a subprocess if you >>>>>> can. As far as Ryan's example, I agree with the if __name__... but I >>>>>> think that using the imp module is a bit overkill. I would recommend >>>>>> using Setuptool's entry_points keyword. >>>>>> Or distutils' scripts keyword, >>>>>> if you must. >>>>>> >>>>>> An example of a well-known Python package which does this is Pygments, >>>>>> which has a large "library" component but also comes with the >>>>>> pygmentize command-line script. The Pygments codebase is pretty >>>>>> large, so if you would like me to whip up a simpler example I'd be glad to >>>>>> do so. >>>>>> >>>>>> Cheers, >>>>>> -- >>>>>> Sean Fisk >>>>>> >>>>>> >>>>>> On Thu, Jan 23, 2014 at 9:17 PM, Frank Rueter | OHUfx < >>>>>> frank at ohufx.com> wrote: >>>>>> >>>>>>> Sorry if I'm being thick, but I'm not quite understanding how this >>>>>>> helps to connect a python function to qprocess?! All your code does is >>>>>>> execute the script, right?! >>>>>>> I can already call myscript.main() straight up, but maybe I'm >>>>>>> missing the point as I'm unfamiliar with the imp module. >>>>>>> >>>>>>> Let me elaborate a little bit more: >>>>>>> myscript.main() calls a bunch of other python scripts that (directly >>>>>>> or through other scripts again) execute external programs to do some >>>>>>> conversion work. Those external programs spit out their progress to stdout >>>>>>> which I can see fine when I run myscript.main() manually in a python >>>>>>> terminal. >>>>>>> >>>>>>> Now I need run myscript.main() via QProcess and grab stdout to do be >>>>>>> able to show a progress bar as well as show stdout and stderr in a debug >>>>>>> window inside my QT code. >>>>>>> >>>>>>> >>>>>>> Cheers, >>>>>>> frank >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 24/01/14 14:58, Ryan Gonzalez wrote: >>>>>>> >>>>>>> If you put an "if __name__ == '__main__'" and a main functions, you >>>>>>> could always import the script from the GUI frontend. Example: >>>>>>> >>>>>>> myscript.py >>>>>>> >>>>>>> def main(argv): >>>>>>> do_cool_stuff() >>>>>>> return 0 >>>>>>> >>>>>>> if __name__ == '__main__': >>>>>>> sys.exit(main(sys.argv)) >>>>>>> >>>>>>> mygui.py(Python 2): >>>>>>> >>>>>>> import imp >>>>>>> >>>>>>> ... >>>>>>> >>>>>>> main = imp.load_module('myscript', *imp.find_module('myscript')) >>>>>>> >>>>>>> main.main(my_argv) >>>>>>> >>>>>>> mygui.py(Python 3): >>>>>>> >>>>>>> import importlib.machinery >>>>>>> >>>>>>> main = importlib.machinery.SourceFileLoader('myscript', >>>>>>> 'myscript.py').load_module('myscript') >>>>>>> >>>>>>> main.main(my_argv) >>>>>>> >>>>>>> >>>>>>> On Thu, Jan 23, 2014 at 7:48 PM, Frank Rueter | OHUfx < >>>>>>> frank at ohufx.com> wrote: >>>>>>> >>>>>>>> Hi all, >>>>>>>> >>>>>>>> I got a little code design question: >>>>>>>> >>>>>>>> I have a python script that does a lot of file >>>>>>>> processing/converting/uploading etc and I'd like to write a decent >>>>>>>> interface for it now. >>>>>>>> The main goal is to be able to show the user detailed info about the >>>>>>>> current step and progress as well as clean up properly in case the >>>>>>>> whole >>>>>>>> thing is cancelled. >>>>>>>> >>>>>>>> My existing python code needs to stay independent of QT so any >>>>>>>> application that supports python can use it. >>>>>>>> I am wondering now how to best connect the python script and the >>>>>>>> PySide >>>>>>>> code. Should I just run the script as an argument to the python >>>>>>>> interpreter like I would with any other program? E.g.: >>>>>>>> >>>>>>>> process = QtCore.QProcess(self) >>>>>>>> process.start(, ) >>>>>>>> >>>>>>>> As simple as this seems, it feels odd to use python to call itself >>>>>>>> as an >>>>>>>> external program. >>>>>>>> >>>>>>>> >>>>>>>> I'm happy to go that way but am curious how others are doing this?! >>>>>>>> >>>>>>>> Cheers, >>>>>>>> frank >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> PySide mailing list >>>>>>>> PySide at qt-project.org >>>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Ryan >>>>>>> If anybody ever asks me why I prefer C++ to C, my answer will be >>>>>>> simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think >>>>>>> that was nul-terminated." >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> PySide mailing list >>>>>>> PySide at qt-project.org >>>>>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>>> >>>> _______________________________________________ >>>> PySide mailing list >>>> PySide at qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/pyside >>>> >>>> >>> >>> >> >> -- >> [image: ohufxLogo 50x50] *vfx compositing >> | workflow customisation and >> consulting * >> >> >> _______________________________________________ >> PySide mailing listPySide at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/pyside >> >> >> -- >> [image: ohufxLogo 50x50] *vfx compositing >> | workflow customisation and >> consulting * >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> >> > > -- > [image: ohufxLogo 50x50] *vfx compositing > | workflow customisation and > consulting * > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 2666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Sun Mar 16 23:48:36 2014 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Mon, 17 Mar 2014 11:48:36 +1300 Subject: [PySide] Slots - to decorate or not to decorate Message-ID: <53262A44.4000404@ohufx.com> Hi all, I have been under the impression that using the decorator @QtCore.Slot() wasn't necessarily required in PySide to be able to use functions/methods as slots. However, the more I am reading up on it, the more I am getting the feeling that, while it may not be necessary to use the decorator, it does make things more efficient because of the explicit signature assignment. Could somebody clarify the "best practice", when to use decorators and when they are not required? Or is it simply good practise to always use them? Cheers, frank -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From mpachock at gmail.com Mon Mar 17 15:39:51 2014 From: mpachock at gmail.com (=?ISO-8859-2?Q?Micha=B3_Pachocki?=) Date: Mon, 17 Mar 2014 15:39:51 +0100 Subject: [PySide] PySide C++ hybrid app. Message-ID: Hello, In tutorial "SuperHybrids part 2, now Qt + PySide [1]" there is a description how run python code from c++ lib, but the app is running from python. How to make calls to PySide from native C++ app, so C++ objects will be visible from Python and vice-versa? [1] http://lynxline.com/superhybrids-part-2-now-qt-pyside/ regards, mp -------------- next part -------------- An HTML attachment was scrubbed... URL: From ntod8729 at uni.sydney.edu.au Mon Mar 17 18:42:50 2014 From: ntod8729 at uni.sydney.edu.au (ntod8729 at uni.sydney.edu.au) Date: Mon, 17 Mar 2014 17:42:50 +0000 Subject: [PySide] PySide C++ hybrid app. In-Reply-To: References: Message-ID: <912865716e6f47a2bd40cc77f9a1bc2a@BN1PR01MB184.prod.exchangelabs.com> Hi Michal, You need to first embed the Python interpreter into your C++ application. You can find the relevant information on doing that here . Section 5.3 shows you how you can call a Python function from C++. You then need to wrap your function arguments as PyObects using either the python C API (for types such as int, char * etc.) or shiboken (for Qt classes) in order to pass them to your Python function. You will also need to unwrap any return types to retrieve a pointer to use in C++. There is some code that demonstrates the wrapping/unwrapping here in some of the source from the CLAM project. Admittedly I haven't tried the shiboken code myself as I had already rolled my own before stumbling across this, but I based some code on their sipunwrap source for doing the same thing with PyQt without any problems. Hope this helps, Nick ? ________________________________ From: pyside-bounces+ntod8729=uni.sydney.edu.au at qt-project.org on behalf of Michał Pachocki Sent: Monday, 17 March 2014 3:39 PM To: pyside at qt-project.org Subject: [PySide] PySide C++ hybrid app. Hello, In tutorial "SuperHybrids part 2, now Qt + PySide [1]" there is a description how run python code from c++ lib, but the app is running from python. How to make calls to PySide from native C++ app, so C++ objects will be visible from Python and vice-versa? [1] http://lynxline.com/superhybrids-part-2-now-qt-pyside/ regards, mp -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter_karasev at agilent.com Thu Mar 20 16:13:27 2014 From: peter_karasev at agilent.com (peter_karasev at agilent.com) Date: Thu, 20 Mar 2014 15:13:27 +0000 Subject: [PySide] PySide C++ hybrid app. In-Reply-To: <912865716e6f47a2bd40cc77f9a1bc2a@BN1PR01MB184.prod.exchangelabs.com> References: , <912865716e6f47a2bd40cc77f9a1bc2a@BN1PR01MB184.prod.exchangelabs.com> Message-ID: Hi Michal, What makes this somewhat difficult (for me anyway) is when you are trying to expose non-QT classes together with shiboken QT classes. Boost python makes executing python from c++ pretty easy; I use template functors like this one to to grab QT objects in c++: http://stackoverflow.com/questions/18542778/import-classes-from-pyside-inside-of-a-boost-python-module/20874038#20874038 Once you register the converter with QtGui_from_python() , a boost::python wrapped class that returns QColor will end up returning a PySide.QtGui.QColor object on the python side. -pk ________________________________ From: pyside-bounces+peter_karasev=agilent.com at qt-project.org [pyside-bounces+peter_karasev=agilent.com at qt-project.org] on behalf of ntod8729 at uni.sydney.edu.au [ntod8729 at uni.sydney.edu.au] Sent: Monday, March 17, 2014 10:42 To: Michał Pachocki; pyside at qt-project.org Subject: Re: [PySide] PySide C++ hybrid app. Hi Michal, You need to first embed the Python interpreter into your C++ application. You can find the relevant information on doing that here . Section 5.3 shows you how you can call a Python function from C++. You then need to wrap your function arguments as PyObects using either the python C API (for types such as int, char * etc.) or shiboken (for Qt classes) in order to pass them to your Python function. You will also need to unwrap any return types to retrieve a pointer to use in C++. There is some code that demonstrates the wrapping/unwrapping here in some of the source from the CLAM project. Admittedly I haven't tried the shiboken code myself as I had already rolled my own before stumbling across this, but I based some code on their sipunwrap source for doing the same thing with PyQt without any problems. Hope this helps, Nick ​ ________________________________ From: pyside-bounces+ntod8729=uni.sydney.edu.au at qt-project.org on behalf of Michał Pachocki Sent: Monday, 17 March 2014 3:39 PM To: pyside at qt-project.org Subject: [PySide] PySide C++ hybrid app. Hello, In tutorial "SuperHybrids part 2, now Qt + PySide [1]" there is a description how run python code from c++ lib, but the app is running from python. How to make calls to PySide from native C++ app, so C++ objects will be visible from Python and vice-versa? [1] http://lynxline.com/superhybrids-part-2-now-qt-pyside/ regards, mp -------------- next part -------------- An HTML attachment was scrubbed... URL: From kartelo at gmx.com Thu Mar 20 18:05:05 2014 From: kartelo at gmx.com (Jorge Araya Navarro) Date: Thu, 20 Mar 2014 11:05:05 -0600 Subject: [PySide] PySide documentation on Qt Assistant Message-ID: <1395335105.6334.3.camel@localhost.localdomain> Hello! I'm in a journey of generating important python-related documentation of many important projects to view them on Qt Assistant. I'm struggling to understand how I can generate the PySide documentation, or how could I change the CMakeLists files to add the command `sphinx-build -b qthelp . build/qthelp` and then `qcollectiongenerator-qt4 build/qthelp/PySide.qhcp` so the documentation for Qt Assistant can be generated. Any help will be very appreciated! -- Pax et bonum. Jorge Araya Navarro. Diseñador publicitario, programador Python/C++ y colaborador en Parabola GNU/Linux-libre. -------------- next part -------------- An HTML attachment was scrubbed... URL: From florianlink at gmail.com Fri Mar 21 15:14:51 2014 From: florianlink at gmail.com (Florian Link) Date: Fri, 21 Mar 2014 15:14:51 +0100 Subject: [PySide] PySide C++ hybrid app Message-ID: For hybrid Qt C++/Python applications or embedding Python into an existing Qt application, PythonQt might also be worth a look, also the wrappers are not as complete as PySide's, it has a nice API for embedding and calling Python from Qt. http://pythonqt.sourceforge.net/ regards, Florian On Fri, Mar 21, 2014 at 12:00 PM, wrote: > Send PySide mailing list submissions to > pyside at qt-project.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.qt-project.org/mailman/listinfo/pyside > or, via email, send a message with subject or body 'help' to > pyside-request at qt-project.org > > You can reach the person managing the list at > pyside-owner at qt-project.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of PySide digest..." > > > Today's Topics: > > 1. Re: PySide C++ hybrid app. (peter_karasev at agilent.com) > 2. PySide documentation on Qt Assistant (Jorge Araya Navarro) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 20 Mar 2014 15:13:27 +0000 > From: > Subject: Re: [PySide] PySide C++ hybrid app. > To: , , > > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > Hi Michal, > > What makes this somewhat difficult (for me anyway) is when you are trying > to expose non-QT classes together with shiboken QT classes. Boost python > makes executing python from c++ pretty easy; I use template functors like > this one to to grab QT objects in c++: > > > http://stackoverflow.com/questions/18542778/import-classes-from-pyside-inside-of-a-boost-python-module/20874038#20874038 > > Once you register the converter with > QtGui_from_python() , a boost::python wrapped class > that returns QColor will end up returning a PySide.QtGui.QColor object on > the python side. > > -pk > > > ________________________________ > From: pyside-bounces+peter_karasev=agilent.com at qt-project.org[pyside-bounces+peter_karasev= > agilent.com at qt-project.org] on behalf of ntod8729 at uni.sydney.edu.au [ > ntod8729 at uni.sydney.edu.au] > Sent: Monday, March 17, 2014 10:42 > To: Micha? Pachocki; pyside at qt-project.org > Subject: Re: [PySide] PySide C++ hybrid app. > > > Hi Michal, > > You need to first embed the Python interpreter into your C++ application. > You can find the relevant information on doing that here< > http://docs.python.org/2/extending/embedding.html> . Section 5.3 shows > you how you can call a Python function from C++. You then need to wrap your > function arguments as PyObects using either the python C API (for types > such as int, char * etc.) or shiboken (for Qt classes) in order to pass > them to your Python function. You will also need to unwrap any return types > to retrieve a pointer to use in C++. There is some code that demonstrates > the wrapping/unwrapping here in some of the source from the CLAM project< > http://clam-project.org/clam/trunk/ipyclam/>. Admittedly I haven't tried > the shiboken code myself as I had already rolled my own before stumbling > across this, but I based some code on their sipunwrap source for doing the > same thing with PyQt without any problems. > > Hope this helps, > Nick ? > > > ________________________________ > From: pyside-bounces+ntod8729=uni.sydney.edu.au at qt-project.org uni.sydney.edu.au at qt-project.org> on behalf of Micha? Pachocki < > mpachock at gmail.com> > Sent: Monday, 17 March 2014 3:39 PM > To: pyside at qt-project.org > Subject: [PySide] PySide C++ hybrid app. > > Hello, > > In tutorial "SuperHybrids part 2, now Qt + PySide [1]" there is a > description how run python code from c++ lib, but the app is running from > python. How to make calls to PySide from native C++ app, so C++ objects > will be visible from Python and vice-versa? > > [1] http://lynxline.com/superhybrids-part-2-now-qt-pyside/ > > regards, > mp > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://lists.qt-project.org/pipermail/pyside/attachments/20140320/861021fb/attachment-0001.html > > ------------------------------ > > Message: 2 > Date: Thu, 20 Mar 2014 11:05:05 -0600 > From: Jorge Araya Navarro > Subject: [PySide] PySide documentation on Qt Assistant > To: pyside at qt-project.org > Message-ID: <1395335105.6334.3.camel at localhost.localdomain> > Content-Type: text/plain; charset="utf-8" > > Hello! > > I'm in a journey of generating important python-related documentation of > many important projects to view them on Qt Assistant. I'm struggling to > understand how I can generate the PySide documentation, or how could I > change the CMakeLists files to add the command `sphinx-build -b qthelp . > build/qthelp` and then `qcollectiongenerator-qt4 > build/qthelp/PySide.qhcp` so the documentation for Qt Assistant can be > generated. > > Any help will be very appreciated! > -- > Pax et bonum. > Jorge Araya Navarro. > Dise?ador publicitario, programador Python/C++ y colaborador en Parabola > GNU/Linux-libre. > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://lists.qt-project.org/pipermail/pyside/attachments/20140320/c60ddb54/attachment-0001.html > > ------------------------------ > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > > End of PySide Digest, Vol 26, Issue 15 > ************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at seanfisk.com Fri Mar 21 20:14:10 2014 From: sean at seanfisk.com (Sean Fisk) Date: Fri, 21 Mar 2014 15:14:10 -0400 Subject: [PySide] PySide documentation on Qt Assistant In-Reply-To: <1395335105.6334.3.camel@localhost.localdomain> References: <1395335105.6334.3.camel@localhost.localdomain> Message-ID: Hello Jorge, I have created a script which I used to build the PySide docs which are currently up at http://pyside.github.io/docs/pyside/. If you look in build_docs.bash, there are a couple places where patches are applied to adjust the targets. That is likely where you will want to go to change html to qthelp. Running qcollectiongenerator could be done by adding a couple of CMake rules after Sphinx runs. There are a large number of gotchas when building the PySide docs, for example that qdoc3 from Qt 4.6.4 is the oldest version capable of building these docs. Therefore I would recommend simply modifying the scripts to do what you want. Hope this helps! -- Sean Fisk On Thu, Mar 20, 2014 at 1:05 PM, Jorge Araya Navarro wrote: > Hello! > > I'm in a journey of generating important python-related documentation of > many important projects to view them on Qt Assistant. I'm struggling to > understand how I can generate the PySide documentation, or how could I > change the CMakeLists files to add the command `sphinx-build -b qthelp . > build/qthelp` and then `qcollectiongenerator-qt4 build/qthelp/PySide.qhcp` > so the documentation for Qt Assistant can be generated. > > Any help will be very appreciated! > -- > *Pax et bonum.* > Jorge Araya Navarro. > Diseñador publicitario, programador Python/C++ y colaborador en Parabola > GNU/Linux-libre. > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hugo at barrera.io Sun Mar 23 15:05:28 2014 From: hugo at barrera.io (Hugo Osvaldo Barrera) Date: Sun, 23 Mar 2014 11:05:28 -0300 Subject: [PySide] Shiboken and python3.4 Message-ID: <20140323140528.GA3295@athena.barrera.io> I'm including a patch that makes shiboken build with python3.4 (as well as 3.3). A very trivial change, but nice to have. I was going to put a pull request on github, but since that isn't the oficial mirror, do those get attention? Or is a patch to the list better? Cheers, -- Hugo Osvaldo Barrera A: No, it doesn't make sense. Q: Should I include quotations *after* my reply? -------------- next part -------------- A non-text attachment was scrubbed... Name: FindPython3Libs.cmake.patch Type: text/x-diff Size: 424 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From mw_triad at users.sourceforge.net Mon Mar 24 16:01:33 2014 From: mw_triad at users.sourceforge.net (Matthew Woehlke) Date: Mon, 24 Mar 2014 11:01:33 -0400 Subject: [PySide] Shiboken and python3.4 In-Reply-To: <20140323140528.GA3295@athena.barrera.io> References: <20140323140528.GA3295@athena.barrera.io> Message-ID: On 2014-03-23 10:05, Hugo Osvaldo Barrera wrote: > I was going to put a pull request on github, but since that isn't the > oficial mirror, do those get attention? Or is a patch to the list better? AFAIK gerrit is still the "officially blessed" mechanism. See http://qt-project.org/wiki/PySideDevelopment. -- Matthew From jerome at jolimont.fr Wed Mar 26 16:49:05 2014 From: jerome at jolimont.fr (=?UTF-8?Q?J=C3=A9r=C3=B4me?=) Date: Wed, 26 Mar 2014 16:49:05 +0100 Subject: [PySide] Form dialog subclassing QDialog In-Reply-To: <5310DCA5.3000000@bluewin.ch> References: "" <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> Message-ID: <16d6df6c44faa981d6d9b57e202007bf@jolimont.fr> Hi Aaron and others. In your example code, how do you get the value of the selected index, for example to feed it to a remove or edit function ? I do the following: When remove, edit or copy button is pressed, I get the selected row index, and it refers to the index of my item in the model's "items" list attribute . To illustrate this with your example, item is a Person, and the model PersonTableModel lists its items in its self.persons attribute. # Get first selected row. If none, exit. # (In practice, I disable multiple selection so only 0 or 1 item selected) selected = self.tableView.selectedIndexes() if selected == []: return index = selected[0].row() # Remove if action == 'Remove': self.model.remove(index) return # Edit or Copy # Get item from row index item = self.model.items[index] ... This used to work, until I added a QSortFilterProxyModel. Now, the rows can be moved about, but the index in self.persons does not change accordingly, so the row index here is not necessarily the index in the item list. What I need is a way to get from the selection in the view not only to the QStandardItem in the model, but to the corresponding item in the source list. I can obtain the QStandardItem index = selected[0] item = QStandardItemModel.itemFromIndex(index) but I still need to associate this QStandardItem with an element of self.persons. This is how you proposed to create the items : > self.persons = persons > for i in xrange(len(self.persons)): > person = self.persons[i] > self.setItem(i, 0, QStandardItem(person.name)) > self.setItem(i, 1, QStandardItem(str(person.age))) Apparently, when sorting, the rows are modified and so the current row is not the item's index in self.persons anymore. Is the link from the row index to the source data (index in self.persons) broken ? Do I need to go through self.persons until I find an item (a person) with the same "name" attribute ? There may even be cases where two elements may have the same name. This example is not great, but there are other cases where it could happen, anyway, I'd rather not rely on this name field. So I'd need to create a new unique ID column and hide that from the view. I can see how to do that. Another way could be to use setData to add a reference to the Person item in a QStandardItem if the row, like this: item = QStandardItem(person.name) item.setData(person, role = something) self.setItem(i, 0, item) self.setItem(i, 1, QStandardItem(str(person.age))) but this sounds totally twisted. Thanks for any advice. The more I think of it, the mode it seems that the only way is to add a (hidden or not) ID column. Overall, I think my problems are due to the fact that I don't rely solely on Qt's Model/View architecture: I keep the data in this self.persons attribute list. As we said in another message in this thread, these lists could be removed and the data could be kept only in QStandardItem instances, but then I'd need to be able to store everything in this form, even data that I don't know how and don't want to display in views. My approach is different, I store everything in python classes, and when I need a user interaction, I set a model to display what I want to display, and this only, and I trash that model when I'm done. -- Jérôme From jerome at jolimont.fr Wed Mar 26 18:08:43 2014 From: jerome at jolimont.fr (=?UTF-8?Q?J=C3=A9r=C3=B4me?=) Date: Wed, 26 Mar 2014 18:08:43 +0100 Subject: [PySide] Form dialog subclassing QDialog In-Reply-To: <16d6df6c44faa981d6d9b57e202007bf@jolimont.fr> References: " " <5310C95E.8000905@bluewin.ch> <559c40a34e4a59c062ece5377ce4daf3@jolimont.fr> <5310DCA5.3000000@bluewin.ch> <16d6df6c44faa981d6d9b57e202007bf@jolimont.fr> Message-ID: <66480dd4cb4c220b48cc23ad603dd376@jolimont.fr> Le 2014-03-26 16:49, Jérôme a écrit : > Thanks for any advice. The more I think of it, the mode it seems that > the only way is to add a (hidden or not) ID column. I just did this. # Get selected items. If none, exit. selected = self.tableView.selectedIndexes() # Get selected row in model from selection in proxy # (Note: all elements are on the same row, # thanks to setSelectionBehavior(QAbstractItemView.SelectRows) selected_row = self.proxy_model.mapToSource(selected[0]).row() # Get ID of item corresponding to selected row (ID is column 0) ID = self.model.item(selected_row, 0).text() # Get corresponding index in model.items list index = self.model.findIndex(ID) findIndex is a method of my model: def findIndex(self, ID): ID_list = [item.ID for item in self._items] if ID not in ID_list: return None return ID_list.index(ID) and now, I'm realizing that the order of the row was not messed up, just modified by the proxying. The quick solution was to just write index = self.proxy_model.mapToSource(selected[0]).row() instead of index = selected[0].row() ... I guess... I've learned something today (TM) [1]. Thanks for reading anyway. > Overall, I think my problems are due to the fact that I don't rely > solely on Qt's Model/View architecture: I keep the data in this > self.persons attribute list. > > As we said in another message in this thread, these lists could be > removed and the data could be kept only in QStandardItem instances, but > then I'd need to be able to store everything in this form, even data > that I don't know how and don't want to display in views. My approach is > different, I store everything in python classes, and when I need a user > interaction, I set a model to display what I want to display, and this > only, and I trash that model when I'm done. Perhaps I should use a TreeModel to fit all the data but for now I'll stick to this approach. [1] http://www.cs.berkeley.edu/~smaji/southpark.html -- Jérôme From jonasthiem at googlemail.com Thu Mar 27 14:37:34 2014 From: jonasthiem at googlemail.com (Jonas Thiem) Date: Thu, 27 Mar 2014 14:37:34 +0100 Subject: [PySide] pypi package doesn't build on Mageia 4 due to position dependent code Message-ID: <5334299E.6040001@googlemail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi everyone, I wanted to use PySide with Python 3, but sadly Mageia 4 doesn't ship PySide packages for Python 3 (just 2.x). Therefore I tried installing it with python3-pip. Unfortunately, it doesn't work: Excerpt from the terminal output (full output is attached): ... [ 4%] Building CXX object ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o In file included from /usr/lib64/qt5/include/QtCore/qchar.h:45:0, from /usr/lib64/qt5/include/QtCore/qhash.h:45, from /usr/lib64/qt5/include/QtCore/QHash:1, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You must build your code with position independent code if Qt was built with - -reduce-relocations. " "Compile your code with -fPIC or -fPIE." # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ ^ /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: In function ‘bool preprocess(const QString&, QFile&, const QStringList&)’: /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: error: ‘convertSeparators’ is not a member of ‘QDir’ ... So it appears all that is missing is a simple -fPIC compile option. Is there a chance this can fixed in the near future? I'm happy to retest stuff or modify files if given suitable instructions for further testing. Regards, Jonas Thiem -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTNCmXAAoJEBIDTbbx8YkerUoP/jVlm+ATNAMCLlJnYUAU7jbE gjnugoHT5SGIQRfwH2KvfXpK6siYqFcj9pkJkBzyh1leTSwnc/Vw9nCqrXwGbPcj Rf1Hs1VHeXRKwqE5wBFVMQZmGBseEjcvt9atakvgn/1buoI4rYs8vJy2IDOoDnQ8 aVJwlGUsbRd7QKUbaKg2jhM4Z04Z3KTS/OOsyhfYvdoWrg8vCe+uaX4LfxEU1v7i hMkdL+fUyWuQifKpBcC3ChxG7Jrns1a6+4aNasKPjNeMxI50ml/Kk4S765xDOZO4 ddJpklZKSXjMf6gET1agTEe1h4SmUcQ+Mjl/6IhMEI4cmqJOJ00ar+bV/joWBNX8 VjAV06TjPf3CYbHPykv9v1yJdeHef5aSdy3qpVja6kD1FGFGclHtMgWiLFFbmHfF xF5gdU2NgdzLdFX8s4cBc579wK0BPZpfMjDWzUzBaPt/rFVFiYGCd0MakQQeMZrI 54g3x1EfnjVF8Lk91Rnj5IEEHfdi7XjTAhC7olCI2CIpq1LNOluTDybxA/diyHm/ 5tw+coCoIWzaUOZY1UV1PWa2JAef0LqdWMKnPzqNVpr3eaMZm5XmuDGao4kLgGo6 PeQB6WdUgZtQawoEW1sPb6hMMTWk4TOx8Zzx6tLoMQOtXATGqmf23Luey1Cv1g5f N3ZOfyLsRt7H3UOP3hiU =pc03 -----END PGP SIGNATURE----- -------------- next part -------------- [root at localhost jonas]# python3-pip install PySide Downloading/unpacking PySide Downloading PySide-1.2.1.tar.gz (9.3MB): 9.3MB downloaded Running setup.py egg_info for package PySide Removing /tmp/pip_build_root/PySide/pyside_package package init file 'pyside_package/PySide/__init__.py' not found (or not a regular file) package init file 'pyside_package/pysideuic/__init__.py' not found (or not a regular file) warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/examples/hyperui' warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/mobility' warning: no previously-included files matching '**' found under directory 'sources/shiboken/.git' warning: no previously-included files matching '**' found under directory 'sources/pyside/.git' warning: no previously-included files matching '**' found under directory 'sources/pyside-tools/.git' warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/.git' warning: no files found matching '**' under directory 'pyside_package/PySide' warning: no files found matching '**' under directory 'pyside_package/PySide/docs' warning: no files found matching '**' under directory 'pyside_package/PySide/plugins' warning: no files found matching '**' under directory 'pyside_package/PySide/imports' warning: no files found matching '**' under directory 'pyside_package/PySide/translations' warning: no files found matching '**' under directory 'pyside_package/PySide/include' warning: no files found matching '**' under directory 'pyside_package/PySide/typesystems' warning: no files found matching '**' under directory 'pyside_package/PySide/examples' warning: no files found matching '**' under directory 'pyside_package/pysideuic' warning: no files found matching '**' under directory 'pyside_package/pysideuic/Compiler' warning: no files found matching '**' under directory 'pyside_package/pysideuic/port_v2' warning: no files found matching '**' under directory 'pyside_package/pysideuic/port_v3' warning: no files found matching '**' under directory 'pyside_package/pysideuic/widget-plugins' Installing collected packages: PySide Running setup.py install for PySide Removing /tmp/pip_build_root/PySide/pyside_package Python architecture is 64bit Inserting path "/tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/bin" to environment ============================== Package version: 1.2.1 Build type: Release Build tests: False --- Make path: /usr/bin/make Make generator: Unix Makefiles Make jobs: --- Script directory: /tmp/pip_build_root/PySide Sources directory: /tmp/pip_build_root/PySide/sources Build directory: /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release Install directory: /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release Python site-packages install directory: /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages --- Python executable: /usr/bin/python3 Python includes: /usr/include/python3.3m Python library: /usr/lib64/libpython3.3m.so Python prefix: /usr Python scripts: /usr/bin --- Qt qmake: /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None ============================== Creating build folder /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release... Creating install folder /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release... Building module shiboken... Creating module build folder /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release/shiboken... Configuring module shiboken (/tmp/pip_build_root/PySide/sources/shiboken)... Running process: /usr/bin/cmake -G "Unix Makefiles" -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DBUILD_TESTS=False -DDISABLE_DOCSTRINGS=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release /tmp/pip_build_root/PySide/sources/shiboken -DPYTHON3_EXECUTABLE=/usr/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/include/python3.3m -DPYTHON3_LIBRARY=/usr/lib64/libpython3.3m.so -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes -DUSE_PYTHON3=ON /usr/bin/cmake -G Unix Makefiles -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DBUILD_TESTS=False -DDISABLE_DOCSTRINGS=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release /tmp/pip_build_root/PySide/sources/shiboken -DPYTHON3_EXECUTABLE=/usr/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/include/python3.3m -DPYTHON3_LIBRARY=/usr/lib64/libpython3.3m.so -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes -DUSE_PYTHON3=ON -- The C compiler identification is GNU 4.8.2 -- The CXX compiler identification is GNU 4.8.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Looking for Q_WS_X11 -- Looking for Q_WS_X11 - not found -- Looking for Q_WS_WIN -- Looking for Q_WS_WIN - not found -- Looking for Q_WS_QWS -- Looking for Q_WS_QWS - not found -- Looking for Q_WS_MAC -- Looking for Q_WS_MAC - not found -- Found unsuitable Qt version "5.2.0" from /usr/bin/qmake -- Found Python3Libs: /usr/lib64/libpython3.3m.so -- Found Python3Interp: /usr/bin/python3 -- Could NOT find Python3InterpDbg (missing: PYTHON3_DBG_EXECUTABLE) -- Could NOT find Python3InterpDbg (missing: PYTHON3_DBG_EXECUTABLE) PYTHON WITH DEBUG: /usr/bin/python3 -- Found LibXml2: /usr/lib64/libxml2.so (found suitable version "2.9.1", minimum required is "2.6.32") -- Found LibXslt: /usr/lib64/libxslt.so (found suitable version "1.1.28", minimum required is "1.1.19") -- sphinx-build - not found! doc target disabled CMake Warning at CMakeLists.txt:127 (message): Some dependencies were not found, shiboken generator compilation disabled! -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release/shiboken Compiling module shiboken... Running process: /usr/bin/make /usr/bin/make [ 2%] Generating qrc_generator.cxx Scanning dependencies of target apiextractor [ 4%] Building CXX object ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o In file included from /usr/lib64/qt5/include/QtCore/qchar.h:45:0, from /usr/lib64/qt5/include/QtCore/qhash.h:45, from /usr/lib64/qt5/include/QtCore/QHash:1, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE." # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ ^ /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: In function ‘bool preprocess(const QString&, QFile&, const QStringList&)’: /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: error: ‘convertSeparators’ is not a member of ‘QDir’ preprocess.push_include_path(QDir::convertSeparators(include).toStdString()); ^ ApiExtractor/CMakeFiles/apiextractor.dir/build.make:64: recipe for target 'ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o' failed make[2]: *** [ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o] Error 1 CMakeFiles/Makefile2:140: recipe for target 'ApiExtractor/CMakeFiles/apiextractor.dir/all' failed make[1]: *** [ApiExtractor/CMakeFiles/apiextractor.dir/all] Error 2 Makefile:116: recipe for target 'all' failed make: *** [all] Error 2 error: Error compiling shiboken Complete output from command /usr/bin/python3 -c "import setuptools;__file__='/tmp/pip_build_root/PySide/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-degjgh-record/install-record.txt --single-version-externally-managed: Removing /tmp/pip_build_root/PySide/pyside_package running install running build Python architecture is 64bit Inserting path "/tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/bin" to environment ============================== Package version: 1.2.1 Build type: Release Build tests: False --- Make path: /usr/bin/make Make generator: Unix Makefiles Make jobs: --- Script directory: /tmp/pip_build_root/PySide Sources directory: /tmp/pip_build_root/PySide/sources Build directory: /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release Install directory: /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release Python site-packages install directory: /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages --- Python executable: /usr/bin/python3 Python includes: /usr/include/python3.3m Python library: /usr/lib64/libpython3.3m.so Python prefix: /usr Python scripts: /usr/bin --- Qt qmake: /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None ============================== Creating build folder /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release... Creating install folder /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release... Building module shiboken... Creating module build folder /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release/shiboken... Configuring module shiboken (/tmp/pip_build_root/PySide/sources/shiboken)... Running process: /usr/bin/cmake -G "Unix Makefiles" -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DBUILD_TESTS=False -DDISABLE_DOCSTRINGS=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release /tmp/pip_build_root/PySide/sources/shiboken -DPYTHON3_EXECUTABLE=/usr/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/include/python3.3m -DPYTHON3_LIBRARY=/usr/lib64/libpython3.3m.so -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes -DUSE_PYTHON3=ON /usr/bin/cmake -G Unix Makefiles -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DBUILD_TESTS=False -DDISABLE_DOCSTRINGS=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release /tmp/pip_build_root/PySide/sources/shiboken -DPYTHON3_EXECUTABLE=/usr/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/include/python3.3m -DPYTHON3_LIBRARY=/usr/lib64/libpython3.3m.so -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes -DUSE_PYTHON3=ON -- The C compiler identification is GNU 4.8.2 -- The CXX compiler identification is GNU 4.8.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Looking for Q_WS_X11 -- Looking for Q_WS_X11 - not found -- Looking for Q_WS_WIN -- Looking for Q_WS_WIN - not found -- Looking for Q_WS_QWS -- Looking for Q_WS_QWS - not found -- Looking for Q_WS_MAC -- Looking for Q_WS_MAC - not found -- Found unsuitable Qt version "5.2.0" from /usr/bin/qmake -- Found Python3Libs: /usr/lib64/libpython3.3m.so -- Found Python3Interp: /usr/bin/python3 -- Could NOT find Python3InterpDbg (missing: PYTHON3_DBG_EXECUTABLE) -- Could NOT find Python3InterpDbg (missing: PYTHON3_DBG_EXECUTABLE) PYTHON WITH DEBUG: /usr/bin/python3 -- Found LibXml2: /usr/lib64/libxml2.so (found suitable version "2.9.1", minimum required is "2.6.32") -- Found LibXslt: /usr/lib64/libxslt.so (found suitable version "1.1.28", minimum required is "1.1.19") -- sphinx-build - not found! doc target disabled CMake Warning at CMakeLists.txt:127 (message): Some dependencies were not found, shiboken generator compilation disabled! -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release/shiboken Compiling module shiboken... Running process: /usr/bin/make /usr/bin/make [ 2%] Generating qrc_generator.cxx Scanning dependencies of target apiextractor [ 4%] Building CXX object ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o In file included from /usr/lib64/qt5/include/QtCore/qchar.h:45:0, from /usr/lib64/qt5/include/QtCore/qhash.h:45, from /usr/lib64/qt5/include/QtCore/QHash:1, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, from /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE." # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ ^ /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: In function ‘bool preprocess(const QString&, QFile&, const QStringList&)’: /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: error: ‘convertSeparators’ is not a member of ‘QDir’ preprocess.push_include_path(QDir::convertSeparators(include).toStdString()); ^ ApiExtractor/CMakeFiles/apiextractor.dir/build.make:64: recipe for target 'ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o' failed make[2]: *** [ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o] Error 1 CMakeFiles/Makefile2:140: recipe for target 'ApiExtractor/CMakeFiles/apiextractor.dir/all' failed make[1]: *** [ApiExtractor/CMakeFiles/apiextractor.dir/all] Error 2 Makefile:116: recipe for target 'all' failed make: *** [all] Error 2 error: Error compiling shiboken ---------------------------------------- Cleaning up... Command /usr/bin/python3 -c "import setuptools;__file__='/tmp/pip_build_root/PySide/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-degjgh-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/PySide Storing complete log in /root/.pip/pip.log [root at localhost jonas]# -------------- next part -------------- A non-text attachment was scrubbed... Name: output.txt.sig Type: application/pgp-signature Size: 543 bytes Desc: not available URL: From backup.rlacko at gmail.com Thu Mar 27 14:59:49 2014 From: backup.rlacko at gmail.com (Roman Lacko) Date: Thu, 27 Mar 2014 14:59:49 +0100 Subject: [PySide] pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: <5334299E.6040001@googlemail.com> References: <5334299E.6040001@googlemail.com> Message-ID: PySide does not support Qt 5 You need to build PySide against Qt 4 ============================== Package version: 1.2.1 Build type: Release Build tests: False --- Make path: /usr/bin/make Make generator: Unix Makefiles Make jobs: --- Script directory: /tmp/pip_build_root/PySide Sources directory: /tmp/pip_build_root/PySide/sources Build directory: /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release Install directory: /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release Python site-packages install directory: /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages --- Python executable: /usr/bin/python3 Python includes: /usr/include/python3.3m Python library: /usr/lib64/libpython3.3m.so Python prefix: /usr Python scripts: /usr/bin --- Qt qmake: /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None ============================== ... 2014-03-27 14:37 GMT+01:00 Jonas Thiem : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi everyone, > > I wanted to use PySide with Python 3, but sadly Mageia 4 doesn't ship > PySide packages for Python 3 (just 2.x). Therefore I tried installing > it with python3-pip. Unfortunately, it doesn't work: > > > Excerpt from the terminal output (full output is attached): > > ... > > [ 4%] Building CXX object > ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > > In file included from /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > > from /usr/lib64/qt5/include/QtCore/qhash.h:45, > > from /usr/lib64/qt5/include/QtCore/QHash:1, > > from > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > > from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > > from > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > > from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > > /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You must > build your code with position independent code if Qt was built with > - -reduce-relocations. " "Compile your code with -fPIC or -fPIE." > > # error "You must build your code with position independent code if > Qt was built with -reduce-relocations. "\ > > ^ > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > In function 'bool preprocess(const QString&, QFile&, const QStringList&)': > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > error: 'convertSeparators' is not a member of 'QDir' > > ... > > > So it appears all that is missing is a simple -fPIC compile option. Is > there a chance this can fixed in the near future? I'm happy to retest > stuff or modify files if given suitable instructions for further testing. > > Regards, > Jonas Thiem > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iQIcBAEBAgAGBQJTNCmXAAoJEBIDTbbx8YkerUoP/jVlm+ATNAMCLlJnYUAU7jbE > gjnugoHT5SGIQRfwH2KvfXpK6siYqFcj9pkJkBzyh1leTSwnc/Vw9nCqrXwGbPcj > Rf1Hs1VHeXRKwqE5wBFVMQZmGBseEjcvt9atakvgn/1buoI4rYs8vJy2IDOoDnQ8 > aVJwlGUsbRd7QKUbaKg2jhM4Z04Z3KTS/OOsyhfYvdoWrg8vCe+uaX4LfxEU1v7i > hMkdL+fUyWuQifKpBcC3ChxG7Jrns1a6+4aNasKPjNeMxI50ml/Kk4S765xDOZO4 > ddJpklZKSXjMf6gET1agTEe1h4SmUcQ+Mjl/6IhMEI4cmqJOJ00ar+bV/joWBNX8 > VjAV06TjPf3CYbHPykv9v1yJdeHef5aSdy3qpVja6kD1FGFGclHtMgWiLFFbmHfF > xF5gdU2NgdzLdFX8s4cBc579wK0BPZpfMjDWzUzBaPt/rFVFiYGCd0MakQQeMZrI > 54g3x1EfnjVF8Lk91Rnj5IEEHfdi7XjTAhC7olCI2CIpq1LNOluTDybxA/diyHm/ > 5tw+coCoIWzaUOZY1UV1PWa2JAef0LqdWMKnPzqNVpr3eaMZm5XmuDGao4kLgGo6 > PeQB6WdUgZtQawoEW1sPb6hMMTWk4TOx8Zzx6tLoMQOtXATGqmf23Luey1Cv1g5f > N3ZOfyLsRt7H3UOP3hiU > =pc03 > -----END PGP SIGNATURE----- > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonasthiem at googlemail.com Thu Mar 27 15:16:08 2014 From: jonasthiem at googlemail.com (Jonas Thiem) Date: Thu, 27 Mar 2014 15:16:08 +0100 Subject: [PySide] Fwd: Re: pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: <53343144.4020206@googlemail.com> References: <53343144.4020206@googlemail.com> Message-ID: <533432A8.6030600@googlemail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I messed up sending this one to the list: - -------- Original Message -------- Subject: Re: [PySide] pypi package doesn't build on Mageia 4 due to position dependent code Date: Thu, 27 Mar 2014 15:10:12 +0100 From: Jonas Thiem To: Roman Lacko I didn't do anything except type python3-pip install PySide. How would I make sure it builds against Qt4? (libqt4-devel is installed) On 03/27/2014 02:59 PM, Roman Lacko wrote: > PySide does not support Qt 5 You need to build PySide against Qt 4 > > ============================== Package version: 1.2.1 Build type: > Release Build tests: False --- Make path: /usr/bin/make Make > generator: Unix Makefiles Make jobs: --- Script directory: > /tmp/pip_build_root/PySide Sources directory: > /tmp/pip_build_root/PySide/sources Build directory: > /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release > > Install > directory: > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release > > Python > site-packages install directory: > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages > > - --- > > Python executable: /usr/bin/python3 Python includes: > /usr/include/python3.3m Python library: > /usr/lib64/libpython3.3m.so Python > prefix: /usr Python scripts: /usr/bin --- Qt qmake: /usr/bin/qmake > Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt plugins: > /usr/lib64/qt5/plugins --- OpenSSL libs: None > ============================== ... > > > > 2014-03-27 14:37 GMT+01:00 Jonas Thiem >: > > Hi everyone, > > I wanted to use PySide with Python 3, but sadly Mageia 4 doesn't > ship PySide packages for Python 3 (just 2.x). Therefore I tried > installing it with python3-pip. Unfortunately, it doesn't work: > > > Excerpt from the terminal output (full output is attached): > > ... > > [ 4%] Building CXX object > ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > > In file included from /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > > from /usr/lib64/qt5/include/QtCore/qhash.h:45, > > from /usr/lib64/qt5/include/QtCore/QHash:1, > > from > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > > > from > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > > > from > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > > > from > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > > > /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You > must build your code with position independent code if Qt was > built with -reduce-relocations. " "Compile your code with -fPIC or > -fPIE." > > # error "You must build your code with position independent code > if Qt was built with -reduce-relocations. "\ > > ^ > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > > In > function ?bool preprocess(const QString&, QFile&, const > QStringList&)?: > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > > error: > ?convertSeparators? is not a member of ?QDir? > > ... > > > So it appears all that is missing is a simple -fPIC compile > option. Is there a chance this can fixed in the near future? I'm > happy to retest stuff or modify files if given suitable > instructions for further testing. > > Regards, Jonas Thiem > > _______________________________________________ PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTNDKiAAoJEBIDTbbx8Yke6rAP/2UxKo5yG5GEOikSephJ1QmP DKIRyaEuwLqDWPnBW4qUKrJWyaWu4UiWj6HmYNNzwkhoj6ChrV8oZg2PRkjEhYAB pUejGXMVSLLnj5AqXQ4sB8BhFCwWf+YwBtmAPU911IHI9QV9tVbv04+7zqAptSUM H17lF2t3yNuJR0osqVgue3asDDRF1eSpKPEAop1/qOZgs1I7qA67xdYmY9u3bUCm zJfWsqalemBr2HfwQiqQAyugCPAFTuqDr/zlwp7Q44yiV8+deyMWM4qufUpRjxxq e7Mhj414w3pMrFwPZZqrAdFOZ8xW3ICps+T/2JFVHv16zryUeWvWK8NFhYNea258 LnPHfZD6m4mjbOrsRteIJFxJF+Bt8SZlxNssBSGp5dbOJhdQow77TJ1QnG87LGfN f+doxjF6lPw/VozV817mg+EXlrjzSQOhEpzo1eRmkuCiObneOWSxqO2sKznQmBIB dUE5N3h9n5xINfpzg+qu6v1ZkUa7TlsuwsRdwX/ZKWABvItH+BbUSKIwKLRJQWS3 h1nS3cBWxEive9OkUhT9/zsXdHg8/0w+cjg+LJKZ6NNKCfD6LzlD+1qWUyei7fPU o+eem4lPoCYdx85GHI/mC7i/0V0XIERNg+/Q2VcKft37PUwXNxVyelg+ClqcpntS B3V6c9jLoCstPX2PPCmb =ASpb -----END PGP SIGNATURE----- From backup.rlacko at gmail.com Thu Mar 27 15:23:26 2014 From: backup.rlacko at gmail.com (Roman Lacko) Date: Thu, 27 Mar 2014 15:23:26 +0100 Subject: [PySide] Fwd: Re: pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: <533432A8.6030600@googlemail.com> References: <53343144.4020206@googlemail.com> <533432A8.6030600@googlemail.com> Message-ID: please try following: python3-pip install PySide --install-option="--qmake=/path/to/qt4-qmake" 2014-03-27 15:16 GMT+01:00 Jonas Thiem : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I messed up sending this one to the list: > - -------- Original Message -------- > Subject: Re: [PySide] pypi package doesn't build on Mageia 4 due to > position dependent code > Date: Thu, 27 Mar 2014 15:10:12 +0100 > From: Jonas Thiem > To: Roman Lacko > > I didn't do anything except type python3-pip install PySide. How would > I make sure it builds against Qt4? (libqt4-devel is installed) > > On 03/27/2014 02:59 PM, Roman Lacko wrote: > > PySide does not support Qt 5 You need to build PySide against Qt 4 > > > > ============================== Package version: 1.2.1 Build type: > > Release Build tests: False --- Make path: /usr/bin/make Make > > generator: Unix Makefiles Make jobs: --- Script directory: > > /tmp/pip_build_root/PySide Sources directory: > > /tmp/pip_build_root/PySide/sources Build directory: > > /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release > > > > > Install > > > directory: > > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release > > > > > Python > > > site-packages install directory: > > > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages > > > > > - --- > > > > > Python executable: /usr/bin/python3 Python includes: > > /usr/include/python3.3m Python library: > > /usr/lib64/libpython3.3m.so Python > > prefix: /usr Python scripts: /usr/bin --- Qt qmake: /usr/bin/qmake > > Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt plugins: > > /usr/lib64/qt5/plugins --- OpenSSL libs: None > > ============================== ... > > > > > > > > 2014-03-27 14:37 GMT+01:00 Jonas Thiem > >: > > > > Hi everyone, > > > > I wanted to use PySide with Python 3, but sadly Mageia 4 doesn't > > ship PySide packages for Python 3 (just 2.x). Therefore I tried > > installing it with python3-pip. Unfortunately, it doesn't work: > > > > > > Excerpt from the terminal output (full output is attached): > > > > ... > > > > [ 4%] Building CXX object > > ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > > > > In file included from /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > > > > from /usr/lib64/qt5/include/QtCore/qhash.h:45, > > > > from /usr/lib64/qt5/include/QtCore/QHash:1, > > > > from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > > > > > > > from > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > > > > > > > from > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > > > > > > > from > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > > > > > > > /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You > > must build your code with position independent code if Qt was > > built with -reduce-relocations. " "Compile your code with -fPIC or > > -fPIE." > > > > # error "You must build your code with position independent code > > if Qt was built with -reduce-relocations. "\ > > > > ^ > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > > > > > In > > > function ?bool preprocess(const QString&, QFile&, const > > QStringList&)?: > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > > > > > error: > > > ?convertSeparators? is not a member of ?QDir? > > > > ... > > > > > > So it appears all that is missing is a simple -fPIC compile > > option. Is there a chance this can fixed in the near future? I'm > > happy to retest stuff or modify files if given suitable > > instructions for further testing. > > > > Regards, Jonas Thiem > > > > _______________________________________________ PySide mailing list > > PySide at qt-project.org > > http://lists.qt-project.org/mailman/listinfo/pyside > > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iQIcBAEBAgAGBQJTNDKiAAoJEBIDTbbx8Yke6rAP/2UxKo5yG5GEOikSephJ1QmP > DKIRyaEuwLqDWPnBW4qUKrJWyaWu4UiWj6HmYNNzwkhoj6ChrV8oZg2PRkjEhYAB > pUejGXMVSLLnj5AqXQ4sB8BhFCwWf+YwBtmAPU911IHI9QV9tVbv04+7zqAptSUM > H17lF2t3yNuJR0osqVgue3asDDRF1eSpKPEAop1/qOZgs1I7qA67xdYmY9u3bUCm > zJfWsqalemBr2HfwQiqQAyugCPAFTuqDr/zlwp7Q44yiV8+deyMWM4qufUpRjxxq > e7Mhj414w3pMrFwPZZqrAdFOZ8xW3ICps+T/2JFVHv16zryUeWvWK8NFhYNea258 > LnPHfZD6m4mjbOrsRteIJFxJF+Bt8SZlxNssBSGp5dbOJhdQow77TJ1QnG87LGfN > f+doxjF6lPw/VozV817mg+EXlrjzSQOhEpzo1eRmkuCiObneOWSxqO2sKznQmBIB > dUE5N3h9n5xINfpzg+qu6v1ZkUa7TlsuwsRdwX/ZKWABvItH+BbUSKIwKLRJQWS3 > h1nS3cBWxEive9OkUhT9/zsXdHg8/0w+cjg+LJKZ6NNKCfD6LzlD+1qWUyei7fPU > o+eem4lPoCYdx85GHI/mC7i/0V0XIERNg+/Q2VcKft37PUwXNxVyelg+ClqcpntS > B3V6c9jLoCstPX2PPCmb > =ASpb > -----END PGP SIGNATURE----- > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonasthiem at googlemail.com Thu Mar 27 16:05:45 2014 From: jonasthiem at googlemail.com (Jonas Thiem) Date: Thu, 27 Mar 2014 16:05:45 +0100 Subject: [PySide] Fwd: Re: pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: References: <53343144.4020206@googlemail.com> <533432A8.6030600@googlemail.com> Message-ID: <53343E49.1090705@googlemail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This seems to work :-) so far it's compiling happily. Many thanks! Maybe the Pypi package could somehow detect Qt5, and then throw some sort of warning? I guess that would help against accidentally compiling it with Qt5. On 03/27/2014 03:23 PM, Roman Lacko wrote: > please try following: > > python3-pip install PySide > --install-option="--qmake=/path/to/qt4-qmake" > > > 2014-03-27 15:16 GMT+01:00 Jonas Thiem >: > > I messed up sending this one to the list: -------- Original Message > -------- Subject: Re: [PySide] pypi package doesn't build on Mageia > 4 due to position dependent code Date: Thu, 27 Mar 2014 15:10:12 > +0100 From: Jonas Thiem > To: Roman Lacko > > > > I didn't do anything except type python3-pip install PySide. How > would I make sure it builds against Qt4? (libqt4-devel is > installed) > > On 03/27/2014 02:59 PM, Roman Lacko wrote: >> PySide does not support Qt 5 You need to build PySide against Qt >> 4 > >> ============================== Package version: 1.2.1 Build >> type: Release Build tests: False --- Make path: /usr/bin/make >> Make generator: Unix Makefiles Make jobs: --- Script directory: >> /tmp/pip_build_root/PySide Sources directory: >> /tmp/pip_build_root/PySide/sources Build directory: >> /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release > >> > > Install > > directory: >> /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release > >> > > Python > > site-packages install directory: > > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages > > > > --- > > > Python executable: /usr/bin/python3 Python includes: >> /usr/include/python3.3m Python library: >> /usr/lib64/libpython3.3m.so > Python >> prefix: /usr Python scripts: /usr/bin --- Qt qmake: >> /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt >> plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None >> ============================== ... > > > >> 2014-03-27 14:37 GMT+01:00 Jonas Thiem >> >> >>: > >> Hi everyone, > >> I wanted to use PySide with Python 3, but sadly Mageia 4 doesn't >> ship PySide packages for Python 3 (just 2.x). Therefore I tried >> installing it with python3-pip. Unfortunately, it doesn't work: > > >> Excerpt from the terminal output (full output is attached): > >> ... > >> [ 4%] Building CXX object >> ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > >> In file included from >> /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > >> from /usr/lib64/qt5/include/QtCore/qhash.h:45, > >> from /usr/lib64/qt5/include/QtCore/QHash:1, > >> from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > > > > > from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > > > > > from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > > > > > from > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > > > > > /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You >> must build your code with position independent code if Qt was >> built with -reduce-relocations. " "Compile your code with -fPIC >> or -fPIE." > >> # error "You must build your code with position independent >> code if Qt was built with -reduce-relocations. "\ > >> ^ > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > > > > In > > function ?bool preprocess(const QString&, QFile&, const >> QStringList&)?: > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > > > > error: > > ?convertSeparators? is not a member of ?QDir? > >> ... > > >> So it appears all that is missing is a simple -fPIC compile >> option. Is there a chance this can fixed in the near future? I'm >> happy to retest stuff or modify files if given suitable >> instructions for further testing. > >> Regards, Jonas Thiem > >> _______________________________________________ PySide mailing >> list PySide at qt-project.org > > >> http://lists.qt-project.org/mailman/listinfo/pyside > > > _______________________________________________ PySide mailing > list PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTND5EAAoJEBIDTbbx8YkeEN4P/38upkPLlyN2VcaIM0O8hCX/ 4KXBRcQgX+/fAaw1EE3TnQJObBGfDQ4uvW1BRBTYFmB0DB2KRCgF2f2DcZc7r7qc jag+G2bzoGdMs8KOf/PamVoM8B9lIBAJyM+oAt2+1HroGqqxpjWK2aDj2Vy5K0Fa xh00BBwLWS8v1u29f683DNs4ef09O5QjOmDPJUOPmRlZJXukgmjhFNNI7veBmcn+ ejmQw/iPALvgIO+JNyW9+t4RNYEBfQ3KcDKCwV1gWg/l6JF1XG6bCMqh/4QCwTJ5 Hl8fD8pkwX+O3AFlteKXw/bQI77B+60eGVtPYWuDEYOaEWfA/s0V7wuGNs6kyss4 JEsU2rVTIJtFZQ+UIJDQagH9QjDSNMlDZ4kTVyZnJi0eBPQcUkA2y2ONhpWEF9My 91B6GFETDqlEko2yFiZXDyzfL/fB1V2ikAw2quWPRtIKFwT/BHMHsRBQSlqTjdHo axkQII70MpC2qFvMwKiYVExtyjtVMfeAN4lWyIdvh2jAktwBu0DwS+sUBVpoSNPA l99WyqIRHeiAGp4zlA2snJAvh9hfhHsHkFm02pf/ya6aTQeQc8/NSmwSHWyLL/zg ry4u/4LIJmiRM0k0TJGOUmDCsLEuOZvl1sswzZTnbOEa/rTmXUsMpnLYUcTV/x4Z V8wPNT2oYsaV4VKLn1Pt =KvYi -----END PGP SIGNATURE----- From jonasthiem at googlemail.com Thu Mar 27 16:48:52 2014 From: jonasthiem at googlemail.com (Jonas Thiem) Date: Thu, 27 Mar 2014 16:48:52 +0100 Subject: [PySide] Fwd: Re: pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: <53343E49.1090705@googlemail.com> References: <53343144.4020206@googlemail.com> <533432A8.6030600@googlemail.com> <53343E49.1090705@googlemail.com> Message-ID: <53344864.8030606@googlemail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ok it finished, but it has some kind of weird error (also the code it quotes looks like Python 2.7?): changing mode of build/scripts-3.3/pyside_postinstall.py from 644 to 755 changing mode of /usr/bin/pyside_postinstall.py to 755 Installing pyside-uic script to /usr/bin Executing post install script '/usr/bin/pyside_postinstall.py'... Running process: /usr/bin/python3 /usr/bin/pyside_postinstall.py - -install /usr/bin/python3 /usr/bin/pyside_postinstall.py -install PySide package found in /usr/lib/python3.3/site-packages/PySide... Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtUiTools.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtXmlPatterns.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtXml.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtCore.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtScript.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtOpenGL.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtGui.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtMultimedia.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/phonon.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtNetwork.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtSql.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtDeclarative.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/shiboken to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtTest.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtScriptTools.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtSvg.so to /usr/lib/python3.3/site-packages/PySide. Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtHelp.so to /usr/lib/python3.3/site-packages/PySide. PySide package successfully installed in /usr/lib/python3.3/site-packages/PySide... File "/usr/lib/python3.3/site-packages/pysideuic/port_v2/load_plugin.py", line 36 except Exception, e: ^ SyntaxError: invalid syntax File "/usr/lib/python3.3/site-packages/pysideuic/port_v2/invoke.py", line 36 except IOError, e: ^ SyntaxError: invalid syntax File "/usr/lib/python3.3/site-packages/PySide/examples/widgets/movie/movie.py", line 72 print "fileName:", fileName ^ SyntaxError: invalid syntax File "/usr/lib/python3.3/site-packages/PySide/examples/itemviews/addressbook/newaddresstab.py", line 85 print "Name:", name ^ SyntaxError: invalid syntax File "/usr/lib/python3.3/site-packages/PySide/examples/itemviews/addressbook/adddialogwidget.py", line 103 print "Name:", name ^ SyntaxError: invalid syntax File "/usr/lib/python3.3/site-packages/PySide/examples/declarative/signals/qmltopy4/main.py", line 42 print s ^ SyntaxError: invalid syntax Sorry: TabError: inconsistent use of tabs and spaces in indentation (main.py, line 45) Sorry: TabError: inconsistent use of tabs and spaces in indentation (main.py, line 50) Sorry: TabError: inconsistent use of tabs and spaces in indentation (main.py, line 57) File "/usr/lib/python3.3/site-packages/PySide/examples/declarative/photoviewer/main.py", line 234 print "Must provide a username" ^ SyntaxError: invalid syntax Successfully installed PySide Cleaning up... [root at localhost jonas]# Would I need to worry about that? On 03/27/2014 04:05 PM, Jonas Thiem wrote: > This seems to work :-) so far it's compiling happily. Many thanks! > > Maybe the Pypi package could somehow detect Qt5, and then throw > some sort of warning? I guess that would help against accidentally > compiling it with Qt5. > > On 03/27/2014 03:23 PM, Roman Lacko wrote: >> please try following: > >> python3-pip install PySide >> --install-option="--qmake=/path/to/qt4-qmake" > > >> 2014-03-27 15:16 GMT+01:00 Jonas Thiem > >: > >> I messed up sending this one to the list: -------- Original >> Message -------- Subject: Re: [PySide] pypi package doesn't build >> on Mageia 4 due to position dependent code Date: Thu, 27 Mar 2014 >> 15:10:12 +0100 From: Jonas Thiem > > To: Roman Lacko >> > > >> I didn't do anything except type python3-pip install PySide. How >> would I make sure it builds against Qt4? (libqt4-devel is >> installed) > >> On 03/27/2014 02:59 PM, Roman Lacko wrote: >>> PySide does not support Qt 5 You need to build PySide against >>> Qt 4 > >>> ============================== Package version: 1.2.1 Build >>> type: Release Build tests: False --- Make path: /usr/bin/make >>> Make generator: Unix Makefiles Make jobs: --- Script directory: >>> /tmp/pip_build_root/PySide Sources directory: >>> /tmp/pip_build_root/PySide/sources Build directory: >>> /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release > >>> >>> > >> Install > >> directory: >>> /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release > >>> >>> > >> Python > >> site-packages install directory: > >> /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages > >> > > >> --- > > >> Python executable: /usr/bin/python3 Python includes: >>> /usr/include/python3.3m Python library: >>> /usr/lib64/libpython3.3m.so >> Python >>> prefix: /usr Python scripts: /usr/bin --- Qt qmake: >>> /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin >>> Qt plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None >>> ============================== ... > > > >>> 2014-03-27 14:37 GMT+01:00 Jonas Thiem >>> > >>> > >>: > >>> Hi everyone, > >>> I wanted to use PySide with Python 3, but sadly Mageia 4 >>> doesn't ship PySide packages for Python 3 (just 2.x). Therefore >>> I tried installing it with python3-pip. Unfortunately, it >>> doesn't work: > > >>> Excerpt from the terminal output (full output is attached): > >>> ... > >>> [ 4%] Building CXX object >>> ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > >>> In file included from >>> /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > >>> from /usr/lib64/qt5/include/QtCore/qhash.h:45, > >>> from /usr/lib64/qt5/include/QtCore/QHash:1, > >>> from > >> /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > >> > > > >> from > >> /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > >> > > > >> from > >> /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > >> > > > >> from > >> /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > >> > > > >> /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error >> "You >>> must build your code with position independent code if Qt was >>> built with -reduce-relocations. " "Compile your code with >>> -fPIC or -fPIE." > >>> # error "You must build your code with position independent >>> code if Qt was built with -reduce-relocations. "\ > >>> ^ > > >> /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > >> > > >> In > >> function ?bool preprocess(const QString&, QFile&, const >>> QStringList&)?: > > >> /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > >> > > >> error: > >> ?convertSeparators? is not a member of ?QDir? > >>> ... > > >>> So it appears all that is missing is a simple -fPIC compile >>> option. Is there a chance this can fixed in the near future? >>> I'm happy to retest stuff or modify files if given suitable >>> instructions for further testing. > >>> Regards, Jonas Thiem > >>> _______________________________________________ PySide mailing >>> list PySide at qt-project.org >> > >>> http://lists.qt-project.org/mailman/listinfo/pyside > > >> _______________________________________________ PySide mailing >> list PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTNEhcAAoJEBIDTbbx8YkeOzsP/il7iBK73OBFdHeH54PHFO9j wx922FjPotaeVGwlZ8Ch8D43u+wsD7W6gWkBRAIGRWNdDNYceVDyAAj278Yb27c3 HYYcHqAJyZb/34OBwk4Fx32KoTPGrQAYLXqlG6171qa1EzWPy0qNW7u/o8hEs5mf 8xILCRyZv/MhkPJ8Iq+h9KYNjNRP1rQE3fATjxsJy5C5xnFQsNlr2gZGpPE+3Co0 EWXwaSDLzpfR62YtnyXKE0X7apW/Lfvm9io/PoVhcXomHXuwsAcEwrpC+jOgDm7K v+8MKUgEOkjzoYrTYyQ+Kw2eRgsCVUz+f5C5orhYfv6g27IrRAmevpkkXhXLWFqD NZQmPTL9Zm5c4ipII7PpZXgT65YOFWz0EfKIBr0HVrNo1tRyny2M+Wdhev/lp+iu io2zS5rUMjv76juRCofL2Sd3pQpp8A39wYJWNHndw5vQXldRigRwYZs797ZJAqlS 4H4LrmaoNyQPbWRFN+T5OP/vucZ1OVtYy4KFfBflQ/cKaZ5Ii7/wNiverHl0BsDB EaNyOeU5c9QxgG3JRa6RLjMCni+1ijDBLhwprcUY1lvD0r27v/DhY3c8GbyDA3qU cLgc62FyRKqAm2hH8odnJNRh5JU2bHmnbPFQZIh3UrEHt9HA6Nmi78704SjBKm79 g/rrJYf+fe5N4bm8UJpf =Z2yo -----END PGP SIGNATURE----- From backup.rlacko at gmail.com Thu Mar 27 19:48:47 2014 From: backup.rlacko at gmail.com (Roman Lacko) Date: Thu, 27 Mar 2014 19:48:47 +0100 Subject: [PySide] Fwd: Re: pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: <53344864.8030606@googlemail.com> References: <53343144.4020206@googlemail.com> <533432A8.6030600@googlemail.com> <53343E49.1090705@googlemail.com> <53344864.8030606@googlemail.com> Message-ID: You can ignore those SyntaxErrors Regards R. 2014-03-27 16:48 GMT+01:00 Jonas Thiem : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Ok it finished, but it has some kind of weird error (also the code it > quotes looks like Python 2.7?): > > changing mode of build/scripts-3.3/pyside_postinstall.py from 644 > to 755 > changing mode of /usr/bin/pyside_postinstall.py to 755 > Installing pyside-uic script to /usr/bin > Executing post install script '/usr/bin/pyside_postinstall.py'... > Running process: /usr/bin/python3 /usr/bin/pyside_postinstall.py > - -install > /usr/bin/python3 /usr/bin/pyside_postinstall.py -install > PySide package found in /usr/lib/python3.3/site-packages/PySide... > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtUiTools.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtXmlPatterns.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtXml.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtCore.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtScript.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtOpenGL.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtGui.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtMultimedia.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/phonon.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtNetwork.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtSql.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtDeclarative.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/shiboken > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtTest.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in > /usr/lib/python3.3/site-packages/PySide/QtScriptTools.so to > /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtSvg.so > to /usr/lib/python3.3/site-packages/PySide. > Patched rpath in /usr/lib/python3.3/site-packages/PySide/QtHelp.so > to /usr/lib/python3.3/site-packages/PySide. > PySide package successfully installed in > /usr/lib/python3.3/site-packages/PySide... > File > "/usr/lib/python3.3/site-packages/pysideuic/port_v2/load_plugin.py", > line 36 > except Exception, e: > ^ > SyntaxError: invalid syntax > > File > "/usr/lib/python3.3/site-packages/pysideuic/port_v2/invoke.py", line 36 > except IOError, e: > ^ > SyntaxError: invalid syntax > > File > "/usr/lib/python3.3/site-packages/PySide/examples/widgets/movie/movie.py", > line 72 > print "fileName:", fileName > ^ > SyntaxError: invalid syntax > > File > > "/usr/lib/python3.3/site-packages/PySide/examples/itemviews/addressbook/newaddresstab.py", > line 85 > print "Name:", name > ^ > SyntaxError: invalid syntax > > File > > "/usr/lib/python3.3/site-packages/PySide/examples/itemviews/addressbook/adddialogwidget.py", > line 103 > print "Name:", name > ^ > SyntaxError: invalid syntax > > File > > "/usr/lib/python3.3/site-packages/PySide/examples/declarative/signals/qmltopy4/main.py", > line 42 > print s > ^ > SyntaxError: invalid syntax > > Sorry: TabError: inconsistent use of tabs and spaces in > indentation (main.py, line 45) > Sorry: TabError: inconsistent use of tabs and spaces in > indentation (main.py, line 50) > Sorry: TabError: inconsistent use of tabs and spaces in > indentation (main.py, line 57) > File > > "/usr/lib/python3.3/site-packages/PySide/examples/declarative/photoviewer/main.py", > line 234 > print "Must provide a username" > ^ > SyntaxError: invalid syntax > > Successfully installed PySide > Cleaning up... > [root at localhost jonas]# > > Would I need to worry about that? > > On 03/27/2014 04:05 PM, Jonas Thiem wrote: > > This seems to work :-) so far it's compiling happily. Many thanks! > > > > Maybe the Pypi package could somehow detect Qt5, and then throw > > some sort of warning? I guess that would help against accidentally > > compiling it with Qt5. > > > > On 03/27/2014 03:23 PM, Roman Lacko wrote: > >> please try following: > > > >> python3-pip install PySide > >> --install-option="--qmake=/path/to/qt4-qmake" > > > > > >> 2014-03-27 15:16 GMT+01:00 Jonas Thiem >> >: > > > >> I messed up sending this one to the list: -------- Original > >> Message -------- Subject: Re: [PySide] pypi package doesn't build > >> on Mageia 4 due to position dependent code Date: Thu, 27 Mar 2014 > >> 15:10:12 +0100 From: Jonas Thiem >> > To: Roman Lacko > >> > > > > >> I didn't do anything except type python3-pip install PySide. How > >> would I make sure it builds against Qt4? (libqt4-devel is > >> installed) > > > >> On 03/27/2014 02:59 PM, Roman Lacko wrote: > >>> PySide does not support Qt 5 You need to build PySide against > >>> Qt 4 > > > >>> ============================== Package version: 1.2.1 Build > >>> type: Release Build tests: False --- Make path: /usr/bin/make > >>> Make generator: Unix Makefiles Make jobs: --- Script directory: > >>> /tmp/pip_build_root/PySide Sources directory: > >>> /tmp/pip_build_root/PySide/sources Build directory: > >>> /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release > > > >>> > >>> > > > >> Install > > > >> directory: > >>> /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release > > > >>> > >>> > > > >> Python > > > >> site-packages install directory: > > > >> > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages > > > >> > > > > > >> --- > > > > > >> Python executable: /usr/bin/python3 Python includes: > >>> /usr/include/python3.3m Python library: > >>> /usr/lib64/libpython3.3m.so > >> Python > >>> prefix: /usr Python scripts: /usr/bin --- Qt qmake: > >>> /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin > >>> Qt plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None > >>> ============================== ... > > > > > > > >>> 2014-03-27 14:37 GMT+01:00 Jonas Thiem > >>> >> > >>> >> >>: > > > >>> Hi everyone, > > > >>> I wanted to use PySide with Python 3, but sadly Mageia 4 > >>> doesn't ship PySide packages for Python 3 (just 2.x). Therefore > >>> I tried installing it with python3-pip. Unfortunately, it > >>> doesn't work: > > > > > >>> Excerpt from the terminal output (full output is attached): > > > >>> ... > > > >>> [ 4%] Building CXX object > >>> ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > > > >>> In file included from > >>> /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > > > >>> from /usr/lib64/qt5/include/QtCore/qhash.h:45, > > > >>> from /usr/lib64/qt5/include/QtCore/QHash:1, > > > >>> from > > > >> > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > > > >> > > > > > > > >> from > > > >> > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > > > >> > > > > > > > >> from > > > >> > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > > > >> > > > > > > > >> from > > > >> > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > > > >> > > > > > > > >> /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error > >> "You > >>> must build your code with position independent code if Qt was > >>> built with -reduce-relocations. " "Compile your code with > >>> -fPIC or -fPIE." > > > >>> # error "You must build your code with position independent > >>> code if Qt was built with -reduce-relocations. "\ > > > >>> ^ > > > > > >> > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > > > >> > > > > > >> In > > > >> function ?bool preprocess(const QString&, QFile&, const > >>> QStringList&)?: > > > > > >> > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > > > >> > > > > > >> error: > > > >> ?convertSeparators? is not a member of ?QDir? > > > >>> ... > > > > > >>> So it appears all that is missing is a simple -fPIC compile > >>> option. Is there a chance this can fixed in the near future? > >>> I'm happy to retest stuff or modify files if given suitable > >>> instructions for further testing. > > > >>> Regards, Jonas Thiem > > > >>> _______________________________________________ PySide mailing > >>> list PySide at qt-project.org > >> > > >>> http://lists.qt-project.org/mailman/listinfo/pyside > > > > > >> _______________________________________________ PySide mailing > >> list PySide at qt-project.org > >> http://lists.qt-project.org/mailman/listinfo/pyside > > > > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iQIcBAEBAgAGBQJTNEhcAAoJEBIDTbbx8YkeOzsP/il7iBK73OBFdHeH54PHFO9j > wx922FjPotaeVGwlZ8Ch8D43u+wsD7W6gWkBRAIGRWNdDNYceVDyAAj278Yb27c3 > HYYcHqAJyZb/34OBwk4Fx32KoTPGrQAYLXqlG6171qa1EzWPy0qNW7u/o8hEs5mf > 8xILCRyZv/MhkPJ8Iq+h9KYNjNRP1rQE3fATjxsJy5C5xnFQsNlr2gZGpPE+3Co0 > EWXwaSDLzpfR62YtnyXKE0X7apW/Lfvm9io/PoVhcXomHXuwsAcEwrpC+jOgDm7K > v+8MKUgEOkjzoYrTYyQ+Kw2eRgsCVUz+f5C5orhYfv6g27IrRAmevpkkXhXLWFqD > NZQmPTL9Zm5c4ipII7PpZXgT65YOFWz0EfKIBr0HVrNo1tRyny2M+Wdhev/lp+iu > io2zS5rUMjv76juRCofL2Sd3pQpp8A39wYJWNHndw5vQXldRigRwYZs797ZJAqlS > 4H4LrmaoNyQPbWRFN+T5OP/vucZ1OVtYy4KFfBflQ/cKaZ5Ii7/wNiverHl0BsDB > EaNyOeU5c9QxgG3JRa6RLjMCni+1ijDBLhwprcUY1lvD0r27v/DhY3c8GbyDA3qU > cLgc62FyRKqAm2hH8odnJNRh5JU2bHmnbPFQZIh3UrEHt9HA6Nmi78704SjBKm79 > g/rrJYf+fe5N4bm8UJpf > =Z2yo > -----END PGP SIGNATURE----- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From backup.rlacko at gmail.com Thu Mar 27 19:52:22 2014 From: backup.rlacko at gmail.com (Roman Lacko) Date: Thu, 27 Mar 2014 19:52:22 +0100 Subject: [PySide] Fwd: Re: pypi package doesn't build on Mageia 4 due to position dependent code In-Reply-To: <53343E49.1090705@googlemail.com> References: <53343144.4020206@googlemail.com> <533432A8.6030600@googlemail.com> <53343E49.1090705@googlemail.com> Message-ID: good point about the Qt5 check, I will look at this tomorrow Regards R. 2014-03-27 16:05 GMT+01:00 Jonas Thiem : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > This seems to work :-) so far it's compiling happily. Many thanks! > > Maybe the Pypi package could somehow detect Qt5, and then throw some > sort of warning? I guess that would help against accidentally > compiling it with Qt5. > > On 03/27/2014 03:23 PM, Roman Lacko wrote: > > please try following: > > > > python3-pip install PySide > > --install-option="--qmake=/path/to/qt4-qmake" > > > > > > 2014-03-27 15:16 GMT+01:00 Jonas Thiem > >: > > > > I messed up sending this one to the list: -------- Original Message > > -------- Subject: Re: [PySide] pypi package doesn't build on Mageia > > 4 due to position dependent code Date: Thu, 27 Mar 2014 15:10:12 > > +0100 From: Jonas Thiem > > To: Roman Lacko > > > > > > > I didn't do anything except type python3-pip install PySide. How > > would I make sure it builds against Qt4? (libqt4-devel is > > installed) > > > > On 03/27/2014 02:59 PM, Roman Lacko wrote: > >> PySide does not support Qt 5 You need to build PySide against Qt > >> 4 > > > >> ============================== Package version: 1.2.1 Build > >> type: Release Build tests: False --- Make path: /usr/bin/make > >> Make generator: Unix Makefiles Make jobs: --- Script directory: > >> /tmp/pip_build_root/PySide Sources directory: > >> /tmp/pip_build_root/PySide/sources Build directory: > >> /tmp/pip_build_root/PySide/pyside_build/py3.3-qt5.2.0-64bit-release > > > >> > > > > Install > > > > directory: > >> /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release > > > >> > > > > Python > > > > site-packages install directory: > > > > > /tmp/pip_build_root/PySide/pyside_install/py3.3-qt5.2.0-64bit-release/lib64/python3.3/site-packages > > > > > > > > --- > > > > > > Python executable: /usr/bin/python3 Python includes: > >> /usr/include/python3.3m Python library: > >> /usr/lib64/libpython3.3m.so > > Python > >> prefix: /usr Python scripts: /usr/bin --- Qt qmake: > >> /usr/bin/qmake Qt version: 5.2.0 Qt bins: /usr/lib64/qt5/bin Qt > >> plugins: /usr/lib64/qt5/plugins --- OpenSSL libs: None > >> ============================== ... > > > > > > > >> 2014-03-27 14:37 GMT+01:00 Jonas Thiem > >> > > >> > >>: > > > >> Hi everyone, > > > >> I wanted to use PySide with Python 3, but sadly Mageia 4 doesn't > >> ship PySide packages for Python 3 (just 2.x). Therefore I tried > >> installing it with python3-pip. Unfortunately, it doesn't work: > > > > > >> Excerpt from the terminal output (full output is attached): > > > >> ... > > > >> [ 4%] Building CXX object > >> ApiExtractor/CMakeFiles/apiextractor.dir/apiextractor.cpp.o > > > >> In file included from > >> /usr/lib64/qt5/include/QtCore/qchar.h:45:0, > > > >> from /usr/lib64/qt5/include/QtCore/qhash.h:45, > > > >> from /usr/lib64/qt5/include/QtCore/QHash:1, > > > >> from > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/typesystem.h:27, > > > > > > > > > > from > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/abstractmetalang.h:27, > > > > > > > > > > from > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.h:28, > > > > > > > > > > from > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:24: > > > > > > > > > > /usr/lib64/qt5/include/QtCore/qglobal.h:996:4: error: #error "You > >> must build your code with position independent code if Qt was > >> built with -reduce-relocations. " "Compile your code with -fPIC > >> or -fPIE." > > > >> # error "You must build your code with position independent > >> code if Qt was built with -reduce-relocations. "\ > > > >> ^ > > > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp: > > > > > > > > In > > > > function ?bool preprocess(const QString&, QFile&, const > >> QStringList&)?: > > > > > > > /tmp/pip_build_root/PySide/sources/shiboken/ApiExtractor/apiextractor.cpp:273:38: > > > > > > > > error: > > > > ?convertSeparators? is not a member of ?QDir? > > > >> ... > > > > > >> So it appears all that is missing is a simple -fPIC compile > >> option. Is there a chance this can fixed in the near future? I'm > >> happy to retest stuff or modify files if given suitable > >> instructions for further testing. > > > >> Regards, Jonas Thiem > > > >> _______________________________________________ PySide mailing > >> list PySide at qt-project.org > > > > >> http://lists.qt-project.org/mailman/listinfo/pyside > > > > > > _______________________________________________ PySide mailing > > list PySide at qt-project.org > > http://lists.qt-project.org/mailman/listinfo/pyside > > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iQIcBAEBAgAGBQJTND5EAAoJEBIDTbbx8YkeEN4P/38upkPLlyN2VcaIM0O8hCX/ > 4KXBRcQgX+/fAaw1EE3TnQJObBGfDQ4uvW1BRBTYFmB0DB2KRCgF2f2DcZc7r7qc > jag+G2bzoGdMs8KOf/PamVoM8B9lIBAJyM+oAt2+1HroGqqxpjWK2aDj2Vy5K0Fa > xh00BBwLWS8v1u29f683DNs4ef09O5QjOmDPJUOPmRlZJXukgmjhFNNI7veBmcn+ > ejmQw/iPALvgIO+JNyW9+t4RNYEBfQ3KcDKCwV1gWg/l6JF1XG6bCMqh/4QCwTJ5 > Hl8fD8pkwX+O3AFlteKXw/bQI77B+60eGVtPYWuDEYOaEWfA/s0V7wuGNs6kyss4 > JEsU2rVTIJtFZQ+UIJDQagH9QjDSNMlDZ4kTVyZnJi0eBPQcUkA2y2ONhpWEF9My > 91B6GFETDqlEko2yFiZXDyzfL/fB1V2ikAw2quWPRtIKFwT/BHMHsRBQSlqTjdHo > axkQII70MpC2qFvMwKiYVExtyjtVMfeAN4lWyIdvh2jAktwBu0DwS+sUBVpoSNPA > l99WyqIRHeiAGp4zlA2snJAvh9hfhHsHkFm02pf/ya6aTQeQc8/NSmwSHWyLL/zg > ry4u/4LIJmiRM0k0TJGOUmDCsLEuOZvl1sswzZTnbOEa/rTmXUsMpnLYUcTV/x4Z > V8wPNT2oYsaV4VKLn1Pt > =KvYi > -----END PGP SIGNATURE----- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonasthiem at googlemail.com Fri Mar 28 17:39:08 2014 From: jonasthiem at googlemail.com (Jonas Thiem) Date: Fri, 28 Mar 2014 17:39:08 +0100 Subject: [PySide] PySide 1.2.1 Windows x86_64/Python 3.3 installer doesn't find Python 3 and doesn't allow manual path input Message-ID: Hi, The PySide 1.2.1 Windows x86_64/Python 3.3 installer doesn't find a python 3.3 and spits out "Python version 3.3 is needed, which was not found in registry". Ok interesting, but why can I not enter a path manually? (it doesn't let me..) And the detection should be probably fixed to work with the official Python windows installer. Steps to reproduce: 1.) Install http://www.python.org/ftp/python/3.3.5/python-3.3.5.amd64.msi and pick "for all users" and C:\Python33\ 2.) Try to install http://download.qt-project.org/official_releases/pyside/PySide-1.2.1.win32-py3.3.exe and see it fail A fix for both of those issues (lack of manual path input in case of failure, failing automatic detection with official python installer) would be neat. Regards, Jonas Thiem From backup.rlacko at gmail.com Fri Mar 28 20:26:59 2014 From: backup.rlacko at gmail.com (Roman Lacko) Date: Fri, 28 Mar 2014 20:26:59 +0100 Subject: [PySide] PySide 1.2.1 Windows x86_64/Python 3.3 installer doesn't find Python 3 and doesn't allow manual path input In-Reply-To: References: Message-ID: Hi, Dňa 28.3.2014 17:39 používateľ "Jonas Thiem" napísal: > Hi, > > The PySide 1.2.1 Windows x86_64/Python 3.3 installer doesn't find a > python 3.3 and spits out "Python version 3.3 is needed, which was not > found in registry". Ok interesting, but why can I not enter a path > manually? (it doesn't let me..) And the detection should be probably > fixed to work with the official Python windows installer. > > Steps to reproduce: > 1.) Install http://www.python.org/ftp/python/3.3.5/python-3.3.5.amd64.msi > and pick "for all users" and C:\Python33\ > 2.) Try to install > > http://download.qt-project.org/official_releases/pyside/PySide-1.2.1.win32-py3.3.exe > and see it fail > You are trying to install 32bit PySide on 64bit Python - this can not work. You need to install 64bit version of PySide from here http://download.qt-project.org/official_releases/pyside/PySide-1.2.1.win-amd64-py3.3.exe Regards R. > > A fix for both of those issues (lack of manual path input in case of > failure, failing automatic detection with official python installer) > would be neat. > > Regards, > Jonas Thiem > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonasthiem at googlemail.com Fri Mar 28 22:08:21 2014 From: jonasthiem at googlemail.com (Jonas Thiem) Date: Fri, 28 Mar 2014 22:08:21 +0100 Subject: [PySide] PySide 1.2.1 Windows x86_64/Python 3.3 installer doesn't find Python 3 and doesn't allow manual path input In-Reply-To: References: Message-ID: Yea I suppose that was the problem. Works now :-) thanks On Fri, Mar 28, 2014 at 8:26 PM, Roman Lacko wrote: > Hi, > > Dňa 28.3.2014 17:39 používateľ "Jonas Thiem" > napísal: > >> Hi, >> >> The PySide 1.2.1 Windows x86_64/Python 3.3 installer doesn't find a >> python 3.3 and spits out "Python version 3.3 is needed, which was not >> found in registry". Ok interesting, but why can I not enter a path >> manually? (it doesn't let me..) And the detection should be probably >> fixed to work with the official Python windows installer. >> >> Steps to reproduce: >> 1.) Install http://www.python.org/ftp/python/3.3.5/python-3.3.5.amd64.msi >> and pick "for all users" and C:\Python33\ >> 2.) Try to install >> >> http://download.qt-project.org/official_releases/pyside/PySide-1.2.1.win32-py3.3.exe >> and see it fail > > > You are trying to install 32bit PySide on 64bit Python - this can not work. > > You need to install 64bit version of PySide from here > http://download.qt-project.org/official_releases/pyside/PySide-1.2.1.win-amd64-py3.3.exe > > Regards > R. > >> >> >> A fix for both of those issues (lack of manual path input in case of >> failure, failing automatic detection with official python installer) >> would be neat. >> >> Regards, >> Jonas Thiem >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside From esp.home at gmail.com Fri Mar 28 23:17:57 2014 From: esp.home at gmail.com (Evgeny Prilepin) Date: Sat, 29 Mar 2014 02:17:57 +0400 Subject: [PySide] Very slow items removing from QGraphicsScene In-Reply-To: <531B38AE.6060302@gmail.com> References: <531B38AE.6060302@gmail.com> Message-ID: <5335F515.6090309@gmail.com> Hi all, I tested the removing graphic items on PyQt4 and C++ Qt4. It works correctly. The time for the removing items not increases exponentially. I think, PySide contains a bug with the garbage collection or something similar. > Hi everyone, > > My program should work with a great number of graphic items in the > graphic scene QGraphicsScene. There are hundred thousand homogeneous > items similar to QGraphicsRectItem. The items can be removed or added at > the runtime. All the items sometimes are removed from the scene. > > I have noticed that if I want to remove all the items from the scene > using “clear” method or in the loop using “removeItem” method (“clear” > works much longer), I have to wait for a long time the operation > completing, if the cleaning is used not for the first time. In this > case, the item removing, unlike the element adding that is always the > same, is extremely slow. Such a situation occurs when there are more > than several thousand items (more than 10 000). The time for the > removing items increases exponentially (see the pictures with the > attached plots). Also I have written a simple test example (please, find > the attached example), demonstrating this problem. > > At present I use PySide, version 1.2.1 (Qt 4.8.5) and Python 2.7.6 > x86/x64 on OS Windows 7 x64. > > CPU: Intel Core 2 Quad 6600 > RAM: 6 Gb > > -- > Best regards, > Evgeny -- Best regards, Evgeny From fabio at bertux.com Sat Mar 29 15:35:28 2014 From: fabio at bertux.com (Fabio Berton) Date: Sat, 29 Mar 2014 11:35:28 -0300 Subject: [PySide] PySide + Qt Embedded Message-ID: <1450e40ae9c.520759483672731736.6912581656056061873@bertux.com> I need to run PySide on Qt Linux Embedded environment without a X11 server, with framebuffer support. PySide support the Linux Framebuffer? Can I run PySide on Linux without a X server? Fabio Berton Engenharia de Computação - UFSM -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at seanfisk.com Sat Mar 29 21:14:42 2014 From: sean at seanfisk.com (Sean Fisk) Date: Sat, 29 Mar 2014 16:14:42 -0400 Subject: [PySide] PySide documentation on Qt Assistant In-Reply-To: <1396118879.4818.2.camel@localhost.localdomain> References: <1395335105.6334.3.camel@localhost.localdomain> <1396118879.4818.2.camel@localhost.localdomain> Message-ID: Hello Jorge, That looks like a Sphinx issue, actually. It looks like it's trying to create an inheritance diagram using Graphviz . Do you have it installed? (try 'dot -V'). Whether you have it installed or not, if that's the problem, it should be warning you in a better way. I would hedge a guess that the qthelp builder gets significantly less attention than, say, the HTML builder. Anyway, let me know what the results are. Cheers, -- Sean Fisk On Sat, Mar 29, 2014 at 2:47 PM, Jorge Araya Navarro wrote: > Hello, Sean! > > I changed the target, and ran build_docs.bash. But this problem appeared > when building the pyside documentation: > > # Sphinx version: 1.1.3 > # Python version: 2.7.6 > # Docutils version: 0.11 release > # Jinja2 version: 2.7.2 > Traceback (most recent call last): > File "/usr/lib/python2.7/site-packages/sphinx/cmdline.py", line 189, in main > app.build(force_all, filenames) > File "/usr/lib/python2.7/site-packages/sphinx/application.py", line 204, in build > self.builder.build_update() > File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 196, in build_update > 'out of date' % len(to_build)) > File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 252, in build > self.write(docnames, list(updated_docnames), method) > File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 292, in write > self.write_doc(docname, doctree) > File "/usr/lib/python2.7/site-packages/sphinx/builders/html.py", line 419, in write_doc > self.docwriter.write(doctree, destination) > File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write > self.translate() > File "/usr/lib/python2.7/site-packages/sphinx/writers/html.py", line 38, in translate > self.document.walkabout(visitor) > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout > if child.walkabout(visitor): > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout > if child.walkabout(visitor): > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 166, in walkabout > visitor.dispatch_visit(self) > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1882, in dispatch_visit > return method(node) > File "/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/doc/inheritance_diagram.py", line 340, in html_visit_inheritance_diagram > alt='Inheritance diagram of ' + node['content']) > File "/usr/lib/python2.7/site-packages/sphinx/ext/graphviz.py", line 219, in render_dot_html > mapfile = open(outfn + '.map', 'rb') > IOError: [Errno 2] No such file or directory: '/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/build/doc/qthelp/_images/inheritance-b09cc3548cdf92177ba3487cbdadc5722f725138.png.map' > > > > No file exists on > '/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/build/doc/qthelp/_images/', > I'm not sure what could be causing this issue! > > -- > *Pax et bonum.* > Jorge Araya Navarro. > Diseñador publicitario, programador Python/C++ y colaborador en Parabola > GNU/Linux-libre. > > El vie, 21-03-2014 a las 15:14 -0400, Sean Fisk escribió: > > Hello Jorge, > > I have created a script which I > used to build the PySide docs which are currently up at > http://pyside.github.io/docs/pyside/. If you look in build_docs.bash, > there are a couple places where patches are applied to adjust the targets. > That is likely where you will want to go to change html to qthelp. > Running qcollectiongenerator could be done by adding a couple of CMake > rules after Sphinx runs. > > There are a large number of gotchas when building the PySide docs, for > example that qdoc3 from Qt 4.6.4 is the oldest version capable of > building these docs. Therefore I would recommend simply modifying the > scripts to do what you want. > > Hope this helps! > > > > > > -- > > Sean Fisk > > > > On Thu, Mar 20, 2014 at 1:05 PM, Jorge Araya Navarro > wrote: > > Hello! > > I'm in a journey of generating important python-related documentation of > many important projects to view them on Qt Assistant. I'm struggling to > understand how I can generate the PySide documentation, or how could I > change the CMakeLists files to add the command `sphinx-build -b qthelp . > build/qthelp` and then `qcollectiongenerator-qt4 build/qthelp/PySide.qhcp` > so the documentation for Qt Assistant can be generated. > > Any help will be very appreciated! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elcorreo at deshackra.com Sat Mar 29 23:34:51 2014 From: elcorreo at deshackra.com (Jorge Araya Navarro) Date: Sat, 29 Mar 2014 16:34:51 -0600 Subject: [PySide] PySide documentation on Qt Assistant In-Reply-To: References: <1395335105.6334.3.camel@localhost.localdomain> <1396118879.4818.2.camel@localhost.localdomain> Message-ID: <1396132491.9525.2.camel@localhost.localdomain> Hello, Sean! Yes, I have it installed: <(jorge at abril)---(sáb mar 29 16:31:38)> [/][1] $ dot -V dot - graphviz version 2.36.0 (20140111.2315) it seems that something isn't generated before sphinx try to use it with graphviz. I successfully build the Python documentation and it have a chart or something like that and I think it uses graphviz. So, maybe one step is missing when generating the documentation with qthelp builder. -- Pax et bonum. Jorge Araya Navarro. Diseñador publicitario, programador Python/C++ y colaborador en Parabola GNU/Linux-libre. El sáb, 29-03-2014 a las 16:14 -0400, Sean Fisk escribió: > Hello Jorge, > > > > That looks like a Sphinx issue, actually. It looks like it's trying to > create an inheritance diagram using Graphviz. Do you have it > installed? (try 'dot -V'). > > > > Whether you have it installed or not, if that's the problem, it should > be warning you in a better way. I would hedge a guess that the qthelp > builder gets significantly less attention than, say, the HTML builder. > Anyway, let me know what the results are. > > Cheers, > > > > > > -- > Sean Fisk > > > > > On Sat, Mar 29, 2014 at 2:47 PM, Jorge Araya Navarro > wrote: > > Hello, Sean! > > I changed the target, and ran build_docs.bash. But this > problem appeared when building the pyside documentation: > > > # Sphinx version: 1.1.3 > # Python version: 2.7.6 > # Docutils version: 0.11 release > # Jinja2 version: 2.7.2 > Traceback (most recent call last): > File "/usr/lib/python2.7/site-packages/sphinx/cmdline.py", line 189, in main > app.build(force_all, filenames) > File "/usr/lib/python2.7/site-packages/sphinx/application.py", line 204, in build > self.builder.build_update() > File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 196, in build_update > 'out of date' % len(to_build)) > File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 252, in build > self.write(docnames, list(updated_docnames), method) > File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 292, in write > self.write_doc(docname, doctree) > File "/usr/lib/python2.7/site-packages/sphinx/builders/html.py", line 419, in write_doc > self.docwriter.write(doctree, destination) > File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write > self.translate() > File "/usr/lib/python2.7/site-packages/sphinx/writers/html.py", line 38, in translate > self.document.walkabout(visitor) > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout > if child.walkabout(visitor): > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout > if child.walkabout(visitor): > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 166, in walkabout > visitor.dispatch_visit(self) > File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1882, in dispatch_visit > return method(node) > File "/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/doc/inheritance_diagram.py", line 340, in html_visit_inheritance_diagram > alt='Inheritance diagram of ' + node['content']) > File "/usr/lib/python2.7/site-packages/sphinx/ext/graphviz.py", line 219, in render_dot_html > mapfile = open(outfn + '.map', 'rb') > IOError: [Errno 2] No such file or directory: '/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/build/doc/qthelp/_images/inheritance-b09cc3548cdf92177ba3487cbdadc5722f725138.png.map' > > > > No file exists on > '/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/build/doc/qthelp/_images/', I'm not sure what could be causing this issue! > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltanure at gmail.com Sun Mar 30 21:32:04 2014 From: ltanure at gmail.com (Lucas Tanure) Date: Sun, 30 Mar 2014 16:32:04 -0300 Subject: [PySide] [Pyside] Inheritance error. Message-ID: Code: ################################ from PySide import QtCore, QtGui import sys class AGraphicsScene(QtGui.QGraphicsScene): def __init__(self, parent=None): super(AGraphicsScene, self).__init__(parent) if __name__ == "__main__": app = QtGui.QApplication(sys.argv) A = AGraphicsScene() tt = QtGui.QGraphicsPixmapItem(None, A) exit() sys.exit(app.exec_()) ################################# Error: ################################# tanure at archDesk ~ $ python2 inheritance.py Traceback (most recent call last): File "inheritance.py", line 13, in tt = QtGui.QGraphicsPixmapItem(None, A) TypeError: 'PySide.QtGui.QGraphicsPixmapItem' called with wrong argument types: PySide.QtGui.QGraphicsPixmapItem(NoneType, AGraphicsScene) Supported signatures: PySide.QtGui.QGraphicsPixmapItem(PySide.QtGui.QGraphicsItem = None, PySide.QtGui.QGraphicsScene = None) PySide.QtGui.QGraphicsPixmapItem(PySide.QtGui.QPixmap, PySide.QtGui.QGraphicsItem = None, PySide.QtGui.QGraphicsScene = None) ################################# Why ? -- Lucas A. Tanure Alves +55 (19) 988176559 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltanure at gmail.com Sun Mar 30 21:47:15 2014 From: ltanure at gmail.com (Lucas Tanure) Date: Sun, 30 Mar 2014 16:47:15 -0300 Subject: [PySide] [Pyside] Inheritance error. In-Reply-To: References: Message-ID: This same code works fine with PyQt4. My version of PySide is 1.2.1 -- Lucas A. Tanure Alves +55 (19) 988176559 -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.garcia at upf.edu Mon Mar 31 09:08:37 2014 From: david.garcia at upf.edu (=?UTF-8?B?RGF2aWQgR2FyY8OtYSBHYXJ6w7Nu?=) Date: Mon, 31 Mar 2014 09:08:37 +0200 Subject: [PySide] PySide C++ hybrid app. In-Reply-To: <912865716e6f47a2bd40cc77f9a1bc2a@BN1PR01MB184.prod.exchangelabs.com> References: <912865716e6f47a2bd40cc77f9a1bc2a@BN1PR01MB184.prod.exchangelabs.com> Message-ID: <53391475.9070604@upf.edu> I am the author of that clam code, coded by taking lots of snippets around. I am glad to see that putting altogether was useful to somebody else :-) But high level functions like those, with a more reliable base than what i coded, are a must for sip and shiboken. What i missed is some way of identifying objects wrapped with Sip and objects wrapped with shiboken, in order to mix them and being able to use conditional code. I asked here some time ago but i got no answer. If you find it useful i could setup a github for the wrapping code, so that anyone could enhance it. David. El 17/03/14 18:42, ntod8729 at uni.sydney.edu.au ha escrit: > Hi Michal, > > You need to first embed the Python interpreter into your C++ application. You can find the relevant information on doing that here . Section 5.3 shows you how you can call a Python function from C++. You then need to wrap your function arguments as PyObects using either the python C API (for types such as int, char * etc.) or shiboken (for Qt classes) in order to pass them to your Python function. You will also need to unwrap any return types to retrieve a pointer to use in C++. There is some code that demonstrates the wrapping/unwrapping here in some of the source from the CLAM project. Admittedly I haven't tried the shiboken code myself as I had already rolled my own before stumbling across this, but I based some code on their sipunwrap source for doing the same thing with PyQt without any problems. > > Hope this helps, > Nick ? > > > ________________________________ > From: pyside-bounces+ntod8729=uni.sydney.edu.au at qt-project.org on behalf of Michał Pachocki > Sent: Monday, 17 March 2014 3:39 PM > To: pyside at qt-project.org > Subject: [PySide] PySide C++ hybrid app. > > Hello, > > In tutorial "SuperHybrids part 2, now Qt + PySide [1]" there is a description how run python code from c++ lib, but the app is running from python. How to make calls to PySide from native C++ app, so C++ objects will be visible from Python and vice-versa? > > [1] http://lynxline.com/superhybrids-part-2-now-qt-pyside/ > > regards, > mp > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > From ltanure at gmail.com Mon Mar 31 13:08:35 2014 From: ltanure at gmail.com (Lucas Tanure) Date: Mon, 31 Mar 2014 08:08:35 -0300 Subject: [PySide] [Pyside] Inheritance error. In-Reply-To: References: Message-ID: Sorry, My mistake. The code is wrong. QtGui.QGraphicsPixmapItem is to set a parent item for the item, not the scene for the item. Thanks -- Lucas A. Tanure Alves +55 (19) 988176559 On Sun, Mar 30, 2014 at 4:47 PM, Lucas Tanure wrote: > This same code works fine with PyQt4. > My version of PySide is 1.2.1 > > > -- > Lucas A. Tanure Alves > +55 (19) 988176559 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From heckiheckiheckipempem at gmx.de Tue Mar 25 12:56:46 2014 From: heckiheckiheckipempem at gmx.de (Vernalia Sunt) Date: Tue, 25 Mar 2014 12:56:46 +0100 Subject: [PySide] QPainter.drawStaticText missing Message-ID: An HTML attachment was scrubbed... URL: From kartelo at gmx.com Sat Mar 29 19:47:59 2014 From: kartelo at gmx.com (Jorge Araya Navarro) Date: Sat, 29 Mar 2014 12:47:59 -0600 Subject: [PySide] PySide documentation on Qt Assistant In-Reply-To: References: <1395335105.6334.3.camel@localhost.localdomain> Message-ID: <1396118879.4818.2.camel@localhost.localdomain> Hello, Sean! I changed the target, and ran build_docs.bash. But this problem appeared when building the pyside documentation: # Sphinx version: 1.1.3 # Python version: 2.7.6 # Docutils version: 0.11 release # Jinja2 version: 2.7.2 Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/sphinx/cmdline.py", line 189, in main app.build(force_all, filenames) File "/usr/lib/python2.7/site-packages/sphinx/application.py", line 204, in build self.builder.build_update() File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 196, in build_update 'out of date' % len(to_build)) File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 252, in build self.write(docnames, list(updated_docnames), method) File "/usr/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 292, in write self.write_doc(docname, doctree) File "/usr/lib/python2.7/site-packages/sphinx/builders/html.py", line 419, in write_doc self.docwriter.write(doctree, destination) File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write self.translate() File "/usr/lib/python2.7/site-packages/sphinx/writers/html.py", line 38, in translate self.document.walkabout(visitor) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 166, in walkabout visitor.dispatch_visit(self) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1882, in dispatch_visit return method(node) File "/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/doc/inheritance_diagram.py", line 340, in html_visit_inheritance_diagram alt='Inheritance diagram of ' + node['content']) File "/usr/lib/python2.7/site-packages/sphinx/ext/graphviz.py", line 219, in render_dot_html mapfile = open(outfn + '.map', 'rb') IOError: [Errno 2] No such file or directory: '/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/build/doc/qthelp/_images/inheritance-b09cc3548cdf92177ba3487cbdadc5722f725138.png.map' No file exists on '/home/jorge/Escritorio/pyside-docs-master/prefix/src/pyside/build/doc/qthelp/_images/', I'm not sure what could be causing this issue! -- Pax et bonum. Jorge Araya Navarro. Diseñador publicitario, programador Python/C++ y colaborador en Parabola GNU/Linux-libre. El vie, 21-03-2014 a las 15:14 -0400, Sean Fisk escribió: > Hello Jorge, > > I have created a script which I used to build the PySide docs which > are currently up at http://pyside.github.io/docs/pyside/. If you look > in build_docs.bash, there are a couple places where patches are > applied to adjust the targets. That is likely where you will want to > go to change html to qthelp. Running qcollectiongenerator could be > done by adding a couple of CMake rules after Sphinx runs. > > There are a large number of gotchas when building the PySide docs, for > example that qdoc3 from Qt 4.6.4 is the oldest version capable of > building these docs. Therefore I would recommend simply modifying the > scripts to do what you want. > > Hope this helps! > > > > > > > -- > Sean Fisk > > > > > On Thu, Mar 20, 2014 at 1:05 PM, Jorge Araya Navarro > wrote: > > Hello! > > I'm in a journey of generating important python-related > documentation of many important projects to view them on Qt > Assistant. I'm struggling to understand how I can generate the > PySide documentation, or how could I change the CMakeLists > files to add the command `sphinx-build -b qthelp . > build/qthelp` and then `qcollectiongenerator-qt4 > build/qthelp/PySide.qhcp` so the documentation for Qt > Assistant can be generated. > > Any help will be very appreciated! > -------------- next part -------------- An HTML attachment was scrubbed... URL: