Re: [PyQt] Re: connection between 2 widget
Hi David, Thanks!!! thanks for point me on how to solve my problem :-) i know it is not only a pyqt ... biut more related to programming, i'm a poor self teached student thanks for your example i'm now able to go ahead with my code! now i'm coonecting : doublespinbox using : self.connect(self.DoubleSpinBox, SIGNAL(valueChanged(double)), self. external_class.setSpinBoxValue) linEdit using : self.connect(self.lineEdit, SIGNAL(textChanged(QString)), self.external_class.setLineEditValue) now looking for combo-box widget too. thanks again!!! regards, Massimo Il giorno 22/giu/09, alle ore 20:01, David Boddie ha scritto: On Sun Jun 21 17:37:54 BST 2009, Massimo Di Stefano wrote: I'm tring to get a solution, i searced for similar code in the pyqt examples source code but i can't find nothig similar. is the question i proposed comprensible? It's a little difficult for me to understand, but I'll try and work through it step by step: i can reproduce my problem with an example : W-1 (spinbox + button) [ it is a main app, and has in the menu bar an action to open W-2] OK, I see this in your example. W-2 (line edit + button) Right. I see this when I select the process-run menu item. i run W-1, pressing its button it increase the spinbox value, then pressing the action from the menu - open W-2 Yes, these work as expected. A question: what happens if the user changes the value in the spin box directly? W-2 , at its start, read value from W-1 -- pressing the W-2 button process W-1 value and print it . When I click the button, I see the value from the spin box in the line edit. my problem : i need that everitime i change the W-1 value ... ... when i press button in W-2 it will process the W-1(changed value) OK, so instead of passing a value when you create W-2, you want the value to be taken from the spin box in W-1 and written to the line edit? Here are some changes I made to your code to do what I think you want. Firstly, I create the Elab widget in the init() method of your application class instead of creating it later in the elaborazione() method. This makes it possible for me to connect a signal from the ZoomSpinBox to a slot in the widget. [app.py] [...] def init(self): self.w = GuiWidget() self.Value = 0 self.query = Elab() self.connect(self.w.p1, SIGNAL(clicked()), self.inc) self.connect(self.w.actionRun, SIGNAL(triggered()), self.elaborazione) self.connect(self.w.ZoomSpinBox, SIGNAL(valueChanged(double)), self.query.setValue) self.w.show() [...] def elaborazione(self): self.query.show() I just show the Elab widget when the elaborazione() method is called. In the Elab class, we no longer need to pass an initial value, but you could make the class take a value to begin with if you want. We don't want to show the widget immediately, so I removed a call to its show() method. [elab.py] class Elab(QWidget, Ui_Form): def __init__(self): QWidget.__init__(self) self.setupUi(self) self.value = 0 self.connect(self.p2, SIGNAL(clicked()),self.elabora) def elabora(self): newvalue = str(self.value)+str('-') self.lineEdit.setText(newvalue) print newvalue def setValue(self, value): self.value = value I added the setValue() slot that we used in the app.py file. This updates the value held by this widget so that clicking the button causes an up- to-date value to be used. Is this what you had in mind? David ___ 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] Using a QCompleter with a QLineEdit
Hey Everyone, I'm trying to get a LineEdit I have in a tool I am writing to have the ability to auto complete the user's entry based on what they have typed. From the sounds of it, QCompleter is exactly what I am after and they work on QLineEdit widgets. However I am having difficulty getting it to work, so I was wondering if I could share what I am trying to do and see if I am doing anything wrong or not doing something that I should be in order to get it to work. So here's an abridged example of what I am doing. From PyQt4 import QtCore, QtGui, uic defaultList = ['foo', 'bar', 'alpha', 'beta', 'ceti', 'delta'] completerList = QtCore.QStringList() for i in defaultList: completerList.append(QtCore.QString(i)) #defining my QDialog class MyPyQtTool(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) self.ui = uic.loadUi ('C:\\myUiFile.ui') lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion) lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.ui.myLineEdit_widget.setCompleter(lineEditCompleter) #... defining other tool logic # I also have the list being modified in another method based off of user's selection. def onMyComboBoxActivated(self) # code here where a string list is created from a mysql db query based on combo box selection. for i in dbQryList: completerList.append(QtCore.QString(i)) lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion) lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.ui.myLineEdit_widget.setCompleter(lineEditCompleter) app = QtGui.QApplication(sys.argv) dialog = MyPyQtTool() dialog.ui.show() app.exec_() --- This may not be the cleanest way of doing what I want but from the example shown in the class reference web page, this should be sound. However when I try to test it, I get no completion what so ever. No errors are thrown so I am not exactly sure what I am doing wrong. Is there another method that needs to be executed before it should work? Any help would be truly appreciated! Thanks, Greg ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: Pressing enter in QLineEdit clicks QPushButton?
Message: 1 Date: Tue, 23 Jun 2009 14:41:20 +0200 From: V. Armando Sol? s...@esrf.fr Subject: Re: [PyQt] Pressing enter in QLineEdit clicks QPushButton? To: Mads Ipsen m...@comxnet.dk Cc: Sibylle Koczian sibylle.kocz...@t-online.de,PyQt-Liste pyqt@riverbankcomputing.com Mads Ipsen wrote: rom the manual pages: A dialog's default button is the button that's pressed when the user presses Enter (Return). This button is used to signify that the user accepts the dialog's settings and wants to close the dialog. In other words, the first button that gets added probably gets connected up with this behaviour, which explains the behaviour. So using a QWidget is probably the correct solution: It is certainly not the correct solution if you really need a dialog :-) Right, but in this case I don't need a return value from my window and so I don't think I need a dialog. This is a small application with only one form. You can also call setAutoDefault(False) for all the buttons. Yes, just tried it, that works too. So, this being solved, on to the next problem I won't be able to solve for myself. Thank you, Sibylle ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Using a QCompleter with a QLineEdit
Hello, can you give a LFE aka a little functiunal example ? C. Greg Smith a écrit : Hey Everyone, I’m trying to get a LineEdit I have in a tool I am writing to have the ability to auto complete the user’s entry based on what they have typed. From the sounds of it, QCompleter is exactly what I am after and they work on QLineEdit widgets. However I am having difficulty getting it to work, so I was wondering if I could share what I am trying to do and see if I am doing anything wrong or not doing something that I should be in order to get it to work. So here’s an abridged example of what I am doing. From PyQt4 import QtCore, QtGui, uic defaultList = [‘foo’, ‘bar’, ‘alpha’, ‘beta’, ‘ceti’, ‘delta’] completerList = QtCore.QStringList() for i in defaultList: completerList.append(QtCore.QString(i)) #defining my QDialog class MyPyQtTool(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) self.ui = uic.loadUi (‘C:\\myUiFile.ui’) lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion) lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.ui.myLineEdit_widget.setCompleter(lineEditCompleter) #... defining other tool logic # I also have the list being modified in another method based off of user’s selection. def onMyComboBoxActivated(self) # code here where a string list is created from a mysql db query based on combo box selection. for i in dbQryList: completerList.append(QtCore.QString(i)) lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion) lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.ui.myLineEdit_widget.setCompleter(lineEditCompleter) app = QtGui.QApplication(sys.argv) dialog = MyPyQtTool() dialog.ui.show() app.exec_() --- This may not be the cleanest way of doing what I want but from the example shown in the class reference web page, this should be sound. However when I try to test it, I get no completion what so ever. No errors are thrown so I am not exactly sure what I am doing wrong. Is there another method that needs to be executed before it should work? Any help would be truly appreciated! Thanks, Greg ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] qtdirs.app can't load QtCore
Hello, I'm trying to build PyQt 4.5.1 from source on Mac OSX 10.5 x86 and I'm running into a problem right from the start in that the qtdirs.app built during the configure step won't run because it won't load QtCore. I've done an otool -L on qtdirs.app/Contents/MacOS/qtdirs and it doesn't have any path prefix in front of the reference to QtCore. Note that my Qt install is *not* a standard install. It is a custom build installed into /Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr. I have verified I can run all the Qt apps, tools, and demos from this install. I have exported QTDIR set to this path prior to invoking PyQt's configure.py script. It looks like the build of the qtdirs.app is picking up all the right paths for this install. But it looks to me like PyQt's qtdirs.app assumes that the various Qt frameworks are in the system location, even though configure explicitly passed the right location for my frameworks via a -F flag to g++. Is this a bug with PyQt's qtdirs build process? Here's some output: Determining the layout of your Qt installation... /Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/bin/qmake -spec macx-g++ -o qtdirs.mk qtdirs.pro make -f qtdirs.mk g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -DQT_CORE_LIB -DQT_SHARED -I/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/mkspecs/macx-g++ -I. -I/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/lib/QtCore.framework/Headers -I/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/include/QtCore -I/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/include -I. -I. -F/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/lib -o qtdirs.o qtdirs.cpp g++ -headerpad_max_install_names -arch i386 -o qtdirs.app/Contents/MacOS/qtdirs qtdirs.o -F/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/lib -L/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/lib -framework QtCore -L/Users/dpeterson/py/qtbuild/install/Qt-4.5.1-1.egg/EGG-INFO/usr/lib -lz -lm -framework ApplicationServices qtdirs.app/Contents/MacOS/qtdirs dyld: Library not loaded: QtCore Referenced from: /Users/dpeterson/py/qtbuild/src/PyQt-mac-gpl-4.5.1/qtdirs.app/Contents/MacOS/qtdirs Reason: image not found Thanks in advance for any help! -- Dave ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
FW: [PyQt] Using a QCompleter with a QLineEdit
Here is a very simple test. Just run it in a command shell, and be sure the .ui file lives in the same directory as the .py file. Greg -Original Message- From: projetmbc [mailto:projet...@club-internet.fr] Sent: Wednesday, June 24, 2009 11:00 AM To: Greg Smith Cc: pyqt@riverbankcomputing.com Subject: Re: [PyQt] Using a QCompleter with a QLineEdit Hello, can you give a LFE aka a little functiunal example ? C. Greg Smith a écrit : Hey Everyone, I'm trying to get a LineEdit I have in a tool I am writing to have the ability to auto complete the user's entry based on what they have typed. From the sounds of it, QCompleter is exactly what I am after and they work on QLineEdit widgets. However I am having difficulty getting it to work, so I was wondering if I could share what I am trying to do and see if I am doing anything wrong or not doing something that I should be in order to get it to work. So here's an abridged example of what I am doing. From PyQt4 import QtCore, QtGui, uic defaultList = ['foo', 'bar', 'alpha', 'beta', 'ceti', 'delta'] completerList = QtCore.QStringList() for i in defaultList: completerList.append(QtCore.QString(i)) #defining my QDialog class MyPyQtTool(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) self.ui = uic.loadUi ('C:\\myUiFile.ui') lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion) lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.ui.myLineEdit_widget.setCompleter(lineEditCompleter) #... defining other tool logic # I also have the list being modified in another method based off of user's selection. def onMyComboBoxActivated(self) # code here where a string list is created from a mysql db query based on combo box selection. for i in dbQryList: completerList.append(QtCore.QString(i)) lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion) lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.ui.myLineEdit_widget.setCompleter(lineEditCompleter) app = QtGui.QApplication(sys.argv) dialog = MyPyQtTool() dialog.ui.show() app.exec_() --- This may not be the cleanest way of doing what I want but from the example shown in the class reference web page, this should be sound. However when I try to test it, I get no completion what so ever. No errors are thrown so I am not exactly sure what I am doing wrong. Is there another method that needs to be executed before it should work? Any help would be truly appreciated! Thanks, Greg simpleTest.py Description: simpleTest.py simpleTest.ui Description: simpleTest.ui ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: FW: [PyQt] Using a QCompleter with a QLineEdit
Am Mittwoch, 24. Juni 2009 schrieb Greg Smith: Here is a very simple test. Just run it in a command shell, and be sure the .ui file lives in the same directory as the .py file. The usual, all time number one issue: take care of lifetime issues, if a Qt class doesn't derive from QWidget applies, even if Phil tries to mitigate this issue since some time.. BTW: execPath could be empty How about: execPath = os.path.dirname(sys.argv[0]) or '.' BTW2: what do you want the str() do in your expression? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: FW: [PyQt] Using a QCompleter with a QLineEdit
On Wed, 24 Jun 2009 13:44:30 -0500, Greg Smith gsm...@troublemakerstudios.com wrote: Here is a very simple test. Just run it in a command shell, and be sure the .ui file lives in the same directory as the .py file. You don't say what version you are using. As Pete said it's probably because you aren't keeping a reference to the QCompleter. The current version of PyQt will do this for you. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
RE: FW: [PyQt] Using a QCompleter with a QLineEdit
Sorry 4.4.3 for Python 2.5 -Original Message- From: Phil Thompson [mailto:p...@riverbankcomputing.com] Sent: Wednesday, June 24, 2009 5:45 PM To: Greg Smith Cc: pyqt@riverbankcomputing.com Subject: Re: FW: [PyQt] Using a QCompleter with a QLineEdit On Wed, 24 Jun 2009 13:44:30 -0500, Greg Smith gsm...@troublemakerstudios.com wrote: Here is a very simple test. Just run it in a command shell, and be sure the .ui file lives in the same directory as the .py file. You don't say what version you are using. As Pete said it's probably because you aren't keeping a reference to the QCompleter. The current version of PyQt will do this for you. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] python vs qt4 datatypes
Hi there I'm starting with a pyqt development, a database application (what original). I can't decide which datatypes and sql library to use. I mean, is it better to use python datatypes (str, int, bool) or qt4 datatypes (qstring, ...) ? If i use python datatypes, using pyqt4-sql to access data seems to bring a lot of datatype convertions, thus in that case i could choose mysqldb, which uses python datatypes. Is that approach better than use all from PyQT ? I feel that python datatypes has more and better methods and functions, and that processing data in native types is always better. What approach could i take to solve this ? I'm locked with this. Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] uic.loadUi() and custom widgets
I was curious if there was a way for a tool to have its Ui generated from a .ui file but still use custom widgets? I have a widget I wrote that inherits the QLineEdit widget in which I needed to modify the event() method so that a custom property will be modified if the backspace key was pressed I was able to get everything to work properly, in a simple dialog where I defined the layout within the __init__() method, however for more complex dialog windows I'd like to keep the ability to modify the layout within the designer and just swap out the which ever widget is supposed to be the custom one, that way the __init__() method remains tidy and less lines of code. Is there any straight forward ways to do this? Greg ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ANN: eric 4.3.4 released
I saw only packages for Ubuntu Karmic... 2009/6/22 Guðjón Guðjónsson gudjon.i.gudjons...@gmail.com Hi eric segfaults on Debian based systems because of python-qscintilla. Please install the eric_4.3.4-1 from Debian and it will require correct versions of other packages. Python-kde4 is broken after the upgrade to sip 4.8.1 and makes eric segfault. Please remove python-kde4. Regarding *Ubuntu. I don't use Ubuntu and I haven't got time to administrate both Debian and Ubuntu Is there someone willing to administrate the Ubuntu package? Regards Gudjon On Mon, Jun 22, 2009 at 3:51 AM, Gustavo A. Díaz gustavo.d...@gmail.comwrote: Hi, I wanted to ask, does Eric 4.3.4 and latest snapshot 4.4.4 works with PyQt4.5? Cause i can't run it... it says Segmentation fault. Using: Python 2.6.2 - PyQt 4.5.1 - QScintilla 2.4 - sip 4.8.1 - Kubuntu Jaunty with Qt4.5. Cheers. 2009/5/31 Detlev Offenbach det...@die-offenbachs.de Hi, I just uploaded eric 4.3.4. It is a maintenance release fixing some bugs. It is available via the eric4 web site. http://eric-ide.python-projects.org/index.html Regards, Detlev -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Gustavo A. Díaz GDNet Projects www.gdnet.com.ar ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Gustavo A. Díaz GDNet Projects www.gdnet.com.ar ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt