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 scorp...@yahoo.com 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] Help: packaging PyQt app
Could someone tell me how to convert python package (python setup.py On Tue, Mar 2, 2010 at 8:10 PM, Scott Ballard sc...@scottballard.netwrote: You need to include sip: http://www.py2exe.org/index.cgi/Py2exeAndPyQt from distutils.core import setup import py2exe setup(windows=[{script:main.py}], options={py2exe:{includes:[sip]}}) -Scott On 3/2/2010 8:51 AM, Anshul Jain wrote: I have made a very simple browser using Qwebview in PyQt. Now i want to package it as an installer to distribute it. I have tried out py2exe. But after i do the command: python setup.py py2exe and then try and run the .exe file created, i get an error, no module named sip found. please help me where am i going wrong. My setup.py code is as follows: from distutils.core import setup setup(name = Aura Browser, version = 0.1, description = A tiny Web Browser, author = Anshul kumar Jain, author_email = ans...@seeta.in, url = http://seeta.in/j/team.html;, packages = [], data_files = [(browser/images, [images/back.png, images/home.png, images/reload.png, images/next.png, images/stop.png,])] ) the code has 'browser.py' as main file and a Qt python class file 'httpWidget.py' Please help me sort out the problem. Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt __ Information from ESET NOD32 Antivirus, version of virus signature database 4909 (20100302) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Ruslan Popov phone: +7 916 926 1205 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Limit the height of a Layout
Thank you for your replay, but I'm doing everything by code, I try to simulate a form with QtDesigner but the genereted code is a mess. Regards, Jorge On 3 March 2010 01:37, dcassid...@mass.rr.com wrote: Are you using QtDesigner? You can set the min and max size for each widget, so I'd probably look at that. -- Regards, -Demetrius Cassidy starglider develop starglider@gmail.com wrote: = Hello, I'm a newby and I have a question: how can I limit the height of a QHBoxLayout? e.g.: There is a central widget with a QHBoxLayout that as two QTableWidget and I want to limit the size of the first QTableWidget to 300 points, but let the second QTableWidget grow until the limit of the screen. Thank you in advance for your help. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Help QX11 in pyqt
Hello. I wanted to know how can I use the QX11EmbedContainer/ QX11EmbedWidget class in Mac OSX or windows. I know X11 is not supported by them by default. Alternatively can anyone suggest me how can I create a process for each tab i create in my application. This is possible using the QX11EmbedContainer class and QProcess class. Is there any other way? Please help me with this. Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Limit the height of a Layout
starglider develop wrote: Thank you for your replay, but I'm doing everything by code, I try to simulate a form with QtDesigner but the genereted code is a mess. Have you tried QWidget.setMaximumHeight(int) ? Doug On 3 March 2010 01:37, dcassid...@mass.rr.com wrote: Are you using QtDesigner? You can set the min and max size for each widget, so I'd probably look at that. -- Regards, -Demetrius Cassidy starglider develop starglider@gmail.com wrote: = Hello, I'm a newby and I have a question: how can I limit the height of a QHBoxLayout? e.g.: There is a central widget with a QHBoxLayout that as two QTableWidget and I want to limit the size of the first QTableWidget to 300 points, but let the second QTableWidget grow until the limit of the screen. Thank you in advance for your help. ___ 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] Pyuic4 bug in PyQt4 snapshot?
Hello, I tried the latest PyQt4 snapshot together with the latest Sip snapshot. I noticed a problem with the order of QSpacerItem parameters. Attached are a test ui file, together with outputs of pyuic4 4.7 and snapshot-4.7.1-307e5cccaf6c. A quick diff reveals: 5,6c5,6 # Created: Wed Mar 03 15:51:18 2010 # by: PyQt4 UI code generator 4.7 --- # Created: Wed Mar 03 15:51:45 2010 # by: PyQt4 UI code generator snapshot-4.7.1-307e5cccaf6c 18c18 spacerItem = QtGui.QSpacerItem(145, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) --- spacerItem = QtGui.QSpacerItem(145, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) 23c23 spacerItem1 = QtGui.QSpacerItem(144, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) --- spacerItem1 = QtGui.QSpacerItem(144, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) Best regards, -- Umit Oztosun test.ui Description: Binary data test_4_7.py Description: Binary data test_snpsht.py Description: Binary data ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Limit the height of a Layout
It's generated code - it's not supposed to be pretty. All you do is import the gui code from your dialog class which is in a separate file. It keeps things clean and simple, and you won't have to start looking around APIs for stuff that QtDesigner does for you. On 3/3/2010 6:56 AM, starglider develop wrote: Thank you for your replay, but I'm doing everything by code, I try to simulate a form with QtDesigner but the genereted code is a mess. Regards, Jorge On 3 March 2010 01:37, dcassid...@mass.rr.com mailto:dcassid...@mass.rr.com wrote: Are you using QtDesigner? You can set the min and max size for each widget, so I'd probably look at that. -- Regards, -Demetrius Cassidy starglider develop starglider@gmail.com mailto:starglider@gmail.com wrote: = Hello, I'm a newby and I have a question: how can I limit the height of a QHBoxLayout? e.g.: There is a central widget with a QHBoxLayout that as two QTableWidget and I want to limit the size of the first QTableWidget to 300 points, but let the second QTableWidget grow until the limit of the screen. Thank you in advance for your help. ___ 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] Pyuic4 bug in PyQt4 snapshot?
On Wed, 3 Mar 2010 16:02:05 +0200, Umit Oztosun u...@oztosun.net wrote: Hello, I tried the latest PyQt4 snapshot together with the latest Sip snapshot. I noticed a problem with the order of QSpacerItem parameters. Attached are a test ui file, together with outputs of pyuic4 4.7 and snapshot-4.7.1-307e5cccaf6c. A quick diff reveals: 5,6c5,6 # Created: Wed Mar 03 15:51:18 2010 # by: PyQt4 UI code generator 4.7 --- # Created: Wed Mar 03 15:51:45 2010 # by: PyQt4 UI code generator snapshot-4.7.1-307e5cccaf6c 18c18 spacerItem = QtGui.QSpacerItem(145, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) --- spacerItem = QtGui.QSpacerItem(145, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) 23c23 spacerItem1 = QtGui.QSpacerItem(144, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) --- spacerItem1 = QtGui.QSpacerItem(144, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) Should be fixed in tonight's snapshot - thanks. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] SIP and Q_PROPERTY
Hi, I've been handed a Qt widget class (C++) that has several Q_PROPERTYs. I'm working on the sip file to wrap the class but can't find any info (in SIP docs or google) on how to wrap a Q_PROPERTY with SIP. Is there a way to do this with SIP? Do I even need to? The Q_PROPERTYs' getters setters are members of the class anyways, so wrapping those ought to provide the necessary functionality. Thanks for any info. Josh ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP and Q_PROPERTY
On Wed, 03 Mar 2010 12:55:33 -0500, Josh jk...@irobot.com wrote: Hi, I've been handed a Qt widget class (C++) that has several Q_PROPERTYs. I'm working on the sip file to wrap the class but can't find any info (in SIP docs or google) on how to wrap a Q_PROPERTY with SIP. Is there a way to do this with SIP? Do I even need to? The Q_PROPERTYs' getters setters are members of the class anyways, so wrapping those ought to provide the necessary functionality. You can't/don't need to. The fundamental problem is that in C++ property names and method names are in different namespaces and so they can (and sometimes do) clash. In Python they would be implemented in the same namespace (i.e. the class's dictionary) hence the problem. As a convenience you can use the QObject.pyqtConfigure() method to set any number of properties at once using keyword arguments. You can also set them when creating a new instance, again using keyword arguments. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help QX11 in pyqt
On Wed Mar 3 12:51:32 GMT 2010, Anshul Jain wrote: I wanted to know how can I use the QX11EmbedContainer/ QX11EmbedWidget class in Mac OSX or windows. I know X11 is not supported by them by default. You can't use the QX11Embed* classes on Mac OS X or Windows using native builds of PyQt. Alternatively can anyone suggest me how can I create a process for each tab i create in my application. This is possible using the QX11EmbedContainer class and QProcess class. Is there any other way? You might be able to use the ActiveQt classes on Windows, and maybe there's some way of using the Carbon/Cocoa APIs via a native Python API on Mac OS X. David ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QAbstractItemModel's dataChanged signal not working?
2010/3/2 Mark Summerfield l...@qtrac.plus.com: On 2010-02-27, Claudio Felix wrote: Hi everyone, I'm using a QSqlRelationalTableModel for a simple dialog where I can add/delete periods related to a particular customer, which is chosen by a QComboBox. The periods table is filtered by customer (whose ID is a foreign key) and shown through a QTableView. There's an Add button which basically inserts a new row in the Periods table and sets the view to edit mode, so the period data can be entered: def addRecord(self): row = self.model.rowCount() customerid = self._getRecordID(self.customerComboBox, self.customersModel, CUSTOMER_ID) self.enableControls(False) self.model.insertRow(row) index = self.model.index(row, CUSTOMER_ID) self.model.setData(index, QVariant(customerid)) index = self.model.index(row, PERIOD_YEAR) self.periodsTableView.setCurrentIndex(index) self.periodsTableView.edit(index) I noticed that, while the view is in edit mode (with the asterisk '*' appearing in the leftmost field), if the user clicks on the add button again, an empty row appears in the view and the asterisk appears in the next row, with this message on the console: edit: index was invalid edit: editing failed The same problem happens in the assetmanager.pyw example from the (great!) book Rapid GUI Programming with Python and QT, which is my main guide. That way, in my limited experience with PyQT, I tried to work around the undesirable behavior creating the method enableControls for the dialog, which is called in the addRecord method so it makes it impossible for the user to click on add again while the view is in edit mode. The idea then was to re-enable the controls when the data was finally committed by the view. That's when the main problem comes up. I tried to use the model's dataChanged signal for calling my enableControls method, but it looks like it never gets emitted, although the record does get written to the database table. Does anybody can confirm that or help me avoiding the problem at all? I used the following signature for the signal, exactly the same shown on QAbstractItemModel's documentation: self.connect(self.model, SIGNAL(dataChanged(const QModelIndex,const QModelIndex)), self.enableControls) That line is declared in my dialog's __init__, along with all the other (working) signals. self.model referes to the QSqlRelationalTableModel. Thanks for any help! Hi Claudio, I must admit that I've grown very frustrated with Qt's database support, particularly with SQLite. I've found that the book's database examples (which all use SQLite since that is supplied with Qt) exhibit varying differences in behavior depending on the Qt version. Regarding your specific problem, I can't see anything obviously wrong with your connection. Personally, I would have written it as self.connect(self.model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), self.enableControls) but that should make no difference. Is your model a QSqlRelationalTableModel or a subclass? If it is a subclass and you have reimplemented setData() then you must emit the dataChanged() signal in your reimplemented setData() method. But if you're using QSqlRelationalTableModel directly then it isn't obvious to me what you're doing wrong. However, dataChanged() might be the wrong signal for reenabling the Add button since it is emitted for every change to every field, whereas I'd have thought you wanted to enable the Add button only when the record was inserted? So maybe you could try connecting to the QAbstractItemModel::rowsInserted() signal? I had a quick go at changing assetmanager.pyw to do this but without success (using PyQt 4.6 and Qt 4.5.2); maybe things have improved with Qt 4.6. -- Mark Summerfield, Qtrac Ltd, www.qtrac.eu C++, Python, Qt, PyQt - training and consultancy C++ GUI Programming with Qt 4 - ISBN 0132354160 Hello Mark, Thanks for your help, and specially for the great book you've written. It's been a really helpful source, very nice to read. It has saved me from quite a lot of endless trial and error loops! Back to the signals, I initially thought rowsInserted would be emitted as soon as the view entered editing mode, and since I needed something to reenable the controls - I had disabled them as soon in the beggining of addRecord - the idea was to use dataChanged because, since the model edit strategy was set to QSqlTableModel.OnRowChange, I thought it would be emitted only when the whole row was commited to the model. Anyway, your suggestion worked fine. Now I disable the buttons in the end of addRecord method, after calling edit on the view. Then I reenable the controls triggered by rowInserted signal, which happens really when the data is commited, so it reenables controls at the right time. By the way, I was using QSqlRelationalTableModel itself, not a
Re: [PyQt] Limit the height of a Layout
You should be able to 'setMaximumHeight' you can also use the setSizePolicy and set the widgets size policy to what you want. And there is a method for QBoxLayout where you set the 'stretch factor' when you add a widget, so that certain widgets will stretch preferentially to others. Maybe you could make a short example of your layout and somebody will fix it. I find the layouts of Qt to be really convenient without resorting to the designer. But at the same time, now that I am more familiar with Qt, I use the designer to whip up some really quick examples. mbs ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Populating a listWidget with a list of files
Hello, I wanted to know how to have a list widget contain a list of files. Basically, I want to be able to give a path to a list of video files and have the video file names displayed in a list widget. Then I want the user be able to click a file which will open an external program. I can already have the user click a button which opens files using QFileDialog. Then they can select a file which then opens VLC (I did this by using QProcess). Here is my code which can do what I mentioned above: #code for signal slot connection between the button and the def video function def video(self): fd2 = QtGui.QFileDialog(self) self.filename = fd2.getOpenFileName() from os.path import isfile if isfile(self.filename): import codecs s = codecs.open(self.filename,'r').read() #z = self.filename # print z video = QtCore.QProcess(self) a = vlc +z video.start(a) I now want to know how to place the list of files into a list Widget. Thank you in advance. -- View this message in context: http://old.nabble.com/Populating-a-listWidget-with-a-list-of-files-tp27776406p27776406.html Sent from the PyQt mailing list archive at Nabble.com. ___ 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 p...@riverbankcomputing.com To: Jason H scorp...@yahoo.com Cc: PyQt pyqt@riverbankcomputing.com 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 scorp...@yahoo.com 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
[PyQt] QwtPlot axis labels clipped
This is more of a PyQwt question than a PyQt question, but someone here may know the answer. I'm using the QwtPlot widgets with QtDesigner, on Windows XP. The numbers labeling the ticks on the left y-axis are often (but not always) displayed with the left edge cut off, so '8.0' looks like '3.0', for example. Reducing the font size doesn't help. I'm guessing that this might be a font issue. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Qt Application with Multiple Windows
I was trying to create a Application which has multiple windows (QMainwindows or QDialogs) Those windows will be designed using QtDesigner and compiled to .py On click of a button ... i must invoke those windows... Just like Visualbasic ... multiple forms on click of a button... form.show() Any one with idea? -- View this message in context: http://old.nabble.com/Qt-Application-with-Multiple-Windows-tp27769238p27769238.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt