[PyQt] SIP/Kinetic task
I have some immediate need to test to see if PyQt will be able to satisfy my needs. I have tried QtScript first, but that turns out not to be able to share QtScript-generated objects with the C++ side (even if derived from QObject). The new animation stuff is in Qt master branch, and the QtScript stuff in in the bindings generator's 4.6 branch. I need to test and see that PyQt will work for my needs (including being able to use a script-defined Python object) with these classes. I am trying to get these patched in by using SIP, but it isn't going well. I was hoping maybe someone out there would be able to do these and post the results ASAP, along with how to patch it into the existing PyQt or provide as a module. I'd be willing provide a little cash incentive (via paypal) to get this done "properly" and ASAP. I don't care what you do, they can go right back into PyQt. I just need these done. I will of course be plugging away on my own, but I've not made it far. (I'm stuck at a SIP error on a line number that is greater than the number of lines in my SIP file, and pyqtconfig doesn't import for some reason, but I built everything ok, and I can use PyQt ok.) Classes I need immediately for my test: * QAbstractAnimation * QAnimationGroup * QEasingCurve * QParallelAnimationGroup * QPropertyAnimation * QSequentialAnimationGroup * QVariantAnimation Not so immediate, but would like to have them eventually: * QGraphicsWidget * QAbstractState * QAbstractTransition * QActionState * QEventTransition * QFinalState * QHistoryState * QKeyEventTransition * QMouseEventTransition * QSignalEvent * QSignalTransition * QState * QStateAction * QStateFinishedEvent * QStateFinishedTransition * QStateInvokeMethodAction * QtStateMachine * QTransition Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] memory can't be "read"
There is a pointer that is referencing something outside of the address space of your program. Its a bad pointer. Since you are closing your program, that means your destructors are being called, memory freed. Likely, you have stored a pointer to a freed block and are trying to use it. perhaps something in a QObject hierarchy that was already deleted? - Original Message From: Arve Knudsen To: Mario Daniel Carugno ; pyqt@riverbankcomputing.com Sent: Friday, July 10, 2009 4:41:40 PM Subject: Re: [PyQt] memory can't be "read" Come to think of it, an idea might be to run PyQt example programs and see if they work properly, to rule out problems on that level. On 7/10/09, Arve Knudsen wrote: > This should simply mean there has been a memory error (segfault) in > the application, and as such you'd need to debug in order to pinpoint > it. > > On 7/10/09, Mario Daniel Carugno wrote: >> Hello, i was trying to run a pyqt application on windows. It works, >> but when i close it, the following error appears: >> >> The instruction at "0x018f9098" references memory at "0x00a8c448". >> The memory can't be "read" >> >> The message could be not exact in english since i'm translating it from >> spanish. >> I've seen this error before, i think it's a common issue on windows. >> Do anybody know how to solve it ? >> Thanks >> ___ >> PyQt mailing listPyQt@riverbankcomputing.com >> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> > > -- > Sent from my mobile device > -- Sent from my mobile device ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QMatrix transformations in QGraphicsView
Well, with the upcoming animation classes, (which I am still looking for help with) You'd best make a small proxy class/API to handle the things that would transform its matrix. Ideally, you would expose these as properties for use with QPropertyAnimation. The proxy class holds all the component vlaues (x,y,z) rotations/scales, etc.then simply calls item->setTransform(QTransform().rotate(xRot, Qt::XAxis).rotate()) after each property update. What I then do is PropertyProxy proxy(item); proxy->setXRotation(45); etc., and don't worry about modifying the item. - Original Message From: Luca Fasano To: pyqt@riverbankcomputing.com Sent: Monday, July 13, 2009 9:22:36 AM Subject: [PyQt] QMatrix transformations in QGraphicsView Hi all, is there any Qt Signal or event handler to handle QGraphicsView transformations which modify its QMatrix (for example scalings, rotations, ...)? Until now I overrided standard QGraphisView transformation methods (i.e. scale(), rotate(), ...) and emitted custom signals in these methods. But I don't think this is the better way to solve the problem. I'm using PyQt. Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Small paid development task
I mentioned last week that I was looking to get some of the Kinetic project's bindings into PyQt. Unfortunately, it is going slow, and my time has had me working things where I am more productive. I am now offering anyone up to $200US via paypal to get these patched into the latest PyQt 4.5.2 snapshot. I am hoping this code will be done in a way (quality, style, license) that it can be used by Phil in the PyQt 4.6 release. I just need to test these features sooner than later, and the next Qt release is 6-9 months off. In order to get these classes, you'll have to get Qt/master or Qt/master-stable out of the git repo. Part of deleivery, aside from sip files is to then provide instructions on how to drop it into a PyQt 4.5.2 installation. Classes I need immediately for my test: ($100) * QAbstractAnimation * QAnimationGroup * QEasingCurve * QParallelAnimationGroup * QPropertyAnimation * QSequentialAnimationGroup * QVariantAnimation Not so immediate, but would like to have them eventually: ($100) * QGraphicsWidget * QAbstractState * QAbstractTransition * QActionState * QEventTransition * QFinalState * QHistoryState * QKeyEventTransition * QMouseEventTransition * QSignalEvent * QSignalTransition * QState * QStateAction * QStateFinishedEvent * QStateFinishedTransition * QStateInvokeMethodAction * QtStateMachine * QTransition I figure it's a cool opportunity to get paid for something that has to be done anyway. Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Small paid development task
Well no one jumped at my offer. I am curious, what would it take? - Original Message From: Jason H To: pyqt@riverbankcomputing.com Sent: Tuesday, July 14, 2009 4:58:29 PM Subject: [PyQt] Small paid development task I mentioned last week that I was looking to get some of the Kinetic project's bindings into PyQt. Unfortunately, it is going slow, and my time has had me working things where I am more productive. I am now offering anyone up to $200US via paypal to get these patched into the latest PyQt 4.5.2 snapshot. I am hoping this code will be done in a way (quality, style, license) that it can be used by Phil in the PyQt 4.6 release. I just need to test these features sooner than later, and the next Qt release is 6-9 months off. In order to get these classes, you'll have to get Qt/master or Qt/master-stable out of the git repo. Part of deleivery, aside from sip files is to then provide instructions on how to drop it into a PyQt 4.5.2 installation. Classes I need immediately for my test: ($100) * QAbstractAnimation * QAnimationGroup * QEasingCurve * QParallelAnimationGroup * QPropertyAnimation * QSequentialAnimationGroup * QVariantAnimation Not so immediate, but would like to have them eventually: ($100) * QGraphicsWidget * QAbstractState * QAbstractTransition * QActionState * QEventTransition * QFinalState * QHistoryState * QKeyEventTransition * QMouseEventTransition * QSignalEvent * QSignalTransition * QState * QStateAction * QStateFinishedEvent * QStateFinishedTransition * QStateInvokeMethodAction * QtStateMachine * QTransition I figure it's a cool opportunity to get paid for something that has to be done anyway. Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] qt_set_sequence_auto_mnemonic
Is anyone else getting this with the latest snapshot? sipQtGuicmodule.o:sipQtGuicmodule.cpp:(.text+0x132fa): undefined reference to `qt_set_sequence_auto_mnemonic(bool)' collect2: ld returned 1 exit status platform = win32-g++ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] GUI freezing when running large function in QThread
This sounds like the GIL. Separate the validation to another process, not another thread. Use non-blocking io (Qt's default) do get yoru GUI responsive again. - Original Message From: Brent Villalobos To: "pyqt@riverbankcomputing.com" Sent: Monday, July 20, 2009 7:35:56 PM Subject: [PyQt] GUI freezing when running large function in QThread I'm trying to write a "validation" thread that will run persistently throughout my PyQt program and validate that user has entered the correct values in the fields. The validation thread calls a function in a separate python module that shouldn't know anything about PyQt since it is a general-purpose module that runs in both gui and non-gui applications. The problem is that my GUI slows way down where actions like mouse clicks aren't recognized until the validation function finishes. The validation function is doing some mild CPU and I/O work, but nothing that peaks out the processor or disk. Unfortunately I don't have a simple case to show at this time, but perhaps people have run into a similar issue in past. Anyone have any suggestions how I can make a function that runs in a QThread more "gui-friendly" without adding any Qt-specific calls to it? Thanks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] TypeError: unable to convert a QVariant
TypeError: unable to convert a QVariant of type 6 to a QMetaType of type 12738896 I have that error message. I have python-defined class that provides a property as: class X (QObject): xScale = pyqtProperty("double", getScaleX, setScaleX) then Qt tries to update the property value using a QVariant. According to QMetaType.typeName(12738896) the type is "None", but this meta type number changes every time I run the script. How can I fix this so either the conversion is not needed or it can happen? Thanks Using PyQt 4.5.2-snapshot ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Menu Item Opening Web Page?
I think this is a general Qt question... So maybe try the regular Qt channel/list But I believe the class you want is QDesktopServices - Original Message From: Brent Villalobos To: "pyqt@riverbankcomputing.com" Sent: Wednesday, July 29, 2009 1:26:28 PM Subject: [PyQt] Menu Item Opening Web Page? Is there a way to create a QAction object (aka, what is created when you add an item to a menu bar in Designer) that links to a web page? For example, I want to create a "User Documentation" menu option that will just open up a specific web page using the default browser. Qt must have some sort of smarts for this because if I create a hyperlink in a text field it will do just that. I'm just trying to figure out how to do that with menu options. Any thoughts? -Brent ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt without X11
Without X11, or Windows, or some other graphics system, there is no QPaintDevice for you to draw anything with. If you really don't have a display, you'd nee dot use a virtual frame buffer of the same quality as you'd expect to capture, that is XxY and Zbpp. All the widgets expect some kind of paint device to paint to. Hrm, I wonder if you could get away with an SVG paint device... - Original Message From: arnau To: pyqt@riverbankcomputing.com Sent: Wednesday, July 29, 2009 6:02:57 PM Subject: [PyQt] PyQt without X11 Hello, I was wondering if it was possible to run PyQt without a X11 server when no GUI is going to be used. I've tried with GUIenabled=False, but I still get a segmentation fault: --- GNU/Linux Debian Sid python 2.5.4 python-qt 4.5.1 libqt4-webkit 4.5.2 $ python Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) [GCC 4.3.3] on linux >>> from PyQt4.QtGui import QApplication >>> from PyQt4.QtWebKit import QWebPage >>> QApplication([], False) >>> webpage = QWebPage() Segmentation fault --- It might be a FAQ, but I've been unable to find an answer, sorry. thanks, arnau --- http://code.google.com/p/spynner/ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Printing a widget
Are you accounting for the higher DPI of printers (300, 600) vs that of the screen (72 or 90)? You'll need to scale accordingly. - Original Message From: Robert J. Hansen To: pyqt@riverbankcomputing.com Sent: Thursday, July 30, 2009 1:58:59 PM Subject: [PyQt] Printing a widget For a piece of code I'm working on, I need the ability to render a QWidget to the printer directly. The logic goes something like this: def printout(self): widget = self.tab_widget.currentWidget() if widget == None: # The 'print' button should've been disabled; # do so now. self.update_ui() return try: widget.printout() except: painter = QPainter(self.get_printer()) rectangle = painter.viewport() size = widget.size() size.scale(rectangle.size(), Qt.KeepAspectRatio) painter.setViewport(rectangle.x(), rectangle.y(), size.width(), size.height()) widget.render(painter) ... Unfortunately, this code does not seem to work. Something gets printed, but it's such a tiny postage stamp that it's not usable for my purposes. For my tests the widget has been a QLabel; the 'except' block is executed. What I'm looking for is some way to print such that the widget's width spans the width of the page, and its length will be split up among multiple pages if necessary. If anyone can give me the magic invocation that will do this, or can direct me to the proper part of the PyQt documentation that tells how to do this, I would be deeply appreciative. Thank you! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Printing a widget
Check labs.trolltech.com They recently (since 4.5's release) had an article about improving rendering on higher DPI screens. Me thinks this would give you clues. - Original Message From: Robert J. Hansen To: Jason H Cc: pyqt@riverbankcomputing.com Sent: Friday, July 31, 2009 12:03:24 AM Subject: Re: [PyQt] Printing a widget > Are you accounting for the higher DPI of printers (300, 600) vs that of the > screen (72 or 90)? You'll need to scale accordingly. I am not; thank you. Now for a follow-up question: is there any way to programmatically discover the DPI of the screen? QPrinter has a .resolution() which I'm assuming will give me the necessary DPI, but I don't know where I'd look in PyQt to find the screen DPI. Once again, thanks for the answer to my question -- I hope you'll indulge another. :) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Make widget look disabled
What in the world you are trying to do? I seriously question your logic... And it's not a PyQt question. But what about setting the stylesheet to match a disabled one? From: Anita Westman To: PyQt@riverbankcomputing.com Sent: Friday, July 31, 2009 2:02:25 PM Subject: [PyQt] Make widget look disabled Make widget look disabled How would I make a widget look disabled with it actually being enabled? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Make widget look disabled
Why wouldn't you what to just use up/down (tristate) buttons? You can set a widget to get mouse events even when the mouse is not down, but I do not know if the enabling changes that. From: Anita Westman To: Jason H ; PyQt@riverbankcomputing.com Sent: Friday, July 31, 2009 2:51:05 PM Subject: RE: [PyQt] Make widget look disabled Make widget look disabled I have 4 widgets. The widget that is currently active has a border around the frame. I want the user to be able to select the other 3 widgets, but while they are not selected I want them to look disabled. When I disable using setEnabled(False), I can't get the mouse events for those widgets to unselect the last frame and draw a border around the newly selected frame. -Original Message----- >From: Jason H > [mailto:scorp...@yahoo.com] >Sent: Friday, July 31, 2009 2:46 > PM >To: Anita Westman; PyQt@riverbankcomputing.com >Subject: > Re: [PyQt] Make widget look disabled > > >What in the world you are trying to do? > >I seriously question your > logic... > >And it's not a PyQt question. > >But what about setting > the stylesheet to match a disabled one? > > > > > From: Anita Westman > >To: > PyQt@riverbankcomputing.com >Sent: Friday, July 31, 2009 2:02:25 > PM >Subject: [PyQt] Make > widget look disabled > > >How would I make a widget look disabled with it > actually being enabled? > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Stream Video
Not a PyQt issue But I am an enabler. FFMPEG. From: Marcus Tenório. To: pyqt@riverbankcomputing.com Sent: Thursday, August 6, 2009 4:17:57 PM Subject: [PyQt] Stream Video Anybody nows how to do this? -- Marcus Tenório "And I Know, even as we face this hungry beast and his corps, he may take our lives here today, but he will never take everything" Academic Unit of Electrical Engineering - UAEE - www.ee.ufcg.edu.br Electrical Engineering and Informatics Center - CEEI - www.ceei.ufcg.edu.br Federal University of Campina Grande - UFCG - www.ufcg.edu.br Robotic's Study and Research Group - eROBOTICA - http://www.embedded.ufcg.edu.br/erobotica/ Embedded Systems and Pervasive Computing Lab- Embedded- http://embedded.ufcg.edu.br/ Percomp- http://wiki.percomp.org/index.php/Home ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] why pyqt can't creat code
.../.\uic is not a valid path. From: caothucodon 123 To: PyQt@riverbankcomputing.com Sent: Friday, August 7, 2009 5:50:31 PM Subject: [PyQt] why pyqt can't creat code when i chose view code then it show dailog " code genneration faild unable to launch .../.\uic." . what it maining ? now how i can view code and creat code ? thank ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt v4.6 and SIP v4.9 Snapshots
configure.py -p win32-g++ mingw32-make ... makefile:26: warning: ignoring old commands for target `.c.o' g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -Wl,-subsystem,console -Wl,-s -o sip.pyd siplib.o apiversions.o descriptors.o qtlib.o threads.o objmap.o bool.o -LC:\Python25\libs -lpython25 siplib.o:siplib.c:(.text+0x6f40): undefined reference to `_PyUnicode_FromStringAndSize' siplib.o:siplib.c:(.text+0x7040): undefined reference to `_PyUnicode_FromStringAndSize' siplib.o:siplib.c:(.text+0x71d0): undefined reference to `_PyUnicode_FromStringAndSize' collect2: ld returned 1 exit status mingw32-make[1]: *** [sip.pyd] Error 1 mingw32-make[1]: Leaving directory `C:/Qt/sip-4.9-snapshot-20090808/siplib' mingw32-make: *** [all] Error 2 With Python 2.5 - Original Message From: Phil Thompson To: PyQt Mailing List Sent: Sunday, August 9, 2009 5:23:48 AM Subject: [PyQt] PyQt v4.6 and SIP v4.9 Snapshots The current PyQt and SIP snapshots are now driven from the v4.6 and v4.9 branches respectively. These implement the (selectable) incompatible API changes described in the Roadmap. You can now decide whether, for example, QVariant and/or QString should be automatically converted to and from the corresponding Python types. The default for Python v3 is to use the newer APIs, so I have updated the installer for Python v3.1. All the demos should work with both Python v2 and v3. I've decided not to look at individual methods to see if they should be made more Pythonic - raising an exception rather than returning an error flag for example. I don't think there are too many of these and they seem to be in areas that duplicate standard Python - so if you want a more Pythonic API then use the Python API. Happy to discuss further if somebody wants to make a strong argument the other way. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] image tool like paint
It is relatively easy. You need a QWidget-detived widget that will collect mouse up/down events and store pixel data. Color is set by setting a pen via a toolbar. After that you can incorporate zoom/scaling and additional tools. Some of the questions though are do you want it to be raster (as above) or vector, like Inkscape? Vector is a little more tricky, but the same basic concept. Good Luck! - Original Message From: vidyadhar To: pyqt@riverbankcomputing.com Sent: Tuesday, August 18, 2009 9:16:05 AM Subject: [PyQt] image tool like paint i have no idea as how to go about for devloping an application similar to paint the one in windows. the one which has a pen tool, eraser,shapes to draw. I would like to use the tool to highlight an area on picture. so anyone has any idea how to use Qpainter class . please help me with an example if possible. or how to go abt -- View this message in context: http://www.nabble.com/image-tool-like-paint-tp25024632p25024632.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Fade effect a widget on top of another widget
The fader widget is limited. What you really want to do is create a parent QWidget or QStackedWidget subclass and have it call render() on both widgets, then fade with one on top of the other with the one being faded to on the bottom (by decreasding the opacity of the top) until it is complete them move it to the current stack item. That is for a cross fade. You could always fade to empty then fade out. - Original Message From: Nicola Murino To: pyqt@riverbankcomputing.com Sent: Tuesday, August 18, 2009 11:25:31 AM Subject: [PyQt] Fade effect a widget on top of another widget Hi all, I'm trying to make a fade effect as explained here: http://doc.trolltech.com/qq/qq16-fader.html http://labs.trolltech.com/blogs/2007/08/21/fade-effects-a-blast-from-the-past/ I have a main windows and I change the centralwidget on some user action so I do somenthing like: self.setCentralWidget(newwidget) I would like to have a fade effect on widget change so I tryed to do a FaderWidget and call something like: self.setCentralWidget(FaderWidget(newwidget)) this is my not working attempt for FaderWidget: class widgetFader(QWidget): def __init__(self,faded,parent=None): super(widgetFader,self).__init__(parent) faded.setupUi(faded) self.timeline=QTimeLine(3000,self) self.connect(self.timeline, SIGNAL("frameChanged(int)"), SLOT("update()")) self.timeline.setFrameRange(0,100) self.timeline.setCurveShape(QTimeLine.EaseInOutCurve) if faded: self.startBrush=faded.palette().window() else: self.startBrush=Qt.white def startAnimation(self): self.timeline.start() def paintEvent(self,event): painter=QPainter(self) frame=self.timeline.currentFrame() #print frame/100.0 painter.setOpacity(frame/100.0) painter.fillRect(self.rect(),self.startBrush) if frame>=100: self.close() what's wrong? waht is the right way to have a fader widget? thanks Nicola ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Fade effect a widget on top of another widget
>> That is for a cross fade. You could always fade to empty then fade out. > I would probably do something like that for a cross fade. The fader widget > appears to do a different kind of fade. The only difference is it is a fade against a solid color. You could create the Pixmap, repsecting the Palette background color. and use that for intermediate fading/in/out ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QObject: Cannot create children for a parent that is in a different thread. How to edit another threads objects?
Qt can pass its "fundamental types" across threads - and use them in signals/slots. You can only access/manipulate GUI elements in the main thread. Use a signal/slot between the two threads and have the slot in the main thread update the GUI. Your line for the *** line should be an emit. - Original Message From: Soumen banerjee To: pyqt@riverbankcomputing.com Sent: Monday, September 14, 2009 8:27:42 PM Subject: Re: [PyQt] QObject: Cannot create children for a parent that is in a different thread. How to edit another threads objects? I cant understand what im doing wrong. Heres the code gui.py: from PyQt4 import QtCore, QtGui import sys from subprocess import Popen class Ui_MainWindow(object): fileinit=False paused=True quit=False filename="" def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(394, 414) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.scrollArea = QtGui.QScrollArea(self.centralwidget) self.scrollArea.setGeometry(QtCore.QRect(19, 9, 361, 281)) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea) self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 357, 277)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.textEdit = QtGui.QTextEdit(self.scrollAreaWidgetContents) self.textEdit.setGeometry(QtCore.QRect(-7, -6, 371, 291)) self.textEdit.setObjectName("textEdit") self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(30, 310, 80, 25)) self.pushButton.setObjectName("pushButton") self.pushButton_2 = QtGui.QPushButton(self.centralwidget) self.pushButton_2.setGeometry(QtCore.QRect(139, 310, 91, 25)) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtGui.QPushButton(self.centralwidget) self.pushButton_3.setGeometry(QtCore.QRect(280, 310, 80, 25)) self.pushButton_3.setObjectName("pushButton_3") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 394, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.Open) QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL("clicked()"), self.Pause) QtCore.QObject.connect(self.pushButton_3, QtCore.SIGNAL("clicked()"), self.Quit) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "Pause/Resume", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_3.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) def Pause(self): print "Pause" self.paused=not(self.paused) def Quit(self): self.quit=True print "setting quit" def Open(self): print "Open" self.filename=QtGui.QFileDialog.getOpenFileName() self.filename=str(self.filename) try: f=open("book.txt","r") except IOError: f=open("log.txt",'w') f.write('0') f.close() old=f.read(20) f.close() f=open(self.filename,'r') new=f.read(20) f.close() if(old!=new): f=open("log.txt",'w') f.write('0') f.close() f=open("book.txt",'w') f.write(new) f.close() self.fileinit=True print "setting fileinit" and heres the main.py from PyQt4 import QtCore, QtGui import sip,gui import sys from subprocess import Popen from threading import Thread class AppThread(Thread): appinit=False def run(self): self.app = QtGui.QApplication(sys.argv) MainWindow = QtGui.QMainWindow() self.ui = gui.Ui_MainWindow() self.ui.setupUi(MainWindow) MainWindow.show() self.appinit=True sys.exit(self.app.exec_()) class Speak(Thread): def run(self): print "starting speaker" try: log=o
Re: [PyQt] DragNDrop on Microsoft Windows.
I don't know why it would be different. I did DnD from Firefox to Qt, but without the Python in the middle. I don't know what would change that would make it not work. From: LIM Fung-Chai To: pyqt@riverbankcomputing.com Sent: Friday, September 18, 2009 9:52:17 AM Subject: [PyQt] DragNDrop on Microsoft Windows. Hello Cutie Pies, Can anyone tell me how I can do a drag-and-drop tango between a PyQt application and a non-Qt application on Microsoft Windows? I have seen many drag&drop examples (and tested them), but they are between 2 PyQt applications. For now, I need to drop some text and filenames on a non-Qt application. In future, I may want to drop (drag) more complex data onto (from) other applications. Thanks in advance. -- FWIW: $\lnot \exists x \, {\rm Right} (x) \leftarrow \forall x \, {\rm Wrong} (x)$ \hfill -- Stephen Stills Freedom's just another word for nothin' left to lose -- Kris Kristofferson ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] GraphicsItem, QObject Inheritance problem
I am working on a hacked PyQt to play with the new animation features. So this isn't entirely kosher, however. I have the following: class AffineItem(QGraphicsItem): def __init__(self, ..., parent): QGraphicsItem.__init__(self, parent) class WrappedAffineItem(QObject, AffineItem): def __init__(self ...): QObject.__init__(self) AffineItem.__init__(self, ..., parent) The WrappedAffineItem needs to declare properties, so I have to inherit QObject. Here is the traceback of what I am getting: Traceback (most recent call last): i = WrappedAffineTextItem(text, ..., self.items['clipItem']) File "C:\Qt\PyQt-win-gpl-4.5.2\Plaza.py" in __init__ AffineTextItem.__init__(self, '', font, brush, parent) File "C:\Qt\PyQt-win-gpl-4.5.2\Plaza.py", line 8, in __init__ QGraphicsItem.__init__(self, parent) TypeError: argument 1 of PyQt4.QtCore.QObject() has an invalid type Help? Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] GraphicsItem, QObject Inheritance problem
Thanks Brian, but I don't understand that. If it is derived from a non-object, how does the connect work? I went with the reverse approach: class ObjWrapper(QObject): def __init__(self, item): QObject.__init__(self) self.item=item ... then provide the properties, signals/slots, which all operate on self.item ... It would be handy if these approaches were discussed in the docs. From: Brian Kelley To: Jason H Cc: "pyqt@riverbankcomputing.com" Sent: Thursday, October 1, 2009 8:16:52 AM Subject: Re: [PyQt] GraphicsItem, QObject Inheritance problem Re: [PyQt] GraphicsItem, QObject Inheritance problem What you can do, however, is to make a QObject delegate like: class WrappedAffineItem(AffineItem): def __init__(self ...): self.qobject = QObject(self) AffineItem.__init__(self, ..., parent) self.qobject.connect(self.qobject, SIGNAL("mysignal(int)", SLOT(self.dosomething)) def connect(self, *a, *kw): self.qobject.connect(*a,**kw) def soSomething(self, *a): pass Brian Kelley ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] GraphicsItem, QObject Inheritance problem
I think you and I are very close to a nice work-around. I see you're providing a object as a property, and connecting to that. What I think should be possible, is to provide a QObject derived class (on the outside), then using __getattr__(self, name), __setattr__(self, name, value), and maybe __call__(self, args) and be able to transparently proxy them to the non-QObject object on the inside. It isn't true inheritance, but it would get the job done. Is there anything like this already? From: Brian Kelley To: Jason H Cc: "pyqt@riverbankcomputing.com" Sent: Thursday, October 1, 2009 10:34:59 AM Subject: Re: [PyQt] GraphicsItem, QObject Inheritance problem Re: [PyQt] GraphicsItem, QObject Inheritance problem All you need to connect signals and slots is a qobject. You can create any qobject for this task. Here is a concrete example, actually using a QGraphicsItem. This makes an Image button that emits a signal “clicked()” and move the graphics to mimic a button press: class ImageButton(QtGui.QGraphicsPixmapItem): def __init__(self, pixmap, parent=None, oneshot=True): QtGui.QGraphicsPixmapItem.__init__( self, pixmap, parent ) self.emitter = QtCore.QObject() self.emitter.setObjectName("ImageButtonEmitter") self.oneshot = oneshot self.callback = None def mousePressEvent(self, event): self.moveBy(1,1) self.emitter.emit( QtCore.SIGNAL("clicked()") ) if self.callback: self.callback() def mouseReleaseEvent(self, event): if not self.oneshot: self.moveBy(-1,-1) To connect to this signal as follows: foo = ImageButton(...) foo.emitter.connect( foo.emitter, QtCore.SIGNAL(“clicked()”), pythonfunc ) I find this to be cleaner than wrapping a QObject around the graphics item, but in internet speak YMMV. Brian > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Another connect problem
job is not a member of the class (self.job) so it gets destroyed. - Original Message From: Thomas Olsen To: pyqt@riverbankcomputing.com Sent: Thursday, October 1, 2009 2:09:21 PM Subject: [PyQt] Another connect problem Hi This is actually PyKDE4 related but the list seems to be dead. I am trying to connect a KIO.TransferJob[1] to a method in my class but must be doing something wrong. A very stripped down version of my class looks like this: from PyKDE4.kdecore import * from PyKDE4.kio import * class MyClass(): def __init__(self): job = KIO.get(KUrl("http://somesite.com";)) QObject.connect(job, SIGNAL("data(Job*, const QByteArray&)"), self.job_received) def job_received(self, job, data): print "Data received: " + data But job_received is never called. I know I should be using the new-style connect but I haven't really grasped it yet... [1] http://api.kde.org/pykde-4.3-api/kio/KIO.TransferJob.html -- Best Regards / Med venlig hilsen Thomas Olsen ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Another connect problem
The C++ code uses new to create an object on the heap, which you must delete later In python if nothing references the object, it is destroyed. So as soon as __init__ is done, job goes *poof* You need to maintain a reference to it by using self.job = ... so that way the class keeps the job instance around. - Original Message From: Thomas Olsen To: pyqt@riverbankcomputing.com; Jason H Sent: Thursday, October 1, 2009 2:46:48 PM Subject: Re: [PyQt] Another connect problem On Thursday 01 October 2009 20:22:00 Jason H wrote: > job is not a member of the class (self.job) so it gets destroyed. > So should it be: def job_recieved(self, data): print "Data recieved: " + data I was looking at the example: #include #include #include #include #include class TransferJob; Browser::Browser() : QWidget(NULL) { slotButtonClicked(); } void Browser::slotButtonClicked() { kDebug() << "entering function"; // creating a kioslave KIO::TransferJob *job = KIO::get(KUrl("http://www.kde.org";)); connect (job, SIGNAL( data(KIO::Job *, const QByteArray & )), this, SLOT(dataIsHere(KIO::Job *,const QByteArray &))); } void Browser::dataIsHere(KIO::Job *,const QByteArray & data ) { kDebug() << "data is here"; kDebug() << data; } from http://techbase.kde.org/Development/Tutorials/KIO_Slaves/Using_KIO_Slaves_in_your_Program and there job is an argument to the slot..? > > > - Original Message > From: Thomas Olsen > To: pyqt@riverbankcomputing.com > Sent: Thursday, October 1, 2009 2:09:21 PM > Subject: [PyQt] Another connect problem > > Hi > > This is actually PyKDE4 related but the list seems to be dead. > > I am trying to connect a KIO.TransferJob[1] to a method in my class but > must be doing something wrong. A very stripped down version of my class > looks like this: > > from PyKDE4.kdecore import * > from PyKDE4.kio import * > > class MyClass(): > def __init__(self): > job = KIO.get(KUrl("http://somesite.com";)) > QObject.connect(job, SIGNAL("data(Job*, const QByteArray&)"), > self.job_received) > > def job_received(self, job, data): > print "Data received: " + data > > > But job_received is never called. I know I should be using the new-style > connect but I haven't really grasped it yet... > > [1] http://api.kde.org/pykde-4.3-api/kio/KIO.TransferJob.html > -- Best Regards / Med venlig hilsen Thomas Olsen Til uvedkommende, der læser med: Der er ingen grund til at læse min mail. Jeg har intet at gøre med FARC, al-Jihad, al-Qaida, Hamas, Hizb al-Mujahidin eller ETA. Jeg har aldrig gjort Zakat, går ikke ind for Istishad, har ikke lavet en bilbombe eller kernevåben og jeg ved dårligt nok, hvad Al Manar og бомба betyder. Men tak for den udviste interesse ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QTimer.singleShot
I have a GUI application and I want to trigger an event after my GUI starts: if __name__=="__main__": a = QApplication(sys.argv) m=Main(False) m.show() a.exec_() I put "QTimer.singleShot(0, self.start)" after the m __init__ialization, both in the class, and I also tried it after m.show() but the console just floods with: QCoreApplication::exec: The event loop is already running QCoreApplication::exec: The event loop is already running QCoreApplication::exec: The event loop is already running QCoreApplication::exec: The event loop is already running What do I have to do to get my GUI started and using the existing event loop? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt4 for Embedded Linux
I used PyQt and 3.3 on an embedded linux device in 2004. (QWS) It worked really well. - Original Message From: David Boddie To: pyqt@riverbankcomputing.com Sent: Wed, October 7, 2009 9:22:50 PM Subject: [PyQt] PyQt4 for Embedded Linux Back in May, I gave a talk at PyCon Tre in Italy about using PyQt on embedded devices. http://chaos.troll.no/~dboddie/Python/PyConTre_Italia_2009/ Although the talk was mostly about PyQt's features and didn't really cover the underlying technologies, a lot of the preparation involved getting a set of bindings to work with Qt for Embedded Linux instead of with Qt for X11. This variant of PyQt is created using a set of patches for Python, SIP, PyQt (for X11) and Qt that I have been maintaining for over two years, starting with Qt 4.1 on the Greenphone. http://www.diotavelli.net/PyQtWiki/PyQt4_on_the_Qtopia_Greenphone During this time, I have gradually updated them to take account of changes in new versions of these tools and libraries, taking them up to the latest stable releases (Python 2.6.3, Qt 4.5.3, SIP 4.9, PyQt 4.6). I've recently spent some time trying to write a build script that can take the source packages for these components and create a set of libraries, using a cross-compiler, that can be deployed either on a device or on a desktop machine. It's not perfect, and I've come to the conclusion that I should really look at existing frameworks for cross-building software, but it's a fairly minimal way of building PyQt and its dependencies if you already have a cross-compiler set up. The result of this is that, not only is it possible to build versions of PyQt that use the Linux framebuffer instead of X11, you can also create PyQt bindings for custom builds of Qt with reduced features (leading to smaller library sizes) and take advantage of features like Qt's VNC display driver to simulate small screen devices on a desktop machine. I've created an archive, containing a snapshot of the build script and the patches for the latest versions of each of the components used, and put it in the following location: http://www.boddie.org.uk/david/Projects/Python/Qt/Software/Python-2.6-Qt-4.5-PyQt-4.6-patches-1.0.tar.gz Earlier this year, I started to manage the patches in a Mercurial repository, and this has now been made published at Bitbucket: http://bitbucket.org/dboddie/pyqt4-for-embedded-linux/ Note that, for various reasons, I have placed all my modifications to SIP, Qt and PyQt under the GNU General Public License (version 3 or later) and the modifications to Python under the Python Software Foundation License (version 2). My aim is just to make all this available for people to use and to save people the effort of having to do all this work again. Also, I know that there are others who have much more experience with this sort of thing, and it would be useful to get their feedback on what I've done in order to develop it further. David Disclaimer: Although I work as a technical writer at Nokia, Qt Development Frameworks (formerly Trolltech ASA), the development of this software is not part of my work duties - it's something I've been doing in my free time. (I have to say this, just in case anyone mistakes what I do at work for what I do "for fun" outside work.) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QTimer.singleShot
Thanks for this, Baz. Indeed your example works as advertised. I'm going to work from that to create a failing example. Thanks! - Original Message From: Baz Walter To: "pyqt@riverbankcomputing.com" Sent: Thu, October 8, 2009 2:09:23 PM Subject: Re: [PyQt] QTimer.singleShot Jason H wrote: > I have a GUI application and I want to trigger an event after my GUI starts: > if __name__=="__main__": > a = QApplication(sys.argv) > m=Main(False) > m.show() > a.exec_() > I put "QTimer.singleShot(0, self.start)" > after the m __init__ialization, both in the class, and I also tried it after > m.show() but the console just floods with: > > QCoreApplication::exec: The event loop is already running > QCoreApplication::exec: The event loop is already running > QCoreApplication::exec: The event loop is already running > QCoreApplication::exec: The event loop is already running > > What do I have to do to get my GUI started and using the existing event loop? it's difficult to be certain what the problem is from what you've posted as you've left out all the relevant code. how does your actual code differ from the working example below: import sys from PyQt4 import QtCore, QtGui class MainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) QtCore.QTimer.singleShot(0, self.start) def start(self): print 'start' if __name__ == "__main__": app = QtGui.QApplication(sys.argv) mw = MainWindow() mw.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QTimer.singleShot
Ok, to get it, try this: import pdb import sys from PyQt4 import QtCore, QtGui class MainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) QtCore.QTimer.singleShot(0, self.start) def start(self): pdb.set_trace() print 'start' if __name__ == "__main__": app = QtGui.QApplication(sys.argv) mw = MainWindow() mw.show() sys.exit(app.exec_()) And with that, how are we supposed to use the debugger? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt4 and threading
GUI operations can only be done in the main thread. - Original Message From: Ole Streicher To: pyqt@riverbankcomputing.com Sent: Wed, October 14, 2009 9:26:25 AM Subject: [PyQt] PyQt4 and threading Hi, I have a problem when I use multi threading with pyqt4: every of my widgets has a worker thread that updates the content on changes. The worker thread is build around Python threading (error handling removed to shorten the code): ---8< class AsyncThread(threading.Thread): def __init__(self, func): threading.Thread.__init__(self) self._cond = threading.Condition() self._func = func self.scheduled = False self.start() def run(self): while True: with self._cond: while not self.scheduled: self._cond.wait() self.scheduled = False self._func() def __call__(self): with self._cond: self.scheduled = True self._cond.notify() ---8< A call of the AsyncThread object will trigger a call of the enclosed function func(). I use this to update a large QGraphicsView: def update_map(): # ... for item in scene.items: # 'items' contains some 1000s QGraphicsRectItems item.setBrush(QtGui.Brush(QtGui.QColor(...))) scene.update() async_update_map = AsyncThread(update_map) QtCore.connect(..., ..., async_update_map) The "connect" connects, for example, cursor changes with the update. The problem is now that I get random *crashes* with that code. This ranges from a simple "segmentation fault" to hundreds of lines glibc Backtraces like: *** glibc detected *** python: realloc(): invalid pointer: 0x7ffcfa2c5360 ** === Backtrace: = /lib/libc.so.6[0x7ffcfb8a4cb8] /lib/libc.so.6(realloc+0x2bc)[0x7ffcfb8a9f3c] /usr/lib/libQtCore.so.4(_ZN9QListData7reallocEi+0x2b)[0x7ffcf9f0a46b] ... /usr/lib/libQtGui.so.4(_ZN26QAbstractGraphicsShapeItem8setBrushERK6QBrush+0x35)[0x7ffcfaa70e15] /usr/lib/python2.6/dist-packages/PyQt4/QtGui.so[0x7ffcfb2d4449] python(PyEval_EvalFrameEx+0x4e23)[0x4a2b03] ... python[0x4d3b3d] /lib/libpthread.so.0[0x7ffcfc44a3ba] /lib/libc.so.6(clone+0x6d)[0x7ffcfb912fcd] Beside "invalid pointer", I also get "double free or corruption (fasttop)" and similar errors. My question is now whether this is a Bug of PyQt4 or if I use the Threading incorrectly? Do I have to use Qt Threads instead? And how do I do locking (the threading.Condition) in that case? Regards Ole ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] connect and "TypeError: argument 1 of QObject.connect() has an invalid type"
Easy. Items aren't QObjects. You need to use QGraphicsObject from Qt 4.6, QGraphicsWidget for 4.5, or make your own proxy for graphics Items. - Original Message From: Thierry Leurent To: pyqt@riverbankcomputing.com Sent: Mon, October 19, 2009 5:17:47 PM Subject: [PyQt] connect and "TypeError: argument 1 of QObject.connect() has an invalid type" Hello, I'm working on small application that will display the map of a network. The main window have a QListWidget and a QGraphicScene. I create a number of object (hosts) in each main widget. When I select an hosts in the QGraphicScene, I would like select the host in the QListWidget too. I try different solution to implement signal but that don't work. I have this kind of message : File "./ANetworkMapper.py", line 240, in addItem self.connect(item, QtCore.SIGNAL("hostSelected"),self.hostSelected) TypeError: argument 1 of QObject.connect() has an invalid type Thanks Thierry the code #!/usr/bin/env python # -*- coding: utf-8 -*- # testdraw.py import sys from PyQt4 import QtCore, QtGui class MainWindow(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setGeometry(300, 300, 1000, 550) self.setWindowTitle(self.tr("Asgardian.be's Network Mapper")) self.setupActions() self.setupMenus() self.setupFrame() self.statusbar = self.statusBar() self.connect(self, QtCore.SIGNAL("messageToStatusbar(QString)"), self.statusbar, QtCore.SLOT("showMessage(QString)")) self.emit(QtCore.SIGNAL("messageToStatusbar(QString)"), "On the road again") self.LoadNetworkMap() def setupFrame(self): frame = QtGui.QFrame() self.networkmap = NetworkMapScene(self) self.networkmap.setSceneRect(QtCore.QRectF(0, 0, 5000, 5000)) self.hostsList = NodesList() #QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), pyFunction) #QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), pyClass.pyMethod) #QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), QtCore.SLOT("QtSlot()")) #QtCore.QObject.connect(a, QtCore.SIGNAL("PySig()"), QtCore.SLOT("QtSlot()")) #QtCore.QObject.connect(a, QtCore.SIGNAL("PySig"), pyFunction) self.connect(self.hostsList, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"),self.listItemClicked) self.connect(self.networkmap, QtCore.SIGNAL("hostSelected"),self.hostSelected) layout = QtGui.QHBoxLayout(frame) layout.addWidget(self.hostsList) self.view = QtGui.QGraphicsView(self.networkmap) self.view.setRenderHints(QtGui.QPainter.Antialiasing) layout.addWidget(self.view) self.setCentralWidget(frame) def about(self): QtGui.QMessageBox.about(self, ("About ANetworkMapper"), ("The Asgerdian.be's Network Mapper is build to help you to make the map of your network.")) def setupActions(self): aboutAction = QtGui.QAction("A&bout", self) aboutAction.setShortcut("Ctrl+B") self.connect(aboutAction, QtCore.SIGNAL("triggered()"), self.about) self.aboutAction = aboutAction def setupMenus(self): fileMenu = self.menuBar().addMenu(self.tr("&File")) exitAction = fileMenu.addAction(self.tr("E&xit")) exitAction.setShortcut(QtGui.QKeySequence(self.tr("Ctrl+Q"))) self.connect(exitAction, QtCore.SIGNAL("triggered()"), QtGui.qApp, QtCore.SLOT("quit()")) self.aboutMenu = self.menuBar().addMenu("&Help") self.aboutMenu.addAction(self.aboutAction) def LoadNetworkMap(self): ServerOne=NetworkHost("ServerOne",["Dell", "PowerEdge1900", "Server", "Debian", "5.0"] ,200,150,None,self.networkmap) ServerOne.add2List(self.hostsList) self.networkmap.addItem(ServerOne) #self.networkmap(ServerOne, QtCore.SIGNAL("hostSelected"),self.hostSelected) #ServerOne.setPixmap(str("./images/debian.png")) ServerTwo=NetworkHost("ServerTwo",["Dell", "PowerEdge2600", "Server", "RedHat", "5.3"] ,50,100,None,self.networkmap) ServerTwo.add2List(self.hostsList) self.networkmap.addItem(ServerTwo) ServerThree=NetworkHost("ServerThree",["Dell", "PowerEdge2600", "Server", "Debian", "Sid"] ,100,150,None,self.networkmap) ServerThree.add2List(self.hostsList) self.networkmap.addItem(ServerThree) ServerFour=NetworkHost("ServerFour",["HP", "Proliant", "Server", "Windows", "2003"] ,50,200,None,self.networkmap) ServerFour.add2List(self.hostsList) self.networkmap.addItem(ServerFour) ServerFive=NetworkHost("ServerFive",["HP", "Proliant", "Server", "Windows", "2003"] ,1500,2000,None,self.networkmap) ServerFive.add2List(self.hostsList) self.networkmap.addItem(ServerFive) self.view.show() for networkthostitem in self.networkmap.items(): X=networkthostitem.x() Y=networkthostitem.y() print X, "
[PyQt] Qt4.6 released... When will PyQt Support it?
Well the announcement has come! I've been looking forward to 4.6 forever! So my question is naturally, when will I be able to use PyQt with it? Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt4.6 released... When will PyQt Support it?
That's why I am asking! Kinda hard to get excited about old features, unless they fixed bugs! :-) From: Arnold Krille To: pyqt@riverbankcomputing.com Sent: Tue, December 1, 2009 9:53:22 AM Subject: Re: [PyQt] Qt4.6 released... When will PyQt Support it? On Tuesday 01 December 2009 15:47:21 Jason H wrote: > Well the announcement has come! I've been looking forward to 4.6 forever! > So my question is naturally, when will I be able to use PyQt with it? As Qt tends to be binary compatible and PyQt isn't linked statically afaik, the answer would be: now! Only the new features (not the bug-fixes!) would need new work in PyQt... Arnold ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Snapshots and Qt 4.6
I noticed that things are being added to the snapshots for the new stuff in Qt 4.6. ::rockon:: I would like to request that QPropertyAnimation in QtCore and the Q*Animation classes of QtGui go in sooner than later so that I can play with them. (Maybe this weekend?) Thanks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Simple QGV crash
This used to work, but my latest sip&pyqt snapshots crashes. import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class Main(QGraphicsView): def __init__(self, parent=None): QGraphicsView.__init__(self, parent) pass if __name__=="__main__": a = QApplication(sys.argv) m= QGraphicsView() m.show() a.exec_() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Simple QGV crash
Well I got SIP 12/19 and PyQt 12/20 snapshots. started up the Qt command prompt (QTDir=c:\qt\2009.05\qt, makespec=win32-g++) sip\configure.py -p win32-g++ sip\ming32-make sip\ming32-make install pyqt\configure.py -p win32-g++ pyqt\ming32-make pyqt\ming32-make install Using python25, had a working PyQt snapshot previously. (12/09 i think) - Original Message From: Phil Thompson To: Jason H Cc: pyqt@riverbankcomputing.com Sent: Tue, December 22, 2009 11:54:30 AM Subject: Re: [PyQt] Simple QGV crash On Mon, 21 Dec 2009 18:18:11 -0800 (PST), Jason H wrote: > This used to work, but my latest sip&pyqt snapshots crashes. Which would they be? > import sys > from PyQt4.QtCore import * > from PyQt4.QtGui import * > > class Main(QGraphicsView): > def __init__(self, parent=None): > QGraphicsView.__init__(self, parent) > pass > > if __name__=="__main__": > a = QApplication(sys.argv) > m= QGraphicsView() > m.show() > a.exec_() Works fine for me. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QGraphicsPixmapItem not showing set pixmap
Simply, your PNG does not exist. Try print QFile.exists('/.../.../pic1.png") Or You aren't looking at it. Try using ensureVisible() on it in case its off-screen. - Original Message From: dizou To: pyqt@riverbankcomputing.com Sent: Tue, January 19, 2010 12:23:19 PM Subject: [PyQt] QGraphicsPixmapItem not showing set pixmap I have: class DisplayItem(QGraphicsPixmapItem): def __init__(self, parent, graphView=None): QGraphicsPixmapItem.__init__(self) pic = QPixmap("/.../.../pic1.png") self.setPixmap(pic) and then when I do QGraphicsScene.addItem(DisplayItem), nothing shows up. I can use the paint() function to draw my DisplayItem as my different shapes and stuff, so I have my QGraphicsScene and QGraphicsView setup correctly. -- View this message in context: http://old.nabble.com/QGraphicsPixmapItem-not-showing-set-pixmap-tp27229352p27229352.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Timers
I have a class that is created and needs to run a function after the event loop starts. Usually I just do: if __name__=="__main__": a = QApplication(sys.argv) m=Main(False) m.show() QTimer.singleShot(0, m.startProcessing) a.exec_() But my startProcessing slot does not get called. Ideas? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Simple connect error
class Main(QGraphicsView): def __init__(self, useGL=False, parent=None): pass @pyqtSlot() def screenFinished(self): print "Main.screenFinished" class Screen(QObject): finished = pyqtSignal() def __init__(self, instanceName, main): QObject.__init__(self) self.main.screenFinished.connect(self.finished) gives me the error: self.main.screenFinished.connect(self.finished) AttributeError: 'Main' object has no attribute 'screenFinished' What am I doing wrong? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Simple connect error
- Original Message From: Andreas Pakulat To: pyqt@riverbankcomputing.com Sent: Wed, January 27, 2010 1:17:48 AM Subject: Re: [PyQt] Simple connect error On 26.01.10 22:05:41, Jason H wrote: > > class Main(QGraphicsView): > def __init__(self, useGL=False, parent=None): > pass > > @pyqtSlot() > def screenFinished(self): > print "Main.screenFinished" > > class Screen(QObject): > finished = pyqtSignal() > > def __init__(self, instanceName, main): > QObject.__init__(self) > self.main.screenFinished.connect(self.finished) > > gives me the error: > self.main.screenFinished.connect(self.finished) > AttributeError: 'Main' object has no attribute 'screenFinished' I'm not too familiar with the new signal/slot mechanism, but a short read on the docs suggests that your connect is in the wrong order. Its usually .connect() and you've got it the other way around. -- Well the Screen object emits "finished" and I want to connect that to the main's screenFinished slot. self.main.screenfinished is the slot, the self.finished is emitted by the screen class. If I reverse it: self.finished.connect(self.main.screenFinished) I still get the error. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Simple connect error
**facepalm** I had a locally defined class that we overriding it. It was missing the slot. - Original Message From: Jason H To: Andreas Pakulat ; pyqt@riverbankcomputing.com Sent: Wed, January 27, 2010 1:22:51 AM Subject: Re: [PyQt] Simple connect error - Original Message From: Andreas Pakulat To: pyqt@riverbankcomputing.com Sent: Wed, January 27, 2010 1:17:48 AM Subject: Re: [PyQt] Simple connect error On 26.01.10 22:05:41, Jason H wrote: > > class Main(QGraphicsView): > def __init__(self, useGL=False, parent=None): > pass > > @pyqtSlot() > def screenFinished(self): > print "Main.screenFinished" > > class Screen(QObject): > finished = pyqtSignal() > > def __init__(self, instanceName, main): > QObject.__init__(self) > self.main.screenFinished.connect(self.finished) > > gives me the error: > self.main.screenFinished.connect(self.finished) > AttributeError: 'Main' object has no attribute 'screenFinished' I'm not too familiar with the new signal/slot mechanism, but a short read on the docs suggests that your connect is in the wrong order. Its usually .connect() and you've got it the other way around. -- Well the Screen object emits "finished" and I want to connect that to the main's screenFinished slot. self.main.screenfinished is the slot, the self.finished is emitted by the screen class. If I reverse it: self.finished.connect(self.main.screenFinished) I still get the error. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ScaleX, ScaleY
Apparently only a single scale factor is supported. QGraphicsItem.setScale(qreal) The Qt API allows for independent X and Y scale factors. QGraphicsItem.setXScale(qreal) QGraphicsItem.setYScale(qreal) Can we get those supported? Thanks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ScaleX, ScaleY
Confused... But now I get it. I searched on QGraphicsItem::setScale() then **some how** got to QGraphicsScale::setXScale() I thought it was a member of QGraphicsItem Sorry! - Original Message From: Phil Thompson To: Jason H Cc: pyqt@riverbankcomputing.com Sent: Fri, January 29, 2010 11:55:11 AM Subject: Re: [PyQt] ScaleX, ScaleY On Fri, 29 Jan 2010 08:37:45 -0800 (PST), Jason H wrote: > Apparently only a single scale factor is supported. > > QGraphicsItem.setScale(qreal) > > The Qt API allows for independent X and Y scale factors. > QGraphicsItem.setXScale(qreal) > QGraphicsItem.setYScale(qreal) > > Can we get those supported? They aren't in Qt v4.6.1. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Is there a way to run the interp AND a gui?
I am working on the new Qt/Kinetic stuff and one thing I would really like to have is an interactive GUI for it. Ideally, I'd have something like the interactive interpreter, which when I type x=QGrahpicsTextItem(...) and add it to the scene, it appears in the scene. Then I can do that with graphics effects and test out animations. The problem though, is the event loop needs to be running for the painting to happen. So I am confused if this is even possible? I'd even settle for some IPC that would translate commands to a seperate process running the GUI, if there was a way to do it (so that then I do x=QGrahicstextItem(...) x is actually a handle to the actual object in another process. But this looks waaay complicated. Thoughts? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Is there a way to run the interp AND a gui?
Undoubtedly, that would work for showing the widget. And yes, I've done that much. Unless something has changed recently, I eventually have to call app.exec_(), which would block until last window has closed... I seems the previous email of calling eval() might be the right route. - Original Message From: Phil Thompson To: Jason H Cc: PyQt Sent: Wed, March 3, 2010 3:21:07 AM Subject: Re: [PyQt] Is there a way to run the interp AND a gui? On Tue, 2 Mar 2010 15:04:37 -0800 (PST), Jason H wrote: > I am working on the new Qt/Kinetic stuff and one thing I would really like > to have is an interactive GUI for it. Ideally, I'd have something like the > interactive interpreter, which when I type x=QGrahpicsTextItem(...) and add > it to the scene, it appears in the scene. Then I can do that with graphics > effects and test out animations. > > The problem though, is the event loop needs to be running for the painting > to happen. So I am confused if this is even possible? I'd even settle for > some IPC that would translate commands to a seperate process running the > GUI, if there was a way to do it (so that then I do x=QGrahicstextItem(...) > x is actually a handle to the actual object in another process. But this > looks waaay complicated. > > Thoughts? Have you actually tried it... >>> from PyQt4.QtGui import * >>> app = QApplication([]) >>> w = QWidget() >>> w.show() Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Is there a way to run the interp AND a gui?
Hah, I guess I am showing my old VB colors :-) This is freaking awesome! - Original Message From: Phil Thompson To: Jason H Cc: PyQt Sent: Thu, March 4, 2010 3:58:56 AM Subject: Re: [PyQt] Is there a way to run the interp AND a gui? On Wed, 3 Mar 2010 18:51:35 -0800 (PST), Jason H wrote: > Undoubtedly, that would work for showing the widget. And yes, I've done > that much. Unless something has changed recently, I eventually have to > call app.exec_(), which would block until last window has closed... > > I seems the previous email of calling eval() might be the right route. show() doesn't display a widget - it schedules the paint of the widget for the next iteration of the event loop. Therefore if the widget is visible then the event loop is running. Therefore you do not need to run exec_(). Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] changing SVG group rendering color
Qt does not support modifying SVG content (without modifying and reparsing the file) - Original Message From: John Ossenfort To: pyqt@riverbankcomputing.com Sent: Thu, April 15, 2010 1:37:55 PM Subject: [PyQt] changing SVG group rendering color Hi list members! I've been hacking away at this for quite some time and found no good examples of what I am trying to do on Google, so I hope that someone can point me in the right direction here (I am also very new to Python, so I will also accept ANY tips on pythonic style, code, etc.) What I want to do is display groups from an SVG file, and then individually and dynamically change the colors for some groups but not others after certain mouse events. My original idea was to read in the groups as QGraphicsSvgItems, render them, and then change the brush colors and redraw them as needed. I'm thinking now that maintaining a reference to the original file precludes any later brush/pen changes unless I use a QSvgGenerator to write out an entirely new SVG file with the color changes embedded! There don't seem to be any functions related to brush color changes for QGraphicsSvgItems to help with this. Another thought was trying to convert the SVG shapes to pixmaps and then applying brush/pen changes, but I have been unable do that as well. Here is some of my code to hopefully show the direction I have taken: from xml.etree import ElementTree from PyQt4 import QtGui from PyQt4 import QtSvg class SvgElement(QtSvg.QGraphicsSvgItem): def __init__(self, name, renderer): QtSvg.QGraphicsSvgItem.__init__(self) self.setElementId(name) self.setSharedRenderer(renderer) self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True); class SvgViewerPane(QtGui.QGraphicsScene): def __init__(self, SVG_FILE, parent=None): QtGui.QGraphicsScene.__init__(self, parent) self.rend = QtSvg.QSvgRenderer(SVG_FILE) """ Produce a list of group Elements from the SVG, each containing an id and multiple 'path' attributes """ tree = ElementTree.parse(SVG_FILE) makeGroupList(tree.getroot(), group_list) for element in group_list: n = SvgElement(element.get("id"), self.rend) self.addItem(n) OK, so that works fine to display all the groups and re-build the whole picture in place (I do some additional coding to get the position of each group using a 'renderer.boundsOnElement' call). But now when I want to redraw a group with a color I am at a loss! I tried to overwrite the paint function for SvgElement thinking that if I could render the original image in alternate colors even once it would be a start, but nothing is displayed at all. All attempts to associate a QPainter with each Svg item have failed as well, but probably just due to my lack of understanding ;-) Any help is much appreciated! John ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] properly exiting application while still in init
You can't if you're in the constructor. What you have to do, is have your constructor post an event to show or exit. I use a singleshot timer with a time of 0. This will post the event immediately after the constructor is done. - Original Message From: Sebastian Elsner To: "pyqt@riverbankcomputing.com" Sent: Fri, April 16, 2010 8:03:51 AM Subject: [PyQt] properly exiting application while still in init Hello, In the __init__ method of a standard QDialog I check for some requirements to be fulfilled before the gui is shown (I communicate with a server over a QTcpSocket for that matter) If the conditions fail I want to exit the Application. How would I properly do that? Currently I tried: socket.close() #first close the socket self.close() #close the window, does not do anything in the init because the window is not actually shown yet sys.exit() works but gives me an error (QWaitCondition: Destroyed while threads are still waiting) What could I try next? Regards Sebastian --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] splitter position preset...
Not a PyQt question, but I think the scale/stretch factor is what you want. You need to assign all items in the splitter for it to work. - Original Message From: F.A.Pinkse To: pyqt@riverbankcomputing.com Sent: Sun, June 13, 2010 3:28:41 PM Subject: [PyQt] splitter position preset... Hi All, How can I set the splitter position to a value other than half way in QtDesigner? Thanks. With best regards, Frans. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QGraphicsScene issue
I started using Qt 4.3.1 and PyQt 4.3. When I added the QGraphicsScene, I got the error: QObject::startTimer: timers cannot be started from another thread With out me actually using any timers. Then I wrote the script below (Change sups.jpg) to another file you have on your system. Everytime it renders the scene, the QObject::startTimer: timers cannot be started from another thread message appears, and floods the console. After a few moments of running, python crashes It typically rotates 3 or 4 times before crashing. I am wondering what I am doing wrong? TIA! import sys from PyQt4.Qt import * class TransformThread(QThread): def__init__(self, item, *args): QThread.__init__(self, *args) self.item=item self.counter=0 def run(self): while (1): self.counter+=.1 self.item.setTransform(QTransform().rotate(self.counter % 360)) QApplication.processEvents() #self.msleep(1) class MainWindow(QMainWindow): def __init__(self, *argv): QMainWindow.__init__(self, *argv) self.scene=QGraphicsScene() self.gv=QGraphicsView(self.scene) self.setCentralWidget(self.gv) pixmap=QPixmap('sups.jpg') self.items=[QGraphicsPixmapItem(pixmap)] self.threads=[] for item in self.items: self.scene.addItem(item) self.threads.append(TransformThread(item)) self.threads[-1].start() if __name__=='__main__': a=QApplication(sys.argv) w=MainWindow() w.show() a.exec_() Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Embedding Qt Designer
Doing my part: Voting Negative (0%) Neutral (0%) Positive (25%) Significant (50%) Must-have (25%) You've voted 'Significant' Total number of votes is 4, average vote is 2.25 - Original Message From: David Boddie <[EMAIL PROTECTED]> To: pyqt@riverbankcomputing.com Sent: Wednesday, August 15, 2007 10:00:57 AM Subject: Re: [PyQt] Embedding Qt Designer On Wed Aug 15 14:38:02 BST 2007, Detlev Offenbach wrote: > I would really like to see the QDesignerComponents classes wrapped. A > couple of weeks ago, I tried it, but gave it up at the end because I didn't > have the time to do the initial wrapping and maintain it next to the eric4 > development. If Albert (or somebody else) would do the job, I would give him > a loud applause. There's an open task for making the QDesignerComponents API part of the public Qt API: http://trolltech.com/developer/task-tracker/index_html?id=163220&method=entry Anyone with a Qt license who's interested in this issue should take a look at the following page and act accordingly. :-) http://trolltech.com/customer/task-tracker/index_html?id=163220&method=entry (You need a Qt license to vote on tasks, as far as I can tell.) David ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt and mysql
Don't you have to fetch a row or something first? I believe in Qt the record pointer is positioned BEFORE the first record so you have to fetchNext() to get the first one. I ended up using the python API for my database work... - Original Message From: Martin Alderete <[EMAIL PROTECTED]> To: PyQt list Sent: Wednesday, August 22, 2007 10:40:53 PM Subject: [PyQt] Qt and mysql Hi! I have problems when i try to get values from sql query. I have record in database but when i do the code below i recived None objects..., I'm using mysql-server5.0, Qt4.3 and PyQt4.3 Can anybody check it? thank's! Martin Alderete self.manager = QtSql.QSqlDatabase("QMYSQL") self.manager.setHostName("sherly"); self.manager.setDatabaseName("opencoffee"); self.manager.setUserName("opencoffee"); self.ok = self.manager.open(); string = QtCore.QString( "SELECT * from users") query = QtSql.QSqlQuery(string, self.manager) print "result: %s" % query.value(0).toString() Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] explanatory label in a not uniformly scaled QGraphicsView
I don't think the items know id they are scaled or not. And if they do, that way madness lies (for me anyway). Rather what I think you need is an item with an overlay functionality. You basically have a widget (Item) stack simultaneously display multiple indexes. When you scale, you only scale the lower item. You keep the top the same. When you move it, then it will move all stacked items at the same time. (I am imagining something like a watermark feature) By subclassing QGraphicsItem, you can control what transforms are applied to the top (overlay) item, as well as the underlying items. - Original Message From: Hans-Peter Jansen To: pyqt@riverbankcomputing.com Sent: Wed, February 9, 2011 4:09:01 PM Subject: Re: [PyQt] explanatory label in a not uniformly scaled QGraphicsView On Wednesday 09 February 2011, 15:06:24 KONTRA, Gergely wrote: > Hi all! > > Is there a way to place a text on a QGraphicsView, which always looks > the same size (say 10px) on screen, regardless of the scaling applied > to the View? Gergo, this is exactly a case, where studying the Qt source is most helpful. Probably you can just subclass and reimplement the object of your liking, that doesn't apply the scaling in the paint event... Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt